Browse Source

* Jedi Windows Api initial import

marco 20 years ago
parent
commit
ce2bd93b8d
100 changed files with 70209 additions and 0 deletions
  1. 1102 0
      packages/extra/winunits/jedi.inc
  2. 258 0
      packages/extra/winunits/jediapilib.inc
  3. 675 0
      packages/extra/winunits/jwaObjsel.pas
  4. 1229 0
      packages/extra/winunits/jwaaccctrl.pas
  5. 1338 0
      packages/extra/winunits/jwaaclapi.pas
  6. 374 0
      packages/extra/winunits/jwaaclui.pas
  7. 1207 0
      packages/extra/winunits/jwaactiveds.pas
  8. 73 0
      packages/extra/winunits/jwaadsdb.pas
  9. 323 0
      packages/extra/winunits/jwaadserr.pas
  10. 485 0
      packages/extra/winunits/jwaadshlp.pas
  11. 146 0
      packages/extra/winunits/jwaadsnms.pas
  12. 389 0
      packages/extra/winunits/jwaadsprop.pas
  13. 203 0
      packages/extra/winunits/jwaadssts.pas
  14. 10302 0
      packages/extra/winunits/jwaadstlb.pas
  15. 458 0
      packages/extra/winunits/jwaadtgen.pas
  16. 446 0
      packages/extra/winunits/jwaaf_irda.pas
  17. 326 0
      packages/extra/winunits/jwaatalkwsh.pas
  18. 647 0
      packages/extra/winunits/jwaauthif.pas
  19. 705 0
      packages/extra/winunits/jwaauthz.pas
  20. 323 0
      packages/extra/winunits/jwabatclass.pas
  21. 447 0
      packages/extra/winunits/jwabits.pas
  22. 133 0
      packages/extra/winunits/jwabits1_5.pas
  23. 92 0
      packages/extra/winunits/jwabitscfg.pas
  24. 996 0
      packages/extra/winunits/jwabitsmsg.pas
  25. 66 0
      packages/extra/winunits/jwablberr.pas
  26. 2014 0
      packages/extra/winunits/jwabluetoothapis.pas
  27. 1527 0
      packages/extra/winunits/jwabthdef.pas
  28. 192 0
      packages/extra/winunits/jwabthsdpdef.pas
  29. 2856 0
      packages/extra/winunits/jwabugcodes.pas
  30. 141 0
      packages/extra/winunits/jwacderr.pas
  31. 281 0
      packages/extra/winunits/jwacmnquery.pas
  32. 135 0
      packages/extra/winunits/jwacolordlg.pas
  33. 297 0
      packages/extra/winunits/jwacpl.pas
  34. 107 0
      packages/extra/winunits/jwacplext.pas
  35. 157 0
      packages/extra/winunits/jwacryptuiapi.pas
  36. 673 0
      packages/extra/winunits/jwadbt.pas
  37. 330 0
      packages/extra/winunits/jwadde.pas
  38. 449 0
      packages/extra/winunits/jwadhcpcsdk.pas
  39. 623 0
      packages/extra/winunits/jwadhcpsapi.pas
  40. 521 0
      packages/extra/winunits/jwadhcpssdk.pas
  41. 497 0
      packages/extra/winunits/jwadlgs.pas
  42. 258 0
      packages/extra/winunits/jwadsadmin.pas
  43. 771 0
      packages/extra/winunits/jwadsclient.pas
  44. 1014 0
      packages/extra/winunits/jwadsgetdc.pas
  45. 425 0
      packages/extra/winunits/jwadskquota.pas
  46. 223 0
      packages/extra/winunits/jwadsquery.pas
  47. 216 0
      packages/extra/winunits/jwadsrole.pas
  48. 175 0
      packages/extra/winunits/jwadssec.pas
  49. 168 0
      packages/extra/winunits/jwaerrorrep.pas
  50. 93 0
      packages/extra/winunits/jwaexcpt.pas
  51. 207 0
      packages/extra/winunits/jwafaxdev.pas
  52. 126 0
      packages/extra/winunits/jwafaxext.pas
  53. 99 0
      packages/extra/winunits/jwafaxmmc.pas
  54. 167 0
      packages/extra/winunits/jwafaxroute.pas
  55. 950 0
      packages/extra/winunits/jwagpedit.pas
  56. 93 0
      packages/extra/winunits/jwahherror.pas
  57. 90 0
      packages/extra/winunits/jwahtmlGuid.pas
  58. 831 0
      packages/extra/winunits/jwahtmlhelp.pas
  59. 116 0
      packages/extra/winunits/jwaiaccess.pas
  60. 130 0
      packages/extra/winunits/jwaiadmext.pas
  61. 445 0
      packages/extra/winunits/jwaicmpapi.pas
  62. 1773 0
      packages/extra/winunits/jwaiiscnfg.pas
  63. 4402 0
      packages/extra/winunits/jwaimagehlp.pas
  64. 301 0
      packages/extra/winunits/jwaimapi.pas
  65. 140 0
      packages/extra/winunits/jwaimapierror.pas
  66. 453 0
      packages/extra/winunits/jwaime.pas
  67. 290 0
      packages/extra/winunits/jwaioevent.pas
  68. 441 0
      packages/extra/winunits/jwaipexport.pas
  69. 1185 0
      packages/extra/winunits/jwaiphlpapi.pas
  70. 490 0
      packages/extra/winunits/jwaipifcons.pas
  71. 133 0
      packages/extra/winunits/jwaipinfoid.pas
  72. 1244 0
      packages/extra/winunits/jwaiprtrmib.pas
  73. 494 0
      packages/extra/winunits/jwaiptypes.pas
  74. 82 0
      packages/extra/winunits/jwaisguids.pas
  75. 400 0
      packages/extra/winunits/jwaissper16.pas
  76. 2820 0
      packages/extra/winunits/jwalmaccess.pas
  77. 276 0
      packages/extra/winunits/jwalmalert.pas
  78. 160 0
      packages/extra/winunits/jwalmapibuf.pas
  79. 225 0
      packages/extra/winunits/jwalmat.pas
  80. 722 0
      packages/extra/winunits/jwalmaudit.pas
  81. 191 0
      packages/extra/winunits/jwalmconfig.pas
  82. 363 0
      packages/extra/winunits/jwalmcons.pas
  83. 731 0
      packages/extra/winunits/jwalmdfs.pas
  84. 930 0
      packages/extra/winunits/jwalmerr.pas
  85. 2188 0
      packages/extra/winunits/jwalmerrlog.pas
  86. 366 0
      packages/extra/winunits/jwalmjoin.pas
  87. 207 0
      packages/extra/winunits/jwalmmsg.pas
  88. 201 0
      packages/extra/winunits/jwalmremutl.pas
  89. 564 0
      packages/extra/winunits/jwalmrepl.pas
  90. 2604 0
      packages/extra/winunits/jwalmserver.pas
  91. 798 0
      packages/extra/winunits/jwalmshare.pas
  92. 231 0
      packages/extra/winunits/jwalmsname.pas
  93. 248 0
      packages/extra/winunits/jwalmstats.pas
  94. 795 0
      packages/extra/winunits/jwalmsvc.pas
  95. 286 0
      packages/extra/winunits/jwalmuse.pas
  96. 71 0
      packages/extra/winunits/jwalmuseflg.pas
  97. 1075 0
      packages/extra/winunits/jwalmwksta.pas
  98. 382 0
      packages/extra/winunits/jwaloadperf.pas
  99. 1657 0
      packages/extra/winunits/jwalpmapi.pas
  100. 150 0
      packages/extra/winunits/jwamciavi.pas

+ 1102 - 0
packages/extra/winunits/jedi.inc

@@ -0,0 +1,1102 @@
+{$IFNDEF JEDI_INC}
+{$DEFINE JEDI_INC}
+
+{******************************************************************************}
+{                                                                              }
+{  The contents of this file are subject to the Mozilla Public License         }
+{  Version 1.1 (the "License"); you may not use this file except in            }
+{  compliance with the License. You may obtain a copy of the License at        }
+{  http://www.mozilla.org/MPL/                                                 }
+{                                                                              }
+{  Software distributed under the License is distributed on an "AS IS" basis,  }
+{  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License    }
+{  for the specific language governing rights and limitations under the        }
+{  License.                                                                    }
+{                                                                              }
+{  The Original Code is: jedi.inc.                                             }
+{  The Initial Developer of the Original Code is Project JEDI                  }
+{  http://www.delphi-jedi.org                                                  }
+{                                                                              }
+{  Alternatively, the contents of this file may be used under the terms of     }
+{  the GNU Lesser General Public License (the  "LGPL License"), in which case  }
+{  the provisions of the LGPL License are applicable instead of those above.   }
+{  If you wish to allow use of your version of this file only under the terms  }
+{  of the LGPL License and not to allow others to use your version of this     }
+{  file under the MPL, indicate your decision by deleting the provisions       }
+{  above and replace them with the notice and other provisions required by     }
+{  the LGPL License. If you do not delete the provisions above, a recipient    }
+{  may use your version of this file under either the MPL or the LGPL License. }
+{                                                                              }
+{  For more information about the LGPL:                                        }
+{  http://www.gnu.org/copyleft/lesser.html                                     }
+{                                                                              }
+{******************************************************************************}
+{                                                                              }
+{  This file defines various generic compiler directives used in different     }
+{  libraries, e.g. in the JEDI Code Library (JCL) and JEDI Visual Component    }
+{  Library Library (J-VCL). The directives in this file are of generic nature  }
+{  and consist mostly of mappings from the VERXXX directives defined by        }
+{  Delphi, C++ Builder and FPC to friendly names such as DELPHI5 and           }
+{  SUPPORTS_WIDESTRING. These friendly names are subsequently used in the      }
+{  libraries to test for compiler versions and/or whether the compiler         }
+{  supports certain features (such as widestrings or 64 bit integers. The      }
+{  libraries provide an additional, library specific, include file. For the    }
+{  JCL e.g. this is jcl.inc. These files should be included in source files    }
+{  instead of this file (which is pulled in automatically).                    }
+{                                                                              }
+{******************************************************************************}
+
+// Last modified: $Date$
+// For history see end of file
+
+(*
+
+- Development environment directives
+
+  This file defines two directives to indicate which development environment the
+  library is being compiled with. Currently this can either be Delphi, Kylix,
+  C++ Builder or FPC.
+
+  Directive        Description
+  ------------------------------------------------------------------------------
+  DELPHI           Defined if compiled with Delphi
+  KYLIX            Defined if compiled with Kylix
+  DELPHICOMPILER   Defined if compiled with Delphi or Kylix/Delphi
+  BCB              Defined if compiled with C++ Builder
+  CPPBUILDER       Defined if compiled with C++ Builder (alias for BCB)
+  BCBCOMPILER      Defined if compiled with C++ Builder or Kylix/C++
+  DELPHILANGUAGE   Defined if compiled with Delphi, Kylix or C++ Builder
+  BORLAND          Defined if compiled with Delphi, Kylix or C++ Builder
+  FPC              Defined if compiled with FPC
+
+- Platform Directives
+
+  Platform directives are not all explicitly defined in this file, some are
+  defined by the compiler itself. They are listed here only for completeness.
+
+  Directive    Description
+  ------------------------------------------------------------------------------
+  WIN32        Defined when target platform is 32 bit Windows
+  MSWINDOWS    Defined when target platform is 32 bit Windows
+  LINUX        Defined when target platform is Linux
+  UNIX         Defined when target platform is Linux or Unix
+
+
+- Visual library Directives
+
+  The following directives indicate for a visual library. In a Delphi
+  application you need to define VisualCLX in the project options, if you want
+  to use the VisualCLX. Alternative you can use the IDE expert, which is distributed
+  with the JCL to do this automatically.
+
+  Directive    Description
+  ------------------------------------------------------------------------------
+  COMPLIB_VCL  Defined when application do not define VisualCLX, obsolete, use VCL
+  COMPLIB_CLX  Defined when application use the VisualCLX, obsolete, use VisualCLX
+  VCL          Defined when application do not define VisualCLX
+  VisualCLX    Defined when application use the VisualCLX
+
+
+- Delphi Versions
+
+  The following directives are direct mappings from the VERXXX directives to a
+  friendly name of the associated compiler. These directives are only defined if
+  the compiler is Delphi (ie DELPHI is defined).
+
+  Directive    Description
+  ------------------------------------------------------------------------------
+  DELPHI1      Defined when compiling with Delphi 1
+  DELPHI2      Defined when compiling with Delphi 2
+  DELPHI3      Defined when compiling with Delphi 3
+  DELPHI4      Defined when compiling with Delphi 4
+  DELPHI5      Defined when compiling with Delphi 5
+  DELPHI6      Defined when compiling with Delphi 6
+  DELPHI7      Defined when compiling with Delphi 7
+  DELPHI8      Defined when compiling with Delphi 8
+  DELPHI9      Defined when compiling with Delphi 9
+  DELPHI1_UP   Defined when compiling with Delphi 1 or higher
+  DELPHI2_UP   Defined when compiling with Delphi 2 or higher
+  DELPHI3_UP   Defined when compiling with Delphi 3 or higher
+  DELPHI4_UP   Defined when compiling with Delphi 4 or higher
+  DELPHI5_UP   Defined when compiling with Delphi 5 or higher
+  DELPHI6_UP   Defined when compiling with Delphi 6 or higher
+  DELPHI7_UP   Defined when compiling with Delphi 7 or higher
+  DELPHI8_UP   Defined when compiling with Delphi 8 or higher
+  DELPHI9_UP   Defined when compiling with Delphi 9 or higher
+
+
+- Kylix Versions
+
+  The following directives are direct mappings from the VERXXX directives to a
+  friendly name of the associated compiler. These directives are only defined if
+  the compiler is Kylix (ie KYLIX is defined).
+
+  Directive    Description
+  ------------------------------------------------------------------------------
+  KYLIX1       Defined when compiling with Kylix 1
+  KYLIX2       Defined when compiling with Kylix 2
+  KYLIX3       Defined when compiling with Kylix 3
+  KYLIX1_UP    Defined when compiling with Kylix 1 or higher
+  KYLIX2_UP    Defined when compiling with Kylix 2 or higher
+  KYLIX3_UP    Defined when compiling with Kylix 3 or higher
+
+
+- Delphi Compiler Versions (Delphi / Kylix, not in BCB mode)
+
+  Directive           Description
+  ------------------------------------------------------------------------------
+  DELPHICOMPILER1     Defined when compiling with Delphi 1
+  DELPHICOMPILER2     Defined when compiling with Delphi 2
+  DELPHICOMPILER3     Defined when compiling with Delphi 3
+  DELPHICOMPILER4     Defined when compiling with Delphi 4
+  DELPHICOMPILER5     Defined when compiling with Delphi 5
+  DELPHICOMPILER6     Defined when compiling with Delphi 6 or Kylix 1, 2 or 3
+  DELPHICOMPILER7     Defined when compiling with Delphi 7
+  DELPHICOMPILER8     Defined when compiling with Delphi 8
+  DELPHICOMPILER9     Defined when compiling with Delphi 9
+  DELPHICOMPILER1_UP  Defined when compiling with Delphi 1 or higher
+  DELPHICOMPILER2_UP  Defined when compiling with Delphi 2 or higher
+  DELPHICOMPILER3_UP  Defined when compiling with Delphi 3 or higher
+  DELPHICOMPILER4_UP  Defined when compiling with Delphi 4 or higher
+  DELPHICOMPILER5_UP  Defined when compiling with Delphi 5 or higher
+  DELPHICOMPILER6_UP  Defined when compiling with Delphi 6 or Kylix 1, 2 or 3 or higher
+  DELPHICOMPILER7_UP  Defined when compiling with Delphi 7 or higher
+  DELPHICOMPILER8_UP  Defined when compiling with Delphi 8 or higher
+  DELPHICOMPILER9_UP  Defined when compiling with Delphi 9 or higher
+
+
+- C++ Builder Versions
+
+  The following directives are direct mappings from the VERXXX directives to a
+  friendly name of the associated compiler. These directives are only defined if
+  the compiler is C++ Builder (ie BCB is defined).
+
+  Directive    Description
+  ------------------------------------------------------------------------------
+  BCB1         Defined when compiling with C++ Builder 1
+  BCB3         Defined when compiling with C++ Builder 3
+  BCB4         Defined when compiling with C++ Builder 4
+  BCB5         Defined when compiling with C++ Builder 5
+  BCB6         Defined when compiling with C++ Builder 6
+  BCB1_UP      Defined when compiling with C++ Builder 1 or higher
+  BCB3_UP      Defined when compiling with C++ Builder 3 or higher
+  BCB4_UP      Defined when compiling with C++ Builder 4 or higher
+  BCB5_UP      Defined when compiling with C++ Builder 5 or higher
+  BCB6_UP      Defined when compiling with C++ Builder 6 or higher
+
+
+- Compiler Versions
+
+  The following directives are direct mappings from the VERXXX directives to a
+  friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X
+  directives, these directives are indepedent of the development environment.
+  That is, they are defined regardless of whether compilation takes place using
+  Delphi or C++ Builder.
+
+  Directive     Description
+  ------------------------------------------------------------------------------
+  COMPILER1     Defined when compiling with Delphi 1
+  COMPILER2     Defined when compiling with Delphi 2 or C++ Builder 1
+  COMPILER3     Defined when compiling with Delphi 3
+  COMPILER35    Defined when compiling with C++ Builder 3
+  COMPILER4     Defined when compiling with Delphi 4 or C++ Builder 4
+  COMPILER5     Defined when compiling with Delphi 5 or C++ Builder 5
+  COMPILER6     Defined when compiling with Delphi 6 or C++ Builder 6
+  COMPILER7     Defined when compiling with Delphi 7
+  COMPILER8     Defined when compiling with Delphi 8
+  COMPILER9     Defined when compiling with Delphi 9
+  COMPILER1_UP  Defined when compiling with Delphi 1 or higher
+  COMPILER2_UP  Defined when compiling with Delphi 2 or C++ Builder 1 or higher
+  COMPILER3_UP  Defined when compiling with Delphi 3 or higher
+  COMPILER35_UP Defined when compiling with C++ Builder 3 or higher
+  COMPILER4_UP  Defined when compiling with Delphi 4 or C++ Builder 4 or higher
+  COMPILER5_UP  Defined when compiling with Delphi 5 or C++ Builder 5 or higher
+  COMPILER6_UP  Defined when compiling with Delphi 6 or C++ Builder 6 or higher
+  COMPILER7_UP  Defined when compiling with Delphi 7
+  COMPILER8_UP  Defined when compiling with Delphi 8
+  COMPILER9_UP  Defined when compiling with Delphi 9
+
+
+- RTL Versions
+
+  Use e.g. following to determine the exact RTL version since version 14.0:
+    {$IFDEF CONDITIONALEXPRESSIONS}
+      {$IF Declared(RTLVersion) and (RTLVersion >= 14.2)}
+        // code for Delphi 6.02 or later, Kylix 2 or later, C++ Builder 6 or later
+        ...
+      {$IFEND}
+    {$ENDIF}
+
+  Directive     Description
+  ------------------------------------------------------------------------------
+  RTL80_UP      Defined when compiling with Delphi 1 or later
+  RTL90_UP      Defined when compiling with Delphi 2 or later
+  RTL93_UP      Defined when compiling with C++ Builder 1 or later
+  RTL100_UP     Defined when compiling with Delphi 3 or later
+  RTL110_UP     Defined when compiling with C++ Builder 3 or later
+  RTL120_UP     Defined when compiling with Delphi 4 or later
+  RTL125_UP     Defined when compiling with C++ Builder 4 or later
+  RTL130_UP     Defined when compiling with Delphi 5 or C++ Builder 5 or later
+  RTL140_UP     Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++ Builder 6 or later
+  RTL150_UP     Defined when compiling with Delphi 7 or later
+  RTL160_UP     Defined when compiling with Delphi 8 or later
+  RTL170_UP     Defined when compiling with Delphi 9 or later
+
+
+- Feature Directives
+
+  The features directives are used to test if the compiler supports specific
+  features, such as method overloading, and adjust the sources accordingly. Use
+  of these directives is preferred over the use of the DELPHI and COMPILER
+  directives.
+
+  Directive              Description
+  ------------------------------------------------------------------------------
+  SUPPORTS_CONSTPARAMS          Compiler supports const parameters (D1+)
+  SUPPORTS_SINGLE               Compiler supports the Single type (D1+)
+  SUPPORTS_DOUBLE               Compiler supports the Double type (D1+)
+  SUPPORTS_EXTENDED             Compiler supports the Extended type (D1+)
+  SUPPORTS_CURRENCY             Compiler supports the Currency type (D2+)
+  SUPPORTS_THREADVAR            Compiler supports threadvar declarations (D2+)
+  SUPPORTS_OUTPARAMS            Compiler supports out parameters (D3+)
+  SUPPORTS_VARIANT              Compiler supports variant (D2+)
+  SUPPORTS_WIDECHAR             Compiler supports the WideChar type (D2+)
+  SUPPORTS_WIDESTRING           Compiler supports the WideString type (D3+/BCB3+)
+  SUPPORTS_INTERFACE            Compiler supports interfaces (D3+/BCB3+)
+  SUPPORTS_DISPINTERFACE        Compiler supports dispinterfaces (D3+/BCB3+)
+  SUPPORTS_EXTSYM               Compiler supports the $EXTERNALSYM directive (D4+/BCB3+)
+  SUPPORTS_NODEFINE             Compiler supports the $NODEFINE directive (D4+/BCB3+)
+  SUPPORTS_LONGWORD             Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+)
+  SUPPORTS_INT64                Compiler supports the Int64 type (D4+/BCB4+)
+  SUPPORTS_DYNAMICARRAYS        Compiler supports dynamic arrays (D4+/BCB4+)
+  SUPPORTS_DEFAULTPARAMS        Compiler supports default parameters (D4+/BCB4+)
+  SUPPORTS_OVERLOAD             Compiler supports overloading (D4+/BCB4+)
+  SUPPORTS_IMPLEMENTS           Compiler supports implements (D4+/BCB4+)
+  SUPPORTS_DEPRECATED           Compiler supports the deprecated directive (D6+/BCB6+)
+  SUPPORTS_PLATFORM             Compiler supports the platform directive (D6+/BCB6+)
+  SUPPORTS_LIBRARY              Compiler supports the library directive (D6+/BCB6+)
+  SUPPORTS_LOCAL                Compiler supports the local directive (D6+/BCB6+)
+  ACCEPT_DEPRECATED             Compiler supports or ignore the deprecated directive (D6/BCB6/FPC)
+  ACCEPT_PLATFORM               Compiler supports or ignore the platform directive (D6+/BCB6+)
+  ACCEPT_LIBRARY                Compiler supports or ignore the library directive (D6+/BCB6+)
+  SUPPORTS_CUSTOMVARIANTS       Compiler supports custom variants (D6+/BCB6+)
+  SUPPORTS_VARARGS              Compiler supports varargs (D6+/BCB6+)
+  SUPPORTS_ENUMVALUE            Compiler supports values for enums (D6+/BCB6+)
+  SUPPORTS_DEPRECATED_WARNINGS  Compiler supports deprecated warnings (D6+/BCB6+)
+  SUPPORTS_LIBRARY_WARNINGS     Compiler supports library warnings (D6+/BCB6+)
+  SUPPORTS_PLATFORM_WARNINGS    Compiler supports platform warnings (D6+/BCB6+)
+  SUPPORTS_UNSAFE_WARNINGS      Compiler supports unsafe warnings (D7)
+  SUPPORTS_WEAKPACKAGEUNIT      Compiler supports the WEAKPACKAGEUNIT directive
+  SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive
+  HAS_UNIT_LIBC                 The unit Libc exists (Kylix, FPC on Linux)
+  HAS_UNIT_RTLCONSTS            The unit RTLConsts exists (D6+/BCB6+)
+  HAS_UNIT_TYPES                The unit Types exists (D6+/BCB6+)
+  HAS_UNIT_VARIANTS             The unit Variants exists (D6+/BCB6+)
+  HAS_UNIT_STRUTILS             The unit StrUtils exists (D6+/BCB6+)
+  XPLATFORM_RTL                 The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC)
+
+- Compiler Settings
+
+  The compiler settings directives indicate whether a specific compiler setting
+  is in effect. This facilitates changing compiler settings locally in a more
+  compact and readible manner.
+
+  Directive              Description
+  ------------------------------------------------------------------------------
+  ALIGN_ON               Compiling in the A+ state (no alignment)
+  BOOLEVAL_ON            Compiling in the B+ state (complete boolean evaluation)
+  ASSERTIONS_ON          Compiling in the C+ state (assertions on)
+  DEBUGINFO_ON           Compiling in the D+ state (debug info generation on)
+  IMPORTEDDATA_ON        Compiling in the G+ state (creation of imported data references)
+  LONGSTRINGS_ON         Compiling in the H+ state (string defined as AnsiString)
+  IOCHECKS_ON            Compiling in the I+ state (I/O checking enabled)
+  WRITEABLECONST_ON      Compiling in the J+ state (typed constants can be modified)
+  LOCALSYMBOLS           Compiling in the L+ state (local symbol generation)
+  TYPEINFO_ON            Compiling in the M+ state (RTTI generation on)
+  OPTIMIZATION_ON        Compiling in the O+ state (code optimization on)
+  OPENSTRINGS_ON         Compiling in the P+ state (variable string parameters are openstrings)
+  OVERFLOWCHECKS_ON      Compiling in the Q+ state (overflow checing on)
+  RANGECHECKS_ON         Compiling in the R+ state (range checking on)
+  TYPEDADDRESS_ON        Compiling in the T+ state (pointers obtained using the @ operator are typed)
+  SAFEDIVIDE_ON          Compiling in the U+ state (save FDIV instruction through RTL emulation)
+  VARSTRINGCHECKS_ON     Compiling in the V+ state (type checking of shortstrings)
+  STACKFRAMES_ON         Compiling in the W+ state (generation of stack frames)
+  EXTENDEDSYNTAX_ON      Compiling in the X+ state (Delphi extended syntax enabled)
+*)
+
+{$DEFINE BORLAND}
+
+{ Set FreePascal to Delphi mode }
+{$IFDEF FPC}
+  {$MODE DELPHI}
+  {$ASMMODE Intel}
+  {$UNDEF BORLAND}
+{$ENDIF}
+
+{$IFDEF BORLAND}
+  {$IFDEF LINUX}
+    {$DEFINE KYLIX}
+  {$ENDIF LINUX}
+{$ENDIF BORLAND}
+
+{------------------------------------------------------------------------------}
+{ VERXXX to COMPILERX, DELPHIX and BCBX mappings                               }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BORLAND}
+  {$IFDEF KYLIX}
+    {$I kylix.inc} // FPC incompatible stuff
+  {$ELSE ~KYLIX}
+
+    {$IFDEF VER170}
+      {$DEFINE COMPILER9}
+      {$DEFINE DELPHI9}
+      {$DEFINE DELPHICOMPILER9}
+      {$DEFINE RTL170_UP}
+    {$ENDIF}
+
+    {$IFDEF VER160}
+      {$DEFINE COMPILER8}
+      {$DEFINE DELPHI8}
+      {$DEFINE DELPHICOMPILER8}
+      {$DEFINE RTL160_UP}
+    {$ENDIF}
+
+    {$IFDEF VER150}
+      {$DEFINE COMPILER7}
+      {$IFDEF BCB}
+        {$DEFINE BCB7}
+      {$ELSE}
+        {$DEFINE DELPHI7}
+        {$DEFINE DELPHICOMPILER7}
+      {$ENDIF}
+      {$DEFINE RTL150_UP}
+    {$ENDIF}
+
+    {$IFDEF VER140}
+      {$DEFINE COMPILER6}
+      {$IFDEF BCB}
+        {$DEFINE BCB6}
+      {$ELSE}
+        {$DEFINE DELPHI6}
+        {$DEFINE DELPHICOMPILER6}
+      {$ENDIF}
+      {$DEFINE RTL140_UP}
+    {$ENDIF}
+
+    {$IFDEF VER130}
+      {$DEFINE COMPILER5}
+      {$IFDEF BCB}
+        {$DEFINE BCB5}
+      {$ELSE}
+        {$DEFINE DELPHI5}
+        {$DEFINE DELPHICOMPILER5}
+      {$ENDIF}
+      {$DEFINE RTL130_UP}
+    {$ENDIF}
+
+    {$IFDEF VER125}
+      {$DEFINE COMPILER4}
+      {$DEFINE BCB4}
+      {$DEFINE BCB}
+      {$DEFINE RTL125_UP}
+    {$ENDIF}
+
+    {$IFDEF VER120}
+      {$DEFINE COMPILER4}
+      {$DEFINE DELPHI4}
+      {$DEFINE DELPHICOMPILER4}
+      {$DEFINE RTL120_UP}
+    {$ENDIF}
+
+    {$IFDEF VER110}
+      {$DEFINE COMPILER35}
+      {$DEFINE BCB3}
+      {$DEFINE RTL110_UP}
+    {$ENDIF}
+
+    {$IFDEF VER100}
+      {$DEFINE COMPILER3}
+      {$DEFINE DELPHI3}
+      {$DEFINE DELPHICOMPILER3}
+      {$DEFINE RTL100_UP}
+    {$ENDIF}
+
+    {$IFDEF VER93}
+      {$DEFINE COMPILER2}
+      {$DEFINE BCB1}
+      {$DEFINE BCB}
+      {$DEFINE RTL93_UP}
+    {$ENDIF}
+
+    {$IFDEF VER90}
+      {$DEFINE COMPILER2}
+      {$DEFINE DELPHI2}
+      {$DEFINE DELPHICOMPILER2}
+      {$DEFINE RTL90_UP}
+    {$ENDIF}
+
+    {$IFDEF VER80}
+      {$DEFINE COMPILER1}
+      {$DEFINE DELPHI1}
+      {$DEFINE DELPHICOMPILER1}
+      {$DEFINE RTL80_UP}
+    {$ENDIF}
+
+  {$ENDIF ~KYLIX}
+
+  {$IFDEF BCB}
+    {$DEFINE CPPBUILDER}
+    {$DEFINE BCBCOMPILER}
+  {$ELSE ~BCB}
+    {$DEFINE DELPHI}
+    {$DEFINE DELPHICOMPILER}
+  {$ENDIF ~BCB}
+
+{$ENDIF BORLAND}
+
+{------------------------------------------------------------------------------}
+{ DELPHIX_UP from DELPHIX mappings                                             }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHI9}
+  {$DEFINE DELPHI9_UP}
+  {$DEFINE DELPHI8_UP}
+  {$DEFINE DELPHI7_UP}
+  {$DEFINE DELPHI6_UP}
+  {$DEFINE DELPHI5_UP}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI8}
+  {$DEFINE DELPHI8_UP}
+  {$DEFINE DELPHI7_UP}
+  {$DEFINE DELPHI6_UP}
+  {$DEFINE DELPHI5_UP}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI7}
+  {$DEFINE DELPHI7_UP}
+  {$DEFINE DELPHI6_UP}
+  {$DEFINE DELPHI5_UP}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI6}
+  {$DEFINE DELPHI6_UP}
+  {$DEFINE DELPHI5_UP}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI5}
+  {$DEFINE DELPHI5_UP}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI4}
+  {$DEFINE DELPHI4_UP}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI3}
+  {$DEFINE DELPHI3_UP}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI2}
+  {$DEFINE DELPHI2_UP}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHI1}
+  {$DEFINE DELPHI1_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ KYLIXX_UP from KYLIXX mappings                                               }
+{------------------------------------------------------------------------------}
+
+{$IFDEF KYLIX3}
+  {$DEFINE KYLIX3_UP}
+  {$DEFINE KYLIX2_UP}
+  {$DEFINE KYLIX1_UP}
+{$ENDIF}
+
+{$IFDEF KYLIX2}
+  {$DEFINE KYLIX2_UP}
+  {$DEFINE KYLIX1_UP}
+{$ENDIF}
+
+{$IFDEF KYLIX1}
+  {$DEFINE KYLIX1_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ BCBX_UP from BCBX mappings                                                   }
+{------------------------------------------------------------------------------}
+
+{$IFDEF BCB7}
+  {$DEFINE BCB7_UP}
+  {$DEFINE BCB6_UP}
+  {$DEFINE BCB5_UP}
+  {$DEFINE BCB4_UP}
+  {$DEFINE BCB3_UP}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{$IFDEF BCB6}
+  {$DEFINE BCB6_UP}
+  {$DEFINE BCB5_UP}
+  {$DEFINE BCB4_UP}
+  {$DEFINE BCB3_UP}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{$IFDEF BCB5}
+  {$DEFINE BCB5_UP}
+  {$DEFINE BCB4_UP}
+  {$DEFINE BCB3_UP}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{$IFDEF BCB4}
+  {$DEFINE BCB4_UP}
+  {$DEFINE BCB3_UP}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{$IFDEF BCB3}
+  {$DEFINE BCB3_UP}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{$IFDEF BCB1}
+  {$DEFINE BCB1_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ DELPHICOMPILERX_UP from DELPHICOMPILERX mappings                             }
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHICOMPILER9}
+  {$DEFINE DELPHICOMPILER9_UP}
+  {$DEFINE DELPHICOMPILER8_UP}
+  {$DEFINE DELPHICOMPILER7_UP}
+  {$DEFINE DELPHICOMPILER6_UP}
+  {$DEFINE DELPHICOMPILER5_UP}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER8}
+  {$DEFINE DELPHICOMPILER8_UP}
+  {$DEFINE DELPHICOMPILER7_UP}
+  {$DEFINE DELPHICOMPILER6_UP}
+  {$DEFINE DELPHICOMPILER5_UP}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER7}
+  {$DEFINE DELPHICOMPILER7_UP}
+  {$DEFINE DELPHICOMPILER6_UP}
+  {$DEFINE DELPHICOMPILER5_UP}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER6}
+  {$DEFINE DELPHICOMPILER6_UP}
+  {$DEFINE DELPHICOMPILER5_UP}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER5}
+  {$DEFINE DELPHICOMPILER5_UP}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER4}
+  {$DEFINE DELPHICOMPILER4_UP}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER3}
+  {$DEFINE DELPHICOMPILER3_UP}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER2}
+  {$DEFINE DELPHICOMPILER2_UP}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF DELPHICOMPILER1}
+  {$DEFINE DELPHICOMPILER1_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ COMPILERX_UP from COMPILERX mappings                                         }
+{------------------------------------------------------------------------------}
+
+{$IFDEF COMPILER9}
+  {$DEFINE COMPILER9_UP}
+  {$DEFINE COMPILER8_UP}
+  {$DEFINE COMPILER7_UP}
+  {$DEFINE COMPILER6_UP}
+  {$DEFINE COMPILER5_UP}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER8}
+  {$DEFINE COMPILER8_UP}
+  {$DEFINE COMPILER7_UP}
+  {$DEFINE COMPILER6_UP}
+  {$DEFINE COMPILER5_UP}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER7}
+  {$DEFINE COMPILER7_UP}
+  {$DEFINE COMPILER6_UP}
+  {$DEFINE COMPILER5_UP}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER6}
+  {$DEFINE COMPILER6_UP}
+  {$DEFINE COMPILER5_UP}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER5}
+  {$DEFINE COMPILER5_UP}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER4}
+  {$DEFINE COMPILER4_UP}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER35}
+  {$DEFINE COMPILER35_UP}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER3}
+  {$DEFINE COMPILER3_UP}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER2}
+  {$DEFINE COMPILER2_UP}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{$IFDEF COMPILER1}
+  {$DEFINE COMPILER1_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+
+{$IFDEF DELPHICOMPILER}
+  {$DEFINE DELPHILANGUAGE}
+{$ENDIF}
+
+{$IFDEF BCBCOMPILER}
+  {$DEFINE DELPHILANGUAGE}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ RTLX_UP from RTLX_UP mappings                                                }
+{------------------------------------------------------------------------------}
+
+{$IFDEF RTL170_UP}
+  {$DEFINE RTL160_UP}
+{$ENDIF}
+
+{$IFDEF RTL160_UP}
+  {$DEFINE RTL150_UP}
+{$ENDIF}
+
+{$IFDEF RTL150_UP}
+  {$DEFINE RTL145_UP}
+{$ENDIF}
+
+{$IFDEF RTL145_UP}
+  {$DEFINE RTL142_UP}
+{$ENDIF}
+
+{$IFDEF RTL142_UP}
+  {$DEFINE RTL140_UP}
+{$ENDIF}
+
+{$IFDEF RTL140_UP}
+  {$DEFINE RTL130_UP}
+{$ENDIF}
+
+{$IFDEF RTL130_UP}
+  {$DEFINE RTL125_UP}
+{$ENDIF}
+
+{$IFDEF RTL125_UP}
+  {$DEFINE RTL120_UP}
+{$ENDIF}
+
+{$IFDEF RTL120_UP}
+  {$DEFINE RTL110_UP}
+{$ENDIF}
+
+{$IFDEF RTL110_UP}
+  {$DEFINE RTL100_UP}
+{$ENDIF}
+
+{$IFDEF RTL100_UP}
+  {$DEFINE RTL93_UP}
+{$ENDIF}
+
+{$IFDEF RTL93_UP}
+  {$DEFINE RTL90_UP}
+{$ENDIF}
+
+{$IFDEF RTL90_UP}
+  {$DEFINE RTL80_UP}
+{$ENDIF}
+
+{------------------------------------------------------------------------------}
+{ Map COMPILERX_UP to friendly feature names                                   }
+{------------------------------------------------------------------------------}
+
+{$IFDEF FPC}
+  {$MODE Delphi}
+  {$IFDEF  VER1_0}
+     Please use FPC 1.1 or later to compile this.
+  {$ELSE}
+    {$DEFINE SUPPORTS_OUTPARAMS}
+    {$DEFINE SUPPORTS_WIDECHAR}
+    {$DEFINE SUPPORTS_WIDESTRING}
+    {$IFDEF HASINTF}
+      {$DEFINE SUPPORTS_INTERFACE}
+    {$ENDIF}
+    {$IFDEF HASVARIANT}
+      {$DEFINE SUPPORTS_VARIANT}
+    {$ENDIF}
+    {$IFDEF FPC_HAS_TYPE_SINGLE}
+      {$DEFINE SUPPORTS_SINGLE}
+    {$ENDIF}
+    {$IFDEF FPC_HAS_TYPE_DOUBLE}
+      {$DEFINE SUPPORTS_DOUBLE}
+    {$ENDIF}
+    {$IFDEF FPC_HAS_TYPE_EXTENDED}
+      {$DEFINE SUPPORTS_EXTENDED}
+    {$ENDIF}
+    {$IFDEF HASCURRENCY}
+      {$DEFINE SUPPORTS_CURRENCY}
+    {$ENDIF}
+    {$DEFINE SUPPORTS_THREADVAR}
+    {$DEFINE SUPPORTS_CONSTPARAMS}
+    {$DEFINE SUPPORTS_LONGWORD}
+    {$DEFINE SUPPORTS_INT64}
+    {$DEFINE SUPPORTS_DYNAMICARRAYS}
+    {$DEFINE SUPPORTS_DEFAULTPARAMS}
+    {$DEFINE SUPPORTS_OVERLOAD}
+    {$DEFINE ACCEPT_DEPRECATED}
+    {$DEFINE ACCEPT_PLATFORM}
+    {$DEFINE ACCEPT_LIBRARY}
+    {$DEFINE SUPPORTS_EXTSYM}
+    {$DEFINE SUPPORTS_NODEFINE}
+
+    {$DEFINE SUPPORTS_CUSTOMVARIANTS}
+    {$DEFINE SUPPORTS_VARARGS}
+    {$DEFINE SUPPORTS_ENUMVALUE}
+    {$IFDEF LINUX}
+      {$DEFINE HAS_UNIT_LIBC}
+    {$ENDIF LINUX}
+    {$DEFINE HAS_UNIT_TYPES}
+    {$DEFINE HAS_UNIT_VARIANTS}
+    {$DEFINE HAS_UNIT_STRUTILS}
+
+    {$DEFINE XPLATFORM_RTL}
+
+    {$UNDEF SUPPORTS_DISPINTERFACE}
+    {$UNDEF SUPPORTS_DISPID} // is used outside of dispinterfaces
+    {$UNDEF SUPPORTS_IMPLEMENTS}
+    {$UNDEF SUPPORTS_UNSAFE_WARNINGS}
+  {$ENDIF}
+{$ENDIF FPC}
+
+{$IFDEF COMPILER1_UP}
+  {$DEFINE SUPPORTS_CONSTPARAMS}
+  {$DEFINE SUPPORTS_SINGLE}
+  {$DEFINE SUPPORTS_DOUBLE}
+  {$DEFINE SUPPORTS_EXTENDED}
+{$ENDIF COMPILER1_UP}
+
+{$IFDEF COMPILER2_UP}
+  {$DEFINE SUPPORTS_CURRENCY}
+  {$DEFINE SUPPORTS_THREADVAR}
+  {$DEFINE SUPPORTS_VARIANT}
+  {$DEFINE SUPPORTS_WIDECHAR}
+{$ENDIF COMPILER2_UP}
+
+{$IFDEF COMPILER3_UP}
+  {$DEFINE SUPPORTS_OUTPARAMS}
+  {$DEFINE SUPPORTS_WIDESTRING}
+  {$DEFINE SUPPORTS_INTERFACE}
+  {$DEFINE SUPPORTS_DISPINTERFACE}
+  {$DEFINE SUPPORTS_DISPID}
+  {$DEFINE SUPPORTS_WEAKPACKAGEUNIT}
+{$ENDIF COMPILER3_UP}
+
+{$IFDEF COMPILER35_UP}
+  {$DEFINE SUPPORTS_EXTSYM}
+  {$DEFINE SUPPORTS_NODEFINE}
+{$ENDIF COMPILER35_UP}
+
+{$IFDEF COMPILER4_UP}
+  {$DEFINE SUPPORTS_LONGWORD}
+  {$DEFINE SUPPORTS_INT64}
+  {$DEFINE SUPPORTS_DYNAMICARRAYS}
+  {$DEFINE SUPPORTS_DEFAULTPARAMS}
+  {$DEFINE SUPPORTS_OVERLOAD}
+  {$DEFINE SUPPORTS_IMPLEMENTS}
+{$ENDIF COMPILER4_UP}
+
+{$IFDEF COMPILER6_UP}
+  {$DEFINE SUPPORTS_DEPRECATED}
+  {$DEFINE SUPPORTS_LIBRARY}
+  {$DEFINE SUPPORTS_PLATFORM}
+  {$DEFINE SUPPORTS_LOCAL}
+  {$DEFINE ACCEPT_DEPRECATED}
+  {$DEFINE ACCEPT_PLATFORM}
+  {$DEFINE ACCEPT_LIBRARY}
+  {$DEFINE SUPPORTS_DEPRECATED_WARNINGS}
+  {$DEFINE SUPPORTS_LIBRARY_WARNINGS}
+  {$DEFINE SUPPORTS_PLATFORM_WARNINGS}
+  {$DEFINE SUPPORTS_CUSTOMVARIANTS}
+  {$DEFINE SUPPORTS_VARARGS}
+  {$DEFINE SUPPORTS_ENUMVALUE}
+  {$DEFINE SUPPORTS_COMPILETIME_MESSAGES}
+{$ENDIF COMPILER6_UP}
+
+{$IFDEF COMPILER7_UP}
+  {$DEFINE SUPPORTS_UNSAFE_WARNINGS}
+{$ENDIF COMPILER7_UP}
+
+{$IFDEF RTL140_UP}
+  {$IFDEF LINUX}
+    {$DEFINE HAS_UNIT_LIBC}
+  {$ENDIF LINUX}
+  {$DEFINE HAS_UNIT_RTLCONSTS}
+  {$DEFINE HAS_UNIT_TYPES}
+  {$DEFINE HAS_UNIT_VARIANTS}
+  {$DEFINE HAS_UNIT_STRUTILS}
+  {$DEFINE XPLATFORM_RTL}
+{$ENDIF RTL140_UP}
+
+{------------------------------------------------------------------------------}
+{ Cross-platform related defines                                               }
+{------------------------------------------------------------------------------}
+
+{$IFDEF WIN32}
+  {$DEFINE MSWINDOWS}
+{$ENDIF}
+
+{$IFDEF DELPHILANGUAGE}
+  {$IFDEF LINUX}
+    {$DEFINE UNIX}
+    {$DEFINE VisualCLX}
+  {$ENDIF}
+
+  {$IFNDEF VisualCLX}
+    {$DEFINE VCL}
+  {$ENDIF}
+
+  {$IFDEF VisualCLX}
+    {$DEFINE COMPLIB_CLX} { kept for backward compatibility, use VisualCLX instead }
+  {$ENDIF}
+
+  {$IFDEF VCL}
+    {$DEFINE COMPLIB_VCL} { kept for backward compatibility, use VCL instead }
+  {$ENDIF}
+{$ENDIF DELPHILANGUAGE}
+
+{------------------------------------------------------------------------------}
+{ Compiler settings                                                            }
+{------------------------------------------------------------------------------}
+
+{$IFOPT A+} {$DEFINE ALIGN_ON} {$ENDIF}
+{$IFOPT B+} {$DEFINE BOOLEVAL_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+  {$IFOPT C+} {$DEFINE ASSERTIONS_ON} {$ENDIF}
+{$ENDIF}
+{$IFOPT D+} {$DEFINE DEBUGINFO_ON} {$ENDIF}
+{$IFOPT G+} {$DEFINE IMPORTEDDATA_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+  {$IFOPT H+} {$DEFINE LONGSTRINGS_ON} {$ENDIF}
+{$ENDIF}
+{ HINTS }
+{$IFOPT I+} {$DEFINE IOCHECKS_ON} {$ENDIF}
+{$IFDEF COMPILER2_UP}
+  {$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF}
+{$ENDIF}
+{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$ENDIF}
+{$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF}
+{$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF}
+{$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF}
+{$IFOPT Q+} {$DEFINE OVERFLOWCHECKS_ON} {$ENDIF}
+{$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF}
+{ REALCOMPATIBILITY }
+{$IFOPT T+} {$DEFINE TYPEDADDRESS_ON} {$ENDIF}
+{$IFOPT U+} {$DEFINE SAFEDIVIDE_ON} {$ENDIF}
+{$IFOPT V+} {$DEFINE VARSTRINGCHECKS_ON} {$ENDIF}
+{$IFOPT W+} {$DEFINE STACKFRAMES_ON} {$ENDIF}
+{ WARNINGS }
+{$IFOPT X+} {$DEFINE EXTENDEDSYNTAX_ON} {$ENDIF}
+
+// for Delphi/BCB trial versions remove the point from the line below
+{.$UNDEF SUPPORTS_WEAKPACKAGEUNIT}
+
+// History:
+
+// $Log$
+// Revision 1.1  2005-04-04 07:56:11  marco
+//  * Jedi Windows Api initial import
+//
+// Revision 1.1  2004/11/11 09:39:29  marquardt
+// added several directory trees, added jedi.inc to files, misc style changes
+//
+// Revision 1.19  2004/11/06 02:11:20  mthoma
+// history cleaning.
+//
+// Revision 1.18  2004/08/10 02:52:02  rrossmair
+// - moved {$ENDIF ~JEDI_INC} to EOF.
+//
+// Revision 1.17  2004/08/09 06:38:08  peter3
+// - D8 support added
+// - D9 support added (guesswork)
+//
+// Revision 1.16  2004/07/29 17:12:28  rrossmair
+// fixed comment ("KYLIXX_UP from KYLIXX mappings")
+//
+// Revision 1.15  2004/07/29 07:58:21  marquardt
+// inc files updated
+//
+// Revision 1.14  2004/06/21 01:10:17  rrossmair
+// - $IFDEFed contents (to prevent from repeated inclusion)
+// - introduced symbols SUPPORTS_DEPRECATED_WARNINGS, SUPPORTS_LIBRARY_WARNINGS, SUPPORTS_PLATFORM_WARNINGS, SUPPORTS_COMPILETIME_MESSAGES
+// - reordered pre-CVS history
+//
+// Revision 1.13  2004/05/08 08:44:20  rrossmair
+// introduced & applied symbol HAS_UNIT_LIBC
+//
+// Revision 1.12  2004/05/06 05:03:59  rrossmair
+// SUPPORTS_ENUMVALUE definition fixed for Free Pascal Compiler
+//
+// Revision 1.11  2004/05/05 03:20:13  rrossmair
+// jedi.inc: moved FPC-incompatible Kylix-related code to separate include file "kylix.inc", disposed of FPC-related TODOs
+//
+// Revision 1.10  2004/05/01 00:03:59  rrossmair
+// FPC workaround removed; didn't work with Kylix
+//
+// Revision 1.9  2004/04/30 18:25:15  rrossmair
+// added symbols BORLAND, CPPBUILDER, BCBCOMPILER
+// removed symbol NONBORLAND
+// cleanup (reduced redundancy)
+// corrected embarrassing typo "widestring's" (for the 3rd time, I believe)
+//
+// Revision 1.8  2004/04/14 20:26:33  mthoma
+// Changed data to date
+// Local is Delphi 6 - removed todo comment
+// Replaced CLX with VisualCLX to be consistent with Borlands current definition of what "CLX" is.
+//
+// Revision 1.7  2004/04/06 05:06:12
+// add support for Kylix, FPC, RTL, versions, some speaking directives
+//
+// 2004-03-22,
+//  - add SUPPORTS_WEAKPACKAGEUNIT
+//
+// 2004-03-20,
+//  - add SUPPORTS_LOCAL
+//
+// 2004-03-18,
+//  - add SUPPORTS_LONGWORD
+//
+// 2004-03-16,
+//  - add HAS_UNIT_STRUTILS
+//  - add XPLATFORM_RTL
+//
+// 2003-12-03,
+//  - add SUPPORTS_ENUMVALUE
+//
+// 2003-11-14,
+//  - add SUPPORTS_VARARGS
+//
+// 2003-10-30,
+//  - correct and complete comments
+//  - add Kylix definitions
+//  - add RTL definitions
+//  - add FPC definitions
+
+{$ENDIF ~JEDI_INC}

+ 258 - 0
packages/extra/winunits/jediapilib.inc

@@ -0,0 +1,258 @@
+{$IFNDEF JEDIAPILIB_INC}
+{$DEFINE JEDIAPILIB_INC}
+
+{******************************************************************************}
+{                                                                              }
+{ Windows Version Unit for Object Pascal                                       }
+{                                                                              }
+{ Portions created by Robert Marquardt are Copyright (C) 2004                  }
+{ Robert Marquardt. All Rights Reserved.                                       }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting the provisions above and   }
+{ replace them with the notice and other provisions required by the LGPL       }
+{ License. If you do not delete the provisions above, a recipient may use      }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+{$A+,Z4}
+
+// This file is intended for C header conversions.
+// It defines several mutually exclusive IFDEFs which determine
+// the Windows version the API conversion is usable with.
+
+// Global switch to enable dynamic linking of some APIs
+{.DEFINE DYNAMIC_LINK}
+{$IFDEF DYNAMIC_LINK}
+  {$STACKFRAMES ON}
+  {$WARNINGS OFF}
+{$ENDIF DYNAMIC_LINK}
+
+// allow FPC compat without any extra params.
+{$ifdef FPC}
+{$MODE Delphi}
+{$DEFINE NOVCL}
+{$else}
+{$DEFINE SUPPORTS_DISPID}
+{$ENDIF}
+
+// Global switch to make UNICODE versions of API functions default
+{.DEFINE UNICODE}
+
+// Global switch to activate the use of the original basic types of
+// Delphi Windows.pas. Either indirectly in JwaWinType.pas or
+// directly through the use of Windows.pas instead of JwaWinType.pas.
+{$DEFINE USE_DELPHI_TYPES}
+
+// Global switch for the Windows version the files are compatible with
+// ONLY A SINGLE ONE IS ALLOWED TO BE ACTIVATED BY CHANGING THE DOT TO A DOLLAR SIGN!
+// Default is WINXP
+{.DEFINE WIN95}
+{.DEFINE WIN98}
+{.DEFINE WIN98SE}
+{.DEFINE WIN98ME}
+{.DEFINE WINNT4}
+{.DEFINE WIN2000}
+{$DEFINE WINXP}
+{.DEFINE WIN2003}
+
+// Global switch for the Windows Internet Explorer versions
+// ONLY A SINGLE ONE IS ALLOWED TO BE ACTIVATED BY CHANGING THE DOT TO A DOLLAR SIGN!
+// Default is IE600
+{.DEFINE IE300}
+{.DEFINE IE400}
+{.DEFINE IE401}
+{.DEFINE IE500}
+{.DEFINE IE501}
+{.DEFINE IE560}
+{$DEFINE IE600}
+
+// Global switch for the MSI (Microsoft Installer) versions
+// ONLY A SINGLE ONE IS ALLOWED TO BE ACTIVATED BY CHANGING THE DOT TO A DOLLAR SIGN!
+// if none is set a default is determined from the Windows version IFDEFs
+{.DEFINE MSI100}
+{.DEFINE MSI110}
+{.DEFINE MSI200}
+
+// Global switch for the HtmlHelp versions
+// ONLY A SINGLE ONE IS ALLOWED TO BE ACTIVATED BY CHANGING THE DOT TO A DOLLAR SIGN!
+// default is HTMLHELP12
+{.DEFINE HTMLHELP11}
+{$DEFINE HTMLHELP12}
+
+// secondary IFDEFs for "_UP" which means also any later OS version
+{$IFDEF WIN2003}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+ {$DEFINE WIN98ME_UP}
+ {$DEFINE WINNT4_UP}
+ {$DEFINE WIN2000_UP}
+ {$DEFINE WINXP_UP}
+ {$DEFINE WIN2003_UP}
+{$ENDIF WIN2003}
+
+{$IFDEF WINXP}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+ {$DEFINE WIN98ME_UP}
+ {$DEFINE WINNT4_UP}
+ {$DEFINE WIN2000_UP}
+ {$DEFINE WINXP_UP}
+{$ENDIF WINXP}
+
+{$IFDEF WIN2000}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+ {$DEFINE WIN98ME_UP}
+ {$DEFINE WINNT4_UP}
+ {$DEFINE WIN2000_UP}
+{$ENDIF WIN2000}
+
+{$IFDEF WINNT4}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+ {$DEFINE WIN98ME_UP}
+ {$DEFINE WINNT4_UP}
+{$ENDIF WINNT4}
+
+{$IFDEF WIN98ME}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+ {$DEFINE WIN98ME_UP}
+{$ENDIF WIN98ME}
+
+{$IFDEF WIN98SE}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+ {$DEFINE WIN98SE_UP}
+{$ENDIF WIN98SE}
+
+{$IFDEF WIN98}
+ {$DEFINE WIN95_UP}
+ {$DEFINE WIN98_UP}
+{$ENDIF WIN98}
+
+{$IFDEF WIN95}
+ {$DEFINE WIN95_UP}
+{$ENDIF WIN95}
+
+
+// secondary IFDEFs for "_UP" which means also any later IE version
+{$IFDEF IE600}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+ {$DEFINE IE401_UP}
+ {$DEFINE IE500_UP}
+ {$DEFINE IE501_UP}
+ {$DEFINE IE560_UP}
+ {$DEFINE IE600_UP}
+{$ENDIF IE600}
+
+{$IFDEF IE560}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+ {$DEFINE IE401_UP}
+ {$DEFINE IE500_UP}
+ {$DEFINE IE501_UP}
+ {$DEFINE IE560_UP}
+{$ENDIF IE560}
+
+{$IFDEF IE501}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+ {$DEFINE IE401_UP}
+ {$DEFINE IE500_UP}
+ {$DEFINE IE501_UP}
+{$ENDIF IE501}
+
+{$IFDEF IE500}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+ {$DEFINE IE401_UP}
+ {$DEFINE IE500_UP}
+{$ENDIF IE500}
+
+{$IFDEF IE401}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+ {$DEFINE IE401_UP}
+{$ENDIF IE401}
+
+{$IFDEF IE400}
+ {$DEFINE IE300_UP}
+ {$DEFINE IE400_UP}
+{$ENDIF IE400}
+
+{$IFDEF IE300}
+ {$DEFINE IE300_UP}
+{$ENDIF IE300}
+
+// IFDEF defaults for MSI (Microsoft Installer)
+{$IFNDEF MSI200}
+{$IFNDEF MSI110}
+{$IFNDEF MSI100}
+ {$IFDEF WINXP_UP}
+  {$DEFINE MSI200}
+ {$ELSE}
+  {$IFDEF WIN2000_UP}
+   {$DEFINE MSI110}
+  {$ELSE}
+   {$DEFINE MSI100}
+  {$ENDIF WIN2000_UP}
+ {$ENDIF WINXP_UP}
+{$ENDIF !MSI100}
+{$ENDIF !MSI110}
+{$ENDIF !MSI200}
+
+// secondary IFDEFs for MSI (Microsoft Installer)
+{$IFDEF MSI200}
+ {$DEFINE MSI200_UP}
+ {$DEFINE MSI110_UP}
+ {$DEFINE MSI100_UP}
+{$ENDIF MSI200}
+
+{$IFDEF MSI110}
+ {$DEFINE MSI110_UP}
+ {$DEFINE MSI100_UP}
+{$ENDIF MSI110}
+
+{$IFDEF MSI100}
+ {$DEFINE MSI100_UP}
+{$ENDIF MSI100}
+
+// secondary IFDEFs for HtmlHelp
+{$IFDEF HTMLHELP12}
+ {$DEFINE HTMLHELP12_UP}
+ {$DEFINE HTMLHELP11_UP}
+{$ENDIF HTMLHELP12}
+
+{$IFDEF HTMLHELP11}
+ {$DEFINE HTMLHELP11_UP}
+{$ENDIF HTMLHELP11}
+
+{$ENDIF ~JEDIAPILIB_INC}

+ 675 - 0
packages/extra/winunits/jwaObjsel.pas

@@ -0,0 +1,675 @@
+{******************************************************************************}
+{                                                                              }
+{ Object Picker API interface Unit for Object Pascal                           }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: objsel.h, released June 2000. The original Pascal      }
+{ code is: ObjSel.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaObjSel;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "ObjSel.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaWinType;
+
+//  Contents:   Object Picker Dialog public header
+
+const
+  //'{17d6ccd8-3b7b-11d2-b9e0-00c04fd8dbf7}'
+  CLSID_DsObjectPicker: TGUID = (
+    D1:$17d6ccd8; D2:$3b7b; D3:$11d2; D4:($b9,$e0,$00,$c0,$4f,$d8,$db,$f7));
+  {$EXTERNALSYM CLSID_DsObjectPicker}
+
+  IID_IDsObjectPicker: TGUID = (
+    D1:$0c87e64e; D2:$3b7a; D3:$11d2; D4:($b9,$e0,$00,$c0,$4f,$d8,$db,$f7));
+  {$EXTERNALSYM IID_IDsObjectPicker}
+
+{
+CLIPBOARD FORMATS
+=================
+
+CFSTR_DSOP_DS_SELECTION_LIST
+    Returns an HGLOBAL for global memory containing a DS_SELECTION_LIST
+    variable length structure.
+}
+
+const
+  CFSTR_DSOP_DS_SELECTION_LIST = 'CFSTR_DSOP_DS_SELECTION_LIST';
+  {$EXTERNALSYM CFSTR_DSOP_DS_SELECTION_LIST}
+
+{
+SCOPE TYPES
+===========
+
+A scope is an entry in the "Look In" dropdown list of the Object Picker
+dialog.
+
+When initializing the DS Object Picker, DSOP_SCOPE_TYPEs are used with
+DSOP_SCOPE_INIT_INFO.flType member to specify which types of scopes the
+DS Object Picker should put in the "Look In" list.
+
+DSOP_SCOPE_TYPE_TARGET_COMPUTER
+    Computer specified by DSOP_INIT_INFO.pwzTargetComputer, NULL is
+    local computer.
+
+DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN
+    Uplevel domain to which target computer is joined.
+
+DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
+    Downlevel domain to which target computer is joined.
+
+DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN
+    All domains in the enterprise to which the target computer belongs
+    other than the JOINED_DOMAIN or USER_SPECIFIED_*_SCOPEs.
+
+DSOP_SCOPE_TYPE_GLOBAL_CATALOG
+    The Entire Directory scope.
+
+DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN
+    All uplevel domains external to the enterprise but trusted by the
+    domain to which the target computer is joined.
+
+DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN
+    All downlevel domains external to the enterprise but trusted by the
+    domain to which the target computer is joined.
+
+DSOP_SCOPE_TYPE_WORKGROUP
+    The workgroup of which TARGET_COMPUTER is a member.  Applies only if the
+    TARGET_COMPUTER is not joined to a domain.
+
+DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE
+DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE
+    Any uplevel or downlevel scope generated by processing user input.  If
+    neither of these types is specified, user entries that do not refer to
+    one of the scopes in the "Look In" control will be rejected.
+
+}
+
+const
+  DSOP_SCOPE_TYPE_TARGET_COMPUTER              = $00000001;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_TARGET_COMPUTER}
+  DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN        = $00000002;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN}
+  DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN      = $00000004;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN}
+  DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN            = $00000008;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN}
+  DSOP_SCOPE_TYPE_GLOBAL_CATALOG               = $00000010;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_GLOBAL_CATALOG}
+  DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN      = $00000020;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN}
+  DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN    = $00000040;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN}
+  DSOP_SCOPE_TYPE_WORKGROUP                    = $00000080;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_WORKGROUP}
+  DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE   = $00000100;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE}
+  DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE = $00000200;
+  {$EXTERNALSYM DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE}
+
+{
+DSOP_SCOPE_INIT_INFO flags
+==========================
+
+The flScope member can contain zero or more of the following flags:
+
+DSOP_SCOPE_FLAG_STARTING_SCOPE
+    The scope should be the first one selected in the Look In control after
+    dialog initialization.  If more than one scope specifies this flag,
+    the one which is chosen to be the starting scope is implementation
+    dependant.
+
+DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT
+    ADs paths for objects selected from this scope should be converted to use
+    the WinNT provider.
+
+DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP
+    ADs paths for objects selected from this scope should be converted to use
+    the LDAP provider.
+
+DSOP_SCOPE_FLAG_WANT_PROVIDER_GC
+    ADs paths for objects selected from this scope should be converted to use
+    the GC provider.
+
+DSOP_SCOPE_FLAG_WANT_SID_PATH
+    ADs paths for objects selected from this scope having an objectSid
+    attribute should be converted to the form LDAP://<SID=x>, where x
+    represents the hexidecimal digits of the objectSid attribute value.
+
+DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH
+    ADs paths for downlevel well-known SID objects (for example,
+    DSOP_DOWNLEVEL_FILTER_INTERACTIVE) are an empty string unless this flag is
+    specified.  If it is, the paths will be of the form
+    WinNT://NT AUTHORITY/Interactive or WinNT://Creator owner.
+
+DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS
+    If the scope filter contains the DSOP_FILTER_USERS or
+    DSOP_DOWNLEVEL_FILTER_USERS flag, then check the Users checkbox by
+    default in the Look For dialog.
+
+DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS
+
+DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS
+
+DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS
+}
+
+const
+  DSOP_SCOPE_FLAG_STARTING_SCOPE              = $00000001;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_STARTING_SCOPE}
+  DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT         = $00000002;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT}
+  DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP          = $00000004;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP}
+  DSOP_SCOPE_FLAG_WANT_PROVIDER_GC            = $00000008;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_WANT_PROVIDER_GC}
+  DSOP_SCOPE_FLAG_WANT_SID_PATH               = $00000010;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_WANT_SID_PATH}
+  DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH = $00000020;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH}
+  DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS        = $00000040;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS}
+  DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS       = $00000080;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS}
+  DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS    = $00000100;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS}
+  DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS     = $00000200;
+  {$EXTERNALSYM DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS}
+
+{
+The flMixedModeOnly/flNativeModeOnly member of an uplevel scope can
+contain one or more of the following flags (at least one must be specified):
+
+DSOP_FILTER_INCLUDE_ADVANCED_VIEW
+    Include objects which have the attribute showInAdvancedViewOnly set to
+    true.
+
+DSOP_FILTER_USERS
+    Include user objects.
+
+DSOP_FILTER_BUILTIN_GROUPS
+    Include group objects with a groupType value having the flag
+    GROUP_TYPE_BUILTIN_LOCAL_GROUP.
+
+DSOP_FILTER_WELL_KNOWN_PRINCIPALS
+    Include the contents of the WellKnown Security Principals container.
+
+DSOP_FILTER_UNIVERSAL_GROUPS_DL
+    Include distribution list universal groups.
+
+DSOP_FILTER_UNIVERSAL_GROUPS_SE
+    Include security enabled universal groups.
+
+DSOP_FILTER_GLOBAL_GROUPS_DL
+    Include distribution list global groups.
+
+DSOP_FILTER_GLOBAL_GROUPS_SE
+    Include security enabled global groups.
+
+DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL
+    Include distribution list domain global groups.
+
+DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
+    Include security enabled domain local groups.
+
+DSOP_FILTER_CONTACTS
+    Include contact objects.
+
+DSOP_FILTER_COMPUTERS
+    Include computer objects.
+}
+
+const
+  DSOP_FILTER_INCLUDE_ADVANCED_VIEW  = $00000001;
+  {$EXTERNALSYM DSOP_FILTER_INCLUDE_ADVANCED_VIEW}
+  DSOP_FILTER_USERS                  = $00000002;
+  {$EXTERNALSYM DSOP_FILTER_USERS}
+  DSOP_FILTER_BUILTIN_GROUPS         = $00000004;
+  {$EXTERNALSYM DSOP_FILTER_BUILTIN_GROUPS}
+  DSOP_FILTER_WELL_KNOWN_PRINCIPALS  = $00000008;
+  {$EXTERNALSYM DSOP_FILTER_WELL_KNOWN_PRINCIPALS}
+  DSOP_FILTER_UNIVERSAL_GROUPS_DL    = $00000010;
+  {$EXTERNALSYM DSOP_FILTER_UNIVERSAL_GROUPS_DL}
+  DSOP_FILTER_UNIVERSAL_GROUPS_SE    = $00000020;
+  {$EXTERNALSYM DSOP_FILTER_UNIVERSAL_GROUPS_SE}
+  DSOP_FILTER_GLOBAL_GROUPS_DL       = $00000040;
+  {$EXTERNALSYM DSOP_FILTER_GLOBAL_GROUPS_DL}
+  DSOP_FILTER_GLOBAL_GROUPS_SE       = $00000080;
+  {$EXTERNALSYM DSOP_FILTER_GLOBAL_GROUPS_SE}
+  DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL = $00000100;
+  {$EXTERNALSYM DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL}
+  DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE = $00000200;
+  {$EXTERNALSYM DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE}
+  DSOP_FILTER_CONTACTS               = $00000400;
+  {$EXTERNALSYM DSOP_FILTER_CONTACTS}
+  DSOP_FILTER_COMPUTERS              = $00000800;
+  {$EXTERNALSYM DSOP_FILTER_COMPUTERS}
+
+{
+The flFilter member of a downlevel scope can contain one or more of the
+following flags:
+
+DSOP_DOWNLEVEL_FILTER_USERS
+    Include user objects.
+
+DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS
+    Include all local groups.
+
+DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
+    Include all global groups.
+
+DSOP_DOWNLEVEL_FILTER_COMPUTERS
+    Include computer objects
+
+DSOP_DOWNLEVEL_FILTER_WORLD
+    Include builtin security principal World (Everyone).
+
+DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER
+    Include builtin security principal Authenticated User.
+
+DSOP_DOWNLEVEL_FILTER_ANONYMOUS
+    Include builtin security principal Anonymous.
+
+DSOP_DOWNLEVEL_FILTER_BATCH
+    Include builtin security principal Batch.
+
+DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER
+    Include builtin security principal Creator Owner.
+
+DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP
+    Include builtin security principal Creator Group.
+
+DSOP_DOWNLEVEL_FILTER_DIALUP
+    Include builtin security principal Dialup.
+
+DSOP_DOWNLEVEL_FILTER_INTERACTIVE
+    Include builtin security principal Interactive.
+
+DSOP_DOWNLEVEL_FILTER_NETWORK
+    Include builtin security principal Network.
+
+DSOP_DOWNLEVEL_FILTER_SERVICE
+    Include builtin security principal Service.
+
+DSOP_DOWNLEVEL_FILTER_SYSTEM
+    Include builtin security principal System.
+
+DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS
+    Exclude local builtin groups returned by groups enumeration.
+
+DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER
+    Include builtin security principal Terminal Server.
+
+DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE
+    Include builtin security principal Local Service
+
+DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE
+    Include builtin security principal Network Service
+
+DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
+    Include all builtin security principals.
+}
+
+const
+  DSOP_DOWNLEVEL_FILTER_USERS                  = DWORD($80000001);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_USERS}
+  DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS           = DWORD($80000002);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS}
+  DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS          = DWORD($80000004);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS}
+  DSOP_DOWNLEVEL_FILTER_COMPUTERS              = DWORD($80000008);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_COMPUTERS}
+  DSOP_DOWNLEVEL_FILTER_WORLD                  = DWORD($80000010);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_WORLD}
+  DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER     = DWORD($80000020);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER}
+  DSOP_DOWNLEVEL_FILTER_ANONYMOUS              = DWORD($80000040);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_ANONYMOUS}
+  DSOP_DOWNLEVEL_FILTER_BATCH                  = DWORD($80000080);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_BATCH}
+  DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER          = DWORD($80000100);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER}
+  DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP          = DWORD($80000200);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP}
+  DSOP_DOWNLEVEL_FILTER_DIALUP                 = DWORD($80000400);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_DIALUP}
+  DSOP_DOWNLEVEL_FILTER_INTERACTIVE            = DWORD($80000800);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_INTERACTIVE}
+  DSOP_DOWNLEVEL_FILTER_NETWORK                = DWORD($80001000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_NETWORK}
+  DSOP_DOWNLEVEL_FILTER_SERVICE                = DWORD($80002000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_SERVICE}
+  DSOP_DOWNLEVEL_FILTER_SYSTEM                 = DWORD($80004000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_SYSTEM}
+  DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS = DWORD($80008000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS}
+  DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER        = DWORD($80010000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER}
+  DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS     = DWORD($80020000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS}
+  DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE          = DWORD($80040000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE}
+  DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE        = DWORD($80080000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE}
+  DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON           = DWORD($80100000);
+  {$EXTERNALSYM DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON}
+
+{
+DSOP_UPLEVEL_FILTER_FLAGS
+=========================
+
+Contains the DSOP_FILTER_* flags for use with a DSOP_SCOPE_INIT_INFO
+structure when the scope is uplevel (DS-aware).
+
+flBothModes
+    Flags to use for an uplevel scope, regardless of whether it is a
+    mixed or native mode domain.
+
+flMixedModeOnly
+    Flags to use when an uplevel domain is in mixed mode.
+
+flNativeModeOnly
+    Flags to use when an uplevel domain is in native mode.
+
+DSOP_FILTER_FLAGS
+=================
+
+Uplevel
+    Contains flags to use for an uplevel scope.
+
+flDownlevel
+    Flags to use for a downlevel scope.
+}
+
+type
+  _DSOP_UPLEVEL_FILTER_FLAGS = record
+    flBothModes: ULONG;
+    flMixedModeOnly: ULONG;
+    flNativeModeOnly: ULONG;
+  end;
+  {$EXTERNALSYM _DSOP_UPLEVEL_FILTER_FLAGS}
+  DSOP_UPLEVEL_FILTER_FLAGS = _DSOP_UPLEVEL_FILTER_FLAGS;
+  {$EXTERNALSYM DSOP_UPLEVEL_FILTER_FLAGS}
+  TDsOpUpLevelFilterFlags = DSOP_UPLEVEL_FILTER_FLAGS;
+  PDsOpUpLevelFilterFlags = ^DSOP_UPLEVEL_FILTER_FLAGS;
+
+  _DSOP_FILTER_FLAGS = record
+    Uplevel: DSOP_UPLEVEL_FILTER_FLAGS;
+    flDownlevel: ULONG;
+  end;
+  {$EXTERNALSYM _DSOP_FILTER_FLAGS}
+  DSOP_FILTER_FLAGS = _DSOP_FILTER_FLAGS;
+  {$EXTERNALSYM DSOP_FILTER_FLAGS}
+  TDsOpFilterFlags = DSOP_FILTER_FLAGS;
+  PDsOpFilterFlags = ^DSOP_FILTER_FLAGS;
+
+{
+DSOP_SCOPE_INIT_INFO
+====================
+
+Each DSOP_SCOPE_INIT_INFO structure in the array DSOP_INIT_INFO.aDsScopeInfos
+describes a single scope or a group of scopes with the same settings.
+
+cbSize
+    Size, in bytes, of the entire structure.
+
+flType
+    DSOP_SCOPE_TYPE_* flags.  It is legal to combine multiple values via
+    bitwise OR if all of the types of scopes combined in this way require
+    the same settings.
+
+flScope
+    DSOP_SCOPE_ * flags.
+
+FilterFlags
+    DSOP_FILTER_* flags that indicate which types of objects should be
+    presented to the user in this scope.
+
+pwzDcName
+    Name of the DC of a domain.  This member is used only if the flType
+    member contains the flag DSOP_SCOPE_TYPE_JOINED_DOMAIN.  If that flag is
+    not set, this member must be NULL.
+
+pwzADsPath
+    Currently not supported, must be NULL.
+
+hr
+    Filled with S_OK if the scope represented by this structure could be
+    created, or an error message indicating why it could not.  If
+    IDsObjectPicker::SetScopes returns a success code, this value will
+    also be a success code.
+}
+
+type
+  PDSOP_SCOPE_INIT_INFO = ^DSOP_SCOPE_INIT_INFO;
+  {$EXTERNALSYM PDSOP_SCOPE_INIT_INFO}
+  _DSOP_SCOPE_INIT_INFO = record
+    cbSize: ULONG;
+    flType: ULONG;
+    flScope: ULONG;
+    FilterFlags: DSOP_FILTER_FLAGS;
+    pwzDcName: PWSTR;  // OPTIONAL
+    pwzADsPath: PWSTR; // OPTIONAL
+    hr: HRESULT;
+  end;
+  {$EXTERNALSYM _DSOP_SCOPE_INIT_INFO}
+  DSOP_SCOPE_INIT_INFO = _DSOP_SCOPE_INIT_INFO;
+  {$EXTERNALSYM DSOP_SCOPE_INIT_INFO}
+  PCDSOP_SCOPE_INIT_INFO = PDSOP_SCOPE_INIT_INFO;
+  {$EXTERNALSYM PCDSOP_SCOPE_INIT_INFO}
+  TDsOpScopeInitInfo = DSOP_SCOPE_INIT_INFO;
+  PDsOpScopeInitInfo = PDSOP_SCOPE_INIT_INFO;
+
+{
+DSOP_INIT_INFO flags
+====================
+
+The following flags may be set in DSOP_INIT_INFO.flOptions:
+
+DSOP_FLAG_MULTISELECT
+    Allow multiple selections.  If this flag is not set, the dialog will
+    return zero or one objects.
+
+DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK
+    If this flag is NOT set, then the DSOP_SCOPE_TYPE_TARGET_COMPUTER flag
+    will be ignored if the target computer is a DC.  This flag has no effect
+    unless DSOP_SCOPE_TYPE_TARGET_COMPUTER is specified.
+
+}
+
+const
+  DSOP_FLAG_MULTISELECT                   = $00000001;
+  {$EXTERNALSYM DSOP_FLAG_MULTISELECT}
+  DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK = $00000002;
+  {$EXTERNALSYM DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK}
+
+{
+DSOP_INIT_INFO
+==============
+
+Used to configure the DS Object Picker dialog.
+
+cbSize
+    Size, in bytes, of entire structure.
+
+pwzTargetComputer
+    Sets the computer associated with DSOP_SCOPE_TARGET_COMPUTER, and
+    which is used to determine the joined domain and enterprise.
+    If this value is NULL, the target computer is the local machine.
+
+cDsScopeInfos
+    Count of elements in aDsScopeInfos.  Must be at least 1, since
+    the object picker cannot operate without at least one scope.
+
+aDsScopeInfos
+    Array of scope initialization structures.  Must be present and
+    contain at least one element.
+
+flOptions
+    Various DS Object Picker flags (DSOP_FLAG_MULTISELECT).
+
+cAttributesToFetch
+    Count of elements in apwzAttributeNames.  Can be 0.
+
+apwzAttributeNames
+    Array of names of attributes to fetch for each object.  Ignored
+    if cAttributesToFetch is 0.
+}
+
+type
+  PDSOP_INIT_INFO = ^DSOP_INIT_INFO;
+  {$EXTERNALSYM PDSOP_INIT_INFO}
+  _DSOP_INIT_INFO = record
+    cbSize: ULONG;
+    pwzTargetComputer: PWSTR;
+    cDsScopeInfos: ULONG;
+    aDsScopeInfos: PDSOP_SCOPE_INIT_INFO;
+    flOptions: ULONG;
+    cAttributesToFetch: ULONG;
+    apwzAttributeNames: LPLPWSTR;
+  end;
+  {$EXTERNALSYM _DSOP_INIT_INFO}
+  DSOP_INIT_INFO = _DSOP_INIT_INFO;
+  {$EXTERNALSYM DSOP_INIT_INFO}
+  PCDSOP_INIT_INFO = PDSOP_INIT_INFO;
+  {$EXTERNALSYM PCDSOP_INIT_INFO}
+  TDsOpInitInfo = DSOP_INIT_INFO;
+  PDsOpInitInfo = PDSOP_INIT_INFO;
+
+{
+DS_SELECTION
+============
+Describes an object selected by the user.
+
+pwzName
+    The object's RDN.
+
+pwzADsPath
+    The object's ADsPath.
+
+pwzClass
+    The object's class attribute value.
+
+pwzUPN
+    The object's userPrincipalName attribute value.
+
+pvarFetchedAttributes
+    An array of VARIANTs, one for each attribute fetched.
+
+flScopeType
+    A single DSOP_SCOPE_TYPE_* flag describing the type of the scope
+    from which this object was selected.
+
+DS_SELECTION_LIST
+=================
+Available as a clipboard format from the data object returned by
+IDsObjectPicker::InvokeDialog.  Contains a list of objects that the user
+selected.
+
+cItems
+    Number of elements in the aDsSelection array.
+
+cFetchedAttributes
+    Number of elements in each DSSELECTION.avarFetchedAttributes member.
+
+aDsSelection
+    Array of cItems DSSELECTION structures.
+}
+
+type
+  PDS_SELECTION = ^DS_SELECTION;
+  {$EXTERNALSYM PDS_SELECTION}
+  _DS_SELECTION = record
+    pwzName: PWSTR;
+    pwzADsPath: PWSTR;
+    pwzClass: PWSTR;
+    pwzUPN: PWSTR;
+    pvarFetchedAttributes: POleVariant; 
+    flScopeType: ULONG;
+  end;
+  {$EXTERNALSYM _DS_SELECTION}
+  DS_SELECTION = _DS_SELECTION;
+  {$EXTERNALSYM DS_SELECTION}
+  TDsSelection = DS_SELECTION;
+  PDsSelection = PDS_SELECTION;
+
+  PDS_SELECTION_LIST = ^DS_SELECTION_LIST;
+  {$EXTERNALSYM PDS_SELECTION_LIST}
+  _DS_SELECTION_LIST = record
+    cItems: ULONG;
+    cFetchedAttributes: ULONG;
+    aDsSelection: array [0..ANYSIZE_ARRAY - 1] of DS_SELECTION;
+  end;
+  {$EXTERNALSYM _DS_SELECTION_LIST}
+  DS_SELECTION_LIST = _DS_SELECTION_LIST;
+  {$EXTERNALSYM DS_SELECTION_LIST}
+  TDsSelectionList = DS_SELECTION_LIST;
+  PDsSelectionList = PDS_SELECTION_LIST;
+
+//
+// Object Picker Interfaces
+//
+
+//
+// The main interface to the DS Object Picker, used to initialize it,
+// invoke the dialog, and return the user's selections.
+//
+
+type
+  IDsObjectPicker = interface (IUnknown)
+  ['{0c87e64e-3b7a-11d2-b9e0-00c04fd8dbf7}']
+    // Sets scope, filter, etc. for use with next invocation of dialog
+    function Initialize(const pInitInfo: DSOP_INIT_INFO): HRESULT; stdcall;
+    // Creates the modal DS Object Picker dialog.
+    function InvokeDialog(hwndParent: HWND; out ppdoSelections: IDataObject): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsObjectPicker}
+
+implementation
+
+end.

+ 1229 - 0
packages/extra/winunits/jwaaccctrl.pas

@@ -0,0 +1,1229 @@
+{******************************************************************************}
+{                                                                              }
+{ Interface Unit for Object Pascal                                             }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2003 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 2003                 }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAccCtrl;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "aclapi.h"'}
+{$HPPEMIT ''}
+{$HPPEMIT 'typedef PTRUSTEE_A *PPTRUSTEE_A'}
+{$HPPEMIT 'typedef PTRUSTEE_W *PPTRUSTEE_W'}
+{$HPPEMIT '#ifdef UNICODE'}
+{$HPPEMIT 'typedef PPTRUSTEE_W PPTRUSTEE'}
+{$HPPEMIT '#else'}
+{$HPPEMIT 'typedef PPTRUSTEE_A PPTRUSTEE'}
+{$HPPEMIT '#endif'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType;
+
+(* Dependencies
+// winnt
+PSID
+//wintype
+HLOCAL
+DWORD
+GUID
+LPSTR
+LPWSTR
+ULONG
+PVOID
+HANDLE
+BOOL
+LONG
+*)
+
+// (rom) MACRO
+function AccFree(hMem: HLOCAL): HLOCAL;
+{$EXTERNALSYM AccFree}
+
+//
+// Definition:
+// This enumerated type defines the objects supported by the get/set API within
+// this document.  See section 3.1, Object Types for a detailed definition of the
+// supported object types, and their name formats.
+//
+
+type
+  _SE_OBJECT_TYPE = (
+    SE_UNKNOWN_OBJECT_TYPE,
+    SE_FILE_OBJECT,
+    SE_SERVICE,
+    SE_PRINTER,
+    SE_REGISTRY_KEY,
+    SE_LMSHARE,
+    SE_KERNEL_OBJECT,
+    SE_WINDOW_OBJECT,
+    SE_DS_OBJECT,
+    SE_DS_OBJECT_ALL,
+    SE_PROVIDER_DEFINED_OBJECT,
+    SE_WMIGUID_OBJECT,
+    SE_REGISTRY_WOW64_32KEY);
+  {$EXTERNALSYM _SE_OBJECT_TYPE}
+  SE_OBJECT_TYPE = _SE_OBJECT_TYPE;
+  {$EXTERNALSYM SE_OBJECT_TYPE}
+  TSeObjectType = SE_OBJECT_TYPE;
+
+//
+// Definition: TRUSTEE_TYPE
+// This enumerated type specifies the type of trustee account for the trustee
+// returned by the API described in this document.
+// TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
+//                      type.  This field is not validated on input to the APIs
+//                      that take Trustees.
+// TRUSTEE_IS_USER      The trustee account is a user account.
+// TRUSTEE_IS_GROUP     The trustee account is a group account.
+//
+
+  _TRUSTEE_TYPE = (
+    TRUSTEE_IS_UNKNOWN,
+    TRUSTEE_IS_USER,
+    TRUSTEE_IS_GROUP,
+    TRUSTEE_IS_DOMAIN,
+    TRUSTEE_IS_ALIAS,
+    TRUSTEE_IS_WELL_KNOWN_GROUP,
+    TRUSTEE_IS_DELETED,
+    TRUSTEE_IS_INVALID,
+    TRUSTEE_IS_COMPUTER);
+  {$EXTERNALSYM _TRUSTEE_TYPE}
+  TRUSTEE_TYPE = _TRUSTEE_TYPE;
+  {$EXTERNALSYM TRUSTEE_TYPE}
+  TTrusteeType = TRUSTEE_TYPE;
+
+//
+// Definition: TRUSTEE_FORM
+// This enumerated type specifies the form the trustee identifier is in for a
+// particular trustee.
+// TRUSTEE_IS_SID       The trustee is identified with a SID rather than with a name.
+// TRUSTEE_IS_NAME      The trustee is identified with a name.
+//
+
+  _TRUSTEE_FORM = (
+    TRUSTEE_IS_SID,
+    TRUSTEE_IS_NAME,
+    TRUSTEE_BAD_FORM,
+    TRUSTEE_IS_OBJECTS_AND_SID,
+    TRUSTEE_IS_OBJECTS_AND_NAME);
+  {$EXTERNALSYM _TRUSTEE_FORM}
+  TRUSTEE_FORM = _TRUSTEE_FORM;
+  {$EXTERNALSYM TRUSTEE_FORM}
+  TTrusteeForm = TRUSTEE_FORM;
+
+//
+// Definition: MULTIPLE_TRUSTEE_OPERATION
+// If the trustee is a multiple trustee, this enumerated type specifies the type.
+// TRUSTEE_IS_IMPERSONATE       The trustee is an impersonate trustee and the multiple
+//                          trustee field in the trustee points to another trustee
+//                          that is a trustee for the server that will be doing the
+//                          impersonation.
+//
+
+  _MULTIPLE_TRUSTEE_OPERATION = (NO_MULTIPLE_TRUSTEE, TRUSTEE_IS_IMPERSONATE);
+  {$EXTERNALSYM _MULTIPLE_TRUSTEE_OPERATION}
+  MULTIPLE_TRUSTEE_OPERATION = _MULTIPLE_TRUSTEE_OPERATION;
+  {$EXTERNALSYM MULTIPLE_TRUSTEE_OPERATION}
+  TMultipleTrusteeOperation = MULTIPLE_TRUSTEE_OPERATION;
+
+  POBJECTS_AND_SID = ^OBJECTS_AND_SID;
+  {$EXTERNALSYM POBJECTS_AND_SID}
+  _OBJECTS_AND_SID = packed record
+    ObjectsPresent: DWORD;
+    ObjectTypeGuid: GUID;
+    InheritedObjectTypeGuid: GUID;
+    pSid: PSID;
+  end;
+  {$EXTERNALSYM _OBJECTS_AND_SID}
+  OBJECTS_AND_SID = _OBJECTS_AND_SID;
+  {$EXTERNALSYM OBJECTS_AND_SID}
+  TObjectsAndSid = OBJECTS_AND_SID;
+  PObjectsAndSid = POBJECTS_AND_SID;
+
+  POBJECTS_AND_NAME_A = ^OBJECTS_AND_NAME_A;
+  {$EXTERNALSYM POBJECTS_AND_NAME_A}
+  _OBJECTS_AND_NAME_A = packed record
+    ObjectsPresent: DWORD;
+    ObjectType: SE_OBJECT_TYPE;
+    ObjectTypeName: LPSTR;
+    InheritedObjectTypeName: LPSTR;
+    ptstrName: LPSTR;
+  end;
+  {$EXTERNALSYM _OBJECTS_AND_NAME_A}
+  OBJECTS_AND_NAME_A = _OBJECTS_AND_NAME_A;
+  {$EXTERNALSYM OBJECTS_AND_NAME_A}
+  TObjectsAndNameA = OBJECTS_AND_NAME_A;
+  PObjectsAndNameA = POBJECTS_AND_NAME_A;
+
+  POBJECTS_AND_NAME_W = ^OBJECTS_AND_NAME_W;
+  {$EXTERNALSYM POBJECTS_AND_NAME_W}
+  _OBJECTS_AND_NAME_W = packed record
+    ObjectsPresent: DWORD;
+    ObjectType: SE_OBJECT_TYPE;
+    ObjectTypeName: LPWSTR;
+    InheritedObjectTypeName: LPWSTR;
+    ptstrName: LPWSTR;
+  end;
+  {$EXTERNALSYM _OBJECTS_AND_NAME_W}
+  OBJECTS_AND_NAME_W = _OBJECTS_AND_NAME_W;
+  {$EXTERNALSYM OBJECTS_AND_NAME_W}
+  TObjectsAndNameW = OBJECTS_AND_NAME_W;
+  PObjectsAndNameW = POBJECTS_AND_NAME_W;
+
+  {$IFDEF UNICODE}
+  OBJECTS_AND_NAME = OBJECTS_AND_NAME_W;
+  {$EXTERNALSYM OBJECTS_AND_NAME}
+  POBJECTS_AND_NAME = POBJECTS_AND_NAME_W;
+  {$EXTERNALSYM POBJECTS_AND_NAME}
+  TObjectsAndName = TObjectsAndNameW;
+  PObjectsAndName = PObjectsAndNameW;
+  {$ELSE}
+  OBJECTS_AND_NAME = OBJECTS_AND_NAME_A;
+  {$EXTERNALSYM OBJECTS_AND_NAME}
+  POBJECTS_AND_NAME = POBJECTS_AND_NAME_A;
+  {$EXTERNALSYM POBJECTS_AND_NAME}
+  TObjectsAndName = TObjectsAndNameA;
+  PObjectsAndName = PObjectsAndNameA;
+  {$ENDIF UNICODE}
+
+//
+// Definition: TRUSTEE
+// This structure is used to pass account information into and out of the system
+// using the API defined in this document.
+// PMultipleTrustee     - if NON-NULL, points to another trustee structure, as
+//                    defined by the multiple trustee operation field.
+// MultipleTrusteeOperation - Defines the multiple trustee operation/type.
+// TrusteeForm - defines if the trustee is defined by name or SID.
+// TrusteeType - defines if the trustee type is unknown, a user or a group.
+// PwcsName     - points to the trustee name or the trustee SID.
+//
+
+  PTRUSTEE_A = ^TRUSTEE_A;
+  {$EXTERNALSYM PTRUSTEE_A}
+  _TRUSTEE_A = packed record
+    pMultipleTrustee: PTRUSTEE_A;
+    MultipleTrusteeOperation: MULTIPLE_TRUSTEE_OPERATION;
+    TrusteeForm: TRUSTEE_FORM;
+    TrusteeType: TRUSTEE_TYPE;
+    ptstrName: LPSTR;
+  end;
+  {$EXTERNALSYM _TRUSTEE_A}
+  TRUSTEE_A = _TRUSTEE_A;
+  {$EXTERNALSYM TRUSTEE_A}
+  TRUSTEEA = TRUSTEE_A;
+  {$EXTERNALSYM PTRUSTEEA}
+  PPTRUSTEE_A = ^PTRUSTEE_A;
+  {$NODEFINE PPTRUSTEE_A}
+  TTrusteeA = TRUSTEE_A;
+  PTrusteeA = PTRUSTEE_A;
+
+  PTRUSTEE_W = ^TRUSTEE_W;
+  {$EXTERNALSYM PTRUSTEE_W}
+  _TRUSTEE_W = packed record
+    pMultipleTrustee: PTRUSTEE_W;
+    MultipleTrusteeOperation: MULTIPLE_TRUSTEE_OPERATION;
+    TrusteeForm: TRUSTEE_FORM;
+    TrusteeType: TRUSTEE_TYPE;
+    ptstrName: LPWSTR;
+  end;
+  {$EXTERNALSYM _TRUSTEE_W}
+  TRUSTEE_W = _TRUSTEE_W;
+  {$EXTERNALSYM TRUSTEE_W}
+  TRUSTEEW = TRUSTEE_W;
+  {$EXTERNALSYM TRUSTEEW}
+  PPTRUSTEE_W = ^PTRUSTEE_W;
+  {$NODEFINE PPTRUSTEE_W}
+  TTrusteeW = TRUSTEE_W;
+  PTrusteeW = PTRUSTEE_W;
+
+  {$IFDEF UNICODE}
+  TRUSTEE_ = TRUSTEE_W;
+  {$EXTERNALSYM TRUSTEE_}
+  PTRUSTEE_ = PTRUSTEE_W;
+  {$EXTERNALSYM PTRUSTEE_}
+  TRUSTEE = TRUSTEEW;
+  {$EXTERNALSYM TRUSTEE}
+  PPTRUSTEE = ^PPTRUSTEE_W;
+  {$NODEFINE PPTRUSTEE}
+  TTrustee = TTrusteeW;
+  PTrustee = PTrusteeW;
+  {$ELSE}
+  TRUSTEE_ = TRUSTEE_A;
+  {$EXTERNALSYM TRUSTEE_}
+  PTRUSTEE_ = PTRUSTEE_A;
+  {$EXTERNALSYM PTRUSTEE_}
+  TRUSTEE = TRUSTEEA;
+  {$EXTERNALSYM TRUSTEE}
+  PPTRUSTEE = ^PPTRUSTEE_A;
+  {$NODEFINE PPTRUSTEE}
+  TTrustee = TTrusteeA;
+  PTrustee = PTrusteeA;
+  {$ENDIF UNICODE}
+
+//
+// Definition: ACCESS_MODE
+// This enumerated type specifies how permissions are (requested)/to be applied
+//  for the trustee by the access control entry.  On input this field can by any
+//  of the values, although it is not meaningful to mix access control and audit
+//  control entries.  On output this field will be either SET_ACCESS, DENY_ACCESS,
+// SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
+// The following descriptions define how this type effects an explicit access
+// request to apply access permissions to an object.
+// GRANT_ACCESS - The trustee will have at least the requested permissions upon
+//                successful completion of the command. (If the trustee has
+//                additional permissions they will not be removed).
+// SET_ACCESS - The trustee will have exactly the requested permissions upon
+//              successful completion of the command.
+// DENY_ACCESS - The trustee will be denied the specified permissions.
+// REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
+// SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
+//                     object using the requested permissions.
+// SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
+//                     using the requested permissions.
+//
+
+  _ACCESS_MODE = (
+    NOT_USED_ACCESS,
+    GRANT_ACCESS,
+    SET_ACCESS,
+    DENY_ACCESS,
+    REVOKE_ACCESS,
+    SET_AUDIT_SUCCESS,
+    SET_AUDIT_FAILURE);
+  {$EXTERNALSYM _ACCESS_MODE}
+  ACCESS_MODE = _ACCESS_MODE;
+  {$EXTERNALSYM ACCESS_MODE}
+  TAccessMode = _ACCESS_MODE;
+
+//
+// Definition: Inheritance flags
+// These bit masks are provided to allow simple application of inheritance in
+// explicit access requests on containers.
+// NO_INHERITANCE       The specific access permissions will only be applied to
+//                  the container, and will not be inherited by objects created
+//                  within the container.
+// SUB_CONTAINERS_ONLY_INHERIT  The specific access permissions will be inherited
+//                              and applied to sub containers created within the
+//                              container, and will be applied to the container
+//                              itself.
+// SUB_OBJECTS_ONLY_INHERIT     The specific access permissions will only be inherited
+//                              by objects created within the specific container.
+//                              The access permissions will not be applied to the
+//                              container itself.
+// SUB_CONTAINERS_AND_OBJECTS_INHERIT   The specific access permissions will be
+//                                      inherited by containers created within the
+//                                      specific container, will be applied to
+//                                      objects created within the container, but
+//                                      will not be applied to the container itself.
+//
+
+const
+  NO_INHERITANCE                     = $0;
+  {$EXTERNALSYM NO_INHERITANCE}
+  SUB_OBJECTS_ONLY_INHERIT           = $1;
+  {$EXTERNALSYM SUB_OBJECTS_ONLY_INHERIT}
+  SUB_CONTAINERS_ONLY_INHERIT        = $2;
+  {$EXTERNALSYM SUB_CONTAINERS_ONLY_INHERIT}
+  SUB_CONTAINERS_AND_OBJECTS_INHERIT = $3;
+  {$EXTERNALSYM SUB_CONTAINERS_AND_OBJECTS_INHERIT}
+  INHERIT_NO_PROPAGATE               = $4;
+  {$EXTERNALSYM INHERIT_NO_PROPAGATE}
+  INHERIT_ONLY                       = $8;
+  {$EXTERNALSYM INHERIT_ONLY}
+
+//
+// Informational bit that is returned
+//
+
+  INHERITED_ACCESS_ENTRY = $10;
+  {$EXTERNALSYM INHERITED_ACCESS_ENTRY}
+
+//
+// Informational bit that tells where a node was inherited from.  Valid only
+// for NT 5 APIs
+//
+
+  INHERITED_PARENT      = $10000000;
+  {$EXTERNALSYM INHERITED_PARENT}
+  INHERITED_GRANDPARENT = $20000000;
+  {$EXTERNALSYM INHERITED_GRANDPARENT}
+
+//
+// Definition: EXPLICIT_ACCESS
+// This structure is used to pass access control entry information into and out
+// of the system using the API defined in this document.
+// grfAccessPermissions - This contains the access permissions to assign for the
+//                     trustee.  It is in the form of an NT access mask.
+// grfAccessMode - This field defines how the permissions are to be applied for
+//                 the trustee.
+// grfInheritance - For containers, this field defines how the access control
+//                  entry is/(is requested) to be inherited on
+//                  objects/sub-containers created within the container.
+// Trustee - This field contains the definition of the trustee account the
+//           explicit access applies to.
+//
+
+type
+  PEXPLICIT_ACCESS_A = ^EXPLICIT_ACCESS_A;
+  {$EXTERNALSYM PEXPLICIT_ACCESS_A}
+  _EXPLICIT_ACCESS_A = packed record
+    grfAccessPermissions: DWORD;
+    grfAccessMode: ACCESS_MODE;
+    grfInheritance: DWORD;
+    Trustee: TRUSTEE_A;
+  end;
+  {$EXTERNALSYM _EXPLICIT_ACCESS_A}
+  EXPLICIT_ACCESS_A = _EXPLICIT_ACCESS_A;
+  {$EXTERNALSYM EXPLICIT_ACCESS_A}
+  EXPLICIT_ACCESSA = EXPLICIT_ACCESS_A;
+  {$EXTERNALSYM EXPLICIT_ACCESSA}
+  PEXPLICIT_ACCESSA = PEXPLICIT_ACCESS_A;
+  {$EXTERNALSYM PEXPLICIT_ACCESSA}
+  TExplicitAccessA = EXPLICIT_ACCESS_A;
+  PExplicitAccessA = PEXPLICIT_ACCESS_A;
+
+  PEXPLICIT_ACCESS_W = ^EXPLICIT_ACCESS_W;
+  {$EXTERNALSYM PEXPLICIT_ACCESS_W}
+  _EXPLICIT_ACCESS_W = packed record
+    grfAccessPermissions: DWORD;
+    grfAccessMode: ACCESS_MODE;
+    grfInheritance: DWORD;
+    Trustee: TRUSTEE_W;
+  end;
+  {$EXTERNALSYM _EXPLICIT_ACCESS_W}
+  EXPLICIT_ACCESS_W = _EXPLICIT_ACCESS_W;
+  {$EXTERNALSYM EXPLICIT_ACCESS_W}
+  EXPLICIT_ACCESSW = EXPLICIT_ACCESS_W;
+  {$EXTERNALSYM EXPLICIT_ACCESSW}
+  PEXPLICIT_ACCESSW = PEXPLICIT_ACCESS_W;
+  {$EXTERNALSYM PEXPLICIT_ACCESSW}
+  TExplicitAccessW = EXPLICIT_ACCESS_W;
+  PExplicitAccessW = PEXPLICIT_ACCESS_W;
+
+  {$IFDEF UNICODE}
+  EXPLICIT_ACCESS_ = EXPLICIT_ACCESS_W;
+  {$EXTERNALSYM EXPLICIT_ACCESS_}
+  PEXPLICIT_ACCESS_ = PEXPLICIT_ACCESS_W;
+  {$EXTERNALSYM PEXPLICIT_ACCESS_}
+  EXPLICIT_ACCESS = EXPLICIT_ACCESSW;
+  {$EXTERNALSYM EXPLICIT_ACCESS}
+  PEXPLICIT_ACCESS = PEXPLICIT_ACCESSW;
+  {$EXTERNALSYM PEXPLICIT_ACCESS}
+  TExplicitAccess = TExplicitAccessW;
+  PExplicitAccess = PExplicitAccessW;
+  {$ELSE}
+  EXPLICIT_ACCESS_ = EXPLICIT_ACCESS_A;
+  {$EXTERNALSYM EXPLICIT_ACCESS_}
+  PEXPLICIT_ACCESS_ = PEXPLICIT_ACCESS_A;
+  {$EXTERNALSYM PEXPLICIT_ACCESS_}
+  EXPLICIT_ACCESS = EXPLICIT_ACCESSA;
+  {$EXTERNALSYM EXPLICIT_ACCESS}
+  PEXPLICIT_ACCESS = PEXPLICIT_ACCESSA;
+  {$EXTERNALSYM PEXPLICIT_ACCESS}
+  TExplicitAccess = TExplicitAccessA;
+  PExplicitAccess = PExplicitAccessA;
+  {$ENDIF UNICODE}
+
+//------------------------------------------------------------------------------
+//                              NT5 APIs
+//------------------------------------------------------------------------------
+
+//
+// Default provider
+//
+
+const
+  ACCCTRL_DEFAULT_PROVIDERA = 'Windows NT Access Provider';
+  {$EXTERNALSYM ACCCTRL_DEFAULT_PROVIDERA}
+  ACCCTRL_DEFAULT_PROVIDERW = 'Windows NT Access Provider';
+  {$EXTERNALSYM ACCCTRL_DEFAULT_PROVIDERW}
+
+  {$IFDEF UNICODE}
+  ACCCTRL_DEFAULT_PROVIDER = ACCCTRL_DEFAULT_PROVIDERW;
+  {$EXTERNALSYM ACCCTRL_DEFAULT_PROVIDER}
+  {$ELSE}
+  ACCCTRL_DEFAULT_PROVIDER = ACCCTRL_DEFAULT_PROVIDERA;
+  {$EXTERNALSYM ACCCTRL_DEFAULT_PROVIDER}
+  {$ENDIF UNICODE}
+
+//
+// Access rights
+//
+
+type
+  ACCESS_RIGHTS = ULONG;
+  {$EXTERNALSYM ACCESS_RIGHTS}
+  PACCESS_RIGHTS = ^ACCESS_RIGHTS;
+  {$EXTERNALSYM PACCESS_RIGHTS}
+
+//
+// Inheritance flags
+//
+
+  INHERIT_FLAGS = ULONG;
+  {$EXTERNALSYM INHERIT_FLAGS}
+  PINHERIT_FLAGS = ^INHERIT_FLAGS;
+  {$EXTERNALSYM PINHERIT_FLAGS}
+
+//
+// Access / Audit structures
+//
+
+  PACTRL_ACCESS_ENTRYA = ^ACTRL_ACCESS_ENTRYA;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRYA}
+  _ACTRL_ACCESS_ENTRYA = packed record
+    Trustee: TRUSTEE_A;
+    fAccessFlags: ULONG;
+    Access: ACCESS_RIGHTS;
+    ProvSpecificAccess: ACCESS_RIGHTS;
+    Inheritance: INHERIT_FLAGS;
+    lpInheritProperty: LPSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_ENTRYA}
+  ACTRL_ACCESS_ENTRYA = _ACTRL_ACCESS_ENTRYA;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRYA}
+  TActrlAccessEntryA = ACTRL_ACCESS_ENTRYA;
+  PActrlAccessEntryA = PACTRL_ACCESS_ENTRYA;
+
+//
+// Access / Audit structures
+//
+
+  PACTRL_ACCESS_ENTRYW = ^ACTRL_ACCESS_ENTRYW;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRYW}
+  _ACTRL_ACCESS_ENTRYW = packed record
+    Trustee: TRUSTEE_W;
+    fAccessFlags: ULONG;
+    Access: ACCESS_RIGHTS;
+    ProvSpecificAccess: ACCESS_RIGHTS;
+    Inheritance: INHERIT_FLAGS;
+    lpInheritProperty: LPWSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_ENTRYW}
+  ACTRL_ACCESS_ENTRYW = _ACTRL_ACCESS_ENTRYW;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRYW}
+  TActrlAccessEntryW = ACTRL_ACCESS_ENTRYW;
+  PActrlAccessEntryW = PACTRL_ACCESS_ENTRYW;
+
+  {$IFDEF UNICODE}
+  ACTRL_ACCESS_ENTRY = ACTRL_ACCESS_ENTRYW;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY}
+  PACTRL_ACCESS_ENTRY = PACTRL_ACCESS_ENTRYW;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY}
+  TActrlAccessEntry = TActrlAccessEntryW;
+  PActrlAccessEntry = PActrlAccessEntryW;
+  {$ELSE}
+  ACTRL_ACCESS_ENTRY = ACTRL_ACCESS_ENTRYA;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY}
+  PACTRL_ACCESS_ENTRY = PACTRL_ACCESS_ENTRYA;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY}
+  TActrlAccessEntry = TActrlAccessEntryA;
+  PActrlAccessEntry = PActrlAccessEntryA;
+  {$ENDIF UNICODE}
+
+  PACTRL_ACCESS_ENTRY_LISTA = ^ACTRL_ACCESS_ENTRY_LISTA;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY_LISTA}
+  _ACTRL_ACCESS_ENTRY_LISTA = packed record
+    cEntries: ULONG;
+    pAccessList: PACTRL_ACCESS_ENTRYA;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_ENTRY_LISTA}
+  ACTRL_ACCESS_ENTRY_LISTA = _ACTRL_ACCESS_ENTRY_LISTA;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY_LISTA}
+  TActrlAccessEntryListA = ACTRL_ACCESS_ENTRY_LISTA;
+  PActrlAccessEntryListA = PACTRL_ACCESS_ENTRY_LISTA;
+
+  PACTRL_ACCESS_ENTRY_LISTW = ^ACTRL_ACCESS_ENTRY_LISTW;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY_LISTW}
+  _ACTRL_ACCESS_ENTRY_LISTW = packed record
+    cEntries: ULONG;
+    pAccessList: PACTRL_ACCESS_ENTRYW;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_ENTRY_LISTW}
+  ACTRL_ACCESS_ENTRY_LISTW = _ACTRL_ACCESS_ENTRY_LISTW;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY_LISTW}
+  TActrlAccessEntryListW = ACTRL_ACCESS_ENTRY_LISTW;
+  PActrlAccessEntryListW = PACTRL_ACCESS_ENTRY_LISTW;
+
+  {$IFDEF UNICODE}
+  ACTRL_ACCESS_ENTRY_LIST = ACTRL_ACCESS_ENTRY_LISTW;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY_LIST}
+  PACTRL_ACCESS_ENTRY_LIST = PACTRL_ACCESS_ENTRY_LISTW;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY_LIST}
+  TActrlAccessEntryList = TActrlAccessEntryListW;
+  PActrlAccessEntryList = PActrlAccessEntryListW;
+  {$ELSE}
+  ACTRL_ACCESS_ENTRY_LIST = ACTRL_ACCESS_ENTRY_LISTA;
+  {$EXTERNALSYM ACTRL_ACCESS_ENTRY_LIST}
+  PACTRL_ACCESS_ENTRY_LIST = PACTRL_ACCESS_ENTRY_LISTA;
+  {$EXTERNALSYM PACTRL_ACCESS_ENTRY_LIST}
+  TActrlAccessEntryList = TActrlAccessEntryListA;
+  PActrlAccessEntryList = PActrlAccessEntryListA;
+  {$ENDIF UNICODE}
+
+  PACTRL_PROPERTY_ENTRYA = ^ACTRL_PROPERTY_ENTRYA;
+  {$EXTERNALSYM PACTRL_PROPERTY_ENTRYA}
+  _ACTRL_PROPERTY_ENTRYA = packed record
+    lpProperty: LPSTR;
+    pAccessEntryList: PACTRL_ACCESS_ENTRY_LISTA;
+    fListFlags: ULONG;
+  end;
+  {$EXTERNALSYM _ACTRL_PROPERTY_ENTRYA}
+  ACTRL_PROPERTY_ENTRYA = _ACTRL_PROPERTY_ENTRYA;
+  {$EXTERNALSYM ACTRL_PROPERTY_ENTRYA}
+  TActrlPropertyEntryA = ACTRL_PROPERTY_ENTRYA;
+  PActrlPropertyEntryA = PACTRL_PROPERTY_ENTRYA;
+
+  PACTRL_PROPERTY_ENTRYW = ^ACTRL_PROPERTY_ENTRYW;
+  {$EXTERNALSYM PACTRL_PROPERTY_ENTRYW}
+  _ACTRL_PROPERTY_ENTRYW = packed record
+    lpProperty: LPWSTR;
+    pAccessEntryList: PACTRL_ACCESS_ENTRY_LISTW;
+    fListFlags: ULONG;
+  end;
+  {$EXTERNALSYM _ACTRL_PROPERTY_ENTRYW}
+  ACTRL_PROPERTY_ENTRYW = _ACTRL_PROPERTY_ENTRYW;
+  {$EXTERNALSYM ACTRL_PROPERTY_ENTRYW}
+  TActrlPropertyEntryW = ACTRL_PROPERTY_ENTRYW;
+  PActrlPropertyEntryW = PACTRL_PROPERTY_ENTRYW;
+
+  {$IFDEF UNICODE}
+  ACTRL_PROPERTY_ENTRY = ACTRL_PROPERTY_ENTRYW;
+  {$EXTERNALSYM ACTRL_PROPERTY_ENTRY}
+  PACTRL_PROPERTY_ENTRY = PACTRL_PROPERTY_ENTRYW;
+  {$EXTERNALSYM PACTRL_PROPERTY_ENTRY}
+  TActrlPropertyEntry = TActrlPropertyEntryW;
+  PActrlPropertyEntry = PActrlPropertyEntryW;
+  {$ELSE}
+  ACTRL_PROPERTY_ENTRY = ACTRL_PROPERTY_ENTRYA;
+  {$EXTERNALSYM ACTRL_PROPERTY_ENTRY}
+  PACTRL_PROPERTY_ENTRY = PACTRL_PROPERTY_ENTRYA;
+  {$EXTERNALSYM PACTRL_PROPERTY_ENTRY}
+  TActrlPropertyEntry = TActrlPropertyEntryA;
+  PActrlPropertyEntry = PActrlPropertyEntryA;
+  {$ENDIF UNICODE}
+
+  PActrlAlistA = ^TActrlAlistA;
+  _ACTRL_ALISTA = packed record
+    cEntries: ULONG;
+    pPropertyAccessList: PACTRL_PROPERTY_ENTRYA;
+  end;
+  {$EXTERNALSYM _ACTRL_ALISTA}
+  ACTRL_ACCESSA = _ACTRL_ALISTA;
+  {$EXTERNALSYM ACTRL_ACCESSA}
+  PACTRL_ACCESSA = ^_ACTRL_ALISTA;
+  {$EXTERNALSYM PACTRL_ACCESSA}
+  ACTRL_AUDITA = ACTRL_ACCESSA;
+  {$EXTERNALSYM ACTRL_AUDITA}
+  PACTRL_AUDITA = ^ACTRL_AUDITA;
+  {$EXTERNALSYM PACTRL_AUDITA}
+  TActrlAlistA = _ACTRL_ALISTA;
+
+  PActrlAlistW = ^TActrlAlistW;
+  _ACTRL_ALISTW = packed record
+    cEntries: ULONG;
+    pPropertyAccessList: PACTRL_PROPERTY_ENTRYW;
+  end;
+  {$EXTERNALSYM _ACTRL_ALISTW}
+  ACTRL_ACCESSW = _ACTRL_ALISTW;
+  {$EXTERNALSYM ACTRL_ACCESSW}
+  PACTRL_ACCESSW = ^_ACTRL_ALISTW;
+  {$EXTERNALSYM PACTRL_ACCESSW}
+  ACTRL_AUDITW = ACTRL_ACCESSW;
+  {$EXTERNALSYM ACTRL_AUDITW}
+  PACTRL_AUDITW = ^ACTRL_AUDITW;
+  {$EXTERNALSYM PACTRL_AUDITW}
+  TActrlAlistW = _ACTRL_ALISTW;
+
+  {$IFDEF UNICODE}
+  ACTRL_ACCESS = ACTRL_ACCESSW;
+  {$EXTERNALSYM ACTRL_ACCESS}
+  PACTRL_ACCESS = PACTRL_ACCESSW;
+  {$EXTERNALSYM PACTRL_ACCESS}
+  ACTRL_AUDIT = ACTRL_AUDITW;
+  {$EXTERNALSYM ACTRL_AUDIT}
+  PACTRL_AUDIT = PACTRL_AUDITW;
+  {$EXTERNALSYM PACTRL_AUDIT}
+  TActrlAlist = TActrlAlistW;
+  PActrlAlist = PActrlAlistW;
+  {$ELSE}
+  ACTRL_ACCESS = ACTRL_ACCESSA;
+  {$EXTERNALSYM ACTRL_ACCESS}
+  PACTRL_ACCESS = PACTRL_ACCESSA;
+  {$EXTERNALSYM PACTRL_ACCESS}
+  ACTRL_AUDIT = ACTRL_AUDITA;
+  {$EXTERNALSYM ACTRL_AUDIT}
+  PACTRL_AUDIT = PACTRL_AUDITA;
+  {$EXTERNALSYM PACTRL_AUDIT}
+  TActrlAlist = TActrlAlistA;
+  PActrlAlist = PActrlAlistA;
+  {$ENDIF UNICODE}
+
+//
+// TRUSTEE_ACCESS flags
+//
+
+const
+  TRUSTEE_ACCESS_ALLOWED    = $00000001;
+  {$EXTERNALSYM TRUSTEE_ACCESS_ALLOWED}
+  TRUSTEE_ACCESS_READ       = $00000002;
+  {$EXTERNALSYM TRUSTEE_ACCESS_READ}
+  TRUSTEE_ACCESS_WRITE      = $00000004;
+  {$EXTERNALSYM TRUSTEE_ACCESS_WRITE}
+
+  TRUSTEE_ACCESS_EXPLICIT   = $00000001;
+  {$EXTERNALSYM TRUSTEE_ACCESS_EXPLICIT}
+  TRUSTEE_ACCESS_READ_WRITE = TRUSTEE_ACCESS_READ or TRUSTEE_ACCESS_WRITE;
+  {$EXTERNALSYM TRUSTEE_ACCESS_READ_WRITE}
+
+  TRUSTEE_ACCESS_ALL = DWORD($FFFFFFFF);
+  {$EXTERNALSYM TRUSTEE_ACCESS_ALL}
+
+type
+  PTRUSTEE_ACCESSA = ^TRUSTEE_ACCESSA;
+  {$EXTERNALSYM PTRUSTEE_ACCESSA}
+  _TRUSTEE_ACCESSA = packed record
+    lpProperty: LPSTR;
+    Access: ACCESS_RIGHTS;
+    fAccessFlags: ULONG;
+    fReturnedAccess: ULONG;
+  end;
+  {$EXTERNALSYM _TRUSTEE_ACCESSA}
+  TRUSTEE_ACCESSA = _TRUSTEE_ACCESSA;
+  {$EXTERNALSYM TRUSTEE_ACCESSA}
+  TTrusteeAccessA = TRUSTEE_ACCESSA;
+  PTrusteeAccessA = PTRUSTEE_ACCESSA;
+
+  PTRUSTEE_ACCESSW = ^TRUSTEE_ACCESSW;
+  {$EXTERNALSYM PTRUSTEE_ACCESSW}
+  _TRUSTEE_ACCESSW = packed record
+    lpProperty: LPWSTR;
+    Access: ACCESS_RIGHTS;
+    fAccessFlags: ULONG;
+    fReturnedAccess: ULONG;
+  end;
+  {$EXTERNALSYM _TRUSTEE_ACCESSW}
+  TRUSTEE_ACCESSW = _TRUSTEE_ACCESSW;
+  {$EXTERNALSYM TRUSTEE_ACCESSW}
+  TTrusteeAccessW = TRUSTEE_ACCESSW;
+  PTrusteeAccessW = PTRUSTEE_ACCESSW;
+
+  {$IFDEF UNICODE}
+  TRUSTEE_ACCESS = TRUSTEE_ACCESSW;
+  {$EXTERNALSYM TRUSTEE_ACCESS}
+  PTRUSTEE_ACCESS = PTRUSTEE_ACCESSW;
+  {$EXTERNALSYM PTRUSTEE_ACCESS}
+  TTrusteeAccess = TTrusteeAccessW;
+  PTrusteeAccess = PTrusteeAccessW;
+  {$ELSE}
+  TRUSTEE_ACCESS = TRUSTEE_ACCESSA;
+  {$EXTERNALSYM TRUSTEE_ACCESS}
+  PTRUSTEE_ACCESS = PTRUSTEE_ACCESSA;
+  {$EXTERNALSYM PTRUSTEE_ACCESS}
+  TTrusteeAccess = TTrusteeAccessA;
+  PTrusteeAccess = PTrusteeAccessA;
+  {$ENDIF UNICODE}
+
+//
+// Generic permission values
+//
+
+const
+  ACTRL_RESERVED = $00000000;
+  {$EXTERNALSYM ACTRL_RESERVED}
+  ACTRL_PERM_1   = $00000001;
+  {$EXTERNALSYM ACTRL_PERM_1}
+  ACTRL_PERM_2   = $00000002;
+  {$EXTERNALSYM ACTRL_PERM_2}
+  ACTRL_PERM_3   = $00000004;
+  {$EXTERNALSYM ACTRL_PERM_3}
+  ACTRL_PERM_4   = $00000008;
+  {$EXTERNALSYM ACTRL_PERM_4}
+  ACTRL_PERM_5   = $00000010;
+  {$EXTERNALSYM ACTRL_PERM_5}
+  ACTRL_PERM_6   = $00000020;
+  {$EXTERNALSYM ACTRL_PERM_6}
+  ACTRL_PERM_7   = $00000040;
+  {$EXTERNALSYM ACTRL_PERM_7}
+  ACTRL_PERM_8   = $00000080;
+  {$EXTERNALSYM ACTRL_PERM_8}
+  ACTRL_PERM_9   = $00000100;
+  {$EXTERNALSYM ACTRL_PERM_9}
+  ACTRL_PERM_10  = $00000200;
+  {$EXTERNALSYM ACTRL_PERM_10}
+  ACTRL_PERM_11  = $00000400;
+  {$EXTERNALSYM ACTRL_PERM_11}
+  ACTRL_PERM_12  = $00000800;
+  {$EXTERNALSYM ACTRL_PERM_12}
+  ACTRL_PERM_13  = $00001000;
+  {$EXTERNALSYM ACTRL_PERM_13}
+  ACTRL_PERM_14  = $00002000;
+  {$EXTERNALSYM ACTRL_PERM_14}
+  ACTRL_PERM_15  = $00004000;
+  {$EXTERNALSYM ACTRL_PERM_15}
+  ACTRL_PERM_16  = $00008000;
+  {$EXTERNALSYM ACTRL_PERM_16}
+  ACTRL_PERM_17  = $00010000;
+  {$EXTERNALSYM ACTRL_PERM_17}
+  ACTRL_PERM_18  = $00020000;
+  {$EXTERNALSYM ACTRL_PERM_18}
+  ACTRL_PERM_19  = $00040000;
+  {$EXTERNALSYM ACTRL_PERM_19}
+  ACTRL_PERM_20  = $00080000;
+  {$EXTERNALSYM ACTRL_PERM_20}
+
+//
+// Access permissions
+//
+
+  ACTRL_ACCESS_ALLOWED = $00000001;
+  {$EXTERNALSYM ACTRL_ACCESS_ALLOWED}
+  ACTRL_ACCESS_DENIED  = $00000002;
+  {$EXTERNALSYM ACTRL_ACCESS_DENIED}
+  ACTRL_AUDIT_SUCCESS  = $00000004;
+  {$EXTERNALSYM ACTRL_AUDIT_SUCCESS}
+  ACTRL_AUDIT_FAILURE  = $00000008;
+  {$EXTERNALSYM ACTRL_AUDIT_FAILURE}
+
+//
+// Property list flags
+//
+
+  ACTRL_ACCESS_PROTECTED = $00000001;
+  {$EXTERNALSYM ACTRL_ACCESS_PROTECTED}
+
+//
+// Standard and object rights
+//
+
+  ACTRL_SYSTEM_ACCESS      = $04000000;
+  {$EXTERNALSYM ACTRL_SYSTEM_ACCESS}
+  ACTRL_DELETE             = $08000000;
+  {$EXTERNALSYM ACTRL_DELETE}
+  ACTRL_READ_CONTROL       = $10000000;
+  {$EXTERNALSYM ACTRL_READ_CONTROL}
+  ACTRL_CHANGE_ACCESS      = $20000000;
+  {$EXTERNALSYM ACTRL_CHANGE_ACCESS}
+  ACTRL_CHANGE_OWNER       = $40000000;
+  {$EXTERNALSYM ACTRL_CHANGE_OWNER}
+  ACTRL_SYNCHRONIZE        = DWORD($80000000);
+  {$EXTERNALSYM ACTRL_SYNCHRONIZE}
+  ACTRL_STD_RIGHTS_ALL     = DWORD($f8000000);
+  {$EXTERNALSYM ACTRL_STD_RIGHTS_ALL}
+  ACTRL_STD_RIGHT_REQUIRED = DWORD(ACTRL_STD_RIGHTS_ALL and not ACTRL_SYNCHRONIZE);
+  {$EXTERNALSYM ACTRL_STD_RIGHT_REQUIRED}
+
+  ACTRL_DS_OPEN           = ACTRL_RESERVED;
+  {$EXTERNALSYM ACTRL_DS_OPEN}
+  ACTRL_DS_CREATE_CHILD   = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_DS_CREATE_CHILD}
+  ACTRL_DS_DELETE_CHILD   = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_DS_DELETE_CHILD}
+  ACTRL_DS_LIST           = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_DS_LIST}
+  ACTRL_DS_SELF           = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_DS_SELF}
+  ACTRL_DS_READ_PROP      = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_DS_READ_PROP}
+  ACTRL_DS_WRITE_PROP     = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_DS_WRITE_PROP}
+  ACTRL_DS_DELETE_TREE    = ACTRL_PERM_7;
+  {$EXTERNALSYM ACTRL_DS_DELETE_TREE}
+  ACTRL_DS_LIST_OBJECT    = ACTRL_PERM_8;
+  {$EXTERNALSYM ACTRL_DS_LIST_OBJECT}
+  ACTRL_DS_CONTROL_ACCESS = ACTRL_PERM_9;
+  {$EXTERNALSYM ACTRL_DS_CONTROL_ACCESS}
+
+  ACTRL_FILE_READ           = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_FILE_READ}
+  ACTRL_FILE_WRITE          = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_FILE_WRITE}
+  ACTRL_FILE_APPEND         = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_FILE_APPEND}
+  ACTRL_FILE_READ_PROP      = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_FILE_READ_PROP}
+  ACTRL_FILE_WRITE_PROP     = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_FILE_WRITE_PROP}
+  ACTRL_FILE_EXECUTE        = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_FILE_EXECUTE}
+  ACTRL_FILE_READ_ATTRIB    = ACTRL_PERM_8;
+  {$EXTERNALSYM ACTRL_FILE_READ_ATTRIB}
+  ACTRL_FILE_WRITE_ATTRIB   = ACTRL_PERM_9;
+  {$EXTERNALSYM ACTRL_FILE_WRITE_ATTRIB}
+  ACTRL_FILE_CREATE_PIPE    = ACTRL_PERM_10;
+  {$EXTERNALSYM ACTRL_FILE_CREATE_PIPE}
+  ACTRL_DIR_LIST            = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_DIR_LIST}
+  ACTRL_DIR_CREATE_OBJECT   = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_DIR_CREATE_OBJECT}
+  ACTRL_DIR_CREATE_CHILD    = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_DIR_CREATE_CHILD}
+  ACTRL_DIR_DELETE_CHILD    = ACTRL_PERM_7;
+  {$EXTERNALSYM ACTRL_DIR_DELETE_CHILD}
+  ACTRL_DIR_TRAVERSE        = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_DIR_TRAVERSE}
+  ACTRL_KERNEL_TERMINATE    = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_KERNEL_TERMINATE}
+  ACTRL_KERNEL_THREAD       = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_KERNEL_THREAD}
+  ACTRL_KERNEL_VM           = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_KERNEL_VM}
+  ACTRL_KERNEL_VM_READ      = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_KERNEL_VM_READ}
+  ACTRL_KERNEL_VM_WRITE     = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_KERNEL_VM_WRITE}
+  ACTRL_KERNEL_DUP_HANDLE   = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_KERNEL_DUP_HANDLE}
+  ACTRL_KERNEL_PROCESS      = ACTRL_PERM_7;
+  {$EXTERNALSYM ACTRL_KERNEL_PROCESS}
+  ACTRL_KERNEL_SET_INFO     = ACTRL_PERM_8;
+  {$EXTERNALSYM ACTRL_KERNEL_SET_INFO}
+  ACTRL_KERNEL_GET_INFO     = ACTRL_PERM_9;
+  {$EXTERNALSYM ACTRL_KERNEL_GET_INFO}
+  ACTRL_KERNEL_CONTROL      = ACTRL_PERM_10;
+  {$EXTERNALSYM ACTRL_KERNEL_CONTROL}
+  ACTRL_KERNEL_ALERT        = ACTRL_PERM_11;
+  {$EXTERNALSYM ACTRL_KERNEL_ALERT}
+  ACTRL_KERNEL_GET_CONTEXT  = ACTRL_PERM_12;
+  {$EXTERNALSYM ACTRL_KERNEL_GET_CONTEXT}
+  ACTRL_KERNEL_SET_CONTEXT  = ACTRL_PERM_13;
+  {$EXTERNALSYM ACTRL_KERNEL_SET_CONTEXT}
+  ACTRL_KERNEL_TOKEN        = ACTRL_PERM_14;
+  {$EXTERNALSYM ACTRL_KERNEL_TOKEN}
+  ACTRL_KERNEL_IMPERSONATE  = ACTRL_PERM_15;
+  {$EXTERNALSYM ACTRL_KERNEL_IMPERSONATE}
+  ACTRL_KERNEL_DIMPERSONATE = ACTRL_PERM_16;
+  {$EXTERNALSYM ACTRL_KERNEL_DIMPERSONATE}
+  ACTRL_PRINT_SADMIN        = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_PRINT_SADMIN}
+  ACTRL_PRINT_SLIST         = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_PRINT_SLIST}
+  ACTRL_PRINT_PADMIN        = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_PRINT_PADMIN}
+  ACTRL_PRINT_PUSE          = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_PRINT_PUSE}
+  ACTRL_PRINT_JADMIN        = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_PRINT_JADMIN}
+  ACTRL_SVC_GET_INFO        = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_SVC_GET_INFO}
+  ACTRL_SVC_SET_INFO        = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_SVC_SET_INFO}
+  ACTRL_SVC_STATUS          = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_SVC_STATUS}
+  ACTRL_SVC_LIST            = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_SVC_LIST}
+  ACTRL_SVC_START           = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_SVC_START}
+  ACTRL_SVC_STOP            = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_SVC_STOP}
+  ACTRL_SVC_PAUSE           = ACTRL_PERM_7;
+  {$EXTERNALSYM ACTRL_SVC_PAUSE}
+  ACTRL_SVC_INTERROGATE     = ACTRL_PERM_8;
+  {$EXTERNALSYM ACTRL_SVC_INTERROGATE}
+  ACTRL_SVC_UCONTROL        = ACTRL_PERM_9;
+  {$EXTERNALSYM ACTRL_SVC_UCONTROL}
+  ACTRL_REG_QUERY           = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_REG_QUERY}
+  ACTRL_REG_SET             = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_REG_SET}
+  ACTRL_REG_CREATE_CHILD    = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_REG_CREATE_CHILD}
+  ACTRL_REG_LIST            = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_REG_LIST}
+  ACTRL_REG_NOTIFY          = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_REG_NOTIFY}
+  ACTRL_REG_LINK            = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_REG_LINK}
+  ACTRL_WIN_CLIPBRD         = ACTRL_PERM_1;
+  {$EXTERNALSYM ACTRL_WIN_CLIPBRD}
+  ACTRL_WIN_GLOBAL_ATOMS    = ACTRL_PERM_2;
+  {$EXTERNALSYM ACTRL_WIN_GLOBAL_ATOMS}
+  ACTRL_WIN_CREATE          = ACTRL_PERM_3;
+  {$EXTERNALSYM ACTRL_WIN_CREATE}
+  ACTRL_WIN_LIST_DESK       = ACTRL_PERM_4;
+  {$EXTERNALSYM ACTRL_WIN_LIST_DESK}
+  ACTRL_WIN_LIST            = ACTRL_PERM_5;
+  {$EXTERNALSYM ACTRL_WIN_LIST}
+  ACTRL_WIN_READ_ATTRIBS    = ACTRL_PERM_6;
+  {$EXTERNALSYM ACTRL_WIN_READ_ATTRIBS}
+  ACTRL_WIN_WRITE_ATTRIBS   = ACTRL_PERM_7;
+  {$EXTERNALSYM ACTRL_WIN_WRITE_ATTRIBS}
+  ACTRL_WIN_SCREEN          = ACTRL_PERM_8;
+  {$EXTERNALSYM ACTRL_WIN_SCREEN}
+  ACTRL_WIN_EXIT            = ACTRL_PERM_9;
+  {$EXTERNALSYM ACTRL_WIN_EXIT}
+
+type
+  PACTRL_OVERLAPPED = ^ACTRL_OVERLAPPED;
+  {$EXTERNALSYM PACTRL_OVERLAPPED}
+  _ACTRL_OVERLAPPED = packed record
+    //union {
+    Provider: PVOID;
+    //    ULONG Reserved1;
+    //};
+    Reserved2: ULONG;
+    hEvent: HANDLE;
+  end;
+  {$EXTERNALSYM _ACTRL_OVERLAPPED}
+  ACTRL_OVERLAPPED = _ACTRL_OVERLAPPED;
+  {$EXTERNALSYM ACTRL_OVERLAPPED}
+  TActrlOverlapped = ACTRL_OVERLAPPED;
+  PActrlOverlapped = PACTRL_OVERLAPPED;
+
+  PACTRL_ACCESS_INFOA = ^ACTRL_ACCESS_INFOA;
+  {$EXTERNALSYM PACTRL_ACCESS_INFOA}
+  _ACTRL_ACCESS_INFOA = packed record
+    fAccessPermission: ULONG;
+    lpAccessPermissionName: LPSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_INFOA}
+  ACTRL_ACCESS_INFOA = _ACTRL_ACCESS_INFOA;
+  {$EXTERNALSYM ACTRL_ACCESS_INFOA}
+  TActrlAccessInfoA = ACTRL_ACCESS_INFOA;
+  PActrlAccessInfoA = PACTRL_ACCESS_INFOA;
+
+  PACTRL_ACCESS_INFOW = ^ACTRL_ACCESS_INFOW;
+  {$EXTERNALSYM PACTRL_ACCESS_INFOW}
+  _ACTRL_ACCESS_INFOW = packed record
+    fAccessPermission: ULONG;
+    lpAccessPermissionName: LPWSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_ACCESS_INFOW}
+  ACTRL_ACCESS_INFOW = _ACTRL_ACCESS_INFOW;
+  {$EXTERNALSYM ACTRL_ACCESS_INFOW}
+  TActrlAccessInfoW = ACTRL_ACCESS_INFOW;
+  PActrlAccessInfoW = PACTRL_ACCESS_INFOW;
+
+  {$IFDEF UNICODE}
+  ACTRL_ACCESS_INFO = ACTRL_ACCESS_INFOW;
+  {$EXTERNALSYM ACTRL_ACCESS_INFO}
+  PACTRL_ACCESS_INFO = PACTRL_ACCESS_INFOW;
+  {$EXTERNALSYM PACTRL_ACCESS_INFO}
+  TActrlAccessInfo = TActrlAccessInfoW;
+  PActrlAccessInfo = PActrlAccessInfoW;
+  {$ELSE}
+  ACTRL_ACCESS_INFO = ACTRL_ACCESS_INFOA;
+  {$EXTERNALSYM ACTRL_ACCESS_INFO}
+  PACTRL_ACCESS_INFO = PACTRL_ACCESS_INFOA;
+  {$EXTERNALSYM PACTRL_ACCESS_INFO}
+  TActrlAccessInfo = TActrlAccessInfoA;
+  PActrlAccessInfo = PActrlAccessInfoA;
+  {$ENDIF UNICODE}
+
+  PACTRL_CONTROL_INFOA = ^ACTRL_CONTROL_INFOA;
+  {$EXTERNALSYM PACTRL_CONTROL_INFOA}
+  _ACTRL_CONTROL_INFOA = packed record
+    lpControlId: LPSTR;
+    lpControlName: LPSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_CONTROL_INFOA}
+  ACTRL_CONTROL_INFOA = _ACTRL_CONTROL_INFOA;
+  {$EXTERNALSYM ACTRL_CONTROL_INFOA}
+  TActrlControlInfoA = ACTRL_CONTROL_INFOA;
+  PActrlControlInfoA = PACTRL_CONTROL_INFOA;
+
+  PACTRL_CONTROL_INFOW = ^ACTRL_CONTROL_INFOW;
+  {$EXTERNALSYM PACTRL_CONTROL_INFOW}
+  _ACTRL_CONTROL_INFOW = packed record
+    lpControlId: LPWSTR;
+    lpControlName: LPWSTR;
+  end;
+  {$EXTERNALSYM _ACTRL_CONTROL_INFOW}
+  ACTRL_CONTROL_INFOW = _ACTRL_CONTROL_INFOW;
+  {$EXTERNALSYM ACTRL_CONTROL_INFOW}
+  TActrlControlInfoW = ACTRL_CONTROL_INFOW;
+  PActrlControlInfoW = PACTRL_CONTROL_INFOW;
+
+  {$IFDEF UNICODE}
+  ACTRL_CONTROL_INFO = ACTRL_CONTROL_INFOW;
+  {$EXTERNALSYM ACTRL_CONTROL_INFO}
+  PACTRL_CONTROL_INFO = PACTRL_CONTROL_INFOW;
+  {$EXTERNALSYM PACTRL_CONTROL_INFO}
+  TActrlControlInfo = TActrlControlInfoW;
+  PActrlControlInfo = PActrlControlInfoW;
+  {$ELSE}
+  ACTRL_CONTROL_INFO = ACTRL_CONTROL_INFOA;
+  {$EXTERNALSYM ACTRL_CONTROL_INFO}
+  PACTRL_CONTROL_INFO = PACTRL_CONTROL_INFOA;
+  {$EXTERNALSYM PACTRL_CONTROL_INFO}
+  TActrlControlInfo = TActrlControlInfoA;
+  PActrlControlInfo = PActrlControlInfoA;
+  {$ENDIF UNICODE}
+
+const
+  ACTRL_ACCESS_NO_OPTIONS              = $00000000;
+  {$EXTERNALSYM ACTRL_ACCESS_NO_OPTIONS}
+  ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES = $00000001;
+  {$EXTERNALSYM ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES}
+
+  ProgressInvokeNever = 1;        // Never invoke the progress function
+  {$EXTERNALSYM ProgressInvokeNever}
+  ProgressInvokeEveryObject = 2;  // Invoke for each object
+  {$EXTERNALSYM ProgressInvokeEveryObject}
+  ProgressInvokeOnError = 3;      // Invoke only for each error case
+  {$EXTERNALSYM ProgressInvokeOnError}
+  ProgressCancelOperation = 4;    // Stop propagation and return
+  {$EXTERNALSYM ProgressCancelOperation}
+  ProgressRetryOperation = 5;     // Retry operation on subtree
+  {$EXTERNALSYM ProgressRetryOperation}
+
+type
+  PROG_INVOKE_SETTING = DWORD;
+  {$EXTERNALSYM PROG_INVOKE_SETTING}
+  PPROG_INVOKE_SETTING = ^PROG_INVOKE_SETTING;
+  {$EXTERNALSYM PPROG_INVOKE_SETTING}
+  TProgInvokeSetting = PROG_INVOKE_SETTING;
+  PProgInvokeSetting = PPROG_INVOKE_SETTING;
+
+//
+// Progress Function:
+// Caller of tree operation implements this Progress function, then
+// passes its function pointer to tree operation.
+// Tree operation invokes Progress function to provide progress and error
+// information to the caller during the potentially long execution
+// of the tree operation.  Tree operation provides the name of the object
+// last processed and the error status of the operation on that object.
+// Tree operation also passes the current InvokeSetting value.
+// Caller may change the InvokeSetting value, for example, from "Always"
+// to "Only On Error."
+//
+
+type
+  FN_PROGRESS = procedure(pObjectName: LPWSTR; Status: DWORD;
+    var pInvokeSetting: PROG_INVOKE_SETTING; Args: PVOID; SecuritySet: BOOL); stdcall;
+  {$EXTERNALSYM FN_PROGRESS}
+  TFnProgress = FN_PROGRESS;
+
+//
+// New Object Type function pointers.  TBD.
+// To support additional object resource managers generically, the
+// resource manager must provide it's own functions for operations
+// like:
+// GetAncestorAcl(IN ObjName, IN GenerationGap, IN DaclOrSacl?, ...)
+// GetAncestorName(...)
+// FreeNameStructure(...)
+//
+
+type
+  _FN_OBJECT_MGR_FUNCTIONS = record
+    Placeholder: ULONG;
+  end;
+  {$EXTERNALSYM _FN_OBJECT_MGR_FUNCTIONS}
+  FN_OBJECT_MGR_FUNCTS = _FN_OBJECT_MGR_FUNCTIONS;
+  {$EXTERNALSYM FN_OBJECT_MGR_FUNCTS}
+  PFN_OBJECT_MGR_FUNCTS = ^FN_OBJECT_MGR_FUNCTS;
+  {$EXTERNALSYM PFN_OBJECT_MGR_FUNCTS}
+  TFnObjectMgrFuncts = FN_OBJECT_MGR_FUNCTS;
+  PFnObjectMgrFuncts = PFN_OBJECT_MGR_FUNCTS;  
+
+//
+// Name of ancestor and number of generations between
+// ancestor and inheriting object.
+//
+// GenerationGap:
+//     Name of ancestor from which ACE was inherited.
+//     NULL for explicit ACE.
+//
+// AncestorName:
+//     Number of levels (or generations) between the object and the ancestor.
+//     Parent, gap=1.
+//     Grandparent, gap=2.
+//     Set to 0 for explicit ACE on object.
+//
+
+type
+  _INHERITED_FROMA = record
+    GenerationGap: LONG;
+    AncestorName: LPSTR;
+  end;
+  {$EXTERNALSYM _INHERITED_FROMA}
+  INHERITED_FROMA = _INHERITED_FROMA;
+  {$EXTERNALSYM INHERITED_FROMA}
+  PINHERITED_FROMA = ^INHERITED_FROMA;
+  {$EXTERNALSYM PINHERITED_FROMA}
+  TInheritedFromA = INHERITED_FROMA;
+  PInheritedFromA = PINHERITED_FROMA;
+
+  _INHERITED_FROMW = record
+    GenerationGap: LONG;
+    AncestorName: LPWSTR;
+  end;
+  {$EXTERNALSYM _INHERITED_FROMW}
+  INHERITED_FROMW = _INHERITED_FROMW;
+  {$EXTERNALSYM INHERITED_FROMW}
+  PINHERITED_FROMW = ^INHERITED_FROMW;
+  {$EXTERNALSYM PINHERITED_FROMW}
+  TInheritedFromW = INHERITED_FROMW;
+  PInheritedFromW = PINHERITED_FROMW;
+
+  {$IFDEF UNICODE}
+  INHERITED_FROM = INHERITED_FROMW;
+  {$EXTERNALSYM INHERITED_FROM}
+  PINHERITED_FROM = PINHERITED_FROMW;
+  {$EXTERNALSYM PINHERITED_FROM}
+  TInheritedFrom = TInheritedFromW;
+  PInheritedFrom = PInheritedFromW;
+  {$ELSE}
+  INHERITED_FROM = INHERITED_FROMA;
+  {$EXTERNALSYM INHERITED_FROM}
+  PINHERITED_FROM = PINHERITED_FROMA;
+  {$EXTERNALSYM PINHERITED_FROM}
+  TInheritedFrom = TInheritedFromA;
+  PInheritedFrom = PInheritedFromA;
+  {$ENDIF UNICODE}
+
+implementation
+
+uses
+  JwaWinBase;
+
+// (rom) MACRO implementation
+function AccFree(hMem: HLOCAL): HLOCAL;
+begin
+  Result := LocalFree(hMem);
+end;
+
+end.
+

+ 1338 - 0
packages/extra/winunits/jwaaclapi.pas

@@ -0,0 +1,1338 @@
+{******************************************************************************}
+{                                                                              }
+{ Access Control API interface Unit for Object Pascal                          }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: aclapi.h, released June 2000. The original Pascal      }
+{ code is: AclApi.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAclApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "aclapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaAccCtrl, JwaWinNT, JwaWinType;
+
+//
+// Progress Function:
+// Caller of tree operation implements this Progress function, then
+// passes its function pointer to tree operation.
+// Tree operation invokes Progress function to provide progress and error
+// information to the caller during the potentially long execution
+// of the tree operation.  Tree operation provides the name of the object
+// last processed and the error status of the operation on that object.
+// Tree operation also passes the current InvokeSetting value.
+// Caller may change the InvokeSetting value, for example, from "Always"
+// to "Only On Error."
+//
+
+type
+  FN_PROGRESS = procedure(
+    pObjectName: LPWSTR;    // name of object just processed
+    Status: DWORD;          // status of operation on object
+    var pInvokeSetting: PPROG_INVOKE_SETTING; // Never, always,
+    Args: PVOID;            // Caller specific data
+    SecuritySet: BOOL       // Whether security was set
+    ); stdcall;
+  {$EXTERNALSYM FN_PROGRESS}
+  TFnProgress = FN_PROGRESS;
+
+function SetEntriesInAclA(cCountOfExplicitEntries: ULONG;
+  pListOfExplicitEntries: PEXPLICIT_ACCESS_A; OldAcl: PACL;
+  var NewAcl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetEntriesInAclA}
+function SetEntriesInAclW(cCountOfExplicitEntries: ULONG;
+  pListOfExplicitEntries: PEXPLICIT_ACCESS_W; OldAcl: PACL;
+  var NewAcl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetEntriesInAclW}
+function SetEntriesInAcl(cCountOfExplicitEntries: ULONG;
+  pListOfExplicitEntries: PEXPLICIT_ACCESS; OldAcl: PACL;
+  var NewAcl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetEntriesInAcl}
+
+function GetExplicitEntriesFromAclA(pacl: PACL; var pcCountOfExplicitEntries: ULONG;
+  var pListOfExplicitEntries: PEXPLICIT_ACCESS_A): DWORD; stdcall;
+{$EXTERNALSYM GetExplicitEntriesFromAclA}
+function GetExplicitEntriesFromAclW(pacl: PACL; var pcCountOfExplicitEntries: ULONG;
+  var pListOfExplicitEntries: PEXPLICIT_ACCESS_W): DWORD; stdcall;
+{$EXTERNALSYM GetExplicitEntriesFromAclW}
+function GetExplicitEntriesFromAcl(pacl: PACL; var pcCountOfExplicitEntries: ULONG;
+  var pListOfExplicitEntries: PEXPLICIT_ACCESS): DWORD; stdcall;
+{$EXTERNALSYM GetExplicitEntriesFromAcl}
+
+function GetEffectiveRightsFromAclA(pacl: PACL; pTrustee: PTRUSTEE_A;
+  var pAccessRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetEffectiveRightsFromAclA}
+function GetEffectiveRightsFromAclW(pacl: PACL; pTrustee: PTRUSTEE_W;
+  var pAccessRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetEffectiveRightsFromAclW}
+function GetEffectiveRightsFromAcl(pacl: PACL; pTrustee: PTRUSTEE;
+  var pAccessRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetEffectiveRightsFromAcl}
+
+function GetAuditedPermissionsFromAclA(pacl: PACL; pTrustee: PTRUSTEE_A;
+  var pSuccessfulAuditedRights, pFailedAuditRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetAuditedPermissionsFromAclA}
+function GetAuditedPermissionsFromAclW(pacl: PACL; pTrustee: PTRUSTEE_W;
+  var pSuccessfulAuditedRights, pFailedAuditRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetAuditedPermissionsFromAclW}
+function GetAuditedPermissionsFromAcl(pacl: PACL; pTrustee: PTRUSTEE;
+  var pSuccessfulAuditedRights, pFailedAuditRights: ACCESS_MASK): DWORD; stdcall;
+{$EXTERNALSYM GetAuditedPermissionsFromAcl}
+
+function GetNamedSecurityInfoA(pObjectName: LPSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; ppsidOwner, ppsidGroup: PPSID; ppDacl,
+  ppSacl: PPACL; var ppSecurityDescriptor: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM GetNamedSecurityInfoA}
+function GetNamedSecurityInfoW(pObjectName: LPWSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; ppsidOwner, ppsidGroup: PPSID; ppDacl,
+  ppSacl: PPACL; var ppSecurityDescriptor: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM GetNamedSecurityInfoW}
+function GetNamedSecurityInfo(pObjectName: LPTSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; ppsidOwner, ppsidGroup: PPSID; ppDacl,
+  ppSacl: PPACL; var ppSecurityDescriptor: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM GetNamedSecurityInfo}
+
+function GetSecurityInfo(handle: HANDLE; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; ppsidOwner: PPSID; ppsidGroup: PPSID;
+  ppDacl, ppSacl: PPACL; var ppSecurityDescriptor: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM GetSecurityInfo}
+
+function SetNamedSecurityInfoA(pObjectName: LPSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; psidOwner, psidGroup: PSID;
+  pDacl, pSacl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetNamedSecurityInfoA}
+function SetNamedSecurityInfoW(pObjectName: LPWSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; psidOwner, psidGroup: PSID;
+  pDacl, pSacl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetNamedSecurityInfoW}
+function SetNamedSecurityInfo(pObjectName: LPTSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; psidOwner, psidGroup: PSID;
+  pDacl, pSacl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetNamedSecurityInfo}
+
+function SetSecurityInfo(handle: HANDLE; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; psidOwner, psidGroup: PSID;
+  pDacl, pSacl: PACL): DWORD; stdcall;
+{$EXTERNALSYM SetSecurityInfo}
+
+function GetInheritanceSourceA(pObjectName: LPSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; Container: BOOL; pObjectClassGuids: LPGUID;
+  GuidCount: DWORD; pAcl: PACL; pfnArray: PFN_OBJECT_MGR_FUNCTS;
+  pGenericMapping: PGENERIC_MAPPING; pInheritArray: PINHERITED_FROMA): DWORD; stdcall;
+{$EXTERNALSYM GetInheritanceSourceA}
+function GetInheritanceSourceW(pObjectName: LPWSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; Container: BOOL; pObjectClassGuids: LPGUID;
+  GuidCount: DWORD; pAcl: PACL; pfnArray: PFN_OBJECT_MGR_FUNCTS;
+  pGenericMapping: PGENERIC_MAPPING; pInheritArray: PINHERITED_FROMW): DWORD; stdcall;
+{$EXTERNALSYM GetInheritanceSourceW}
+function GetInheritanceSource(pObjectName: LPTSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; Container: BOOL; pObjectClassGuids: LPGUID;
+  GuidCount: DWORD; pAcl: PACL; pfnArray: PFN_OBJECT_MGR_FUNCTS;
+  pGenericMapping: PGENERIC_MAPPING; pInheritArray: PINHERITED_FROM): DWORD; stdcall;
+{$EXTERNALSYM GetInheritanceSource}
+
+function FreeInheritedFromArray(pInheritArray: PINHERITED_FROMW; AceCnt: USHORT;
+  pfnArray: PFN_OBJECT_MGR_FUNCTS): DWORD; stdcall;
+{$EXTERNALSYM FreeInheritedFromArray}
+
+function TreeResetNamedSecurityInfoA(pObjectName: LPSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; pOwner, pGroup: PSID; pDacl, pSacl: PACL;
+  KeepExplicit: BOOL; fnProgress: FN_PROGRESS; ProgressInvokeSetting: PROG_INVOKE_SETTING;
+  Args: PVOID): DWORD; stdcall;
+{$EXTERNALSYM TreeResetNamedSecurityInfoA}
+function TreeResetNamedSecurityInfoW(pObjectName: LPWSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; pOwner, pGroup: PSID; pDacl, pSacl: PACL;
+  KeepExplicit: BOOL; fnProgress: FN_PROGRESS; ProgressInvokeSetting: PROG_INVOKE_SETTING;
+  Args: PVOID): DWORD; stdcall;
+{$EXTERNALSYM TreeResetNamedSecurityInfoW}
+function TreeResetNamedSecurityInfo(pObjectName: LPTSTR; ObjectType: SE_OBJECT_TYPE;
+  SecurityInfo: SECURITY_INFORMATION; pOwner, pGroup: PSID; pDacl, pSacl: PACL;
+  KeepExplicit: BOOL; fnProgress: FN_PROGRESS; ProgressInvokeSetting: PROG_INVOKE_SETTING;
+  Args: PVOID): DWORD; stdcall;
+{$EXTERNALSYM TreeResetNamedSecurityInfo}
+
+//----------------------------------------------------------------------------
+// The following API are provided for trusted servers to use to
+// implement access control on their own objects.
+//----------------------------------------------------------------------------
+
+function BuildSecurityDescriptorA(pOwner: PTRUSTEE_A; pGroup: PTRUSTEE_A;
+  cCountOfAccessEntries: ULONG; pListOfAccessEntries: PEXPLICIT_ACCESS_A;
+  cCountOfAuditEntries: ULONG; pListOfAuditEntries: PEXPLICIT_ACCESS_A;
+  pOldSD: PSECURITY_DESCRIPTOR; var pSizeNewSD: ULONG;
+  var pNewSD: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM BuildSecurityDescriptorA}
+function BuildSecurityDescriptorW(pOwner: PTRUSTEE_W; pGroup: PTRUSTEE_W;
+  cCountOfAccessEntries: ULONG; pListOfAccessEntries: PEXPLICIT_ACCESS_W;
+  cCountOfAuditEntries: ULONG; pListOfAuditEntries: PEXPLICIT_ACCESS_W;
+  pOldSD: PSECURITY_DESCRIPTOR; var pSizeNewSD: ULONG;
+  var pNewSD: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM BuildSecurityDescriptorW}
+function BuildSecurityDescriptor(pOwner: PTRUSTEE; pGroup: PTRUSTEE;
+  cCountOfAccessEntries: ULONG; pListOfAccessEntries: PEXPLICIT_ACCESS;
+  cCountOfAuditEntries: ULONG; pListOfAuditEntries: PEXPLICIT_ACCESS;
+  pOldSD: PSECURITY_DESCRIPTOR; var pSizeNewSD: ULONG;
+  var pNewSD: PSECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM BuildSecurityDescriptor}
+
+function LookupSecurityDescriptorPartsA(pOwner, pGroup: PPTRUSTEE_A;
+  cCountOfAccessEntries: PULONG; pListOfAccessEntries: PEXPLICIT_ACCESS_A;
+  cCountOfAuditEntries: PULONG; pListOfAuditEntries: PEXPLICIT_ACCESS_A;
+  var pSD: SECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM LookupSecurityDescriptorPartsA}
+function LookupSecurityDescriptorPartsW(pOwner, pGroup: PPTRUSTEE_W;
+  cCountOfAccessEntries: PULONG; pListOfAccessEntries: PEXPLICIT_ACCESS_W;
+  cCountOfAuditEntries: PULONG; pListOfAuditEntries: PEXPLICIT_ACCESS_W;
+  var pSD: SECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM LookupSecurityDescriptorPartsW}
+function LookupSecurityDescriptorParts(pOwner, pGroup: PPTRUSTEE;
+  cCountOfAccessEntries: PULONG; pListOfAccessEntries: PEXPLICIT_ACCESS;
+  cCountOfAuditEntries: PULONG; pListOfAuditEntries: PEXPLICIT_ACCESS;
+  var pSD: SECURITY_DESCRIPTOR): DWORD; stdcall;
+{$EXTERNALSYM LookupSecurityDescriptorParts}
+
+//----------------------------------------------------------------------------
+// The following helper API are provided for building
+// access control structures.
+//----------------------------------------------------------------------------
+
+procedure BuildExplicitAccessWithNameA(pExplicitAccess: PEXPLICIT_ACCESS_A;
+  pTrusteeName: LPSTR; AccessPermissions: DWORD; AccessMode: ACCESS_MODE;
+  Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildExplicitAccessWithNameA}
+procedure BuildExplicitAccessWithNameW(pExplicitAccess: PEXPLICIT_ACCESS_W;
+  pTrusteeName: LPWSTR; AccessPermissions: DWORD; AccessMode: ACCESS_MODE;
+  Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildExplicitAccessWithNameW}
+procedure BuildExplicitAccessWithName(pExplicitAccess: PEXPLICIT_ACCESS;
+  pTrusteeName: LPTSTR; AccessPermissions: DWORD; AccessMode: ACCESS_MODE;
+  Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildExplicitAccessWithName}
+
+procedure BuildImpersonateExplicitAccessWithNameA(pExplicitAccess: PEXPLICIT_ACCESS_A;
+  pTrusteeName: LPSTR; pTrustee: PTRUSTEE_A; AccessPermissions: DWORD;
+  AccessMode: ACCESS_MODE; Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildImpersonateExplicitAccessWithNameA}
+procedure BuildImpersonateExplicitAccessWithNameW(pExplicitAccess: PEXPLICIT_ACCESS_W;
+  pTrusteeName: LPWSTR; pTrustee: PTRUSTEE_W; AccessPermissions: DWORD;
+  AccessMode: ACCESS_MODE; Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildImpersonateExplicitAccessWithNameW}
+procedure BuildImpersonateExplicitAccessWithName(pExplicitAccess: PEXPLICIT_ACCESS;
+  pTrusteeName: LPTSTR; pTrustee: PTRUSTEE; AccessPermissions: DWORD;
+  AccessMode: ACCESS_MODE; Inheritance: DWORD); stdcall;
+{$EXTERNALSYM BuildImpersonateExplicitAccessWithName}
+
+procedure BuildTrusteeWithNameA(pTrustee: PTRUSTEE_A; pName: LPSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithNameA}
+procedure BuildTrusteeWithNameW(pTrustee: PTRUSTEE_W; pName: LPWSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithNameW}
+procedure BuildTrusteeWithName(pTrustee: PTRUSTEE; pName: LPTSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithName}
+
+procedure BuildImpersonateTrusteeA(pTrustee: PTRUSTEE_A;
+  pImpersonateTrustee: PTRUSTEE_A); stdcall;
+{$EXTERNALSYM BuildImpersonateTrusteeA}
+procedure BuildImpersonateTrusteeW(pTrustee: PTRUSTEE_W;
+  pImpersonateTrustee: PTRUSTEE_W); stdcall;
+{$EXTERNALSYM BuildImpersonateTrusteeW}
+procedure BuildImpersonateTrustee(pTrustee: PTRUSTEE;
+  pImpersonateTrustee: PTRUSTEE); stdcall;
+{$EXTERNALSYM BuildImpersonateTrustee}
+
+procedure BuildTrusteeWithSidA(pTrustee: PTRUSTEE_A; pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithSidA}
+procedure BuildTrusteeWithSidW(pTrustee: PTRUSTEE_W; pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithSidW}
+procedure BuildTrusteeWithSid(pTrustee: PTRUSTEE; pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithSid}
+
+procedure BuildTrusteeWithObjectsAndSidA(pTrustee: PTRUSTEE_A;
+  pObjSid: POBJECTS_AND_SID; pObjectGuid: PGUID; pInheritedObjectGuid: PGUID;
+  pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndSidA}
+procedure BuildTrusteeWithObjectsAndSidW(pTrustee: PTRUSTEE_W;
+  pObjSid: POBJECTS_AND_SID; pObjectGuid: PGUID; pInheritedObjectGuid: PGUID;
+  pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndSidW}
+procedure BuildTrusteeWithObjectsAndSid(pTrustee: PTRUSTEE;
+  pObjSid: POBJECTS_AND_SID; pObjectGuid: PGUID; pInheritedObjectGuid: PGUID;
+  pSid: PSID); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndSid}
+
+procedure BuildTrusteeWithObjectsAndNameA(pTrustee: PTRUSTEE_A;
+  pObjName: POBJECTS_AND_NAME_A; ObjectType: SE_OBJECT_TYPE;
+  ObjectTypeName, InheritedObjectTypeName, Name: LPSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndNameA}
+procedure BuildTrusteeWithObjectsAndNameW(pTrustee: PTRUSTEE_W;
+  pObjName: POBJECTS_AND_NAME_W; ObjectType: SE_OBJECT_TYPE;
+  ObjectTypeName, InheritedObjectTypeName, Name: LPWSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndNameW}
+procedure BuildTrusteeWithObjectsAndName(pTrustee: PTRUSTEE;
+  pObjName: POBJECTS_AND_NAME; ObjectType: SE_OBJECT_TYPE;
+  ObjectTypeName, InheritedObjectTypeName, Name: LPTSTR); stdcall;
+{$EXTERNALSYM BuildTrusteeWithObjectsAndName}
+
+function GetTrusteeNameA(pTrustee: PTRUSTEE_A): LPSTR; stdcall;
+{$EXTERNALSYM GetTrusteeNameA}
+function GetTrusteeNameW(pTrustee: PTRUSTEE_W): LPWSTR; stdcall;
+{$EXTERNALSYM GetTrusteeNameW}
+function GetTrusteeName(pTrustee: PTRUSTEE): LPTSTR; stdcall;
+{$EXTERNALSYM GetTrusteeName}
+
+function GetTrusteeTypeA(pTrustee: PTRUSTEE_A): TRUSTEE_TYPE; stdcall;
+{$EXTERNALSYM GetTrusteeTypeA}
+function GetTrusteeTypeW(pTrustee: PTRUSTEE_W): TRUSTEE_TYPE; stdcall;
+{$EXTERNALSYM GetTrusteeTypeW}
+function GetTrusteeType(pTrustee: PTRUSTEE): TRUSTEE_TYPE; stdcall;
+{$EXTERNALSYM GetTrusteeType}
+
+function GetTrusteeFormA(pTrustee: PTRUSTEE_A): TRUSTEE_FORM; stdcall;
+{$EXTERNALSYM GetTrusteeFormA}
+function GetTrusteeFormW(pTrustee: PTRUSTEE_W): TRUSTEE_FORM; stdcall;
+{$EXTERNALSYM GetTrusteeFormW}
+function GetTrusteeForm(pTrustee: PTRUSTEE): TRUSTEE_FORM; stdcall;
+{$EXTERNALSYM GetTrusteeForm}
+
+function GetMultipleTrusteeOperationA(pTrustee: PTRUSTEE_A): MULTIPLE_TRUSTEE_OPERATION; stdcall;
+{$EXTERNALSYM GetMultipleTrusteeOperationA}
+function GetMultipleTrusteeOperationW(pTrustee: PTRUSTEE_W): MULTIPLE_TRUSTEE_OPERATION; stdcall;
+{$EXTERNALSYM GetMultipleTrusteeOperationW}
+function GetMultipleTrusteeOperation(pTrustee: PTRUSTEE): MULTIPLE_TRUSTEE_OPERATION; stdcall;
+{$EXTERNALSYM GetMultipleTrusteeOperation}
+
+function GetMultipleTrusteeA(pTrustee: PTRUSTEE_A): PTRUSTEE_A; stdcall;
+{$EXTERNALSYM GetMultipleTrusteeA}
+function GetMultipleTrusteeW(pTrustee: PTRUSTEE_W): PTRUSTEE_W; stdcall;
+{$EXTERNALSYM GetMultipleTrusteeW}
+function GetMultipleTrustee(pTrustee: PTRUSTEE): PTRUSTEE; stdcall;
+{$EXTERNALSYM GetMultipleTrustee}
+
+implementation
+
+const
+  aclapilib = 'advapi32.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _SetEntriesInAclA: Pointer;
+
+function SetEntriesInAclA;
+begin
+  GetProcedureAddress(_SetEntriesInAclA, aclapilib, 'SetEntriesInAclA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetEntriesInAclA]
+  end;
+end;
+
+var
+  _SetEntriesInAclW: Pointer;
+
+function SetEntriesInAclW;
+begin
+  GetProcedureAddress(_SetEntriesInAclW, aclapilib, 'SetEntriesInAclW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetEntriesInAclW]
+  end;
+end;
+
+var
+  _SetEntriesInAcl: Pointer;
+
+function SetEntriesInAcl;
+begin
+  GetProcedureAddress(_SetEntriesInAcl, aclapilib, 'SetEntriesInAcl' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetEntriesInAcl]
+  end;
+end;
+
+var
+  _GetExplicitEntriesFromAclA: Pointer;
+
+function GetExplicitEntriesFromAclA;
+begin
+  GetProcedureAddress(_GetExplicitEntriesFromAclA, aclapilib, 'GetExplicitEntriesFromAclA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetExplicitEntriesFromAclA]
+  end;
+end;
+
+var
+  _GetExplicitEntriesFromAclW: Pointer;
+
+function GetExplicitEntriesFromAclW;
+begin
+  GetProcedureAddress(_GetExplicitEntriesFromAclW, aclapilib, 'GetExplicitEntriesFromAclW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetExplicitEntriesFromAclW]
+  end;
+end;
+
+var
+  _GetExplicitEntriesFromAcl: Pointer;
+
+function GetExplicitEntriesFromAcl;
+begin
+  GetProcedureAddress(_GetExplicitEntriesFromAcl, aclapilib, 'GetExplicitEntriesFromAcl' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetExplicitEntriesFromAcl]
+  end;
+end;
+
+var
+  _GetEffectiveRightsFromAclA: Pointer;
+
+function GetEffectiveRightsFromAclA;
+begin
+  GetProcedureAddress(_GetEffectiveRightsFromAclA, aclapilib, 'GetEffectiveRightsFromAclA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetEffectiveRightsFromAclA]
+  end;
+end;
+
+var
+  _GetEffectiveRightsFromAclW: Pointer;
+
+function GetEffectiveRightsFromAclW;
+begin
+  GetProcedureAddress(_GetEffectiveRightsFromAclW, aclapilib, 'GetEffectiveRightsFromAclW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetEffectiveRightsFromAclW]
+  end;
+end;
+
+var
+  _GetEffectiveRightsFromAcl: Pointer;
+
+function GetEffectiveRightsFromAcl;
+begin
+  GetProcedureAddress(_GetEffectiveRightsFromAcl, aclapilib, 'GetEffectiveRightsFromAcl' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetEffectiveRightsFromAcl]
+  end;
+end;
+
+var
+  _GetAuditedPermissionsFromAclA: Pointer;
+
+function GetAuditedPermissionsFromAclA;
+begin
+  GetProcedureAddress(_GetAuditedPermissionsFromAclA, aclapilib, 'GetAuditedPermissionsFromAclA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAuditedPermissionsFromAclA]
+  end;
+end;
+
+var
+  _GetAuditedPermissionsFromAclW: Pointer;
+
+function GetAuditedPermissionsFromAclW;
+begin
+  GetProcedureAddress(_GetAuditedPermissionsFromAclW, aclapilib, 'GetAuditedPermissionsFromAclW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAuditedPermissionsFromAclW]
+  end;
+end;
+
+var
+  _GetAuditedPermissionsFromAcl: Pointer;
+
+function GetAuditedPermissionsFromAcl;
+begin
+  GetProcedureAddress(_GetAuditedPermissionsFromAcl, aclapilib, 'GetAuditedPermissionsFromAcl' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAuditedPermissionsFromAcl]
+  end;
+end;
+
+var
+  _GetNamedSecurityInfoA: Pointer;
+
+function GetNamedSecurityInfoA;
+begin
+  GetProcedureAddress(_GetNamedSecurityInfoA, aclapilib, 'GetNamedSecurityInfoA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetNamedSecurityInfoA]
+  end;
+end;
+
+var
+  _GetNamedSecurityInfoW: Pointer;
+
+function GetNamedSecurityInfoW;
+begin
+  GetProcedureAddress(_GetNamedSecurityInfoW, aclapilib, 'GetNamedSecurityInfoW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetNamedSecurityInfoW]
+  end;
+end;
+
+var
+  _GetNamedSecurityInfo: Pointer;
+
+function GetNamedSecurityInfo;
+begin
+  GetProcedureAddress(_GetNamedSecurityInfo, aclapilib, 'GetNamedSecurityInfo' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetNamedSecurityInfo]
+  end;
+end;
+
+var
+  _GetSecurityInfo: Pointer;
+
+function GetSecurityInfo;
+begin
+  GetProcedureAddress(_GetSecurityInfo, aclapilib, 'GetSecurityInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetSecurityInfo]
+  end;
+end;
+
+var
+  _SetNamedSecurityInfoA: Pointer;
+
+function SetNamedSecurityInfoA;
+begin
+  GetProcedureAddress(_SetNamedSecurityInfoA, aclapilib, 'SetNamedSecurityInfoA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetNamedSecurityInfoA]
+  end;
+end;
+
+var
+  _SetNamedSecurityInfoW: Pointer;
+
+function SetNamedSecurityInfoW;
+begin
+  GetProcedureAddress(_SetNamedSecurityInfoW, aclapilib, 'SetNamedSecurityInfoW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetNamedSecurityInfoW]
+  end;
+end;
+
+var
+  _SetNamedSecurityInfo: Pointer;
+
+function SetNamedSecurityInfo;
+begin
+  GetProcedureAddress(_SetNamedSecurityInfo, aclapilib, 'SetNamedSecurityInfo' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetNamedSecurityInfo]
+  end;
+end;
+
+var
+  _SetSecurityInfo: Pointer;
+
+function SetSecurityInfo;
+begin
+  GetProcedureAddress(_SetSecurityInfo, aclapilib, 'SetSecurityInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetSecurityInfo]
+  end;
+end;
+
+var
+  _GetInheritanceSourceA: Pointer;
+
+function GetInheritanceSourceA;
+begin
+  GetProcedureAddress(_GetInheritanceSourceA, aclapilib, 'GetInheritanceSourceA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetInheritanceSourceA]
+  end;
+end;
+
+var
+  _GetInheritanceSourceW: Pointer;
+
+function GetInheritanceSourceW;
+begin
+  GetProcedureAddress(_GetInheritanceSourceW, aclapilib, 'GetInheritanceSourceW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetInheritanceSourceW]
+  end;
+end;
+
+var
+  _GetInheritanceSource: Pointer;
+
+function GetInheritanceSource;
+begin
+  GetProcedureAddress(_GetInheritanceSource, aclapilib, 'GetInheritanceSource' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetInheritanceSource]
+  end;
+end;
+
+var
+  _FreeInheritedFromArray: Pointer;
+
+function FreeInheritedFromArray;
+begin
+  GetProcedureAddress(_FreeInheritedFromArray, aclapilib, 'FreeInheritedFromArray');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeInheritedFromArray]
+  end;
+end;
+
+var
+  _TreeResetNamedSecurityInfoA: Pointer;
+
+function TreeResetNamedSecurityInfoA;
+begin
+  GetProcedureAddress(_TreeResetNamedSecurityInfoA, aclapilib, 'TreeResetNamedSecurityInfoA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_TreeResetNamedSecurityInfoA]
+  end;
+end;
+
+var
+  _TreeResetNamedSecurityInfoW: Pointer;
+
+function TreeResetNamedSecurityInfoW;
+begin
+  GetProcedureAddress(_TreeResetNamedSecurityInfoW, aclapilib, 'TreeResetNamedSecurityInfoW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_TreeResetNamedSecurityInfoW]
+  end;
+end;
+
+var
+  _TreeResetNamedSecurityInfo: Pointer;
+
+function TreeResetNamedSecurityInfo;
+begin
+  GetProcedureAddress(_TreeResetNamedSecurityInfo, aclapilib, 'TreeResetNamedSecurityInfo' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_TreeResetNamedSecurityInfo]
+  end;
+end;
+
+var
+  _BuildSecurityDescriptorA: Pointer;
+
+function BuildSecurityDescriptorA;
+begin
+  GetProcedureAddress(_BuildSecurityDescriptorA, aclapilib, 'BuildSecurityDescriptorA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildSecurityDescriptorA]
+  end;
+end;
+
+var
+  _BuildSecurityDescriptorW: Pointer;
+
+function BuildSecurityDescriptorW;
+begin
+  GetProcedureAddress(_BuildSecurityDescriptorW, aclapilib, 'BuildSecurityDescriptorW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildSecurityDescriptorW]
+  end;
+end;
+
+var
+  _BuildSecurityDescriptor: Pointer;
+
+function BuildSecurityDescriptor;
+begin
+  GetProcedureAddress(_BuildSecurityDescriptor, aclapilib, 'BuildSecurityDescriptor' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildSecurityDescriptor]
+  end;
+end;
+
+var
+  _LookupSecurityDescriptorPartsA: Pointer;
+
+function LookupSecurityDescriptorPartsA;
+begin
+  GetProcedureAddress(_LookupSecurityDescriptorPartsA, aclapilib, 'LookupSecurityDescriptorPartsA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LookupSecurityDescriptorPartsA]
+  end;
+end;
+
+var
+  _LookupSecurityDescriptorPartsW: Pointer;
+
+function LookupSecurityDescriptorPartsW;
+begin
+  GetProcedureAddress(_LookupSecurityDescriptorPartsW, aclapilib, 'LookupSecurityDescriptorPartsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LookupSecurityDescriptorPartsW]
+  end;
+end;
+
+var
+  _LookupSecurityDescriptorParts: Pointer;
+
+function LookupSecurityDescriptorParts;
+begin
+  GetProcedureAddress(_LookupSecurityDescriptorParts, aclapilib, 'LookupSecurityDescriptorParts' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LookupSecurityDescriptorParts]
+  end;
+end;
+
+var
+  _BuildExplicitAccessWithNameA: Pointer;
+
+procedure BuildExplicitAccessWithNameA;
+begin
+  GetProcedureAddress(_BuildExplicitAccessWithNameA, aclapilib, 'BuildExplicitAccessWithNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildExplicitAccessWithNameA]
+  end;
+end;
+
+var
+  _BuildExplicitAccessWithNameW: Pointer;
+
+procedure BuildExplicitAccessWithNameW;
+begin
+  GetProcedureAddress(_BuildExplicitAccessWithNameW, aclapilib, 'BuildExplicitAccessWithNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildExplicitAccessWithNameW]
+  end;
+end;
+
+var
+  _BuildExplicitAccessWithName: Pointer;
+
+procedure BuildExplicitAccessWithName;
+begin
+  GetProcedureAddress(_BuildExplicitAccessWithName, aclapilib, 'BuildExplicitAccessWithName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildExplicitAccessWithName]
+  end;
+end;
+
+var
+  _BuildImpersonateExplAccWNA: Pointer;
+
+procedure BuildImpersonateExplicitAccessWithNameA;
+begin
+  GetProcedureAddress(_BuildImpersonateExplAccWNA, aclapilib, 'BuildImpersonateExplicitAccessWithNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateExplAccWNA]
+  end;
+end;
+
+var
+  _BuildImpersonateExplAccWNW: Pointer;
+
+procedure BuildImpersonateExplicitAccessWithNameW;
+begin
+  GetProcedureAddress(_BuildImpersonateExplAccWNW, aclapilib, 'BuildImpersonateExplicitAccessWithNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateExplAccWNW]
+  end;
+end;
+
+var
+  _BuildImpersonateExplAccWN: Pointer;
+
+procedure BuildImpersonateExplicitAccessWithName;
+begin
+  GetProcedureAddress(_BuildImpersonateExplAccWN, aclapilib, 'BuildImpersonateExplicitAccessWithName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateExplAccWN]
+  end;
+end;
+
+var
+  _BuildTrusteeWithNameA: Pointer;
+
+procedure BuildTrusteeWithNameA;
+begin
+  GetProcedureAddress(_BuildTrusteeWithNameA, aclapilib, 'BuildTrusteeWithNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithNameA]
+  end;
+end;
+
+var
+  _BuildTrusteeWithNameW: Pointer;
+
+procedure BuildTrusteeWithNameW;
+begin
+  GetProcedureAddress(_BuildTrusteeWithNameW, aclapilib, 'BuildTrusteeWithNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithNameW]
+  end;
+end;
+
+var
+  _BuildTrusteeWithName: Pointer;
+
+procedure BuildTrusteeWithName;
+begin
+  GetProcedureAddress(_BuildTrusteeWithName, aclapilib, 'BuildTrusteeWithName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithName]
+  end;
+end;
+
+var
+  _BuildImpersonateTrusteeA: Pointer;
+
+procedure BuildImpersonateTrusteeA;
+begin
+  GetProcedureAddress(_BuildImpersonateTrusteeA, aclapilib, 'BuildImpersonateTrusteeA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateTrusteeA]
+  end;
+end;
+
+var
+  _BuildImpersonateTrusteeW: Pointer;
+
+procedure BuildImpersonateTrusteeW;
+begin
+  GetProcedureAddress(_BuildImpersonateTrusteeW, aclapilib, 'BuildImpersonateTrusteeW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateTrusteeW]
+  end;
+end;
+
+var
+  _BuildImpersonateTrustee: Pointer;
+
+procedure BuildImpersonateTrustee;
+begin
+  GetProcedureAddress(_BuildImpersonateTrustee, aclapilib, 'BuildImpersonateTrustee' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildImpersonateTrustee]
+  end;
+end;
+
+var
+  _BuildTrusteeWithSidA: Pointer;
+
+procedure BuildTrusteeWithSidA;
+begin
+  GetProcedureAddress(_BuildTrusteeWithSidA, aclapilib, 'BuildTrusteeWithSidA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithSidA]
+  end;
+end;
+
+var
+  _BuildTrusteeWithSidW: Pointer;
+
+procedure BuildTrusteeWithSidW;
+begin
+  GetProcedureAddress(_BuildTrusteeWithSidW, aclapilib, 'BuildTrusteeWithSidW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithSidW]
+  end;
+end;
+
+var
+  _BuildTrusteeWithSid: Pointer;
+
+procedure BuildTrusteeWithSid;
+begin
+  GetProcedureAddress(_BuildTrusteeWithSid, aclapilib, 'BuildTrusteeWithSid' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithSid]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndSidA: Pointer;
+
+procedure BuildTrusteeWithObjectsAndSidA;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndSidA, aclapilib, 'BuildTrusteeWithObjectsAndSidA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndSidA]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndSidW: Pointer;
+
+procedure BuildTrusteeWithObjectsAndSidW;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndSidW, aclapilib, 'BuildTrusteeWithObjectsAndSidW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndSidW]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndSid: Pointer;
+
+procedure BuildTrusteeWithObjectsAndSid;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndSid, aclapilib, 'BuildTrusteeWithObjectsAndSid' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndSid]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndNameA: Pointer;
+
+procedure BuildTrusteeWithObjectsAndNameA;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndNameA, aclapilib, 'BuildTrusteeWithObjectsAndNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndNameA]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndNameW: Pointer;
+
+procedure BuildTrusteeWithObjectsAndNameW;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndNameW, aclapilib, 'BuildTrusteeWithObjectsAndNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndNameW]
+  end;
+end;
+
+var
+  _BuildTrusteeWithObjectsAndName: Pointer;
+
+procedure BuildTrusteeWithObjectsAndName;
+begin
+  GetProcedureAddress(_BuildTrusteeWithObjectsAndName, aclapilib, 'BuildTrusteeWithObjectsAndName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BuildTrusteeWithObjectsAndName]
+  end;
+end;
+
+var
+  _GetTrusteeNameA: Pointer;
+
+function GetTrusteeNameA;
+begin
+  GetProcedureAddress(_GetTrusteeNameA, aclapilib, 'GetTrusteeNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeNameA]
+  end;
+end;
+
+var
+  _GetTrusteeNameW: Pointer;
+
+function GetTrusteeNameW;
+begin
+  GetProcedureAddress(_GetTrusteeNameW, aclapilib, 'GetTrusteeNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeNameW]
+  end;
+end;
+
+var
+  _GetTrusteeName: Pointer;
+
+function GetTrusteeName;
+begin
+  GetProcedureAddress(_GetTrusteeName, aclapilib, 'GetTrusteeName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeName]
+  end;
+end;
+
+var
+  _GetTrusteeTypeA: Pointer;
+
+function GetTrusteeTypeA;
+begin
+  GetProcedureAddress(_GetTrusteeTypeA, aclapilib, 'GetTrusteeTypeA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeTypeA]
+  end;
+end;
+
+var
+  _GetTrusteeTypeW: Pointer;
+
+function GetTrusteeTypeW;
+begin
+  GetProcedureAddress(_GetTrusteeTypeW, aclapilib, 'GetTrusteeTypeW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeTypeW]
+  end;
+end;
+
+var
+  _GetTrusteeType: Pointer;
+
+function GetTrusteeType;
+begin
+  GetProcedureAddress(_GetTrusteeType, aclapilib, 'GetTrusteeType' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeType]
+  end;
+end;
+
+var
+  _GetTrusteeFormA: Pointer;
+
+function GetTrusteeFormA;
+begin
+  GetProcedureAddress(_GetTrusteeFormA, aclapilib, 'GetTrusteeFormA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeFormA]
+  end;
+end;
+
+var
+  _GetTrusteeFormW: Pointer;
+
+function GetTrusteeFormW;
+begin
+  GetProcedureAddress(_GetTrusteeFormW, aclapilib, 'GetTrusteeFormW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeFormW]
+  end;
+end;
+
+var
+  _GetTrusteeForm: Pointer;
+
+function GetTrusteeForm;
+begin
+  GetProcedureAddress(_GetTrusteeForm, aclapilib, 'GetTrusteeForm' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTrusteeForm]
+  end;
+end;
+
+var
+  _GetMultipleTrusteeOperationA: Pointer;
+
+function GetMultipleTrusteeOperationA;
+begin
+  GetProcedureAddress(_GetMultipleTrusteeOperationA, aclapilib, 'GetMultipleTrusteeOperationA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrusteeOperationA]
+  end;
+end;
+
+var
+  _GetMultipleTrusteeOperationW: Pointer;
+
+function GetMultipleTrusteeOperationW;
+begin
+  GetProcedureAddress(_GetMultipleTrusteeOperationW, aclapilib, 'GetMultipleTrusteeOperationW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrusteeOperationW]
+  end;
+end;
+
+var
+  _GetMultipleTrusteeOperation: Pointer;
+
+function GetMultipleTrusteeOperation;
+begin
+  GetProcedureAddress(_GetMultipleTrusteeOperation, aclapilib, 'GetMultipleTrusteeOperation' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrusteeOperation]
+  end;
+end;
+
+var
+  _GetMultipleTrusteeA: Pointer;
+
+function GetMultipleTrusteeA;
+begin
+  GetProcedureAddress(_GetMultipleTrusteeA, aclapilib, 'GetMultipleTrusteeA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrusteeA]
+  end;
+end;
+
+var
+  _GetMultipleTrusteeW: Pointer;
+
+function GetMultipleTrusteeW;
+begin
+  GetProcedureAddress(_GetMultipleTrusteeW, aclapilib, 'GetMultipleTrusteeW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrusteeW]
+  end;
+end;
+
+var
+  _GetMultipleTrustee: Pointer;
+
+function GetMultipleTrustee;
+begin
+  GetProcedureAddress(_GetMultipleTrustee, aclapilib, 'GetMultipleTrustee' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetMultipleTrustee]
+  end;
+end;
+
+{$ELSE}
+
+function SetEntriesInAclA; external aclapilib name 'SetEntriesInAclA';
+function SetEntriesInAclW; external aclapilib name 'SetEntriesInAclW';
+function SetEntriesInAcl; external aclapilib name 'SetEntriesInAcl' + AWSuffix;
+function GetExplicitEntriesFromAclA; external aclapilib name 'GetExplicitEntriesFromAclA';
+function GetExplicitEntriesFromAclW; external aclapilib name 'GetExplicitEntriesFromAclW';
+function GetExplicitEntriesFromAcl; external aclapilib name 'GetExplicitEntriesFromAcl' + AWSuffix;
+function GetEffectiveRightsFromAclA; external aclapilib name 'GetEffectiveRightsFromAclA';
+function GetEffectiveRightsFromAclW; external aclapilib name 'GetEffectiveRightsFromAclW';
+function GetEffectiveRightsFromAcl; external aclapilib name 'GetEffectiveRightsFromAcl' + AWSuffix;
+function GetAuditedPermissionsFromAclA; external aclapilib name 'GetAuditedPermissionsFromAclA';
+function GetAuditedPermissionsFromAclW; external aclapilib name 'GetAuditedPermissionsFromAclW';
+function GetAuditedPermissionsFromAcl; external aclapilib name 'GetAuditedPermissionsFromAcl' + AWSuffix;
+function GetNamedSecurityInfoA; external aclapilib name 'GetNamedSecurityInfoA';
+function GetNamedSecurityInfoW; external aclapilib name 'GetNamedSecurityInfoW';
+function GetNamedSecurityInfo; external aclapilib name 'GetNamedSecurityInfo' + AWSuffix;
+function GetSecurityInfo; external aclapilib name 'GetSecurityInfo';
+function SetNamedSecurityInfoA; external aclapilib name 'SetNamedSecurityInfoA';
+function SetNamedSecurityInfoW; external aclapilib name 'SetNamedSecurityInfoW';
+function SetNamedSecurityInfo; external aclapilib name 'SetNamedSecurityInfo' + AWSuffix;
+function SetSecurityInfo; external aclapilib name 'SetSecurityInfo';
+function GetInheritanceSourceA; external aclapilib name 'GetInheritanceSourceA';
+function GetInheritanceSourceW; external aclapilib name 'GetInheritanceSourceW';
+function GetInheritanceSource; external aclapilib name 'GetInheritanceSource' + AWSuffix;
+function FreeInheritedFromArray; external aclapilib name 'FreeInheritedFromArray';
+function TreeResetNamedSecurityInfoA; external aclapilib name 'TreeResetNamedSecurityInfoA';
+function TreeResetNamedSecurityInfoW; external aclapilib name 'TreeResetNamedSecurityInfoW';
+function TreeResetNamedSecurityInfo; external aclapilib name 'TreeResetNamedSecurityInfo' + AWSuffix;
+function BuildSecurityDescriptorA; external aclapilib name 'BuildSecurityDescriptorA';
+function BuildSecurityDescriptorW; external aclapilib name 'BuildSecurityDescriptorW';
+function BuildSecurityDescriptor; external aclapilib name 'BuildSecurityDescriptor' + AWSuffix;
+function LookupSecurityDescriptorPartsA; external aclapilib name 'LookupSecurityDescriptorPartsA';
+function LookupSecurityDescriptorPartsW; external aclapilib name 'LookupSecurityDescriptorPartsW';
+function LookupSecurityDescriptorParts; external aclapilib name 'LookupSecurityDescriptorParts' + AWSuffix;
+procedure BuildExplicitAccessWithNameA; external aclapilib name 'BuildExplicitAccessWithNameA';
+procedure BuildExplicitAccessWithNameW; external aclapilib name 'BuildExplicitAccessWithNameW';
+procedure BuildExplicitAccessWithName; external aclapilib name 'BuildExplicitAccessWithName' + AWSuffix;
+procedure BuildImpersonateExplicitAccessWithNameA; external aclapilib name 'BuildImpersonateExplicitAccessWithNameA';
+procedure BuildImpersonateExplicitAccessWithNameW; external aclapilib name 'BuildImpersonateExplicitAccessWithNameW';
+procedure BuildImpersonateExplicitAccessWithName; external aclapilib name 'BuildImpersonateExplicitAccessWithName' + AWSuffix;
+procedure BuildTrusteeWithNameA; external aclapilib name 'BuildTrusteeWithNameA';
+procedure BuildTrusteeWithNameW; external aclapilib name 'BuildTrusteeWithNameW';
+procedure BuildTrusteeWithName; external aclapilib name 'BuildTrusteeWithName' + AWSuffix;
+procedure BuildImpersonateTrusteeA; external aclapilib name 'BuildImpersonateTrusteeA';
+procedure BuildImpersonateTrusteeW; external aclapilib name 'BuildImpersonateTrusteeW';
+procedure BuildImpersonateTrustee; external aclapilib name 'BuildImpersonateTrustee' + AWSuffix;
+procedure BuildTrusteeWithSidA; external aclapilib name 'BuildTrusteeWithSidA';
+procedure BuildTrusteeWithSidW; external aclapilib name 'BuildTrusteeWithSidW';
+procedure BuildTrusteeWithSid; external aclapilib name 'BuildTrusteeWithSid' + AWSuffix;
+procedure BuildTrusteeWithObjectsAndSidA; external aclapilib name 'BuildTrusteeWithObjectsAndSidA';
+procedure BuildTrusteeWithObjectsAndSidW; external aclapilib name 'BuildTrusteeWithObjectsAndSidW';
+procedure BuildTrusteeWithObjectsAndSid; external aclapilib name 'BuildTrusteeWithObjectsAndSid' + AWSuffix;
+procedure BuildTrusteeWithObjectsAndNameA; external aclapilib name 'BuildTrusteeWithObjectsAndNameA';
+procedure BuildTrusteeWithObjectsAndNameW; external aclapilib name 'BuildTrusteeWithObjectsAndNameW';
+procedure BuildTrusteeWithObjectsAndName; external aclapilib name 'BuildTrusteeWithObjectsAndName' + AWSuffix;
+function GetTrusteeNameA; external aclapilib name 'GetTrusteeNameA';
+function GetTrusteeNameW; external aclapilib name 'GetTrusteeNameW';
+function GetTrusteeName; external aclapilib name 'GetTrusteeName' + AWSuffix;
+function GetTrusteeTypeA; external aclapilib name 'GetTrusteeTypeA';
+function GetTrusteeTypeW; external aclapilib name 'GetTrusteeTypeW';
+function GetTrusteeType; external aclapilib name 'GetTrusteeType' + AWSuffix;
+function GetTrusteeFormA; external aclapilib name 'GetTrusteeFormA';
+function GetTrusteeFormW; external aclapilib name 'GetTrusteeFormW';
+function GetTrusteeForm; external aclapilib name 'GetTrusteeForm' + AWSuffix;
+function GetMultipleTrusteeOperationA; external aclapilib name 'GetMultipleTrusteeOperationA';
+function GetMultipleTrusteeOperationW; external aclapilib name 'GetMultipleTrusteeOperationW';
+function GetMultipleTrusteeOperation; external aclapilib name 'GetMultipleTrusteeOperation' + AWSuffix;
+function GetMultipleTrusteeA; external aclapilib name 'GetMultipleTrusteeA';
+function GetMultipleTrusteeW; external aclapilib name 'GetMultipleTrusteeW';
+function GetMultipleTrustee; external aclapilib name 'GetMultipleTrustee' + AWSuffix;
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 374 - 0
packages/extra/winunits/jwaaclui.pas

@@ -0,0 +1,374 @@
+{******************************************************************************}
+{                                                                              }
+{ Access Control UI API interface Unit for Object Pascal                       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: aclui.h, released June 2000. The original Pascal       }
+{ code is: AclUI.pas, released December 2000. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAclUI;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "aclui.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaAccCtrl, JwaWinNT, JwaWinUser, JwaWinType;
+
+//
+// ISecurityInformation interface
+//
+//  Methods:
+//
+//     GetObjectInformation - Allows UI to determine type of object being
+//       edited.  Also allows determining if object is a container.
+//
+//     GetSecurity - Allows retrieving of ACLs from the original object
+//                       NOTE: ACLUI will LocalFree the security descriptor
+//                       returned by GetSecurity.
+//     SetSecurity - Allows setting of the ACLs on the original object
+//
+//     GetAccessRights - For retrieving the list of rights allowed
+//              on this object.
+//
+//     MapGeneric - For mapping generic rights to standard & specific rights
+//
+//     GetInheritTypes - For retrieving the list of possible sub-object types
+//              for a container.
+//
+//     PropertySheetCallback - A method which is called back during the various
+//              security UI property pages so that specialized work can be
+//              done.  Similar to PropSheetPageProc.  If uMsg == PSPCB_CREATE,
+//              then any error return value other than E_NOTIMPL will abort
+//              the creation of that page.  The type of page being created or
+//              destroyed is indicated by the uPage parameter.
+//
+
+type
+  PSI_OBJECT_INFO = ^SI_OBJECT_INFO;
+  {$EXTERNALSYM PSI_OBJECT_INFO}
+  _SI_OBJECT_INFO = record
+    dwFlags: DWORD;
+    hInstance: HINSTANCE;  // resources (e.g. strings) reside here
+    pszServerName: LPWSTR; // must be present
+    pszObjectName: LPWSTR; // must be present
+    pszPageTitle: LPWSTR;  // only valid if SI_PAGE_TITLE is set
+    guidObjectType: GUID;  // only valid if SI_OBJECT_GUID is set
+  end;
+  {$EXTERNALSYM _SI_OBJECT_INFO}
+  SI_OBJECT_INFO = _SI_OBJECT_INFO;
+  {$EXTERNALSYM SI_OBJECT_INFO}
+  TSiObjectInfo = SI_OBJECT_INFO;
+  PSiObjectInfo = PSI_OBJECT_INFO;
+
+// SI_OBJECT_INFO flags
+
+const
+  SI_EDIT_PERMS      = $00000000; // always implied
+  {$EXTERNALSYM SI_EDIT_PERMS}
+  SI_EDIT_OWNER      = $00000001;
+  {$EXTERNALSYM SI_EDIT_OWNER}
+  SI_EDIT_AUDITS     = $00000002;
+  {$EXTERNALSYM SI_EDIT_AUDITS}
+  SI_CONTAINER       = $00000004;
+  {$EXTERNALSYM SI_CONTAINER}
+  SI_READONLY        = $00000008;
+  {$EXTERNALSYM SI_READONLY}
+  SI_ADVANCED        = $00000010;
+  {$EXTERNALSYM SI_ADVANCED}
+  SI_RESET           = $00000020; // equals to SI_RESET_DACL|SI_RESET_SACL|SI_RESET_OWNER
+  {$EXTERNALSYM SI_RESET}
+  SI_OWNER_READONLY  = $00000040;
+  {$EXTERNALSYM SI_OWNER_READONLY}
+  SI_EDIT_PROPERTIES = $00000080;
+  {$EXTERNALSYM SI_EDIT_PROPERTIES}
+  SI_OWNER_RECURSE   = $00000100;
+  {$EXTERNALSYM SI_OWNER_RECURSE}
+  SI_NO_ACL_PROTECT  = $00000200;
+  {$EXTERNALSYM SI_NO_ACL_PROTECT}
+  SI_NO_TREE_APPLY   = $00000400;
+  {$EXTERNALSYM SI_NO_TREE_APPLY}
+  SI_PAGE_TITLE      = $00000800;
+  {$EXTERNALSYM SI_PAGE_TITLE}
+  SI_SERVER_IS_DC    = $00001000;
+  {$EXTERNALSYM SI_SERVER_IS_DC}
+  SI_RESET_DACL_TREE = $00004000;
+  {$EXTERNALSYM SI_RESET_DACL_TREE}
+  SI_RESET_SACL_TREE = $00008000;
+  {$EXTERNALSYM SI_RESET_SACL_TREE}
+  SI_OBJECT_GUID     = $00010000;
+  {$EXTERNALSYM SI_OBJECT_GUID}
+  SI_EDIT_EFFECTIVE  = $00020000;
+  {$EXTERNALSYM SI_EDIT_EFFECTIVE}
+  SI_RESET_DACL      = $00040000;
+  {$EXTERNALSYM SI_RESET_DACL}
+  SI_RESET_SACL      = $00080000;
+  {$EXTERNALSYM SI_RESET_SACL}
+  SI_RESET_OWNER     = $00100000;
+  {$EXTERNALSYM SI_RESET_OWNER}
+  SI_NO_ADDITIONAL_PERMISSION = $00200000;
+  {$EXTERNALSYM SI_NO_ADDITIONAL_PERMISSION}
+  SI_MAY_WRITE       = $10000000; //not sure if user can write permission
+  {$EXTERNALSYM SI_MAY_WRITE}
+
+  SI_EDIT_ALL = SI_EDIT_PERMS or SI_EDIT_OWNER or SI_EDIT_AUDITS;
+  {$EXTERNALSYM SI_EDIT_ALL}
+
+type
+  PSI_ACCESS = ^SI_ACCESS;
+  {$EXTERNALSYM PSI_ACCESS}
+  _SI_ACCESS = record
+    pguid: LPGUID;
+    mask: ACCESS_MASK;
+    pszName: LPCWSTR; // may be resource ID
+    dwFlags: DWORD;
+  end;
+  {$EXTERNALSYM _SI_ACCESS}
+  SI_ACCESS = _SI_ACCESS;
+  {$EXTERNALSYM SI_ACCESS}
+  TSiAccess = SI_ACCESS;
+  PSiAccess = PSI_ACCESS;
+
+// SI_ACCESS flags
+
+const
+  SI_ACCESS_SPECIFIC  = $00010000;
+  {$EXTERNALSYM SI_ACCESS_SPECIFIC}
+  SI_ACCESS_GENERAL   = $00020000;
+  {$EXTERNALSYM SI_ACCESS_GENERAL}
+  SI_ACCESS_CONTAINER = $00040000; // general access, container-only
+  {$EXTERNALSYM SI_ACCESS_CONTAINER}
+  SI_ACCESS_PROPERTY  = $00080000;
+  {$EXTERNALSYM SI_ACCESS_PROPERTY}
+
+// ACE inheritance flags (CONTAINER_INHERIT_ACE, etc.) may also be set.
+// They will be used as the inheritance when an access is turned on.
+
+type
+  PSI_INHERIT_TYPE = ^SI_INHERIT_TYPE;
+  {$EXTERNALSYM PSI_INHERIT_TYPE}
+  _SI_INHERIT_TYPE = record
+    pguid: LPGUID;
+    dwFlags: ULONG;
+    pszName: LPCWSTR; // may be resource ID
+  end;
+  {$EXTERNALSYM _SI_INHERIT_TYPE}
+  SI_INHERIT_TYPE = _SI_INHERIT_TYPE;
+  {$EXTERNALSYM SI_INHERIT_TYPE}
+  TSiInheritType = SI_INHERIT_TYPE;
+  PSiInheritType = PSI_INHERIT_TYPE;
+
+// SI_INHERIT_TYPE flags are a combination of INHERIT_ONLY_ACE,
+// CONTAINER_INHERIT_ACE, and OBJECT_INHERIT_ACE.
+
+  _SI_PAGE_TYPE = (SI_PAGE_PERM, SI_PAGE_ADVPERM, SI_PAGE_AUDIT, SI_PAGE_OWNER, SI_PAGE_EFFECTIVE);
+  {$EXTERNALSYM _SI_PAGE_TYPE}
+  SI_PAGE_TYPE = _SI_PAGE_TYPE;
+  {$EXTERNALSYM SI_PAGE_TYPE}
+  TSiPageType = _SI_PAGE_TYPE;
+
+// Message to PropertySheetPageCallback (in addition to
+// PSPCB_CREATE and PSPCB_RELEASE)
+
+const
+  PSPCB_SI_INITDIALOG = WM_USER + 1;
+  {$EXTERNALSYM PSPCB_SI_INITDIALOG}
+
+const
+  IID_ISecurityInformation: GUID = (
+    D1:$965fc360; D2:$16ff; D3:$11d0; D4:($91, $cb, $0, $aa, $0, $bb, $b7, $23));
+  {$EXTERNALSYM IID_ISecurityInformation}
+  IID_ISecurityInformation2: GUID = (
+    D1:$c3ccfdb4; D2:$6f88; D3:$11d2; D4:($a3, $ce, $0, $c0, $4f, $b1, $78, $2a));
+  {$EXTERNALSYM IID_ISecurityInformation2}
+
+  SID_ISecurityInformation  = '{965FC360-16FF-11d0-91CB-00AA00BBB723}';
+  SID_ISecurityInformation2 = '{c3ccfdb4-6f88-11d2-a3ce-00c04fb1782a}';
+
+type
+  ISecurityInformation = interface(IUnknown)
+  [SID_ISecurityInformation]
+    function GetObjectInformation(out pObjectInfo: SI_OBJECT_INFO): HRESULT; stdcall;
+    function GetSecurity(RequestedInformation: SECURITY_INFORMATION;
+      out ppSecurityDescriptor: PSECURITY_DESCRIPTOR; fDefault: BOOL): HRESULT; stdcall;
+    function SetSecurity(SecurityInformation: SECURITY_INFORMATION;
+      pSecurityDescriptor: PSECURITY_DESCRIPTOR): HRESULT; stdcall;
+    function GetAccessRights(pguidObjectType: LPGUID; dwFlags: DWORD;
+      out ppAccess: PSI_ACCESS; out pcAccesses, piDefaultAccess: ULONG): HRESULT; stdcall;
+    function MapGeneric(pguidObjectType: LPGUID; pAceFlags: PUCHAR;
+      pMask: PACCESS_MASK): HRESULT; stdcall;
+    function GetInheritTypes(out ppInheritTypes: PSI_INHERIT_TYPE;
+      out pcInheritTypes: ULONG): HRESULT; stdcall;
+    function PropertySheetPageCallback(hwnd: HWND; uMsg: UINT;
+      uPage: SI_PAGE_TYPE): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM ISecurityInformation}
+
+  LPSECURITYINFO = ISecurityInformation;
+  {$EXTERNALSYM LPSECURITYINFO}
+
+  ISecurityInformation2 = interface(IUnknown)
+  [SID_ISecurityInformation]
+    function IsDaclCanonical(pDacl: PACL): BOOL; stdcall;
+    function LookupSids(cSids: ULONG; rgpSids: PPSID;
+      out ppdo: Pointer{*LPDATAOBJECT}): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM ISecurityInformation2}
+
+  LPSECURITYINFO2 = ISecurityInformation2;
+  {$EXTERNALSYM LPSECURITYINFO2}
+
+// HGLOBAL containing SID_INFO_LIST returned by ISecurityInformation2::LookupSids
+
+const
+  CFSTR_ACLUI_SID_INFO_LIST = 'CFSTR_ACLUI_SID_INFO_LIST';
+  {$EXTERNALSYM CFSTR_ACLUI_SID_INFO_LIST}
+
+// Data structures corresponding to CFSTR_ACLUI_SID_INFO_LIST
+
+type
+  PSID_INFO = ^SID_INFO;
+  {$EXTERNALSYM PSID_INFO}
+  _SID_INFO = record
+    pSid: PSID;
+    pwzCommonName: PWSTR;
+    pwzClass: PWSTR; // Used for selecting icon, e.g. "User" or "Group"
+    pwzUPN: PWSTR;   // Optional, may be NULL
+  end;
+  {$EXTERNALSYM _SID_INFO}
+  SID_INFO = _SID_INFO;
+  {$EXTERNALSYM SID_INFO}
+  TSidInfo = SID_INFO;
+  PSidInfo = PSID_INFO;
+
+  PSID_INFO_LIST = ^SID_INFO_LIST;
+  {$EXTERNALSYM PSID_INFO_LIST}
+  _SID_INFO_LIST = record
+    cItems: ULONG;
+    aSidInfo: array [0..ANYSIZE_ARRAY - 1] of SID_INFO;
+  end;
+  {$EXTERNALSYM _SID_INFO_LIST}
+  SID_INFO_LIST = _SID_INFO_LIST;
+  {$EXTERNALSYM SID_INFO_LIST}
+  TSidInfoList = SID_INFO_LIST;
+  PSidInfoList = PSID_INFO_LIST;
+
+const
+  IID_IEffectivePermission: TGUID = '{3853DC76-9F35-407c-88A1-D19344365FBC}';
+  {$EXTERNALSYM IID_IEffectivePermission}
+  IID_ISecurityObjectTypeInfo: TGUID = '{fc3066eb-79ef-444b-9111-d18a75ebf2fa}';
+  {$EXTERNALSYM IID_ISecurityObjectTypeInfo}
+
+type
+  IEffectivePermission = interface(IUnknown)
+  ['{3853DC76-9F35-407c-88A1-D19344365FBC}']
+    function GetEffectivePermission(const pguidObjectType: TGUID; pUserSid: PSID;
+      pszServerName: LPCWSTR; pSD: PSECURITY_DESCRIPTOR; var ppObjectTypeList: POBJECT_TYPE_LIST;
+      var pcObjectTypeListLength: ULONG; var ppGrantedAccessList: PACCESS_MASK;
+      var pcGrantedAccessListLength: ULONG): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEffectivePermission}
+  LPEFFECTIVEPERMISSION = IEffectivePermission;
+  {$EXTERNALSYM LPEFFECTIVEPERMISSION}
+
+  ISecurityObjectTypeInfo = interface(IUnknown)
+  ['{fc3066eb-79ef-444b-9111-d18a75ebf2fa}']
+    function GetInheritSource(si: SECURITY_INFORMATION; pACL: PACL;
+      var ppInheritArray: PINHERITED_FROM): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM ISecurityObjectTypeInfo}
+  LPSecurityObjectTypeInfo = ISecurityObjectTypeInfo;
+  {$EXTERNALSYM LPSecurityObjectTypeInfo}
+
+type
+  HPROPSHEETPAGE = Pointer;
+  {$EXTERNALSYM HPROPSHEETPAGE}
+
+function CreateSecurityPage(psi: LPSECURITYINFO): HPROPSHEETPAGE; stdcall;
+{$EXTERNALSYM CreateSecurityPage}
+function EditSecurity(hwndOwner: HWND; psi: LPSECURITYINFO): BOOL; stdcall;
+{$EXTERNALSYM EditSecurity}
+
+implementation
+
+const
+  acluilib = 'aclui.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _CreateSecurityPage: Pointer;
+
+function CreateSecurityPage;
+begin
+  GetProcedureAddress(_CreateSecurityPage, acluilib, 'CreateSecurityPage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CreateSecurityPage]
+  end;
+end;
+
+var
+  _EditSecurity: Pointer;
+
+function EditSecurity;
+begin
+  GetProcedureAddress(_EditSecurity, acluilib, 'EditSecurity');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_EditSecurity]
+  end;
+end;
+
+{$ELSE}
+
+function CreateSecurityPage; external acluilib name 'CreateSecurityPage';
+function EditSecurity; external acluilib name 'EditSecurity';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 1207 - 0
packages/extra/winunits/jwaactiveds.pas

@@ -0,0 +1,1207 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Services API interface Unit for Object Pascal               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: activeds.h, released June 2000. The original Pascal    }
+{ code is: ActiveDS.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaActiveDS;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "activeds.h"'}
+{$HPPEMIT ''}
+{$HPPEMIT 'typedef GUID REFIID'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaAdsTLB, JwaWinNT, JwaWinType, JwaWinUser;
+
+type
+  REFIID = GUID;
+  {$NODEFINE REFIID}
+
+type
+  // imports of a type library sometimes are missing a few decls, these are just
+  // a few of them to make this file compile at all. I really should do all of
+  // them one day.
+
+  PADSVALUE = ^_adsvalue;
+  {$EXTERNALSYM PADSVALUE}
+  PADS_ATTR_INFO = ^_ads_attr_info;
+  {$EXTERNALSYM PADS_ATTR_INFO}
+
+//  Contents:   Master include file for Ole Ds
+//
+//  Notes:      All Ole Ds client applications must include this file. This
+//              provides access to the primary Ole Ds interfaces, the error
+//              codes, and function prototypes for the Ole Ds helper apis.
+
+//
+// Interface definitions and well known GUIDS for Ole Ds
+//
+
+//#include "iads.h"  >> AdsTLB from activeds.dll
+
+//
+// Helper function prototypes for Ole Ds
+//
+
+//#include "adshlp.h"
+
+function ADsGetObject(lpszPathName: LPCWSTR; const riid: REFIID; out ppObject: Pointer): HRESULT; stdcall;
+{$EXTERNALSYM ADsGetObject}
+
+function ADsBuildEnumerator(pADsContainer: IADsContainer; out ppEnumVariant: IEnumVARIANT): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildEnumerator}
+
+function ADsFreeEnumerator(var pEnumVariant: IEnumVARIANT): HRESULT;
+{$EXTERNALSYM ADsFreeEnumerator}
+
+function ADsEnumerateNext(pEnumVariant: IEnumVARIANT; cElements: ULONG;
+  var pvar: OleVariant; var pcElementsFetched: ULONG): HRESULT; stdcall;
+{$EXTERNALSYM ADsEnumerateNext}
+
+function ADsBuildVarArrayStr(lppPathNames: LPWSTR; dwPathNames: DWORD;
+  var pVar: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildVarArrayStr}
+
+function ADsBuildVarArrayInt(lpdwObjectTypes: LPDWORD; dwObjectTypes: DWORD;
+  var pVar: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildVarArrayInt}
+
+function ADsOpenObject(lpszPathName, lpszUserName, lpszPassword: LPCWSTR;
+  dwReserved: DWORD; const riid: REFIID; out ppObject: Pointer): HRESULT; stdcall;
+{$EXTERNALSYM ADsOpenObject}
+
+//
+// Helper functions for extended error support
+//
+
+function ADsGetLastError(var lpError: DWORD; lpErrorBuf: LPWSTR;
+  dwErrorBufLen: DWORD; lpNameBuf: LPWSTR; dwNameBufLen: DWORD): HRESULT; stdcall;
+{$EXTERNALSYM ADsGetLastError}
+
+procedure ADsSetLastError(dwErr: DWORD; pszError, pszProvider: LPCWSTR); stdcall;
+{$EXTERNALSYM ADsSetLastError}
+
+//procedure ADsFreeAllErrorRecords; stdcall;
+//{$EXTERNALSYM ADsFreeAllErrorRecords}
+
+function AllocADsMem(cb: DWORD): LPVOID; stdcall;
+{$EXTERNALSYM AllocADsMem}
+
+function FreeADsMem(pMem: LPVOID): BOOL; stdcall;
+{$EXTERNALSYM FreeADsMem}
+
+function ReallocADsMem(pOldMem: LPVOID; cbOld, cbNew: DWORD): LPVOID; stdcall;
+{$EXTERNALSYM ReallocADsMem}
+
+function AllocADsStr(pStr: LPCWSTR): LPWSTR; stdcall;
+{$EXTERNALSYM AllocADsStr}
+
+function FreeADsStr(pStr: LPWSTR): BOOL; stdcall;
+{$EXTERNALSYM FreeADsStr}
+
+function ReallocADsStr(var ppStr: LPWSTR; pStr: LPWSTR): BOOL; stdcall;
+{$EXTERNALSYM ReallocADsStr}
+
+function ADsEncodeBinaryData(pbSrcData: PBYTE; dwSrcLen: DWORD;
+  var ppszDestData: LPWSTR): HRESULT; stdcall;
+{$EXTERNALSYM ADsEncodeBinaryData}
+
+function ADsDecodeBinaryData(szSrcData: LPCWSTR; var ppbDestData: PBYTE;
+  var pdwDestLen: ULONG): HRESULT; stdcall;
+{$EXTERNALSYM ADsDecodeBinaryData}
+
+function PropVariantToAdsType(var pVariant: OleVariant; dwNumVariant: DWORD;
+  var ppAdsValues: PADSVALUE; pdwNumValues: PDWORD): HRESULT; stdcall;
+{$EXTERNALSYM PropVariantToAdsType}
+
+function AdsTypeToPropVariant(pAdsValues: PADSVALUE; dwNumValues: DWORD;
+  var pVariant: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM AdsTypeToPropVariant}
+
+procedure AdsFreeAdsValues(pAdsValues: PADSVALUE; dwNumValues: DWORD); stdcall;
+{$EXTERNALSYM AdsFreeAdsValues}
+
+//
+// Error codes for Ole Ds - generated from ..\..\errmsg
+//
+
+//#include "adserr.h"
+
+// ---------------------- HRESULT value definitions -----------------
+//
+// HRESULT definitions
+//
+
+//
+//  Values are 32 bit values layed out as follows:
+//
+//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+//  +---+-+-+-----------------------+-------------------------------+
+//  |Sev|C|R|     Facility          |               Code            |
+//  +---+-+-+-----------------------+-------------------------------+
+//
+//  where
+//
+//      Sev - is the severity code
+//
+//          00 - Success
+//          01 - Informational
+//          10 - Warning
+//          11 - Error
+//
+//      C - is the Customer code flag
+//
+//      R - is a reserved bit
+//
+//      Facility - is the facility code
+//
+//      Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+const
+  FACILITY_WINDOWS  = 8;
+  {$EXTERNALSYM FACILITY_WINDOWS}
+  FACILITY_STORAGE  = 3;
+  {$EXTERNALSYM FACILITY_STORAGE}
+  FACILITY_RPC      = 1;
+  {$EXTERNALSYM FACILITY_RPC}
+  FACILITY_SSPI     = 9;
+  {$EXTERNALSYM FACILITY_SSPI}
+  FACILITY_WIN32    = 7;
+  {$EXTERNALSYM FACILITY_WIN32}
+  FACILITY_CONTROL  = 10;
+  {$EXTERNALSYM FACILITY_CONTROL}
+  FACILITY_NULL     = 0;
+  {$EXTERNALSYM FACILITY_NULL}
+  FACILITY_ITF      = 4;
+  {$EXTERNALSYM FACILITY_ITF}
+  FACILITY_DISPATCH = 2;
+  {$EXTERNALSYM FACILITY_DISPATCH}
+
+//
+// Define the severity codes
+//
+
+//
+// MessageId: E_ADS_BAD_PATHNAME
+//
+// MessageText:
+//
+//  An invalid Active Directory pathname was passed
+//
+
+  E_ADS_BAD_PATHNAME               = HRESULT($80005000);
+  {$EXTERNALSYM E_ADS_BAD_PATHNAME}
+
+//
+// MessageId: E_ADS_INVALID_DOMAIN_OBJECT
+//
+// MessageText:
+//
+//  An unknown Active Directory domain object was requested
+//
+
+  E_ADS_INVALID_DOMAIN_OBJECT      = HRESULT($80005001);
+  {$EXTERNALSYM  E_ADS_INVALID_DOMAIN_OBJECT}
+
+//
+// MessageId: E_ADS_INVALID_USER_OBJECT
+//
+// MessageText:
+//
+//  An unknown Active Directory user object was requested
+//
+
+  E_ADS_INVALID_USER_OBJECT        = HRESULT($80005002);
+  {$EXTERNALSYM E_ADS_INVALID_USER_OBJECT}
+
+//
+// MessageId: E_ADS_INVALID_COMPUTER_OBJECT
+//
+// MessageText:
+//
+//  An unknown Active Directory computer object was requested
+//
+
+  E_ADS_INVALID_COMPUTER_OBJECT    = HRESULT($80005003);
+  {$EXTERNALSYM E_ADS_INVALID_COMPUTER_OBJECT}
+
+//
+// MessageId: E_ADS_UNKNOWN_OBJECT
+//
+// MessageText:
+//
+//  An unknown Active Directory object was requested
+//
+
+  E_ADS_UNKNOWN_OBJECT             = HRESULT($80005004);
+  {$EXTERNALSYM E_ADS_UNKNOWN_OBJECT}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_SET
+//
+// MessageText:
+//
+//  The specified Active Directory property was not set
+//
+
+  E_ADS_PROPERTY_NOT_SET           = HRESULT($80005005);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_SET}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_SUPPORTED
+//
+// MessageText:
+//
+//  The specified Active Directory property is not supported
+//
+
+  E_ADS_PROPERTY_NOT_SUPPORTED     = HRESULT($80005006);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_SUPPORTED}
+
+//
+// MessageId: E_ADS_PROPERTY_INVALID
+//
+// MessageText:
+//
+//  The specified Active Directory property is invalid
+//
+
+  E_ADS_PROPERTY_INVALID           = HRESULT($80005007);
+  {$EXTERNALSYM E_ADS_PROPERTY_INVALID}
+
+//
+// MessageId: E_ADS_BAD_PARAMETER
+//
+// MessageText:
+//
+//  One or more input parameters are invalid
+//
+
+  E_ADS_BAD_PARAMETER              = HRESULT($80005008);
+  {$EXTERNALSYM E_ADS_BAD_PARAMETER}
+
+//
+// MessageId: E_ADS_OBJECT_UNBOUND
+//
+// MessageText:
+//
+//  The specified Active Directory object is not bound to a remote resource
+//
+
+  E_ADS_OBJECT_UNBOUND             = HRESULT($80005009);
+  {$EXTERNALSYM E_ADS_OBJECT_UNBOUND}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_MODIFIED
+//
+// MessageText:
+//
+//  The specified Active Directory object has not been modified
+//
+
+  E_ADS_PROPERTY_NOT_MODIFIED      = HRESULT($8000500A);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_MODIFIED}
+
+//
+// MessageId: E_ADS_PROPERTY_MODIFIED
+//
+// MessageText:
+//
+//  The specified Active Directory object has not been modified
+//
+
+  E_ADS_PROPERTY_MODIFIED          = HRESULT($8000500B);
+  {$EXTERNALSYM E_ADS_PROPERTY_MODIFIED}
+
+//
+// MessageId: E_ADS_CANT_CONVERT_DATATYPE
+//
+// MessageText:
+//
+//  The Active Directory datatype cannot be converted to/from a native DS datatype
+//
+
+  E_ADS_CANT_CONVERT_DATATYPE      = HRESULT($8000500C);
+  {$EXTERNALSYM E_ADS_CANT_CONVERT_DATATYPE}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_FOUND
+//
+// MessageText:
+//
+//  The Active Directory property cannot be found in the cache.
+//
+
+  E_ADS_PROPERTY_NOT_FOUND         = HRESULT($8000500D);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_FOUND}
+
+//
+// MessageId: E_ADS_OBJECT_EXISTS
+//
+// MessageText:
+//
+//  The Active Directory object exists.
+//
+
+  E_ADS_OBJECT_EXISTS              = HRESULT($8000500E);
+  {$EXTERNALSYM E_ADS_OBJECT_EXISTS}
+
+//
+// MessageId: E_ADS_SCHEMA_VIOLATION
+//
+// MessageText:
+//
+//  The attempted action violates the DS schema rules.
+//
+
+  E_ADS_SCHEMA_VIOLATION           = HRESULT($8000500F);
+  {$EXTERNALSYM E_ADS_SCHEMA_VIOLATION}
+
+//
+// MessageId: E_ADS_COLUMN_NOT_SET
+//
+// MessageText:
+//
+//  The specified column in the Active Directory was not set.
+//
+
+  E_ADS_COLUMN_NOT_SET             = HRESULT($80005010);
+  {$EXTERNALSYM E_ADS_COLUMN_NOT_SET}
+
+//
+// MessageId: S_ADS_ERRORSOCCURRED
+//
+// MessageText:
+//
+//  One or more errors occurred
+//
+
+  S_ADS_ERRORSOCCURRED             = HRESULT($00005011);
+  {$EXTERNALSYM S_ADS_ERRORSOCCURRED}
+
+//
+// MessageId: S_ADS_NOMORE_ROWS
+//
+// MessageText:
+//
+//  No more rows to be obatained by the search result.
+//
+
+  S_ADS_NOMORE_ROWS                = HRESULT($00005012);
+  {$EXTERNALSYM S_ADS_NOMORE_ROWS}
+
+//
+// MessageId: S_ADS_NOMORE_COLUMNS
+//
+// MessageText:
+//
+//  No more columns to be obatained for the current row.
+//
+
+  S_ADS_NOMORE_COLUMNS             = HRESULT($00005013);
+  {$EXTERNALSYM S_ADS_NOMORE_COLUMNS}
+
+//
+// MessageId: E_ADS_INVALID_FILTER
+//
+// MessageText:
+//
+//  The search filter specified is invalid
+//
+
+  E_ADS_INVALID_FILTER             = HRESULT($80005014);
+  {$EXTERNALSYM E_ADS_INVALID_FILTER}
+
+//
+// Globally accessible GUIDS
+//
+
+//#include "adsiid.h" -> adstlb from activeds.dll
+
+//
+// Status codes for ads objects
+//
+
+//#include "adssts.h"
+
+const
+  ADS_PRINTER_PAUSED            = $00000001;
+  {$EXTERNALSYM ADS_PRINTER_PAUSED}
+  ADS_PRINTER_PENDING_DELETION  = $00000002;
+  {$EXTERNALSYM ADS_PRINTER_PENDING_DELETION}
+  ADS_PRINTER_ERROR             = $00000003;
+  {$EXTERNALSYM ADS_PRINTER_ERROR}
+  ADS_PRINTER_PAPER_JAM         = $00000004;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_JAM}
+  ADS_PRINTER_PAPER_OUT         = $00000005;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_OUT}
+  ADS_PRINTER_MANUAL_FEED       = $00000006;
+  {$EXTERNALSYM ADS_PRINTER_MANUAL_FEED}
+  ADS_PRINTER_PAPER_PROBLEM     = $00000007;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_PROBLEM}
+  ADS_PRINTER_OFFLINE           = $00000008;
+  {$EXTERNALSYM ADS_PRINTER_OFFLINE}
+  ADS_PRINTER_IO_ACTIVE         = $00000100;
+  {$EXTERNALSYM ADS_PRINTER_IO_ACTIVE}
+  ADS_PRINTER_BUSY              = $00000200;
+  {$EXTERNALSYM ADS_PRINTER_BUSY}
+  ADS_PRINTER_PRINTING          = $00000400;
+  {$EXTERNALSYM ADS_PRINTER_PRINTING}
+  ADS_PRINTER_OUTPUT_BIN_FULL   = $00000800;
+  {$EXTERNALSYM ADS_PRINTER_OUTPUT_BIN_FULL}
+  ADS_PRINTER_NOT_AVAILABLE     = $00001000;
+  {$EXTERNALSYM ADS_PRINTER_NOT_AVAILABLE}
+  ADS_PRINTER_WAITING           = $00002000;
+  {$EXTERNALSYM ADS_PRINTER_WAITING}
+  ADS_PRINTER_PROCESSING        = $00004000;
+  {$EXTERNALSYM ADS_PRINTER_PROCESSING}
+  ADS_PRINTER_INITIALIZING      = $00008000;
+  {$EXTERNALSYM ADS_PRINTER_INITIALIZING}
+  ADS_PRINTER_WARMING_UP        = $00010000;
+  {$EXTERNALSYM ADS_PRINTER_WARMING_UP}
+  ADS_PRINTER_TONER_LOW         = $00020000;
+  {$EXTERNALSYM ADS_PRINTER_TONER_LOW}
+  ADS_PRINTER_NO_TONER          = $00040000;
+  {$EXTERNALSYM ADS_PRINTER_NO_TONER}
+  ADS_PRINTER_PAGE_PUNT         = $00080000;
+  {$EXTERNALSYM ADS_PRINTER_PAGE_PUNT}
+  ADS_PRINTER_USER_INTERVENTION = $00100000;
+  {$EXTERNALSYM ADS_PRINTER_USER_INTERVENTION}
+  ADS_PRINTER_OUT_OF_MEMORY     = $00200000;
+  {$EXTERNALSYM ADS_PRINTER_OUT_OF_MEMORY}
+  ADS_PRINTER_DOOR_OPEN         = $00400000;
+  {$EXTERNALSYM ADS_PRINTER_DOOR_OPEN}
+  ADS_PRINTER_SERVER_UNKNOWN    = $00800000;
+  {$EXTERNALSYM ADS_PRINTER_SERVER_UNKNOWN}
+  ADS_PRINTER_POWER_SAVE        = $01000000;
+  {$EXTERNALSYM ADS_PRINTER_POWER_SAVE}
+
+//
+// job status values
+//
+
+  ADS_JOB_PAUSED   = $00000001;
+  {$EXTERNALSYM ADS_JOB_PAUSED}
+  ADS_JOB_ERROR    = $00000002;
+  {$EXTERNALSYM ADS_JOB_ERROR}
+  ADS_JOB_DELETING = $00000004;
+  {$EXTERNALSYM ADS_JOB_DELETING}
+  ADS_JOB_SPOOLING = $00000008;
+  {$EXTERNALSYM ADS_JOB_SPOOLING}
+  ADS_JOB_PRINTING = $00000010;
+  {$EXTERNALSYM ADS_JOB_PRINTING}
+  ADS_JOB_OFFLINE  = $00000020;
+  {$EXTERNALSYM ADS_JOB_OFFLINE}
+  ADS_JOB_PAPEROUT = $00000040;
+  {$EXTERNALSYM ADS_JOB_PAPEROUT}
+  ADS_JOB_PRINTED  = $00000080;
+  {$EXTERNALSYM ADS_JOB_PRINTED}
+  ADS_JOB_DELETED  = $00000100;
+  {$EXTERNALSYM ADS_JOB_DELETED}
+
+//
+// service status values
+//
+
+  ADS_SERVICE_STOPPED          = $00000001;
+  {$EXTERNALSYM ADS_SERVICE_STOPPED}
+  ADS_SERVICE_START_PENDING    = $00000002;
+  {$EXTERNALSYM ADS_SERVICE_START_PENDING}
+  ADS_SERVICE_STOP_PENDING     = $00000003;
+  {$EXTERNALSYM ADS_SERVICE_STOP_PENDING}
+  ADS_SERVICE_RUNNING          = $00000004;
+  {$EXTERNALSYM ADS_SERVICE_RUNNING}
+  ADS_SERVICE_CONTINUE_PENDING = $00000005;
+  {$EXTERNALSYM ADS_SERVICE_CONTINUE_PENDING}
+  ADS_SERVICE_PAUSE_PENDING    = $00000006;
+  {$EXTERNALSYM ADS_SERVICE_PAUSE_PENDING}
+  ADS_SERVICE_PAUSED           = $00000007;
+  {$EXTERNALSYM ADS_SERVICE_PAUSED}
+  ADS_SERVICE_ERROR            = $00000008;
+  {$EXTERNALSYM ADS_SERVICE_ERROR}
+
+//---------------------------------------------------------------------
+
+//
+// Service Type Valid Values
+//
+
+  ADS_SERVICE_OWN_PROCESS        = $00000010;
+  {$EXTERNALSYM ADS_SERVICE_OWN_PROCESS}
+  ADS_SERVICE_SHARE_PROCESS      = $00000020;
+  {$EXTERNALSYM ADS_SERVICE_SHARE_PROCESS}
+  ADS_SERVICE_KERNEL_DRIVER      = $00000001;
+  {$EXTERNALSYM ADS_SERVICE_KERNEL_DRIVER}
+  ADS_SERVICE_FILE_SYSTEM_DRIVER = $00000002;
+  {$EXTERNALSYM ADS_SERVICE_FILE_SYSTEM_DRIVER}
+
+//
+// Start Type Valid Values
+//
+
+  ADS_SERVICE_BOOT_START   = SERVICE_BOOT_START;
+  {$EXTERNALSYM ADS_SERVICE_BOOT_START}
+  ADS_SERVICE_SYSTEM_START = SERVICE_SYSTEM_START;
+  {$EXTERNALSYM ADS_SERVICE_SYSTEM_START}
+  ADS_SERVICE_AUTO_START   = SERVICE_AUTO_START;
+  {$EXTERNALSYM ADS_SERVICE_AUTO_START}
+  ADS_SERVICE_DEMAND_START = SERVICE_DEMAND_START;
+  {$EXTERNALSYM ADS_SERVICE_DEMAND_START}
+  ADS_SERVICE_DISABLED     = SERVICE_DISABLED;
+  {$EXTERNALSYM ADS_SERVICE_DISABLED}
+
+//
+// Error Control Values
+//
+
+  ADS_SERVICE_ERROR_IGNORE   = 0;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_IGNORE}
+  ADS_SERVICE_ERROR_NORMAL   = 1;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_NORMAL}
+  ADS_SERVICE_ERROR_SEVERE   = 2;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_SEVERE}
+  ADS_SERVICE_ERROR_CRITICAL = 3;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_CRITICAL}
+
+//
+// Schema class names and other schema related definitions
+//
+
+//#include "adsnms.h"
+
+const
+  NAMESPACE_CLASS_NAME        = 'Namespace';
+  {$EXTERNALSYM NAMESPACE_CLASS_NAME}
+  COUNTRY_CLASS_NAME          = 'Country';
+  {$EXTERNALSYM COUNTRY_CLASS_NAME}
+  LOCALITY_CLASS_NAME         = 'Locality';
+  {$EXTERNALSYM LOCALITY_CLASS_NAME}
+  ORGANIZATION_CLASS_NAME     = 'Organization';
+  {$EXTERNALSYM ORGANIZATION_CLASS_NAME}
+  ORGANIZATIONUNIT_CLASS_NAME = 'Organizational Unit';
+  {$EXTERNALSYM ORGANIZATIONUNIT_CLASS_NAME}
+  DOMAIN_CLASS_NAME           = 'Domain';
+  {$EXTERNALSYM DOMAIN_CLASS_NAME}
+  COMPUTER_CLASS_NAME         = 'Computer';
+  {$EXTERNALSYM COMPUTER_CLASS_NAME}
+  USER_CLASS_NAME             = 'User';
+  {$EXTERNALSYM USER_CLASS_NAME}
+  GROUP_CLASS_NAME            = 'Group';
+  {$EXTERNALSYM GROUP_CLASS_NAME}
+  GLOBALGROUP_CLASS_NAME      = 'GlobalGroup';
+  {$EXTERNALSYM GLOBALGROUP_CLASS_NAME}
+  LOCALGROUP_CLASS_NAME       = 'LocalGroup';
+  {$EXTERNALSYM LOCALGROUP_CLASS_NAME}
+  SERVICE_CLASS_NAME          = 'Service';
+  {$EXTERNALSYM SERVICE_CLASS_NAME}
+  FILESERVICE_CLASS_NAME      = 'FileService';
+  {$EXTERNALSYM FILESERVICE_CLASS_NAME}
+  SESSION_CLASS_NAME          = 'Session';
+  {$EXTERNALSYM SESSION_CLASS_NAME}
+  RESOURCE_CLASS_NAME         = 'Resource';
+  {$EXTERNALSYM RESOURCE_CLASS_NAME}
+  FILESHARE_CLASS_NAME        = 'FileShare';
+  {$EXTERNALSYM FILESHARE_CLASS_NAME}
+  PRINTER_CLASS_NAME          = 'PrintQueue';
+  {$EXTERNALSYM PRINTER_CLASS_NAME}
+  PRINTJOB_CLASS_NAME         = 'PrintJob';
+  {$EXTERNALSYM PRINTJOB_CLASS_NAME}
+  SCHEMA_CLASS_NAME           = 'Schema';
+  {$EXTERNALSYM SCHEMA_CLASS_NAME}
+  CLASS_CLASS_NAME            = 'Class';
+  {$EXTERNALSYM CLASS_CLASS_NAME}
+  PROPERTY_CLASS_NAME         = 'Property';
+  {$EXTERNALSYM PROPERTY_CLASS_NAME}
+  SYNTAX_CLASS_NAME           = 'Syntax';
+  {$EXTERNALSYM SYNTAX_CLASS_NAME}
+  ROOTDSE_CLASS_NAME          = 'RootDSE';
+  {$EXTERNALSYM ROOTDSE_CLASS_NAME}
+
+  NO_SCHEMA                    = '';
+  {$EXTERNALSYM NO_SCHEMA}
+  DOMAIN_SCHEMA_NAME           = 'Domain';
+  {$EXTERNALSYM DOMAIN_SCHEMA_NAME}
+  COMPUTER_SCHEMA_NAME         = 'Computer';
+  {$EXTERNALSYM COMPUTER_SCHEMA_NAME}
+  USER_SCHEMA_NAME             = 'User';
+  {$EXTERNALSYM USER_SCHEMA_NAME}
+  GROUP_SCHEMA_NAME            = 'Group';
+  {$EXTERNALSYM GROUP_SCHEMA_NAME}
+  GLOBALGROUP_SCHEMA_NAME      = 'GlobalGroup';
+  {$EXTERNALSYM GLOBALGROUP_SCHEMA_NAME}
+  LOCALGROUP_SCHEMA_NAME       = 'LocalGroup';
+  {$EXTERNALSYM LOCALGROUP_SCHEMA_NAME}
+  SERVICE_SCHEMA_NAME          = 'Service';
+  {$EXTERNALSYM SERVICE_SCHEMA_NAME}
+  PRINTER_SCHEMA_NAME          = 'PrintQueue';
+  {$EXTERNALSYM PRINTER_SCHEMA_NAME}
+  PRINTJOB_SCHEMA_NAME         = 'PrintJob';
+  {$EXTERNALSYM PRINTJOB_SCHEMA_NAME}
+  FILESERVICE_SCHEMA_NAME      = 'FileService';
+  {$EXTERNALSYM FILESERVICE_SCHEMA_NAME}
+  SESSION_SCHEMA_NAME          = 'Session';
+  {$EXTERNALSYM SESSION_SCHEMA_NAME}
+  RESOURCE_SCHEMA_NAME         = 'Resource';
+  {$EXTERNALSYM RESOURCE_SCHEMA_NAME}
+  FILESHARE_SCHEMA_NAME        = 'FileShare';
+  {$EXTERNALSYM FILESHARE_SCHEMA_NAME}
+  FPNW_FILESERVICE_SCHEMA_NAME = 'FPNWFileService';
+  {$EXTERNALSYM FPNW_FILESERVICE_SCHEMA_NAME}
+  FPNW_SESSION_SCHEMA_NAME     = 'FPNWSession';
+  {$EXTERNALSYM FPNW_SESSION_SCHEMA_NAME}
+  FPNW_RESOURCE_SCHEMA_NAME    = 'FPNWResource';
+  {$EXTERNALSYM FPNW_RESOURCE_SCHEMA_NAME}
+  FPNW_FILESHARE_SCHEMA_NAME   = 'FPNWFileShare';
+  {$EXTERNALSYM FPNW_FILESHARE_SCHEMA_NAME}
+
+//
+// Definitions in the OLE DB provider for ADSI
+//
+
+//#include "adsdb.h"
+
+//
+// printer status values
+//
+
+// Most of the constants have been moved into an enum in adstype.h and
+// are available publicly in iads.h. This file has been left here so that
+// old references to adsdb.h do not break compiles.
+
+const
+  DBPROPFLAGS_ADSISEARCH        = $0000C000;
+  {$EXTERNALSYM DBPROPFLAGS_ADSISEARCH}
+
+//#include "adsprop.h"
+
+//  Windows NT Active Directory Service Property Pages
+//
+//  Contents:   Functions and definitions used in the creation of AD property
+//              sheets.
+
+const
+  WM_ADSPROP_NOTIFY_PAGEINIT   = WM_USER + 1101; // where LPARAM is the PADSPROPINITPARAMS pointer.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_PAGEINIT}
+  WM_ADSPROP_NOTIFY_PAGEHWND   = WM_USER + 1102; // where WPARAM => page's HWND
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_PAGEHWND}
+  WM_ADSPROP_NOTIFY_CHANGE     = WM_USER + 1103; // used to send a change notification to a parent sheet
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_CHANGE}
+  WM_ADSPROP_NOTIFY_APPLY      = WM_USER + 1104; // pages send this to the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_APPLY}
+  WM_ADSPROP_NOTIFY_SETFOCUS   = WM_USER + 1105; // used internally by the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_SETFOCUS}
+  WM_ADSPROP_NOTIFY_FOREGROUND = WM_USER + 1106; // used internally by the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_FOREGROUND}
+  WM_ADSPROP_NOTIFY_EXIT       = WM_USER + 1107; // sent on page release
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_EXIT}
+
+//+----------------------------------------------------------------------------
+//
+//  Structure:  ADSPROPINITPARAMS
+//
+//  Usage:      Used to pass page initialization information to new pages from
+//              the notify object.
+//
+//-----------------------------------------------------------------------------
+
+type
+  PADSPROPINITPARAMS = ^ADSPROPINITPARAMS;
+  {$EXTERNALSYM PADSPROPINITPARAMS}
+  _ADSPROPINITPARAMS = record
+    dwSize: DWORD;            // Set this to the size of the struct.
+    dwFlags: DWORD;           // Reserved for future use.
+    hr: HRESULT;              // If this is non-zero, then the others
+    pDsObj: IDirectoryObject; // should be ignored.
+    pwzCN: LPWSTR;
+    pWritableAttrs: PADS_ATTR_INFO;
+  end;
+  {$EXTERNALSYM _ADSPROPINITPARAMS}
+  ADSPROPINITPARAMS = _ADSPROPINITPARAMS;
+  {$EXTERNALSYM ADSPROPINITPARAMS}
+  TAdsPropInitParams = ADSPROPINITPARAMS;
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropCreateNotifyObj
+//
+//  Synopsis:   Checks to see if the notification window/object exists for this
+//              sheet instance and if not creates it.
+//
+//  Arguments:  [pAppThdDataObj] - the unmarshalled data object pointer.
+//              [pwzADsObjName]  - object path name.
+//              [phNotifyObj]    - to return the notificion window handle.
+//
+//  Returns:    HRESULTs.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropCreateNotifyObj(pAppThdDataObj: Pointer; {LPDATAOBJECT}
+  pwzADsObjName: PWSTR; var phNotifyObj: HWND): HRESULT; stdcall;
+{$EXTERNALSYM ADsPropCreateNotifyObj}
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropGetInitInfo
+//
+//  Synopsis:   Pages call this at their init time to retreive DS object info.
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [pInitParams] - struct filled in with DS object info. This
+//                              struct must be allocated by the caller before
+//                              the call.
+//
+//  Returns:    FALSE if the notify window has gone away for some reason or
+//              if the parameters are invalid.
+//
+//  Notes:      This call results in the sending of the
+//              WM_ADSPROP_NOTIFY_PAGEINIT message to the notify window.
+//              pInitParams->pWritableAttrs can be NULL if there are no
+//              writable attributes.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropGetInitInfo(hNotifyObj: HWND; pInitParams: PADSPROPINITPARAMS): BOOL; stdcall;
+{$EXTERNALSYM ADsPropGetInitInfo}
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropSetHwnd
+//
+//  Synopsis:   Pages call this at their dialog init time to send their hwnd.
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [hPage]       - the page's window handle.
+//
+//  Returns:    FALSE if the notify window has gone away for some reason.
+//
+//  Notes:      Sends the WM_ADSPROP_NOTIFY_PAGEHWND message to the notify
+//              window.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropSetHwnd(hNotifyObj: HWND; hPage: HWND): BOOL; stdcall;
+{$EXTERNALSYM ADsPropSetHwnd}
+
+//+----------------------------------------------------------------------------
+//
+//  function:   ADsPropCheckIfWritable
+//
+//  Synopsis:   See if the attribute is writable by checking if it is in
+//              the allowedAttributesEffective array.
+//
+//  Arguments:  [pwzAttr]        - the attribute name.
+//              [pWritableAttrs] - the array of writable attributes.
+//
+//  Returns:    FALSE if the attribute name is not found in the writable-attrs
+//              array or if the array pointer is NULL.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropCheckIfWritable(pwzAttr: PWSTR; pWritableAttrs: PADS_ATTR_INFO): BOOL; stdcall;
+{$EXTERNALSYM ADsPropCheckIfWritable}
+
+implementation
+
+const
+  adslib = 'activeds.dll';
+  dsprop = 'dsprop.dll';
+
+// adshlp.h
+
+function _ADsFreeEnumerator(pEnumVariant: IEnumVARIANT): HRESULT; stdcall; external adslib name 'ADsFreeEnumerator';
+
+function ADsFreeEnumerator(var pEnumVariant: IEnumVARIANT): HRESULT;
+begin
+  Result := _ADsFreeEnumerator(pEnumVariant);
+  // ADsFreeEnumerator doesn't set pEnumVariant to nil causing Delphi to call
+  // Release() again when pEnumVariant leaves scope. Result would be an access
+  // violation, explicitly setting the interface to nil prevents this.
+  if Result = 0 {S_OK} then
+    Pointer(pEnumVariant) := nil;
+end;
+
+//procedure ADsFreeAllErrorRecords
+
+// adsprop.h
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _ADsGetObject: Pointer;
+
+function ADsGetObject;
+begin
+  GetProcedureAddress(_ADsGetObject, adslib, 'ADsGetObject');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsGetObject]
+  end;
+end;
+
+var
+  _ADsBuildEnumerator: Pointer;
+
+function ADsBuildEnumerator;
+begin
+  GetProcedureAddress(_ADsBuildEnumerator, adslib, 'ADsBuildEnumerator');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildEnumerator]
+  end;
+end;
+
+var
+  _ADsEnumerateNext: Pointer;
+
+function ADsEnumerateNext;
+begin
+  GetProcedureAddress(_ADsEnumerateNext, adslib, 'ADsEnumerateNext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsEnumerateNext]
+  end;
+end;
+
+var
+  _ADsBuildVarArrayStr: Pointer;
+
+function ADsBuildVarArrayStr;
+begin
+  GetProcedureAddress(_ADsBuildVarArrayStr, adslib, 'ADsBuildVarArrayStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildVarArrayStr]
+  end;
+end;
+
+var
+  _ADsBuildVarArrayInt: Pointer;
+
+function ADsBuildVarArrayInt;
+begin
+  GetProcedureAddress(_ADsBuildVarArrayInt, adslib, 'ADsBuildVarArrayInt');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildVarArrayInt]
+  end;
+end;
+
+var
+  _ADsOpenObject: Pointer;
+
+function ADsOpenObject;
+begin
+  GetProcedureAddress(_ADsOpenObject, adslib, 'ADsOpenObject');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsOpenObject]
+  end;
+end;
+
+var
+  _ADsGetLastError: Pointer;
+
+function ADsGetLastError;
+begin
+  GetProcedureAddress(_ADsGetLastError, adslib, 'ADsGetLastError');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsGetLastError]
+  end;
+end;
+
+var
+  _ADsSetLastError: Pointer;
+
+procedure ADsSetLastError;
+begin
+  GetProcedureAddress(_ADsSetLastError, adslib, 'ADsSetLastError');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsSetLastError]
+  end;
+end;
+
+var
+  _AllocADsMem: Pointer;
+
+function AllocADsMem;
+begin
+  GetProcedureAddress(_AllocADsMem, adslib, 'AllocADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AllocADsMem]
+  end;
+end;
+
+var
+  _FreeADsMem: Pointer;
+
+function FreeADsMem;
+begin
+  GetProcedureAddress(_FreeADsMem, adslib, 'FreeADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeADsMem]
+  end;
+end;
+
+var
+  _ReallocADsMem: Pointer;
+
+function ReallocADsMem;
+begin
+  GetProcedureAddress(_ReallocADsMem, adslib, 'ReallocADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReallocADsMem]
+  end;
+end;
+
+var
+  _AllocADsStr: Pointer;
+
+function AllocADsStr;
+begin
+  GetProcedureAddress(_AllocADsStr, adslib, 'AllocADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AllocADsStr]
+  end;
+end;
+
+var
+  _FreeADsStr: Pointer;
+
+function FreeADsStr;
+begin
+  GetProcedureAddress(_FreeADsStr, adslib, 'FreeADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeADsStr]
+  end;
+end;
+
+var
+  _ReallocADsStr: Pointer;
+
+function ReallocADsStr;
+begin
+  GetProcedureAddress(_ReallocADsStr, adslib, 'ReallocADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReallocADsStr]
+  end;
+end;
+
+var
+  _ADsEncodeBinaryData: Pointer;
+
+function ADsEncodeBinaryData;
+begin
+  GetProcedureAddress(_ADsEncodeBinaryData, adslib, 'ADsEncodeBinaryData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsEncodeBinaryData]
+  end;
+end;
+
+var
+  _ADsDecodeBinaryData: Pointer;
+
+function ADsDecodeBinaryData;
+begin
+  GetProcedureAddress(_ADsDecodeBinaryData, adslib, 'ADsDecodeBinaryData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsDecodeBinaryData]
+  end;
+end;
+
+var
+  _PropVariantToAdsType: Pointer;
+
+function PropVariantToAdsType;
+begin
+  GetProcedureAddress(_PropVariantToAdsType, adslib, 'PropVariantToAdsType');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_PropVariantToAdsType]
+  end;
+end;
+
+var
+  _AdsTypeToPropVariant: Pointer;
+
+function AdsTypeToPropVariant;
+begin
+  GetProcedureAddress(_AdsTypeToPropVariant, adslib, 'AdsTypeToPropVariant');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AdsTypeToPropVariant]
+  end;
+end;
+
+var
+  _AdsFreeAdsValues: Pointer;
+
+procedure AdsFreeAdsValues;
+begin
+  GetProcedureAddress(_AdsFreeAdsValues, adslib, 'AdsFreeAdsValues');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AdsFreeAdsValues]
+  end;
+end;
+
+var
+  _ADsPropCreateNotifyObj: Pointer;
+
+function ADsPropCreateNotifyObj;
+begin
+  GetProcedureAddress(_ADsPropCreateNotifyObj, dsprop, 'ADsPropCreateNotifyObj');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropCreateNotifyObj]
+  end;
+end;
+
+var
+  _ADsPropGetInitInfo: Pointer;
+
+function ADsPropGetInitInfo;
+begin
+  GetProcedureAddress(_ADsPropGetInitInfo, dsprop, 'ADsPropGetInitInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropGetInitInfo]
+  end;
+end;
+
+var
+  _ADsPropSetHwnd: Pointer;
+
+function ADsPropSetHwnd;
+begin
+  GetProcedureAddress(_ADsPropSetHwnd, dsprop, 'ADsPropSetHwnd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropSetHwnd]
+  end;
+end;
+
+var
+  _ADsPropCheckIfWritable: Pointer;
+
+function ADsPropCheckIfWritable;
+begin
+  GetProcedureAddress(_ADsPropCheckIfWritable, dsprop, 'ADsPropCheckIfWritable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropCheckIfWritable]
+  end;
+end;
+
+{$ELSE}
+
+function ADsGetObject; external adslib name 'ADsGetObject';
+function ADsBuildEnumerator; external adslib name 'ADsBuildEnumerator';
+function ADsEnumerateNext; external adslib name 'ADsEnumerateNext';
+function ADsBuildVarArrayStr; external adslib name 'ADsBuildVarArrayStr';
+function ADsBuildVarArrayInt; external adslib name 'ADsBuildVarArrayInt';
+function ADsOpenObject; external adslib name 'ADsOpenObject';
+function ADsGetLastError; external adslib name 'ADsGetLastError';
+procedure ADsSetLastError; external adslib name 'ADsSetLastError';
+function AllocADsMem; external adslib name 'AllocADsMem';
+function FreeADsMem; external adslib name 'FreeADsMem';
+function ReallocADsMem; external adslib name 'ReallocADsMem';
+function AllocADsStr; external adslib name 'AllocADsStr';
+function FreeADsStr; external adslib name 'FreeADsStr';
+function ReallocADsStr; external adslib name 'ReallocADsStr';
+function ADsEncodeBinaryData; external adslib name 'ADsEncodeBinaryData';
+function ADsDecodeBinaryData; external adslib name 'ADsDecodeBinaryData';
+function PropVariantToAdsType; external adslib name 'PropVariantToAdsType';
+function AdsTypeToPropVariant; external adslib name 'AdsTypeToPropVariant';
+procedure AdsFreeAdsValues; external adslib name 'AdsFreeAdsValues';
+function ADsPropCreateNotifyObj; external dsprop name 'ADsPropCreateNotifyObj';
+function ADsPropGetInitInfo; external dsprop name 'ADsPropGetInitInfo';
+function ADsPropSetHwnd; external dsprop name 'ADsPropSetHwnd';
+function ADsPropCheckIfWritable; external dsprop name 'ADsPropCheckIfWritable';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 73 - 0
packages/extra/winunits/jwaadsdb.pas

@@ -0,0 +1,73 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory OLE DB Provider API interface Unit for Object Pascal        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adsdb.h, released June 2000. The original Pascal       }
+{ code is: AdsDb.pas, released December 2000. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdsDb;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adsdb.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//  Contents:   Definitions for the OLE DB provider for ADSI
+
+//
+// printer status values
+//
+
+// Most of the constants have been moved into an enum in adstype.h and
+// are available publicly in iads.h. This file has been left here so that
+// old references to adsdb.h do not break compiles.
+
+const
+  DBPROPFLAGS_ADSISEARCH        = $0000C000;
+  {$EXTERNALSYM DBPROPFLAGS_ADSISEARCH}
+
+implementation
+
+end.

+ 323 - 0
packages/extra/winunits/jwaadserr.pas

@@ -0,0 +1,323 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Error Codes API interface Unit for Object Pascal            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adserr.h, released June 2000. The original Pascal      }
+{ code is: AdsErr.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdsErr;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adserr.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//
+//  Values are 32 bit values layed out as follows:
+//
+//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+//  +---+-+-+-----------------------+-------------------------------+
+//  |Sev|C|R|     Facility          |               Code            |
+//  +---+-+-+-----------------------+-------------------------------+
+//
+//  where
+//
+//      Sev - is the severity code
+//
+//          00 - Success
+//          01 - Informational
+//          10 - Warning
+//          11 - Error
+//
+//      C - is the Customer code flag
+//
+//      R - is a reserved bit
+//
+//      Facility - is the facility code
+//
+//      Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+const
+  FACILITY_WINDOWS  = 8;
+  {$EXTERNALSYM FACILITY_WINDOWS}
+  FACILITY_STORAGE  = 3;
+  {$EXTERNALSYM FACILITY_STORAGE}
+  FACILITY_RPC      = 1;
+  {$EXTERNALSYM FACILITY_RPC}
+  FACILITY_SSPI     = 9;
+  {$EXTERNALSYM FACILITY_SSPI}
+  FACILITY_WIN32    = 7;
+  {$EXTERNALSYM FACILITY_WIN32}
+  FACILITY_CONTROL  = 10;
+  {$EXTERNALSYM FACILITY_CONTROL}
+  FACILITY_NULL     = 0;
+  {$EXTERNALSYM FACILITY_NULL}
+  FACILITY_ITF      = 4;
+  {$EXTERNALSYM FACILITY_ITF}
+  FACILITY_DISPATCH = 2;
+  {$EXTERNALSYM FACILITY_DISPATCH}
+
+//
+// Define the severity codes
+//
+
+//
+// MessageId: E_ADS_BAD_PATHNAME
+//
+// MessageText:
+//
+//  An invalid directory pathname was passed
+//
+  E_ADS_BAD_PATHNAME = HRESULT($80005000);
+  {$EXTERNALSYM E_ADS_BAD_PATHNAME}
+
+//
+// MessageId: E_ADS_INVALID_DOMAIN_OBJECT
+//
+// MessageText:
+//
+//  An unknown directory domain object was requested
+//
+  E_ADS_INVALID_DOMAIN_OBJECT = HRESULT($80005001);
+  {$EXTERNALSYM E_ADS_INVALID_DOMAIN_OBJECT}
+
+//
+// MessageId: E_ADS_INVALID_USER_OBJECT
+//
+// MessageText:
+//
+//  An unknown directory user object was requested
+//
+  E_ADS_INVALID_USER_OBJECT = HRESULT($80005002);
+  {$EXTERNALSYM E_ADS_INVALID_USER_OBJECT}
+
+//
+// MessageId: E_ADS_INVALID_COMPUTER_OBJECT
+//
+// MessageText:
+//
+//  An unknown directory computer object was requested
+//
+  E_ADS_INVALID_COMPUTER_OBJECT = HRESULT($80005003);
+  {$EXTERNALSYM E_ADS_INVALID_COMPUTER_OBJECT}
+
+//
+// MessageId: E_ADS_UNKNOWN_OBJECT
+//
+// MessageText:
+//
+//  An unknown directory object was requested
+//
+  E_ADS_UNKNOWN_OBJECT = HRESULT($80005004);
+  {$EXTERNALSYM E_ADS_UNKNOWN_OBJECT}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_SET
+//
+// MessageText:
+//
+//  The specified directory property was not set
+//
+  E_ADS_PROPERTY_NOT_SET = HRESULT($80005005);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_SET}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_SUPPORTED
+//
+// MessageText:
+//
+//  The specified directory property is not supported
+//
+  E_ADS_PROPERTY_NOT_SUPPORTED = HRESULT($80005006);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_SUPPORTED}
+
+//
+// MessageId: E_ADS_PROPERTY_INVALID
+//
+// MessageText:
+//
+//  The specified directory property is invalid
+//
+  E_ADS_PROPERTY_INVALID = HRESULT($80005007);
+  {$EXTERNALSYM E_ADS_PROPERTY_INVALID}
+
+//
+// MessageId: E_ADS_BAD_PARAMETER
+//
+// MessageText:
+//
+//  One or more input parameters are invalid
+//
+  E_ADS_BAD_PARAMETER = HRESULT($80005008);
+  {$EXTERNALSYM E_ADS_BAD_PARAMETER}
+
+//
+// MessageId: E_ADS_OBJECT_UNBOUND
+//
+// MessageText:
+//
+//  The specified directory object is not bound to a remote resource
+//
+  E_ADS_OBJECT_UNBOUND = HRESULT($80005009);
+  {$EXTERNALSYM E_ADS_OBJECT_UNBOUND}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_MODIFIED
+//
+// MessageText:
+//
+//  The specified directory object has not been modified
+//
+  E_ADS_PROPERTY_NOT_MODIFIED = HRESULT($8000500A);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_MODIFIED}
+
+//
+// MessageId: E_ADS_PROPERTY_MODIFIED
+//
+// MessageText:
+//
+//  The specified directory object has been modified
+//
+  E_ADS_PROPERTY_MODIFIED = HRESULT($8000500B);
+  {$EXTERNALSYM E_ADS_PROPERTY_MODIFIED}
+
+//
+// MessageId: E_ADS_CANT_CONVERT_DATATYPE
+//
+// MessageText:
+//
+//  The directory datatype cannot be converted to/from a native DS datatype
+//
+  E_ADS_CANT_CONVERT_DATATYPE = HRESULT($8000500C);
+  {$EXTERNALSYM E_ADS_CANT_CONVERT_DATATYPE}
+
+//
+// MessageId: E_ADS_PROPERTY_NOT_FOUND
+//
+// MessageText:
+//
+//  The directory property cannot be found in the cache.
+//
+  E_ADS_PROPERTY_NOT_FOUND = HRESULT($8000500D);
+  {$EXTERNALSYM E_ADS_PROPERTY_NOT_FOUND}
+
+//
+// MessageId: E_ADS_OBJECT_EXISTS
+//
+// MessageText:
+//
+//  The directory object exists.
+//
+  E_ADS_OBJECT_EXISTS = HRESULT($8000500E);
+  {$EXTERNALSYM E_ADS_OBJECT_EXISTS}
+
+//
+// MessageId: E_ADS_SCHEMA_VIOLATION
+//
+// MessageText:
+//
+//  The attempted action violates the DS schema rules.
+//
+  E_ADS_SCHEMA_VIOLATION = HRESULT($8000500F);
+  {$EXTERNALSYM E_ADS_SCHEMA_VIOLATION}
+
+//
+// MessageId: E_ADS_COLUMN_NOT_SET
+//
+// MessageText:
+//
+//  The specified column in the directory was not set.
+//
+  E_ADS_COLUMN_NOT_SET = HRESULT($80005010);
+  {$EXTERNALSYM E_ADS_COLUMN_NOT_SET}
+
+//
+// MessageId: S_ADS_ERRORSOCCURRED
+//
+// MessageText:
+//
+//  One or more errors occurred
+//
+  S_ADS_ERRORSOCCURRED = HRESULT($00005011);
+  {$EXTERNALSYM S_ADS_ERRORSOCCURRED}
+
+//
+// MessageId: S_ADS_NOMORE_ROWS
+//
+// MessageText:
+//
+//  No more rows to be obatained by the search result.
+//
+  S_ADS_NOMORE_ROWS = HRESULT($00005012);
+  {$EXTERNALSYM S_ADS_NOMORE_ROWS}
+
+//
+// MessageId: S_ADS_NOMORE_COLUMNS
+//
+// MessageText:
+//
+//  No more columns to be obatained for the current row.
+//
+  S_ADS_NOMORE_COLUMNS = HRESULT($00005013);
+  {$EXTERNALSYM S_ADS_NOMORE_COLUMNS}
+
+//
+// MessageId: E_ADS_INVALID_FILTER
+//
+// MessageText:
+//
+//  The search filter specified is invalid
+//
+  E_ADS_INVALID_FILTER = HRESULT($80005014);
+  {$EXTERNALSYM E_ADS_INVALID_FILTER}
+
+implementation
+
+end.

+ 485 - 0
packages/extra/winunits/jwaadshlp.pas

@@ -0,0 +1,485 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Helper Functions API interface Unit for Object Pascal       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adshlp.h, released June 2000. The original Pascal      }
+{ code is: AdsHlp.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdsHlp;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adshlp.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaAdsTLB, JwaWinType, JwaWinNT;
+
+function ADsGetObject(lpszPathName: LPCWSTR; const riid: TGUID; out ppObject: Pointer): HRESULT; stdcall;
+{$EXTERNALSYM ADsGetObject}
+
+function ADsBuildEnumerator(pADsContainer: IADsContainer; out ppEnumVariant: IEnumVARIANT): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildEnumerator}
+
+function ADsFreeEnumerator(pEnumVariant: IEnumVARIANT): HRESULT; stdcall;
+{$EXTERNALSYM ADsFreeEnumerator}
+
+function ADsEnumerateNext(pEnumVariant: IEnumVARIANT; cElements: ULONG;
+  var pvar: OleVariant; var pcElementsFetched: ULONG): HRESULT; stdcall;
+{$EXTERNALSYM ADsEnumerateNext}
+
+function ADsBuildVarArrayStr(lppPathNames: LPWSTR; dwPathNames: DWORD;
+  var pVar: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildVarArrayStr}
+
+function ADsBuildVarArrayInt(lpdwObjectTypes: LPDWORD; dwObjectTypes: DWORD;
+  var pVar: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM ADsBuildVarArrayInt}
+
+function ADsOpenObject(lpszPathName, lpszUserName, lpszPassword: LPCWSTR;
+  dwReserved: DWORD; const riid: TGUID; out ppObject: Pointer): HRESULT; stdcall;
+{$EXTERNALSYM ADsOpenObject}
+
+//
+// Helper functions for extended error support
+//
+
+function ADsGetLastError(var lpError: DWORD; lpErrorBuf: LPWSTR;
+  dwErrorBufLen: DWORD; lpNameBuf: LPWSTR; dwNameBufLen: DWORD): HRESULT; stdcall;
+{$EXTERNALSYM ADsGetLastError}
+
+procedure ADsSetLastError(dwErr: DWORD; pszError, pszProvider: LPCWSTR); stdcall;
+{$EXTERNALSYM ADsSetLastError}
+
+//procedure ADsFreeAllErrorRecords; stdcall;
+//{$EXTERNALSYM ADsFreeAllErrorRecords}
+
+function AllocADsMem(cb: DWORD): LPVOID; stdcall;
+{$EXTERNALSYM AllocADsMem}
+
+function FreeADsMem(pMem: LPVOID): BOOL; stdcall;
+{$EXTERNALSYM FreeADsMem}
+
+function ReallocADsMem(pOldMem: LPVOID; cbOld, cbNew: DWORD): LPVOID; stdcall;
+{$EXTERNALSYM ReallocADsMem}
+
+function AllocADsStr(pStr: LPCWSTR): LPWSTR; stdcall;
+{$EXTERNALSYM AllocADsStr}
+
+function FreeADsStr(pStr: LPWSTR): BOOL; stdcall;
+{$EXTERNALSYM FreeADsStr}
+
+function ReallocADsStr(var ppStr: LPWSTR; pStr: LPWSTR): BOOL; stdcall;
+{$EXTERNALSYM ReallocADsStr}
+
+function ADsEncodeBinaryData(pbSrcData: PBYTE; dwSrcLen: DWORD;
+  var ppszDestData: LPWSTR): HRESULT; stdcall;
+{$EXTERNALSYM ADsEncodeBinaryData}
+
+function ADsDecodeBinaryData(szSrcData: LPCWSTR; var ppbDestData: PBYTE;
+  var pdwDestLen: ULONG): HRESULT; stdcall;
+{$EXTERNALSYM ADsDecodeBinaryData}
+
+type
+  // imports of a type library sometimes are missing a few decls, these are just
+  // a few of them to make this file compile at all. I really should do all of
+  // them one day.
+
+  PADSVALUE = ^_adsvalue;
+  {$EXTERNALSYM PADSVALUE}
+  PADS_ATTR_INFO = ^_ads_attr_info;
+  {$EXTERNALSYM PADS_ATTR_INFO}
+
+function PropVariantToAdsType(var pVariant: OleVariant; dwNumVariant: DWORD;
+  var ppAdsValues: PADSVALUE; pdwNumValues: PDWORD): HRESULT; stdcall;
+{$EXTERNALSYM PropVariantToAdsType}
+
+function AdsTypeToPropVariant(pAdsValues: PADSVALUE; dwNumValues: DWORD;
+  var pVariant: OleVariant): HRESULT; stdcall;
+{$EXTERNALSYM AdsTypeToPropVariant}
+
+procedure AdsFreeAdsValues(pAdsValues: PADSVALUE; dwNumValues: DWORD); stdcall;
+{$EXTERNALSYM AdsFreeAdsValues}
+
+//
+// Helper routines to convert IADsSecurityDescriptor to a binary
+// security descriptor and also to convert a binary SD to 
+// IADsSecurityDescriptor.
+//
+
+// TODO VARIANT!
+
+function BinarySDToSecurityDescriptor(pSecurityDescriptor: PSECURITY_DESCRIPTOR;
+  var pVarsec: VARIANT; pszServerName, userName, passWord: LPCWSTR; dwFlags: DWORD): HRESULT; stdcall;
+{$EXTERNALSYM BinarySDToSecurityDescriptor}
+
+function SecurityDescriptorToBinarySD(vVarSecDes: VARIANT;
+  var ppSecurityDescriptor: PSECURITY_DESCRIPTOR; pdwSDLength: PDWORD;
+  pszServerName, userName, passWord: LPCWSTR; dwFlags: DWORD): HRESULT; stdcall;
+{$EXTERNALSYM SecurityDescriptorToBinarySD}
+
+implementation
+
+const
+  adslib = 'activeds.dll';
+
+//procedure ADsFreeAllErrorRecords
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _ADsGetObject: Pointer;
+
+function ADsGetObject;
+begin
+  GetProcedureAddress(_ADsGetObject, adslib, 'ADsGetObject');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsGetObject]
+  end;
+end;
+
+var
+  _ADsBuildEnumerator: Pointer;
+
+function ADsBuildEnumerator;
+begin
+  GetProcedureAddress(_ADsBuildEnumerator, adslib, 'ADsBuildEnumerator');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildEnumerator]
+  end;
+end;
+
+var
+  _ADsFreeEnumerator: Pointer;
+
+function ADsFreeEnumerator;
+begin
+  GetProcedureAddress(_ADsFreeEnumerator, adslib, 'ADsFreeEnumerator');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsFreeEnumerator]
+  end;
+end;
+
+var
+  _ADsEnumerateNext: Pointer;
+
+function ADsEnumerateNext;
+begin
+  GetProcedureAddress(_ADsEnumerateNext, adslib, 'ADsEnumerateNext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsEnumerateNext]
+  end;
+end;
+
+var
+  _ADsBuildVarArrayStr: Pointer;
+
+function ADsBuildVarArrayStr;
+begin
+  GetProcedureAddress(_ADsBuildVarArrayStr, adslib, 'ADsBuildVarArrayStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildVarArrayStr]
+  end;
+end;
+
+var
+  _ADsBuildVarArrayInt: Pointer;
+
+function ADsBuildVarArrayInt;
+begin
+  GetProcedureAddress(_ADsBuildVarArrayInt, adslib, 'ADsBuildVarArrayInt');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsBuildVarArrayInt]
+  end;
+end;
+
+var
+  _ADsOpenObject: Pointer;
+
+function ADsOpenObject;
+begin
+  GetProcedureAddress(_ADsOpenObject, adslib, 'ADsOpenObject');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsOpenObject]
+  end;
+end;
+
+var
+  _ADsGetLastError: Pointer;
+
+function ADsGetLastError;
+begin
+  GetProcedureAddress(_ADsGetLastError, adslib, 'ADsGetLastError');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsGetLastError]
+  end;
+end;
+
+var
+  _ADsSetLastError: Pointer;
+
+procedure ADsSetLastError;
+begin
+  GetProcedureAddress(_ADsSetLastError, adslib, 'ADsSetLastError');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsSetLastError]
+  end;
+end;
+
+var
+  _AllocADsMem: Pointer;
+
+function AllocADsMem;
+begin
+  GetProcedureAddress(_AllocADsMem, adslib, 'AllocADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AllocADsMem]
+  end;
+end;
+
+var
+  _FreeADsMem: Pointer;
+
+function FreeADsMem;
+begin
+  GetProcedureAddress(_FreeADsMem, adslib, 'FreeADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeADsMem]
+  end;
+end;
+
+var
+  _ReallocADsMem: Pointer;
+
+function ReallocADsMem;
+begin
+  GetProcedureAddress(_ReallocADsMem, adslib, 'ReallocADsMem');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReallocADsMem]
+  end;
+end;
+
+var
+  _AllocADsStr: Pointer;
+
+function AllocADsStr;
+begin
+  GetProcedureAddress(_AllocADsStr, adslib, 'AllocADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AllocADsStr]
+  end;
+end;
+
+var
+  _FreeADsStr: Pointer;
+
+function FreeADsStr;
+begin
+  GetProcedureAddress(_FreeADsStr, adslib, 'FreeADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeADsStr]
+  end;
+end;
+
+var
+  _ReallocADsStr: Pointer;
+
+function ReallocADsStr;
+begin
+  GetProcedureAddress(_ReallocADsStr, adslib, 'ReallocADsStr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReallocADsStr]
+  end;
+end;
+
+var
+  _ADsEncodeBinaryData: Pointer;
+
+function ADsEncodeBinaryData;
+begin
+  GetProcedureAddress(_ADsEncodeBinaryData, adslib, 'ADsEncodeBinaryData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsEncodeBinaryData]
+  end;
+end;
+
+var
+  _ADsDecodeBinaryData: Pointer;
+
+function ADsDecodeBinaryData;
+begin
+  GetProcedureAddress(_ADsDecodeBinaryData, adslib, 'ADsDecodeBinaryData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsDecodeBinaryData]
+  end;
+end;
+
+var
+  _PropVariantToAdsType: Pointer;
+
+function PropVariantToAdsType;
+begin
+  GetProcedureAddress(_PropVariantToAdsType, adslib, 'PropVariantToAdsType');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_PropVariantToAdsType]
+  end;
+end;
+
+var
+  _AdsTypeToPropVariant: Pointer;
+
+function AdsTypeToPropVariant;
+begin
+  GetProcedureAddress(_AdsTypeToPropVariant, adslib, 'AdsTypeToPropVariant');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AdsTypeToPropVariant]
+  end;
+end;
+
+var
+  _AdsFreeAdsValues: Pointer;
+
+procedure AdsFreeAdsValues;
+begin
+  GetProcedureAddress(_AdsFreeAdsValues, adslib, 'AdsFreeAdsValues');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AdsFreeAdsValues]
+  end;
+end;
+
+var
+  _BinarySDToSecurityDescriptor: Pointer;
+
+function BinarySDToSecurityDescriptor;
+begin
+  GetProcedureAddress(_BinarySDToSecurityDescriptor, adslib, 'BinarySDToSecurityDescriptor');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BinarySDToSecurityDescriptor]
+  end;
+end;
+
+var
+  _SecurityDescriptorToBinarySD: Pointer;
+
+function SecurityDescriptorToBinarySD;
+begin
+  GetProcedureAddress(_SecurityDescriptorToBinarySD, adslib, 'SecurityDescriptorToBinarySD');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SecurityDescriptorToBinarySD]
+  end;
+end;
+
+{$ELSE}
+
+function ADsGetObject; external adslib name 'ADsGetObject';
+function ADsBuildEnumerator; external adslib name 'ADsBuildEnumerator';
+function ADsFreeEnumerator; external adslib name 'ADsFreeEnumerator';
+function ADsEnumerateNext; external adslib name 'ADsEnumerateNext';
+function ADsBuildVarArrayStr; external adslib name 'ADsBuildVarArrayStr';
+function ADsBuildVarArrayInt; external adslib name 'ADsBuildVarArrayInt';
+function ADsOpenObject; external adslib name 'ADsOpenObject';
+function ADsGetLastError; external adslib name 'ADsGetLastError';
+procedure ADsSetLastError; external adslib name 'ADsSetLastError';
+function AllocADsMem; external adslib name 'AllocADsMem';
+function FreeADsMem; external adslib name 'FreeADsMem';
+function ReallocADsMem; external adslib name 'ReallocADsMem';
+function AllocADsStr; external adslib name 'AllocADsStr';
+function FreeADsStr; external adslib name 'FreeADsStr';
+function ReallocADsStr; external adslib name 'ReallocADsStr';
+function ADsEncodeBinaryData; external adslib name 'ADsEncodeBinaryData';
+function ADsDecodeBinaryData; external adslib name 'ADsDecodeBinaryData';
+function PropVariantToAdsType; external adslib name 'PropVariantToAdsType';
+function AdsTypeToPropVariant; external adslib name 'AdsTypeToPropVariant';
+procedure AdsFreeAdsValues; external adslib name 'AdsFreeAdsValues';
+function BinarySDToSecurityDescriptor; external adslib name 'BinarySDToSecurityDescriptor';
+function SecurityDescriptorToBinarySD; external adslib name 'SecurityDescriptorToBinarySD';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 146 - 0
packages/extra/winunits/jwaadsnms.pas

@@ -0,0 +1,146 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Class Names API interface Unit for Object Pascal            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adsnms.h, released June 2000. The original Pascal      }
+{ code is: AdsNms.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdsnms;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adsnms.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//  Contents:   Class Names and schema definitions for ADS objects
+
+const
+  NAMESPACE_CLASS_NAME        = 'Namespace';
+  {$EXTERNALSYM NAMESPACE_CLASS_NAME}
+  COUNTRY_CLASS_NAME          = 'Country';
+  {$EXTERNALSYM COUNTRY_CLASS_NAME}
+  LOCALITY_CLASS_NAME         = 'Locality';
+  {$EXTERNALSYM LOCALITY_CLASS_NAME}
+  ORGANIZATION_CLASS_NAME     = 'Organization';
+  {$EXTERNALSYM ORGANIZATION_CLASS_NAME}
+  ORGANIZATIONUNIT_CLASS_NAME = 'Organizational Unit';
+  {$EXTERNALSYM ORGANIZATIONUNIT_CLASS_NAME}
+  DOMAIN_CLASS_NAME           = 'Domain';
+  {$EXTERNALSYM DOMAIN_CLASS_NAME}
+  COMPUTER_CLASS_NAME         = 'Computer';
+  {$EXTERNALSYM COMPUTER_CLASS_NAME}
+  USER_CLASS_NAME             = 'User';
+  {$EXTERNALSYM USER_CLASS_NAME}
+  GROUP_CLASS_NAME            = 'Group';
+  {$EXTERNALSYM GROUP_CLASS_NAME}
+  GLOBALGROUP_CLASS_NAME      = 'GlobalGroup';
+  {$EXTERNALSYM GLOBALGROUP_CLASS_NAME}
+  LOCALGROUP_CLASS_NAME       = 'LocalGroup';
+  {$EXTERNALSYM LOCALGROUP_CLASS_NAME}
+  SERVICE_CLASS_NAME          = 'Service';
+  {$EXTERNALSYM SERVICE_CLASS_NAME}
+  FILESERVICE_CLASS_NAME      = 'FileService';
+  {$EXTERNALSYM FILESERVICE_CLASS_NAME}
+  SESSION_CLASS_NAME          = 'Session';
+  {$EXTERNALSYM SESSION_CLASS_NAME}
+  RESOURCE_CLASS_NAME         = 'Resource';
+  {$EXTERNALSYM RESOURCE_CLASS_NAME}
+  FILESHARE_CLASS_NAME        = 'FileShare';
+  {$EXTERNALSYM FILESHARE_CLASS_NAME}
+  PRINTER_CLASS_NAME          = 'PrintQueue';
+  {$EXTERNALSYM PRINTER_CLASS_NAME}
+  PRINTJOB_CLASS_NAME         = 'PrintJob';
+  {$EXTERNALSYM PRINTJOB_CLASS_NAME}
+  SCHEMA_CLASS_NAME           = 'Schema';
+  {$EXTERNALSYM SCHEMA_CLASS_NAME}
+  CLASS_CLASS_NAME            = 'Class';
+  {$EXTERNALSYM CLASS_CLASS_NAME}
+  PROPERTY_CLASS_NAME         = 'Property';
+  {$EXTERNALSYM PROPERTY_CLASS_NAME}
+  SYNTAX_CLASS_NAME           = 'Syntax';
+  {$EXTERNALSYM SYNTAX_CLASS_NAME}
+  ROOTDSE_CLASS_NAME          = 'RootDSE';
+  {$EXTERNALSYM ROOTDSE_CLASS_NAME}
+
+  NO_SCHEMA                    = '';
+  {$EXTERNALSYM NO_SCHEMA}
+  DOMAIN_SCHEMA_NAME           = 'Domain';
+  {$EXTERNALSYM DOMAIN_SCHEMA_NAME}
+  COMPUTER_SCHEMA_NAME         = 'Computer';
+  {$EXTERNALSYM COMPUTER_SCHEMA_NAME}
+  USER_SCHEMA_NAME             = 'User';
+  {$EXTERNALSYM USER_SCHEMA_NAME}
+  GROUP_SCHEMA_NAME            = 'Group';
+  {$EXTERNALSYM GROUP_SCHEMA_NAME}
+  GLOBALGROUP_SCHEMA_NAME      = 'GlobalGroup';
+  {$EXTERNALSYM GLOBALGROUP_SCHEMA_NAME}
+  LOCALGROUP_SCHEMA_NAME       = 'LocalGroup';
+  {$EXTERNALSYM LOCALGROUP_SCHEMA_NAME}
+  SERVICE_SCHEMA_NAME          = 'Service';
+  {$EXTERNALSYM SERVICE_SCHEMA_NAME}
+  PRINTER_SCHEMA_NAME          = 'PrintQueue';
+  {$EXTERNALSYM PRINTER_SCHEMA_NAME}
+  PRINTJOB_SCHEMA_NAME         = 'PrintJob';
+  {$EXTERNALSYM PRINTJOB_SCHEMA_NAME}
+  FILESERVICE_SCHEMA_NAME      = 'FileService';
+  {$EXTERNALSYM FILESERVICE_SCHEMA_NAME}
+  SESSION_SCHEMA_NAME          = 'Session';
+  {$EXTERNALSYM SESSION_SCHEMA_NAME}
+  RESOURCE_SCHEMA_NAME         = 'Resource';
+  {$EXTERNALSYM RESOURCE_SCHEMA_NAME}
+  FILESHARE_SCHEMA_NAME        = 'FileShare';
+  {$EXTERNALSYM FILESHARE_SCHEMA_NAME}
+  FPNW_FILESERVICE_SCHEMA_NAME = 'FPNWFileService';
+  {$EXTERNALSYM FPNW_FILESERVICE_SCHEMA_NAME}
+  FPNW_SESSION_SCHEMA_NAME     = 'FPNWSession';
+  {$EXTERNALSYM FPNW_SESSION_SCHEMA_NAME}
+  FPNW_RESOURCE_SCHEMA_NAME    = 'FPNWResource';
+  {$EXTERNALSYM FPNW_RESOURCE_SCHEMA_NAME}
+  FPNW_FILESHARE_SCHEMA_NAME   = 'FPNWFileShare';
+  {$EXTERNALSYM FPNW_FILESHARE_SCHEMA_NAME}
+
+implementation
+
+end.

+ 389 - 0
packages/extra/winunits/jwaadsprop.pas

@@ -0,0 +1,389 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Property Pages API interface Unit for Object Pascal         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adsprop.h, released June 2000. The original Pascal     }
+{ code is: AdsProp.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdsProp;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adsprop.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaAdsTLB, JwaWinUser, JwaWinType;
+
+//  Windows NT Active Directory Service Property Pages
+//
+//  Contents:   Functions and definitions used in the creation of AD property
+//              sheets.
+
+const
+  WM_ADSPROP_NOTIFY_PAGEINIT   = WM_USER + 1101; // where LPARAM is the PADSPROPINITPARAMS pointer.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_PAGEINIT}
+  WM_ADSPROP_NOTIFY_PAGEHWND   = WM_USER + 1102; // where WPARAM => page's HWND and LPARAM => page's Title
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_PAGEHWND}
+  WM_ADSPROP_NOTIFY_CHANGE     = WM_USER + 1103; // used to send a change notification to a parent sheet
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_CHANGE}
+  WM_ADSPROP_NOTIFY_APPLY      = WM_USER + 1104; // pages send this to the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_APPLY}
+  WM_ADSPROP_NOTIFY_SETFOCUS   = WM_USER + 1105; // used internally by the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_SETFOCUS}
+  WM_ADSPROP_NOTIFY_FOREGROUND = WM_USER + 1106; // used internally by the notification object.
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_FOREGROUND}
+  WM_ADSPROP_NOTIFY_EXIT       = WM_USER + 1107; // sent on page release
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_EXIT}
+  WM_ADSPROP_NOTIFY_ERROR      = WM_USER + 1110; // used to send the notification object an error message
+  {$EXTERNALSYM WM_ADSPROP_NOTIFY_ERROR}
+  
+//+----------------------------------------------------------------------------
+//
+//  Structure:  ADSPROPINITPARAMS
+//
+//  Usage:      Used to pass page initialization information to new pages from
+//              the notify object.
+//
+//-----------------------------------------------------------------------------
+
+type
+  // imports of a type library sometimes are missing a few decls, these are just
+  // a few of them to make this file compile at all. I really should do all of
+  // them one day. TODO
+
+  PADSVALUE = ^_adsvalue;
+  {$EXTERNALSYM PADSVALUE}
+  PADS_ATTR_INFO = ^_ads_attr_info;
+  {$EXTERNALSYM PADS_ATTR_INFO}
+
+  PADSPROPINITPARAMS = ^ADSPROPINITPARAMS;
+  {$EXTERNALSYM PADSPROPINITPARAMS}
+  _ADSPROPINITPARAMS = record
+    dwSize: DWORD;            // Set this to the size of the struct.
+    dwFlags: DWORD;           // Reserved for future use.
+    hr: HRESULT;              // If this is non-zero, then the others
+    pDsObj: IDirectoryObject; // should be ignored.
+    pwzCN: LPWSTR;
+    pWritableAttrs: PADS_ATTR_INFO;
+  end;
+  {$EXTERNALSYM _ADSPROPINITPARAMS}
+  ADSPROPINITPARAMS = _ADSPROPINITPARAMS;
+  {$EXTERNALSYM ADSPROPINITPARAMS}
+  TAdsPropInitParams = ADSPROPINITPARAMS;
+
+//+----------------------------------------------------------------------------
+//
+//  Structure:  ADSPROPERROR
+//
+//  Usage:      Used to pass page error information to the notify object
+//
+//-----------------------------------------------------------------------------
+
+  _ADSPROPERROR = record
+    hwndPage: HWND;         // The HWND of the page that had the error
+    pszPageTitle: PWSTR;    // The title of the page that had the error
+    pszObjPath: PWSTR;      // Path to the object that the error occurred on
+    pszObjClass: PWSTR;     // Class of the object that the error occurred on    
+    hr: HRESULT;            // If this is non-zero, then the others
+                            // pszError will be ignored
+    pszError: PWSTR;        // An error message.  Used only if hr is zero
+  end;
+  {$EXTERNALSYM _ADSPROPERROR}
+  ADSPROPERROR = _ADSPROPERROR;
+  {$EXTERNALSYM ADSPROPERROR}
+  PADSPROPERROR = ^ADSPROPERROR;
+  {$EXTERNALSYM PADSPROPERROR}
+  TAdsPropError = ADSPROPERROR;
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropCreateNotifyObj
+//
+//  Synopsis:   Checks to see if the notification window/object exists for this
+//              sheet instance and if not creates it.
+//
+//  Arguments:  [pAppThdDataObj] - the unmarshalled data object pointer.
+//              [pwzADsObjName]  - object path name.
+//              [phNotifyObj]    - to return the notificion window handle.
+//
+//  Returns:    HRESULTs.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropCreateNotifyObj(pAppThdDataObj: Pointer{LPDATAOBJECT};
+  pwzADsObjName: PWSTR; var phNotifyObj: HWND): HRESULT; stdcall;
+{$EXTERNALSYM ADsPropCreateNotifyObj}
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropGetInitInfo
+//
+//  Synopsis:   Pages call this at their init time to retreive DS object info.
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [pInitParams] - struct filled in with DS object info. This
+//                              struct must be allocated by the caller before
+//                              the call.
+//
+//  Returns:    FALSE if the notify window has gone away for some reason or
+//              if the parameters are invalid.
+//
+//  Notes:      This call results in the sending of the
+//              WM_ADSPROP_NOTIFY_PAGEINIT message to the notify window.
+//              pInitParams->pWritableAttrs can be NULL if there are no
+//              writable attributes.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropGetInitInfo(hNotifyObj: HWND; pInitParams: PADSPROPINITPARAMS): BOOL; stdcall;
+{$EXTERNALSYM ADsPropGetInitInfo}
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropSetHwndWithTitle
+//
+//  Synopsis:   Pages call this at their dialog init time to send their hwnd
+//              to the Notify object.
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [hPage]       - the page's window handle.
+//              [ptzTitle]    - the page's title
+//
+//  Returns:    FALSE if the notify window has gone away for some reason.
+//
+//  Notes:      Sends the WM_ADSPROP_NOTIFY_PAGEHWND message to the notify
+//              window. Use this function instead of ADsPropSetHwnd for
+//              multi-select property pages
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropSetHwndWithTitle(hNotifyObj, hPage: HWND; ptzTitle: PTSTR): BOOL; stdcall;
+{$EXTERNALSYM ADsPropSetHwndWithTitle}
+
+//+----------------------------------------------------------------------------
+//
+//  Function:   ADsPropSetHwnd
+//
+//  Synopsis:   Pages call this at their dialog init time to send their hwnd
+//              to the Notify object.
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [hPage]       - the page's window handle.
+//              [ptzTitle]    - the page's title
+//
+//  Returns:    FALSE if the notify window has gone away for some reason.
+//
+//  Notes:      Sends the WM_ADSPROP_NOTIFY_PAGEHWND message to the notify
+//              window.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropSetHwnd(hNotifyObj: HWND; hPage: HWND): BOOL; stdcall;
+{$EXTERNALSYM ADsPropSetHwnd}
+
+//+----------------------------------------------------------------------------
+//
+//  function:   ADsPropCheckIfWritable
+//
+//  Synopsis:   See if the attribute is writable by checking if it is in
+//              the allowedAttributesEffective array.
+//
+//  Arguments:  [pwzAttr]        - the attribute name.
+//              [pWritableAttrs] - the array of writable attributes.
+//
+//  Returns:    FALSE if the attribute name is not found in the writable-attrs
+//              array or if the array pointer is NULL.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropCheckIfWritable(pwzAttr: PWSTR; pWritableAttrs: PADS_ATTR_INFO): BOOL; stdcall;
+{$EXTERNALSYM ADsPropCheckIfWritable}
+
+//+----------------------------------------------------------------------------
+//
+//  function:   ADsPropSendErrorMessage
+//
+//  Synopsis:   Adds an error message to a list which is presented when
+//              ADsPropShowErrorDialog is called
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [pError]      - the error structure
+//
+//  Returns:    FALSE if the notify window has gone away for some reason.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropSendErrorMessage(hNotifyObj: HWND; pError: PADSPROPERROR): BOOL; stdcall;
+{$EXTERNALSYM ADsPropSendErrorMessage}
+
+//+----------------------------------------------------------------------------
+//
+//  function:   ADsPropShowErrorDialog
+//
+//  Synopsis:   Presents an error dialog with the error messages accumulated
+//              through calls to ADsPropSendErrorMessage
+//
+//  Arguments:  [hNotifyObj]  - the notificion window handle.
+//              [hPage]       - the property page window handle.
+//
+//  Returns:    FALSE if the notify window has gone away for some reason.
+//
+//-----------------------------------------------------------------------------
+
+function ADsPropShowErrorDialog(hNotifyObj: HWND; hPage: HWND): BOOL; stdcall;
+{$EXTERNALSYM ADsPropShowErrorDialog}
+
+implementation
+
+const
+  dsprop = 'dsprop.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _ADsPropCreateNotifyObj: Pointer;
+
+function ADsPropCreateNotifyObj;
+begin
+  GetProcedureAddress(_ADsPropCreateNotifyObj, dsprop, 'ADsPropCreateNotifyObj');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropCreateNotifyObj]
+  end;
+end;
+
+var
+  _ADsPropGetInitInfo: Pointer;
+
+function ADsPropGetInitInfo;
+begin
+  GetProcedureAddress(_ADsPropGetInitInfo, dsprop, 'ADsPropGetInitInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropGetInitInfo]
+  end;
+end;
+
+var
+  _ADsPropSetHwndWithTitle: Pointer;
+
+function ADsPropSetHwndWithTitle;
+begin
+  GetProcedureAddress(_ADsPropSetHwndWithTitle, dsprop, 'ADsPropSetHwndWithTitle');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropSetHwndWithTitle]
+  end;
+end;
+
+var
+  _ADsPropSetHwnd: Pointer;
+
+function ADsPropSetHwnd;
+begin
+  GetProcedureAddress(_ADsPropSetHwnd, dsprop, 'ADsPropSetHwnd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropSetHwnd]
+  end;
+end;
+
+var
+  _ADsPropCheckIfWritable: Pointer;
+
+function ADsPropCheckIfWritable;
+begin
+  GetProcedureAddress(_ADsPropCheckIfWritable, dsprop, 'ADsPropCheckIfWritable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropCheckIfWritable]
+  end;
+end;
+
+var
+  _ADsPropSendErrorMessage: Pointer;
+
+function ADsPropSendErrorMessage;
+begin
+  GetProcedureAddress(_ADsPropSendErrorMessage, dsprop, 'ADsPropSendErrorMessage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropSendErrorMessage]
+  end;
+end;
+
+var
+  _ADsPropShowErrorDialog: Pointer;
+
+function ADsPropShowErrorDialog;
+begin
+  GetProcedureAddress(_ADsPropShowErrorDialog, dsprop, 'ADsPropShowErrorDialog');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ADsPropShowErrorDialog]
+  end;
+end;
+
+{$ELSE}
+
+function ADsPropCreateNotifyObj; external dsprop name 'ADsPropCreateNotifyObj';
+function ADsPropGetInitInfo; external dsprop name 'ADsPropGetInitInfo';
+function ADsPropSetHwndWithTitle; external dsprop name 'ADsPropSetHwndWithTitle';
+function ADsPropSetHwnd; external dsprop name 'ADsPropSetHwnd';
+function ADsPropCheckIfWritable; external dsprop name 'ADsPropCheckIfWritable';
+function ADsPropSendErrorMessage; external dsprop name 'ADsPropSendErrorMessage';
+function ADsPropShowErrorDialog; external dsprop name 'ADsPropShowErrorDialog';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 203 - 0
packages/extra/winunits/jwaadssts.pas

@@ -0,0 +1,203 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Status Codes  API interface Unit for Object Pascal          }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adssts.h, released June 2000. The original Pascal      }
+{ code is: AdsSts.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdssts;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adssts.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT;
+
+//  Contents:   Status Codes for ADS objects
+
+const
+  ADS_PRINTER_PAUSED            = $00000001;
+  {$EXTERNALSYM ADS_PRINTER_PAUSED}
+  ADS_PRINTER_PENDING_DELETION  = $00000002;
+  {$EXTERNALSYM ADS_PRINTER_PENDING_DELETION}
+  ADS_PRINTER_ERROR             = $00000003;
+  {$EXTERNALSYM ADS_PRINTER_ERROR}
+  ADS_PRINTER_PAPER_JAM         = $00000004;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_JAM}
+  ADS_PRINTER_PAPER_OUT         = $00000005;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_OUT}
+  ADS_PRINTER_MANUAL_FEED       = $00000006;
+  {$EXTERNALSYM ADS_PRINTER_MANUAL_FEED}
+  ADS_PRINTER_PAPER_PROBLEM     = $00000007;
+  {$EXTERNALSYM ADS_PRINTER_PAPER_PROBLEM}
+  ADS_PRINTER_OFFLINE           = $00000008;
+  {$EXTERNALSYM ADS_PRINTER_OFFLINE}
+  ADS_PRINTER_IO_ACTIVE         = $00000100;
+  {$EXTERNALSYM ADS_PRINTER_IO_ACTIVE}
+  ADS_PRINTER_BUSY              = $00000200;
+  {$EXTERNALSYM ADS_PRINTER_BUSY}
+  ADS_PRINTER_PRINTING          = $00000400;
+  {$EXTERNALSYM ADS_PRINTER_PRINTING}
+  ADS_PRINTER_OUTPUT_BIN_FULL   = $00000800;
+  {$EXTERNALSYM ADS_PRINTER_OUTPUT_BIN_FULL}
+  ADS_PRINTER_NOT_AVAILABLE     = $00001000;
+  {$EXTERNALSYM ADS_PRINTER_NOT_AVAILABLE}
+  ADS_PRINTER_WAITING           = $00002000;
+  {$EXTERNALSYM ADS_PRINTER_WAITING}
+  ADS_PRINTER_PROCESSING        = $00004000;
+  {$EXTERNALSYM ADS_PRINTER_PROCESSING}
+  ADS_PRINTER_INITIALIZING      = $00008000;
+  {$EXTERNALSYM ADS_PRINTER_INITIALIZING}
+  ADS_PRINTER_WARMING_UP        = $00010000;
+  {$EXTERNALSYM ADS_PRINTER_WARMING_UP}
+  ADS_PRINTER_TONER_LOW         = $00020000;
+  {$EXTERNALSYM ADS_PRINTER_TONER_LOW}
+  ADS_PRINTER_NO_TONER          = $00040000;
+  {$EXTERNALSYM ADS_PRINTER_NO_TONER}
+  ADS_PRINTER_PAGE_PUNT         = $00080000;
+  {$EXTERNALSYM ADS_PRINTER_PAGE_PUNT}
+  ADS_PRINTER_USER_INTERVENTION = $00100000;
+  {$EXTERNALSYM ADS_PRINTER_USER_INTERVENTION}
+  ADS_PRINTER_OUT_OF_MEMORY     = $00200000;
+  {$EXTERNALSYM ADS_PRINTER_OUT_OF_MEMORY}
+  ADS_PRINTER_DOOR_OPEN         = $00400000;
+  {$EXTERNALSYM ADS_PRINTER_DOOR_OPEN}
+  ADS_PRINTER_SERVER_UNKNOWN    = $00800000;
+  {$EXTERNALSYM ADS_PRINTER_SERVER_UNKNOWN}
+  ADS_PRINTER_POWER_SAVE        = $01000000;
+  {$EXTERNALSYM ADS_PRINTER_POWER_SAVE}
+
+//
+// job status values
+//
+
+  ADS_JOB_PAUSED   = $00000001;
+  {$EXTERNALSYM ADS_JOB_PAUSED}
+  ADS_JOB_ERROR    = $00000002;
+  {$EXTERNALSYM ADS_JOB_ERROR}
+  ADS_JOB_DELETING = $00000004;
+  {$EXTERNALSYM ADS_JOB_DELETING}
+  ADS_JOB_SPOOLING = $00000008;
+  {$EXTERNALSYM ADS_JOB_SPOOLING}
+  ADS_JOB_PRINTING = $00000010;
+  {$EXTERNALSYM ADS_JOB_PRINTING}
+  ADS_JOB_OFFLINE  = $00000020;
+  {$EXTERNALSYM ADS_JOB_OFFLINE}
+  ADS_JOB_PAPEROUT = $00000040;
+  {$EXTERNALSYM ADS_JOB_PAPEROUT}
+  ADS_JOB_PRINTED  = $00000080;
+  {$EXTERNALSYM ADS_JOB_PRINTED}
+  ADS_JOB_DELETED  = $00000100;
+  {$EXTERNALSYM ADS_JOB_DELETED}
+
+//
+// service status values
+//
+
+  ADS_SERVICE_STOPPED          = $00000001;
+  {$EXTERNALSYM ADS_SERVICE_STOPPED}
+  ADS_SERVICE_START_PENDING    = $00000002;
+  {$EXTERNALSYM ADS_SERVICE_START_PENDING}
+  ADS_SERVICE_STOP_PENDING     = $00000003;
+  {$EXTERNALSYM ADS_SERVICE_STOP_PENDING}
+  ADS_SERVICE_RUNNING          = $00000004;
+  {$EXTERNALSYM ADS_SERVICE_RUNNING}
+  ADS_SERVICE_CONTINUE_PENDING = $00000005;
+  {$EXTERNALSYM ADS_SERVICE_CONTINUE_PENDING}
+  ADS_SERVICE_PAUSE_PENDING    = $00000006;
+  {$EXTERNALSYM ADS_SERVICE_PAUSE_PENDING}
+  ADS_SERVICE_PAUSED           = $00000007;
+  {$EXTERNALSYM ADS_SERVICE_PAUSED}
+  ADS_SERVICE_ERROR            = $00000008;
+  {$EXTERNALSYM ADS_SERVICE_ERROR}
+
+//---------------------------------------------------------------------
+
+//
+// Service Type Valid Values
+//
+
+  ADS_SERVICE_OWN_PROCESS        = $00000010;
+  {$EXTERNALSYM ADS_SERVICE_OWN_PROCESS}
+  ADS_SERVICE_SHARE_PROCESS      = $00000020;
+  {$EXTERNALSYM ADS_SERVICE_SHARE_PROCESS}
+  ADS_SERVICE_KERNEL_DRIVER      = $00000001;
+  {$EXTERNALSYM ADS_SERVICE_KERNEL_DRIVER}
+  ADS_SERVICE_FILE_SYSTEM_DRIVER = $00000002;
+  {$EXTERNALSYM ADS_SERVICE_FILE_SYSTEM_DRIVER}
+
+//
+// Start Type Valid Values
+//
+
+  ADS_SERVICE_BOOT_START   = SERVICE_BOOT_START;
+  {$EXTERNALSYM ADS_SERVICE_BOOT_START}
+  ADS_SERVICE_SYSTEM_START = SERVICE_SYSTEM_START;
+  {$EXTERNALSYM ADS_SERVICE_SYSTEM_START}
+  ADS_SERVICE_AUTO_START   = SERVICE_AUTO_START;
+  {$EXTERNALSYM ADS_SERVICE_AUTO_START}
+  ADS_SERVICE_DEMAND_START = SERVICE_DEMAND_START;
+  {$EXTERNALSYM ADS_SERVICE_DEMAND_START}
+  ADS_SERVICE_DISABLED     = SERVICE_DISABLED;
+  {$EXTERNALSYM ADS_SERVICE_DISABLED}
+
+//
+// Error Control Values
+//
+
+  ADS_SERVICE_ERROR_IGNORE   = 0;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_IGNORE}
+  ADS_SERVICE_ERROR_NORMAL   = 1;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_NORMAL}
+  ADS_SERVICE_ERROR_SEVERE   = 2;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_SEVERE}
+  ADS_SERVICE_ERROR_CRITICAL = 3;
+  {$EXTERNALSYM ADS_SERVICE_ERROR_CRITICAL}
+
+implementation
+
+end.

+ 10302 - 0
packages/extra/winunits/jwaadstlb.pas

@@ -0,0 +1,10302 @@
+// $Id$
+
+unit JwaAdsTLB;
+
+// ************************************************************************ //
+// WARNING
+// -------
+// The types declared in this file were generated from data read from a
+// Type Library. If this type library is explicitly or indirectly (via
+// another type library referring to this type library) re-imported, or the
+// 'Refresh' command of the Type Library Editor activated while editing the
+// Type Library, the contents of this file will be regenerated and all
+// manual modifications will be lost.
+// ************************************************************************ //
+
+// (rom) deactivated CVS string
+// PASTLWTR : Revision:   1.88.1.0.1.0
+// File generated on 9/25/2000 11:37:09 AM from Type Library described below.
+
+// *************************************************************************//
+// NOTE:
+// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties
+// which return objects that may need to be explicitly created via a function
+// call prior to any access via the property. These items have been disabled
+// in order to prevent accidental use from within the object inspector. You
+// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively
+// removing them from the $IFDEF blocks. However, such items must still be
+// programmatically created via a method of the appropriate CoClass before
+// they can be used.
+// ************************************************************************ //
+// Type Lib: C:\WINNT\system32\activeds.tlb (1)
+// IID\LCID: {97D25DB0-0363-11CF-ABC4-02608C9E7553}\0
+// Helpfile:
+// DepndLst:
+//   (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
+//   (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL)
+// Errors:
+//   Hint: Member 'String' of '_ADS_CASEIGNORE_LIST' changed to 'String_'
+//   Hint: Member 'Type' of '__MIDL___MIDL_itf_ads_0000_0005' changed to 'Type_'
+//   Hint: Member 'Type' of '__MIDL___MIDL_itf_ads_0000_0014' changed to 'Type_'
+//   Hint: Member 'Class' of 'IADs' changed to 'Class_'
+//   Hint: Member 'Set' of 'IADsNameTranslate' changed to 'Set_'
+//   Hint: Member 'Type' of 'IADsEmail' changed to 'Type_'
+//   Hint: Member 'Type' of 'IADsPath' changed to 'Type_'
+//   Hint: Member 'Set' of 'IADsPathname' changed to 'Set_'
+//   Error creating palette bitmap of (TPropertyEntry) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TPropertyValue) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TAccessControlEntry) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TAccessControlList) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TSecurityDescriptor) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TLargeInteger) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TNameTranslate) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TCaseIgnoreList) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TFaxNumber) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TNetAddress) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TOctetList) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TEmail) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TPath) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TReplicaPointer) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TAcl) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TTimestamp) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TPostalAddress) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TBackLink) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TTypedName) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (THold) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TPathname) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TADSystemInfo) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TWinNTSystemInfo) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TDNWithBinary) : Server activeds.dll contains no icons
+//   Error creating palette bitmap of (TDNWithString) : Server activeds.dll contains no icons
+// ************************************************************************ //
+{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
+
+interface
+{$i jediapilib.inc}
+uses
+  Windows, ActiveX, Classes {$IFNDEF NOVCL} ,Graphics, OleServer, OleCtrls, StdVCL {$ENDIF} ;
+
+{$IFDEF FPC}
+Type
+// Temporary dummies to get FPC working.
+           TServerData= Record
+                            ClassID:   TGUID;
+                            IntfIID:   TGUID;
+                            EventIID:  String;   // probably TGUID too
+                            LicenseKey: pointer;
+                            Version: integer
+                            end;
+
+
+
+               TOleServer = Class(TComponent)  // for registercomponents to work
+                           private
+                            ServerData : ^TServerData;
+                           public
+                 function  GetServer:IUnknown;
+                 procedure InitServerData; virtual;
+                 constructor Create(AOwner: TComponent); virtual;
+                 Procedure Connect; virtual;
+                 procedure Disconnect; virtual;
+                 end;
+
+
+  SysUINT    = Windows.UINT;
+  SysINT     = Windows.WINT;
+{$endif}
+
+// *********************************************************************//
+// GUIDS declared in the TypeLibrary. Following prefixes are used:
+//   Type Libraries     : LIBID_xxxx
+//   CoClasses          : CLASS_xxxx
+//   DISPInterfaces     : DIID_xxxx
+//   Non-DISP interfaces: IID_xxxx
+// *********************************************************************//
+
+const
+  // TypeLibrary Major and minor versions
+  ActiveDsMajorVersion = 1;
+  ActiveDsMinorVersion = 0;
+
+  LIBID_ActiveDs: TGUID = '{97D25DB0-0363-11CF-ABC4-02608C9E7553}';
+
+  IID_IADs: TGUID = '{FD8256D0-FD15-11CE-ABC4-02608C9E7553}';
+  IID_IADsContainer: TGUID = '{001677D0-FD16-11CE-ABC4-02608C9E7553}';
+  IID_IADsCollection: TGUID = '{72B945E0-253B-11CF-A988-00AA006BC149}';
+  IID_IADsMembers: TGUID = '{451A0030-72EC-11CF-B03B-00AA006E0975}';
+  IID_IADsPropertyList: TGUID = '{C6F602B6-8F69-11D0-8528-00C04FD8D503}';
+  IID_IADsPropertyEntry: TGUID = '{05792C8E-941F-11D0-8529-00C04FD8D503}';
+  CLASS_PropertyEntry: TGUID = '{72D3EDC2-A4C4-11D0-8533-00C04FD8D503}';
+  IID_IADsPropertyValue: TGUID = '{79FA9AD0-A97C-11D0-8534-00C04FD8D503}';
+  IID_IADsPropertyValue2: TGUID = '{306E831C-5BC7-11D1-A3B8-00C04FB950DC}';
+  CLASS_PropertyValue: TGUID = '{7B9E38B0-A97C-11D0-8534-00C04FD8D503}';
+  IID_IPrivateDispatch: TGUID = '{86AB4BBE-65F6-11D1-8C13-00C04FD8D503}';
+  IID_ITypeInfo: TGUID = '{00020401-0000-0000-C000-000000000046}';
+  IID_ITypeComp: TGUID = '{00020403-0000-0000-C000-000000000046}';
+  IID_ITypeLib: TGUID = '{00020402-0000-0000-C000-000000000046}';
+  IID_IPrivateUnknown: TGUID = '{89126BAB-6EAD-11D1-8C18-00C04FD8D503}';
+  IID_IADsExtension: TGUID = '{3D35553C-D2B0-11D1-B17B-0000F87593A0}';
+  IID_IADsDeleteOps: TGUID = '{B2BD0902-8878-11D1-8C21-00C04FD8D503}';
+  IID_IADsNamespaces: TGUID = '{28B96BA0-B330-11CF-A9AD-00AA006BC149}';
+  IID_IADsClass: TGUID = '{C8F93DD0-4AE0-11CF-9E73-00AA004A5691}';
+  IID_IADsProperty: TGUID = '{C8F93DD3-4AE0-11CF-9E73-00AA004A5691}';
+  IID_IADsSyntax: TGUID = '{C8F93DD2-4AE0-11CF-9E73-00AA004A5691}';
+  IID_IADsLocality: TGUID = '{A05E03A2-EFFE-11CF-8ABC-00C04FD8D503}';
+  IID_IADsO: TGUID = '{A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503}';
+  IID_IADsOU: TGUID = '{A2F733B8-EFFE-11CF-8ABC-00C04FD8D503}';
+  IID_IADsDomain: TGUID = '{00E4C220-FD16-11CE-ABC4-02608C9E7553}';
+  IID_IADsComputer: TGUID = '{EFE3CC70-1D9F-11CF-B1F3-02608C9E7553}';
+  IID_IADsComputerOperations: TGUID = '{EF497680-1D9F-11CF-B1F3-02608C9E7553}';
+  IID_IADsGroup: TGUID = '{27636B00-410F-11CF-B1FF-02608C9E7553}';
+  IID_IADsUser: TGUID = '{3E37E320-17E2-11CF-ABC4-02608C9E7553}';
+  IID_IADsPrintQueue: TGUID = '{B15160D0-1226-11CF-A985-00AA006BC149}';
+  IID_IADsPrintQueueOperations: TGUID = '{124BE5C0-156E-11CF-A986-00AA006BC149}';
+  IID_IADsPrintJob: TGUID = '{32FB6780-1ED0-11CF-A988-00AA006BC149}';
+  IID_IADsPrintJobOperations: TGUID = '{9A52DB30-1ECF-11CF-A988-00AA006BC149}';
+  IID_IADsService: TGUID = '{68AF66E0-31CA-11CF-A98A-00AA006BC149}';
+  IID_IADsServiceOperations: TGUID = '{5D7B33F0-31CA-11CF-A98A-00AA006BC149}';
+  IID_IADsFileService: TGUID = '{A89D1900-31CA-11CF-A98A-00AA006BC149}';
+  IID_IADsFileServiceOperations: TGUID = '{A02DED10-31CA-11CF-A98A-00AA006BC149}';
+  IID_IADsFileShare: TGUID = '{EB6DCAF0-4B83-11CF-A995-00AA006BC149}';
+  IID_IADsSession: TGUID = '{398B7DA0-4AAB-11CF-AE2C-00AA006EBFB9}';
+  IID_IADsResource: TGUID = '{34A05B20-4AAB-11CF-AE2C-00AA006EBFB9}';
+  IID_IADsOpenDSObject: TGUID = '{DDF2891E-0F9C-11D0-8AD4-00C04FD8D503}';
+  IID_IDirectoryObject: TGUID = '{E798DE2C-22E4-11D0-84FE-00C04FD8D503}';
+  IID_IDirectorySearch: TGUID = '{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}';
+  IID_IDirectorySchemaMgmt: TGUID = '{75DB3B9C-A4D8-11D0-A79C-00C04FD8D5A8}';
+  IID_IADsAggregatee: TGUID = '{1346CE8C-9039-11D0-8528-00C04FD8D503}';
+  IID_IADsAggregator: TGUID = '{52DB5FB0-941F-11D0-8529-00C04FD8D503}';
+  IID_IADsAccessControlEntry: TGUID = '{B4F3A14C-9BDD-11D0-852C-00C04FD8D503}';
+  CLASS_AccessControlEntry: TGUID = '{B75AC000-9BDD-11D0-852C-00C04FD8D503}';
+  IID_IADsAccessControlList: TGUID = '{B7EE91CC-9BDD-11D0-852C-00C04FD8D503}';
+  CLASS_AccessControlList: TGUID = '{B85EA052-9BDD-11D0-852C-00C04FD8D503}';
+  IID_IADsSecurityDescriptor: TGUID = '{B8C787CA-9BDD-11D0-852C-00C04FD8D503}';
+  CLASS_SecurityDescriptor: TGUID = '{B958F73C-9BDD-11D0-852C-00C04FD8D503}';
+  IID_IADsLargeInteger: TGUID = '{9068270B-0939-11D1-8BE1-00C04FD8D503}';
+  CLASS_LargeInteger: TGUID = '{927971F5-0939-11D1-8BE1-00C04FD8D503}';
+  IID_IADsNameTranslate: TGUID = '{B1B272A3-3625-11D1-A3A4-00C04FB950DC}';
+  CLASS_NameTranslate: TGUID = '{274FAE1F-3626-11D1-A3A4-00C04FB950DC}';
+  IID_IADsCaseIgnoreList: TGUID = '{7B66B533-4680-11D1-A3B4-00C04FB950DC}';
+  CLASS_CaseIgnoreList: TGUID = '{15F88A55-4680-11D1-A3B4-00C04FB950DC}';
+  IID_IADsFaxNumber: TGUID = '{A910DEA9-4680-11D1-A3B4-00C04FB950DC}';
+  CLASS_FaxNumber: TGUID = '{A5062215-4681-11D1-A3B4-00C04FB950DC}';
+  IID_IADsNetAddress: TGUID = '{B21A50A9-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_NetAddress: TGUID = '{B0B71247-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsOctetList: TGUID = '{7B28B80F-4680-11D1-A3B4-00C04FB950DC}';
+  CLASS_OctetList: TGUID = '{1241400F-4680-11D1-A3B4-00C04FB950DC}';
+  IID_IADsEmail: TGUID = '{97AF011A-478E-11D1-A3B4-00C04FB950DC}';
+  CLASS_Email: TGUID = '{8F92A857-478E-11D1-A3B4-00C04FB950DC}';
+  IID_IADsPath: TGUID = '{B287FCD5-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_Path: TGUID = '{B2538919-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsReplicaPointer: TGUID = '{F60FB803-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_ReplicaPointer: TGUID = '{F5D1BADF-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsAcl: TGUID = '{8452D3AB-0869-11D1-A377-00C04FB950DC}';
+  CLASS_Acl: TGUID = '{7AF1EFB6-0869-11D1-A377-00C04FB950DC}';
+  IID_IADsTimestamp: TGUID = '{B2F5A901-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_Timestamp: TGUID = '{B2BED2EB-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsPostalAddress: TGUID = '{7ADECF29-4680-11D1-A3B4-00C04FB950DC}';
+  CLASS_PostalAddress: TGUID = '{0A75AFCD-4680-11D1-A3B4-00C04FB950DC}';
+  IID_IADsBackLink: TGUID = '{FD1302BD-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_BackLink: TGUID = '{FCBF906F-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsTypedName: TGUID = '{B371A349-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_TypedName: TGUID = '{B33143CB-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsHold: TGUID = '{B3EB3B37-4080-11D1-A3AC-00C04FB950DC}';
+  CLASS_Hold: TGUID = '{B3AD3E13-4080-11D1-A3AC-00C04FB950DC}';
+  IID_IADsObjectOptions: TGUID = '{46F14FDA-232B-11D1-A808-00C04FD8D5A8}';
+  IID_IADsPathname: TGUID = '{D592AED4-F420-11D0-A36E-00C04FB950DC}';
+  CLASS_Pathname: TGUID = '{080D0D78-F421-11D0-A36E-00C04FB950DC}';
+  IID_IADsADSystemInfo: TGUID = '{5BB11929-AFD1-11D2-9CB9-0000F87A369E}';
+  CLASS_ADSystemInfo: TGUID = '{50B6327F-AFD1-11D2-9CB9-0000F87A369E}';
+  IID_IADsWinNTSystemInfo: TGUID = '{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}';
+  CLASS_WinNTSystemInfo: TGUID = '{66182EC4-AFD1-11D2-9CB9-0000F87A369E}';
+  IID_IADsDNWithBinary: TGUID = '{7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}';
+  CLASS_DNWithBinary: TGUID = '{7E99C0A3-F935-11D2-BA96-00C04FB6D0D1}';
+  IID_IADsDNWithString: TGUID = '{370DF02E-F934-11D2-BA96-00C04FB6D0D1}';
+  CLASS_DNWithString: TGUID = '{334857CC-F934-11D2-BA96-00C04FB6D0D1}';
+
+// *********************************************************************//
+// Declaration of Enumerations defined in Type Library
+// *********************************************************************//
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0001
+type
+  __MIDL___MIDL_itf_ads_0000_0001 = TOleEnum;
+const
+  ADSTYPE_INVALID = $00000000;
+  ADSTYPE_DN_STRING = $00000001;
+  ADSTYPE_CASE_EXACT_STRING = $00000002;
+  ADSTYPE_CASE_IGNORE_STRING = $00000003;
+  ADSTYPE_PRINTABLE_STRING = $00000004;
+  ADSTYPE_NUMERIC_STRING = $00000005;
+  ADSTYPE_BOOLEAN = $00000006;
+  ADSTYPE_INTEGER = $00000007;
+  ADSTYPE_OCTET_STRING = $00000008;
+  ADSTYPE_UTC_TIME = $00000009;
+  ADSTYPE_LARGE_INTEGER = $0000000A;
+  ADSTYPE_PROV_SPECIFIC = $0000000B;
+  ADSTYPE_OBJECT_CLASS = $0000000C;
+  ADSTYPE_CASEIGNORE_LIST = $0000000D;
+  ADSTYPE_OCTET_LIST = $0000000E;
+  ADSTYPE_PATH = $0000000F;
+  ADSTYPE_POSTALADDRESS = $00000010;
+  ADSTYPE_TIMESTAMP = $00000011;
+  ADSTYPE_BACKLINK = $00000012;
+  ADSTYPE_TYPEDNAME = $00000013;
+  ADSTYPE_HOLD = $00000014;
+  ADSTYPE_NETADDRESS = $00000015;
+  ADSTYPE_REPLICAPOINTER = $00000016;
+  ADSTYPE_FAXNUMBER = $00000017;
+  ADSTYPE_EMAIL = $00000018;
+  ADSTYPE_NT_SECURITY_DESCRIPTOR = $00000019;
+  ADSTYPE_UNKNOWN = $0000001A;
+  ADSTYPE_DN_WITH_BINARY = $0000001B;
+  ADSTYPE_DN_WITH_STRING = $0000001C;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0018
+type
+  __MIDL___MIDL_itf_ads_0000_0018 = TOleEnum;
+const
+  ADS_SECURE_AUTHENTICATION = $00000001;
+  ADS_USE_ENCRYPTION = $00000002;
+  ADS_USE_SSL = $00000002;
+  ADS_READONLY_SERVER = $00000004;
+  ADS_PROMPT_CREDENTIALS = $00000008;
+  ADS_NO_AUTHENTICATION = $00000010;
+  ADS_FAST_BIND = $00000020;
+  ADS_USE_SIGNING = $00000040;
+  ADS_USE_SEALING = $00000080;
+  ADS_USE_DELEGATION = $00000100;
+  ADS_AUTH_RESERVED = $80000000;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0019
+type
+  __MIDL___MIDL_itf_ads_0000_0019 = TOleEnum;
+const
+  ADS_STATUS_S_OK = $00000000;
+  ADS_STATUS_INVALID_SEARCHPREF = $00000001;
+  ADS_STATUS_INVALID_SEARCHPREFVALUE = $00000002;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0020
+type
+  __MIDL___MIDL_itf_ads_0000_0020 = TOleEnum;
+const
+  ADS_DEREF_NEVER = $00000000;
+  ADS_DEREF_SEARCHING = $00000001;
+  ADS_DEREF_FINDING = $00000002;
+  ADS_DEREF_ALWAYS = $00000003;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0021
+type
+  __MIDL___MIDL_itf_ads_0000_0021 = TOleEnum;
+const
+  ADS_SCOPE_BASE = $00000000;
+  ADS_SCOPE_ONELEVEL = $00000001;
+  ADS_SCOPE_SUBTREE = $00000002;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0022
+type
+  __MIDL___MIDL_itf_ads_0000_0022 = TOleEnum;
+const
+  ADSIPROP_ASYNCHRONOUS = $00000000;
+  ADSIPROP_DEREF_ALIASES = $00000001;
+  ADSIPROP_SIZE_LIMIT = $00000002;
+  ADSIPROP_TIME_LIMIT = $00000003;
+  ADSIPROP_ATTRIBTYPES_ONLY = $00000004;
+  ADSIPROP_SEARCH_SCOPE = $00000005;
+  ADSIPROP_TIMEOUT = $00000006;
+  ADSIPROP_PAGESIZE = $00000007;
+  ADSIPROP_PAGED_TIME_LIMIT = $00000008;
+  ADSIPROP_CHASE_REFERRALS = $00000009;
+  ADSIPROP_SORT_ON = $0000000A;
+  ADSIPROP_CACHE_RESULTS = $0000000B;
+  ADSIPROP_ADSIFLAG = $0000000C;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0023
+type
+  __MIDL___MIDL_itf_ads_0000_0023 = TOleEnum;
+const
+  ADSI_DIALECT_LDAP = $00000000;
+  ADSI_DIALECT_SQL = $00000001;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0024
+type
+  __MIDL___MIDL_itf_ads_0000_0024 = TOleEnum;
+const
+  ADS_CHASE_REFERRALS_NEVER = $00000000;
+  ADS_CHASE_REFERRALS_SUBORDINATE = $00000020;
+  ADS_CHASE_REFERRALS_EXTERNAL = $00000040;
+  ADS_CHASE_REFERRALS_ALWAYS = $00000060;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0025
+type
+  __MIDL___MIDL_itf_ads_0000_0025 = TOleEnum;
+const
+  ADS_SEARCHPREF_ASYNCHRONOUS = $00000000;
+  ADS_SEARCHPREF_DEREF_ALIASES = $00000001;
+  ADS_SEARCHPREF_SIZE_LIMIT = $00000002;
+  ADS_SEARCHPREF_TIME_LIMIT = $00000003;
+  ADS_SEARCHPREF_ATTRIBTYPES_ONLY = $00000004;
+  ADS_SEARCHPREF_SEARCH_SCOPE = $00000005;
+  ADS_SEARCHPREF_TIMEOUT = $00000006;
+  ADS_SEARCHPREF_PAGESIZE = $00000007;
+  ADS_SEARCHPREF_PAGED_TIME_LIMIT = $00000008;
+  ADS_SEARCHPREF_CHASE_REFERRALS = $00000009;
+  ADS_SEARCHPREF_SORT_ON = $0000000A;
+  ADS_SEARCHPREF_CACHE_RESULTS = $0000000B;
+  ADS_SEARCHPREF_DIRSYNC = $0000000C;
+  ADS_SEARCHPREF_TOMBSTONE = $0000000D;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0000_0026
+type
+  __MIDL___MIDL_itf_ads_0000_0026 = TOleEnum;
+const
+  ADS_PROPERTY_CLEAR = $00000001;
+  ADS_PROPERTY_UPDATE = $00000002;
+  ADS_PROPERTY_APPEND = $00000003;
+  ADS_PROPERTY_DELETE = $00000004;
+
+// Constants for enum tagTYPEKIND
+type
+  tagTYPEKIND = TOleEnum;
+const
+  TKIND_ENUM = $00000000;
+  TKIND_RECORD = $00000001;
+  TKIND_MODULE = $00000002;
+  TKIND_INTERFACE = $00000003;
+  TKIND_DISPATCH = $00000004;
+  TKIND_COCLASS = $00000005;
+  TKIND_ALIAS = $00000006;
+  TKIND_UNION = $00000007;
+  TKIND_MAX = $00000008;
+
+// Constants for enum tagDESCKIND
+type
+  tagDESCKIND = TOleEnum;
+const
+  DESCKIND_NONE = $00000000;
+  DESCKIND_FUNCDESC = $00000001;
+  DESCKIND_VARDESC = $00000002;
+  DESCKIND_TYPECOMP = $00000003;
+  DESCKIND_IMPLICITAPPOBJ = $00000004;
+  DESCKIND_MAX = $00000005;
+
+// Constants for enum tagFUNCKIND
+type
+  tagFUNCKIND = TOleEnum;
+const
+  FUNC_VIRTUAL = $00000000;
+  FUNC_PUREVIRTUAL = $00000001;
+  FUNC_NONVIRTUAL = $00000002;
+  FUNC_STATIC = $00000003;
+  FUNC_DISPATCH = $00000004;
+
+// Constants for enum tagINVOKEKIND
+type
+  tagINVOKEKIND = TOleEnum;
+const
+  INVOKE_FUNC = $00000001;
+  INVOKE_PROPERTYGET = $00000002;
+  INVOKE_PROPERTYPUT = $00000004;
+  INVOKE_PROPERTYPUTREF = $00000008;
+
+// Constants for enum tagCALLCONV
+type
+  tagCALLCONV = TOleEnum;
+const
+  CC_FASTCALL = $00000000;
+  CC_CDECL = $00000001;
+  CC_MSCPASCAL = $00000002;
+  CC_PASCAL = $00000002;
+  CC_MACPASCAL = $00000003;
+  CC_STDCALL = $00000004;
+  CC_FPFASTCALL = $00000005;
+  CC_SYSCALL = $00000006;
+  CC_MPWCDECL = $00000007;
+  CC_MPWPASCAL = $00000008;
+  CC_MAX = $00000009;
+
+// Constants for enum tagVARKIND
+type
+  tagVARKIND = TOleEnum;
+const
+  VAR_PERINSTANCE = $00000000;
+  VAR_STATIC = $00000001;
+  VAR_CONST = $00000002;
+  VAR_DISPATCH = $00000003;
+
+// Constants for enum tagSYSKIND
+type
+  tagSYSKIND = TOleEnum;
+const
+  SYS_WIN16 = $00000000;
+  SYS_WIN32 = $00000001;
+  SYS_MAC = $00000002;
+  SYS_WIN64 = $00000001;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0120_0001
+type
+  __MIDL___MIDL_itf_ads_0120_0001 = TOleEnum;
+const
+  ADS_SYSTEMFLAG_DISALLOW_DELETE = $80000000;
+  ADS_SYSTEMFLAG_CONFIG_ALLOW_RENAME = $40000000;
+  ADS_SYSTEMFLAG_CONFIG_ALLOW_MOVE = $20000000;
+  ADS_SYSTEMFLAG_CONFIG_ALLOW_LIMITED_MOVE = $10000000;
+  ADS_SYSTEMFLAG_DOMAIN_DISALLOW_RENAME = $08000000;
+  ADS_SYSTEMFLAG_DOMAIN_DISALLOW_MOVE = $04000000;
+  ADS_SYSTEMFLAG_CR_NTDS_NC = $00000001;
+  ADS_SYSTEMFLAG_CR_NTDS_DOMAIN = $00000002;
+  ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED = $00000001;
+  ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED = $00000004;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0126_0001
+type
+  __MIDL___MIDL_itf_ads_0126_0001 = TOleEnum;
+const
+  ADS_GROUP_TYPE_GLOBAL_GROUP = $00000002;
+  ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = $00000004;
+  ADS_GROUP_TYPE_LOCAL_GROUP = $00000004;
+  ADS_GROUP_TYPE_UNIVERSAL_GROUP = $00000008;
+  ADS_GROUP_TYPE_SECURITY_ENABLED = $80000000;
+
+// Constants for enum ADS_USER_FLAG
+type
+  ADS_USER_FLAG = TOleEnum;
+const
+  ADS_UF_SCRIPT = $00000001;
+  ADS_UF_ACCOUNTDISABLE = $00000002;
+  ADS_UF_HOMEDIR_REQUIRED = $00000008;
+  ADS_UF_LOCKOUT = $00000010;
+  ADS_UF_PASSWD_NOTREQD = $00000020;
+  ADS_UF_PASSWD_CANT_CHANGE = $00000040;
+  ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED = $00000080;
+  ADS_UF_TEMP_DUPLICATE_ACCOUNT = $00000100;
+  ADS_UF_NORMAL_ACCOUNT = $00000200;
+  ADS_UF_INTERDOMAIN_TRUST_ACCOUNT = $00000800;
+  ADS_UF_WORKSTATION_TRUST_ACCOUNT = $00001000;
+  ADS_UF_SERVER_TRUST_ACCOUNT = $00002000;
+  ADS_UF_DONT_EXPIRE_PASSWD = $00010000;
+  ADS_UF_MNS_LOGON_ACCOUNT = $00020000;
+  ADS_UF_SMARTCARD_REQUIRED = $00040000;
+  ADS_UF_TRUSTED_FOR_DELEGATION = $00080000;
+  ADS_UF_NOT_DELEGATED = $00100000;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0001
+type
+  __MIDL___MIDL_itf_ads_0148_0001 = TOleEnum;
+const
+  ADS_RIGHT_DELETE = $00010000;
+  ADS_RIGHT_READ_CONTROL = $00020000;
+  ADS_RIGHT_WRITE_DAC = $00040000;
+  ADS_RIGHT_WRITE_OWNER = $00080000;
+  ADS_RIGHT_SYNCHRONIZE = $00100000;
+  ADS_RIGHT_ACCESS_SYSTEM_SECURITY = $01000000;
+  ADS_RIGHT_GENERIC_READ = $80000000;
+  ADS_RIGHT_GENERIC_WRITE = $40000000;
+  ADS_RIGHT_GENERIC_EXECUTE = $20000000;
+  ADS_RIGHT_GENERIC_ALL = $10000000;
+  ADS_RIGHT_DS_CREATE_CHILD = $00000001;
+  ADS_RIGHT_DS_DELETE_CHILD = $00000002;
+  ADS_RIGHT_ACTRL_DS_LIST = $00000004;
+  ADS_RIGHT_DS_SELF = $00000008;
+  ADS_RIGHT_DS_READ_PROP = $00000010;
+  ADS_RIGHT_DS_WRITE_PROP = $00000020;
+  ADS_RIGHT_DS_DELETE_TREE = $00000040;
+  ADS_RIGHT_DS_LIST_OBJECT = $00000080;
+  ADS_RIGHT_DS_CONTROL_ACCESS = $00000100;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0002
+type
+  __MIDL___MIDL_itf_ads_0148_0002 = TOleEnum;
+const
+  ADS_ACETYPE_ACCESS_ALLOWED = $00000000;
+  ADS_ACETYPE_ACCESS_DENIED = $00000001;
+  ADS_ACETYPE_SYSTEM_AUDIT = $00000002;
+  ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = $00000005;
+  ADS_ACETYPE_ACCESS_DENIED_OBJECT = $00000006;
+  ADS_ACETYPE_SYSTEM_AUDIT_OBJECT = $00000007;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0003
+type
+  __MIDL___MIDL_itf_ads_0148_0003 = TOleEnum;
+const
+  ADS_ACEFLAG_INHERIT_ACE = $00000002;
+  ADS_ACEFLAG_NO_PROPAGATE_INHERIT_ACE = $00000004;
+  ADS_ACEFLAG_INHERIT_ONLY_ACE = $00000008;
+  ADS_ACEFLAG_INHERITED_ACE = $00000010;
+  ADS_ACEFLAG_VALID_INHERIT_FLAGS = $0000001F;
+  ADS_ACEFLAG_SUCCESSFUL_ACCESS = $00000040;
+  ADS_ACEFLAG_FAILED_ACCESS = $00000080;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0004
+type
+  __MIDL___MIDL_itf_ads_0148_0004 = TOleEnum;
+const
+  ADS_FLAG_OBJECT_TYPE_PRESENT = $00000001;
+  ADS_FLAG_INHERITED_OBJECT_TYPE_PRESENT = $00000002;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0005
+type
+  __MIDL___MIDL_itf_ads_0148_0005 = TOleEnum;
+const
+  ADS_SD_CONTROL_SE_OWNER_DEFAULTED = $00000001;
+  ADS_SD_CONTROL_SE_GROUP_DEFAULTED = $00000002;
+  ADS_SD_CONTROL_SE_DACL_PRESENT = $00000004;
+  ADS_SD_CONTROL_SE_DACL_DEFAULTED = $00000008;
+  ADS_SD_CONTROL_SE_SACL_PRESENT = $00000010;
+  ADS_SD_CONTROL_SE_SACL_DEFAULTED = $00000020;
+  ADS_SD_CONTROL_SE_DACL_AUTO_INHERIT_REQ = $00000100;
+  ADS_SD_CONTROL_SE_SACL_AUTO_INHERIT_REQ = $00000200;
+  ADS_SD_CONTROL_SE_DACL_AUTO_INHERITED = $00000400;
+  ADS_SD_CONTROL_SE_SACL_AUTO_INHERITED = $00000800;
+  ADS_SD_CONTROL_SE_DACL_PROTECTED = $00001000;
+  ADS_SD_CONTROL_SE_SACL_PROTECTED = $00002000;
+  ADS_SD_CONTROL_SE_SELF_RELATIVE = $00008000;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0148_0006
+type
+  __MIDL___MIDL_itf_ads_0148_0006 = TOleEnum;
+const
+  ADS_SD_REVISION_DS = $00000004;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0149_0001
+type
+  __MIDL___MIDL_itf_ads_0149_0001 = TOleEnum;
+const
+  ADS_NAME_TYPE_1779 = $00000001;
+  ADS_NAME_TYPE_CANONICAL = $00000002;
+  ADS_NAME_TYPE_NT4 = $00000003;
+  ADS_NAME_TYPE_DISPLAY = $00000004;
+  ADS_NAME_TYPE_DOMAIN_SIMPLE = $00000005;
+  ADS_NAME_TYPE_ENTERPRISE_SIMPLE = $00000006;
+  ADS_NAME_TYPE_GUID = $00000007;
+  ADS_NAME_TYPE_UNKNOWN = $00000008;
+  ADS_NAME_TYPE_USER_PRINCIPAL_NAME = $00000009;
+  ADS_NAME_TYPE_CANONICAL_EX = $0000000A;
+  ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME = $0000000B;
+  ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME = $0000000C;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0149_0002
+type
+  __MIDL___MIDL_itf_ads_0149_0002 = TOleEnum;
+const
+  ADS_NAME_INITTYPE_DOMAIN = $00000001;
+  ADS_NAME_INITTYPE_SERVER = $00000002;
+  ADS_NAME_INITTYPE_GC = $00000003;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0163_0001
+type
+  __MIDL___MIDL_itf_ads_0163_0001 = TOleEnum;
+const
+  ADS_OPTION_SERVERNAME = $00000000;
+  ADS_OPTION_REFERRALS = $00000001;
+  ADS_OPTION_PAGE_SIZE = $00000002;
+  ADS_OPTION_SECURITY_MASK = $00000003;
+  ADS_OPTION_MUTUAL_AUTH_STATUS = $00000004;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0163_0002
+type
+  __MIDL___MIDL_itf_ads_0163_0002 = TOleEnum;
+const
+  ADS_SECURITY_INFO_OWNER = $00000001;
+  ADS_SECURITY_INFO_GROUP = $00000002;
+  ADS_SECURITY_INFO_DACL = $00000004;
+  ADS_SECURITY_INFO_SACL = $00000008;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0164_0001
+type
+  __MIDL___MIDL_itf_ads_0164_0001 = TOleEnum;
+const
+  ADS_SETTYPE_FULL = $00000001;
+  ADS_SETTYPE_PROVIDER = $00000002;
+  ADS_SETTYPE_SERVER = $00000003;
+  ADS_SETTYPE_DN = $00000004;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0164_0002
+type
+  __MIDL___MIDL_itf_ads_0164_0002 = TOleEnum;
+const
+  ADS_FORMAT_WINDOWS = $00000001;
+  ADS_FORMAT_WINDOWS_NO_SERVER = $00000002;
+  ADS_FORMAT_WINDOWS_DN = $00000003;
+  ADS_FORMAT_WINDOWS_PARENT = $00000004;
+  ADS_FORMAT_X500 = $00000005;
+  ADS_FORMAT_X500_NO_SERVER = $00000006;
+  ADS_FORMAT_X500_DN = $00000007;
+  ADS_FORMAT_X500_PARENT = $00000008;
+  ADS_FORMAT_SERVER = $00000009;
+  ADS_FORMAT_PROVIDER = $0000000A;
+  ADS_FORMAT_LEAF = $0000000B;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0164_0003
+type
+  __MIDL___MIDL_itf_ads_0164_0003 = TOleEnum;
+const
+  ADS_DISPLAY_FULL = $00000001;
+  ADS_DISPLAY_VALUE_ONLY = $00000002;
+
+// Constants for enum __MIDL___MIDL_itf_ads_0164_0004
+type
+  __MIDL___MIDL_itf_ads_0164_0004 = TOleEnum;
+const
+  ADS_ESCAPEDMODE_DEFAULT = $00000001;
+  ADS_ESCAPEDMODE_ON = $00000002;
+  ADS_ESCAPEDMODE_OFF = $00000003;
+  ADS_ESCAPEDMODE_OFF_EX = $00000004;
+
+type
+
+// *********************************************************************//
+// Forward declaration of types defined in TypeLibrary
+// *********************************************************************//
+  IADs = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDisp = dispinterface;
+  {$endif}
+  IADsContainer = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsContainerDisp = dispinterface;
+  {$endif}
+  IADsCollection = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsCollectionDisp = dispinterface;
+  {$endif}
+  IADsMembers = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsMembersDisp = dispinterface;
+  {$endif}
+  IADsPropertyList = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyListDisp = dispinterface;
+  {$endif}
+  IADsPropertyEntry = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyEntryDisp = dispinterface;
+  {$endif}
+  IADsPropertyValue = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyValueDisp = dispinterface;
+  {$endif}
+  IADsPropertyValue2 = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyValue2Disp = dispinterface;
+  {$endif}
+  IPrivateDispatch = interface;
+  ITypeInfo = interface;
+  ITypeComp = interface;
+  ITypeLib = interface;
+  IPrivateUnknown = interface;
+  IADsExtension = interface;
+  IADsDeleteOps = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDeleteOpsDisp = dispinterface;
+  {$endif}
+  IADsNamespaces = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNamespacesDisp = dispinterface;
+  {$endif}
+  IADsClass = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsClassDisp = dispinterface;
+  {$endif}
+  IADsProperty = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyDisp = dispinterface;
+  {$endif}
+  IADsSyntax = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSyntaxDisp = dispinterface;
+  {$endif}
+  IADsLocality = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsLocalityDisp = dispinterface;
+  {$endif}
+  IADsO = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsODisp = dispinterface;
+  {$endif}
+  IADsOU = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOUDisp = dispinterface;
+  {$endif}
+  IADsDomain = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDomainDisp = dispinterface;
+  {$endif}
+  IADsComputer = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsComputerDisp = dispinterface;
+  {$endif}
+  IADsComputerOperations = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsComputerOperationsDisp = dispinterface;
+  {$endif}
+  IADsGroup = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsGroupDisp = dispinterface;
+  {$endif}
+  IADsUser = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsUserDisp = dispinterface;
+  {$endif}
+  IADsPrintQueue = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintQueueDisp = dispinterface;
+  {$endif}
+  IADsPrintQueueOperations = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintQueueOperationsDisp = dispinterface;
+  {$endif}
+  IADsPrintJob = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintJobDisp = dispinterface;
+  {$endif}
+  IADsPrintJobOperations = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintJobOperationsDisp = dispinterface;
+  {$endif}
+  IADsService = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsServiceDisp = dispinterface;
+  {$endif}
+  IADsServiceOperations = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsServiceOperationsDisp = dispinterface;
+  {$endif}
+  IADsFileService = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileServiceDisp = dispinterface;
+  {$endif}
+  IADsFileServiceOperations = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileServiceOperationsDisp = dispinterface;
+  {$endif}
+  IADsFileShare = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileShareDisp = dispinterface;
+  {$endif}
+  IADsSession = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSessionDisp = dispinterface;
+  {$endif}
+  IADsResource = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsResourceDisp = dispinterface;
+  {$endif}
+  IADsOpenDSObject = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOpenDSObjectDisp = dispinterface;
+  {$endif}
+  IDirectoryObject = interface;
+  IDirectorySearch = interface;
+  IDirectorySchemaMgmt = interface;
+  IADsAggregatee = interface;
+  IADsAggregator = interface;
+  IADsAccessControlEntry = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAccessControlEntryDisp = dispinterface;
+  {$endif}
+  IADsAccessControlList = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAccessControlListDisp = dispinterface;
+  {$endif}
+  IADsSecurityDescriptor = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSecurityDescriptorDisp = dispinterface;
+  {$endif}
+  IADsLargeInteger = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsLargeIntegerDisp = dispinterface;
+  {$endif}
+  IADsNameTranslate = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNameTranslateDisp = dispinterface;
+  {$endif}
+  IADsCaseIgnoreList = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsCaseIgnoreListDisp = dispinterface;
+  {$endif}
+  IADsFaxNumber = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFaxNumberDisp = dispinterface;
+  {$endif}
+  IADsNetAddress = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNetAddressDisp = dispinterface;
+  {$endif}
+  IADsOctetList = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOctetListDisp = dispinterface;
+  {$endif}
+  IADsEmail = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsEmailDisp = dispinterface;
+  {$endif}
+  IADsPath = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPathDisp = dispinterface;
+  {$endif}
+  IADsReplicaPointer = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsReplicaPointerDisp = dispinterface;
+  {$endif}
+  IADsAcl = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAclDisp = dispinterface;
+  {$endif}
+  IADsTimestamp = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsTimestampDisp = dispinterface;
+  {$endif}
+  IADsPostalAddress = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPostalAddressDisp = dispinterface;
+  {$endif}
+  IADsBackLink = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsBackLinkDisp = dispinterface;
+  {$endif}
+  IADsTypedName = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsTypedNameDisp = dispinterface;
+  {$endif}
+  IADsHold = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsHoldDisp = dispinterface;
+  {$endif}
+  IADsObjectOptions = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsObjectOptionsDisp = dispinterface;
+  {$endif}
+  IADsPathname = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPathnameDisp = dispinterface;
+  {$endif}
+  IADsADSystemInfo = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsADSystemInfoDisp = dispinterface;
+  {$endif}
+  IADsWinNTSystemInfo = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsWinNTSystemInfoDisp = dispinterface;
+  {$endif}
+  IADsDNWithBinary = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDNWithBinaryDisp = dispinterface;
+  {$endif}
+  IADsDNWithString = interface;
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDNWithStringDisp = dispinterface;
+  {$endif}
+
+// *********************************************************************//
+// Declaration of CoClasses defined in Type Library
+// (NOTE: Here we map each CoClass to its Default Interface)
+// *********************************************************************//
+  PropertyEntry = IADsPropertyEntry;
+  PropertyValue = IADsPropertyValue;
+  AccessControlEntry = IADsAccessControlEntry;
+  AccessControlList = IADsAccessControlList;
+  SecurityDescriptor = IADsSecurityDescriptor;
+  LargeInteger = IADsLargeInteger;
+  NameTranslate = IADsNameTranslate;
+  CaseIgnoreList = IADsCaseIgnoreList;
+  FaxNumber = IADsFaxNumber;
+  NetAddress = IADsNetAddress;
+  OctetList = IADsOctetList;
+  Email = IADsEmail;
+  Path = IADsPath;
+  ReplicaPointer = IADsReplicaPointer;
+  Acl = IADsAcl;
+  Timestamp = IADsTimestamp;
+  PostalAddress = IADsPostalAddress;
+  BackLink = IADsBackLink;
+  TypedName = IADsTypedName;
+  Hold = IADsHold;
+  Pathname = IADsPathname;
+  ADSystemInfo = IADsADSystemInfo;
+  WinNTSystemInfo = IADsWinNTSystemInfo;
+  DNWithBinary = IADsDNWithBinary;
+  DNWithString = IADsDNWithString;
+
+// *********************************************************************//
+// Declaration of structures, unions and aliases.
+// *********************************************************************//
+  PUserType1 = ^_ADS_CASEIGNORE_LIST; {*}
+  PUserType2 = ^_ADS_OCTET_LIST; {*}
+  PPWideChar1 = ^PWideChar; {*}
+  PUserType8 = ^tagTYPEDESC; {*}
+  PUserType9 = ^tagARRAYDESC; {*}
+  PUserType3 = ^TGUID; {*}
+  PWord1 = ^Word; {*}
+  PPWord1 = ^PWord1; {*}
+  PUserType4 = ^TGUID; {*}
+  PUserType5 = ^tagTYPEATTR; {*}
+  PUserType6 = ^tagFUNCDESC; {*}
+  PUserType7 = ^tagVARDESC; {*}
+  PUserType10 = ^tagTLIBATTR; {*}
+  PUserType11 = ^_ads_object_info; {*}
+  PUserType12 = ^_ads_attr_info; {*}
+  PUserType13 = ^ads_searchpref_info; {*}
+  PUserType14 = ^ads_search_column; {*}
+  PUserType15 = ^_ads_attr_def; {*}
+  PPUserType1 = ^PUserType15; {*}
+  PUINT1 = ^LongWord; {*}
+  PUserType16 = ^_ads_class_def; {*}
+  PPUserType2 = ^PUserType16; {*}
+
+  ADSTYPEENUM = __MIDL___MIDL_itf_ads_0000_0001;
+
+  __MIDL___MIDL_itf_ads_0000_0002 = packed record
+    dwLength: LongWord;
+    lpValue: ^Byte;
+  end;
+
+  ADS_OCTET_STRING = __MIDL___MIDL_itf_ads_0000_0002;
+
+  __MIDL___MIDL_itf_ads_0000_0003 = packed record
+    dwLength: LongWord;
+    lpValue: ^Byte;
+  end;
+
+  ADS_NT_SECURITY_DESCRIPTOR = __MIDL___MIDL_itf_ads_0000_0003;
+
+  _SYSTEMTIME = packed record
+    wYear: Word;
+    wMonth: Word;
+    wDayOfWeek: Word;
+    wDay: Word;
+    wHour: Word;
+    wMinute: Word;
+    wSecond: Word;
+    wMilliseconds: Word;
+  end;
+
+  _LARGE_INTEGER = packed record
+    QuadPart: Int64;
+  end;
+
+  __MIDL___MIDL_itf_ads_0000_0004 = packed record
+    dwLength: LongWord;
+    lpValue: ^Byte;
+  end;
+
+  ADS_PROV_SPECIFIC = __MIDL___MIDL_itf_ads_0000_0004;
+
+  __MIDL___MIDL_itf_ads_0000_0005 = packed record
+    Type_: LongWord;
+    VolumeName: PWideChar;
+    Path: PWideChar;
+  end;
+
+  ADS_PATH = __MIDL___MIDL_itf_ads_0000_0005;
+
+  __MIDL___MIDL_itf_ads_0000_0006 = packed record
+    PostalAddress: array[0..5] of PWideChar;
+  end;
+
+  ADS_POSTALADDRESS = __MIDL___MIDL_itf_ads_0000_0006;
+
+  __MIDL___MIDL_itf_ads_0000_0007 = packed record
+    WholeSeconds: LongWord;
+    EventID: LongWord;
+  end;
+
+  ADS_TIMESTAMP = __MIDL___MIDL_itf_ads_0000_0007;
+
+  __MIDL___MIDL_itf_ads_0000_0008 = packed record
+    RemoteID: LongWord;
+    ObjectName: PWideChar;
+  end;
+
+  ADS_BACKLINK = __MIDL___MIDL_itf_ads_0000_0008;
+
+  __MIDL___MIDL_itf_ads_0000_0009 = packed record
+    ObjectName: PWideChar;
+    Level: LongWord;
+    Interval: LongWord;
+  end;
+
+  ADS_TYPEDNAME = __MIDL___MIDL_itf_ads_0000_0009;
+
+  __MIDL___MIDL_itf_ads_0000_0010 = packed record
+    ObjectName: PWideChar;
+    Amount: LongWord;
+  end;
+
+  ADS_HOLD = __MIDL___MIDL_itf_ads_0000_0010;
+
+  __MIDL___MIDL_itf_ads_0000_0011 = packed record
+    AddressType: LongWord;
+    AddressLength: LongWord;
+    Address: ^Byte;
+  end;
+
+  ADS_NETADDRESS = __MIDL___MIDL_itf_ads_0000_0011;
+
+  __MIDL___MIDL_itf_ads_0000_0012 = packed record
+    ServerName: PWideChar;
+    ReplicaType: LongWord;
+    ReplicaNumber: LongWord;
+    Count: LongWord;
+    ReplicaAddressHints: ^__MIDL___MIDL_itf_ads_0000_0011;
+  end;
+
+  ADS_REPLICAPOINTER = __MIDL___MIDL_itf_ads_0000_0012;
+
+  __MIDL___MIDL_itf_ads_0000_0013 = packed record
+    TelephoneNumber: PWideChar;
+    NumberOfBits: LongWord;
+    Parameters: ^Byte;
+  end;
+
+  ADS_FAXNUMBER = __MIDL___MIDL_itf_ads_0000_0013;
+
+  __MIDL___MIDL_itf_ads_0000_0014 = packed record
+    Address: PWideChar;
+    Type_: LongWord;
+  end;
+
+  ADS_EMAIL = __MIDL___MIDL_itf_ads_0000_0014;
+
+  __MIDL___MIDL_itf_ads_0000_0015 = packed record
+    dwLength: LongWord;
+    lpBinaryValue: ^Byte;
+    pszDNString: PWideChar;
+  end;
+
+  ADS_DN_WITH_BINARY = __MIDL___MIDL_itf_ads_0000_0015;
+
+  __MIDL___MIDL_itf_ads_0000_0016 = packed record
+    pszStringValue: PWideChar;
+    pszDNString: PWideChar;
+  end;
+
+  ADS_DN_WITH_STRING = __MIDL___MIDL_itf_ads_0000_0016;
+
+  _ADS_CASEIGNORE_LIST = packed record
+    Next: PUserType1;
+    String_: PWideChar;
+  end;
+
+  _ADS_OCTET_LIST = packed record
+    Next: PUserType2;
+    Length: LongWord;
+    Data: ^Byte;
+  end;
+
+  __MIDL___MIDL_itf_ads_0000_0017 = record
+    case Integer of
+      0: (DNString: PWideChar);
+      1: (CaseExactString: PWideChar);
+      2: (CaseIgnoreString: PWideChar);
+      3: (PrintableString: PWideChar);
+      4: (NumericString: PWideChar);
+      5: (Boolean: LongWord);
+      6: (Integer: LongWord);
+      7: (OctetString: ADS_OCTET_STRING);
+      8: (UTCTime: _SYSTEMTIME);
+      9: (LargeInteger: _LARGE_INTEGER);
+      10: (ClassName: PWideChar);
+      11: (ProviderSpecific: ADS_PROV_SPECIFIC);
+      12: (pCaseIgnoreList: ^_ADS_CASEIGNORE_LIST);
+      13: (pOctetList: ^_ADS_OCTET_LIST);
+      14: (pPath: ^__MIDL___MIDL_itf_ads_0000_0005);
+      15: (pPostalAddress: ^__MIDL___MIDL_itf_ads_0000_0006);
+      16: (Timestamp: ADS_TIMESTAMP);
+      17: (BackLink: ADS_BACKLINK);
+      18: (pTypedName: ^__MIDL___MIDL_itf_ads_0000_0009);
+      19: (Hold: ADS_HOLD);
+      20: (pNetAddress: ^__MIDL___MIDL_itf_ads_0000_0011);
+      21: (pReplicaPointer: ^__MIDL___MIDL_itf_ads_0000_0012);
+      22: (pFaxNumber: ^__MIDL___MIDL_itf_ads_0000_0013);
+      23: (Email: ADS_EMAIL);
+      24: (SecurityDescriptor: ADS_NT_SECURITY_DESCRIPTOR);
+      25: (pDNWithBinary: ^__MIDL___MIDL_itf_ads_0000_0015);
+      26: (pDNWithString: ^__MIDL___MIDL_itf_ads_0000_0016);
+  end;
+
+  ADS_AUTHENTICATION_ENUM = __MIDL___MIDL_itf_ads_0000_0018;
+
+  _ads_object_info = packed record
+    pszRDN: PWideChar;
+    pszObjectDN: PWideChar;
+    pszParentDN: PWideChar;
+    pszSchemaDN: PWideChar;
+    pszClassName: PWideChar;
+  end;
+
+  ADS_STATUSENUM = __MIDL___MIDL_itf_ads_0000_0019;
+  ADS_DEREFENUM = __MIDL___MIDL_itf_ads_0000_0020;
+  ADS_SCOPEENUM = __MIDL___MIDL_itf_ads_0000_0021;
+  ADS_PREFERENCES_ENUM = __MIDL___MIDL_itf_ads_0000_0022;
+  ADSI_DIALECT_ENUM = __MIDL___MIDL_itf_ads_0000_0023;
+  ADS_CHASE_REFERRALS_ENUM = __MIDL___MIDL_itf_ads_0000_0024;
+  ADS_SEARCHPREF_ENUM = __MIDL___MIDL_itf_ads_0000_0025;
+
+  _adsvalue = packed record
+    dwType: ADSTYPEENUM;
+    __MIDL_0010: __MIDL___MIDL_itf_ads_0000_0017;
+  end;
+
+  ads_search_column = packed record
+    pszAttrName: PWideChar;
+    dwADsType: ADSTYPEENUM;
+    pADsValues: ^_adsvalue;
+    dwNumValues: LongWord;
+    hReserved: Pointer;
+  end;
+
+  _ads_attr_def = packed record
+    pszAttrName: PWideChar;
+    dwADsType: ADSTYPEENUM;
+    dwMinRange: LongWord;
+    dwMaxRange: LongWord;
+    fMultiValued: Integer;
+  end;
+
+  _ads_sortkey = packed record
+    pszAttrType: PWideChar;
+    pszReserved: PWideChar;
+    fReverseorder: Shortint;
+  end;
+
+  ADS_PROPERTY_OPERATION_ENUM = __MIDL___MIDL_itf_ads_0000_0026;
+
+  __MIDL_IOleAutomationTypes_0005 = record
+    case Integer of
+      0: (lptdesc: PUserType8);
+      1: (lpadesc: PUserType9);
+      2: (hreftype: LongWord);
+  end;
+
+  tagTYPEDESC = packed record
+    __MIDL_0008: __MIDL_IOleAutomationTypes_0005;
+    vt: Word;
+  end;
+
+  tagSAFEARRAYBOUND = packed record
+    cElements: LongWord;
+    lLbound: Integer;
+  end;
+
+  ULONG_PTR = LongWord;
+
+  tagIDLDESC = packed record
+    dwReserved: ULONG_PTR;
+    wIDLFlags: Word;
+  end;
+
+  DWORD = LongWord;
+
+  tagPARAMDESCEX = packed record
+    cBytes: LongWord;
+    varDefaultValue: OleVariant;
+  end;
+
+  tagPARAMDESC = packed record
+    pparamdescex: ^tagPARAMDESCEX;
+    wParamFlags: Word;
+  end;
+
+  tagELEMDESC = packed record
+    tdesc: tagTYPEDESC;
+    paramdesc: tagPARAMDESC;
+  end;
+
+  tagFUNCDESC = packed record
+    memid: Integer;
+    lprgscode: ^SCODE;
+    lprgelemdescParam: ^tagELEMDESC;
+    funckind: tagFUNCKIND;
+    invkind: tagINVOKEKIND;
+    callconv: tagCALLCONV;
+    cParams: Smallint;
+    cParamsOpt: Smallint;
+    oVft: Smallint;
+    cScodes: Smallint;
+    elemdescFunc: tagELEMDESC;
+    wFuncFlags: Word;
+  end;
+
+  __MIDL_IOleAutomationTypes_0006 = record
+    case Integer of
+      0: (oInst: LongWord);
+      1: (lpvarValue: ^OleVariant);
+  end;
+
+  tagVARDESC = packed record
+    memid: Integer;
+    lpstrSchema: PWideChar;
+    __MIDL_0009: __MIDL_IOleAutomationTypes_0006;
+    elemdescVar: tagELEMDESC;
+    wVarFlags: Word;
+    varkind: tagVARKIND;
+  end;
+
+  tagTLIBATTR = packed record
+    GUID: TGUID;
+    lcid: LongWord;
+    syskind: tagSYSKIND;
+    wMajorVerNum: Word;
+    wMinorVerNum: Word;
+    wLibFlags: Word;
+  end;
+
+  ADS_SYSTEMFLAG_ENUM = __MIDL___MIDL_itf_ads_0120_0001;
+  ADS_GROUP_TYPE_ENUM = __MIDL___MIDL_itf_ads_0126_0001;
+  ADS_RIGHTS_ENUM = __MIDL___MIDL_itf_ads_0148_0001;
+  ADS_ACETYPE_ENUM = __MIDL___MIDL_itf_ads_0148_0002;
+  ADS_ACEFLAG_ENUM = __MIDL___MIDL_itf_ads_0148_0003;
+  ADS_FLAGTYPE_ENUM = __MIDL___MIDL_itf_ads_0148_0004;
+  ADS_SD_CONTROL_ENUM = __MIDL___MIDL_itf_ads_0148_0005;
+  ADS_SD_REVISION_ENUM = __MIDL___MIDL_itf_ads_0148_0006;
+  ADS_NAME_TYPE_ENUM = __MIDL___MIDL_itf_ads_0149_0001;
+  ADS_NAME_INITTYPE_ENUM = __MIDL___MIDL_itf_ads_0149_0002;
+  ADS_OPTION_ENUM = __MIDL___MIDL_itf_ads_0163_0001;
+  ADS_SECURITY_INFO_ENUM = __MIDL___MIDL_itf_ads_0163_0002;
+  ADS_SETTYPE_ENUM = __MIDL___MIDL_itf_ads_0164_0001;
+  ADS_FORMAT_ENUM = __MIDL___MIDL_itf_ads_0164_0002;
+  ADS_DISPLAY_ENUM = __MIDL___MIDL_itf_ads_0164_0003;
+  ADS_ESCAPE_MODE_ENUM = __MIDL___MIDL_itf_ads_0164_0004;
+
+  _ads_attr_info = packed record
+    pszAttrName: PWideChar;
+    dwControlCode: LongWord;
+    dwADsType: ADSTYPEENUM;
+    pADsValues: ^_adsvalue;
+    dwNumValues: LongWord;
+  end;
+
+  ads_searchpref_info = packed record
+    dwSearchPref: ADS_SEARCHPREF_ENUM;
+    vValue: _adsvalue;
+    dwStatus: ADS_STATUSENUM;
+  end;
+
+  _ads_class_def = packed record
+    pszClassName: PWideChar;
+    dwMandatoryAttrs: LongWord;
+    ppszMandatoryAttrs: ^PWideChar;
+    optionalAttrs: LongWord;
+    ppszOptionalAttrs: ^PPWideChar1;
+    dwNamingAttrs: LongWord;
+    ppszNamingAttrs: ^PPWideChar1;
+    dwSuperClasses: LongWord;
+    ppszSuperClasses: ^PPWideChar1;
+    fIsContainer: Integer;
+  end;
+
+  tagTYPEATTR = packed record
+    GUID: TGUID;
+    lcid: LongWord;
+    dwReserved: LongWord;
+    memidConstructor: Integer;
+    memidDestructor: Integer;
+    lpstrSchema: PWideChar;
+    cbSizeInstance: LongWord;
+    typekind: tagTYPEKIND;
+    cFuncs: Word;
+    cVars: Word;
+    cImplTypes: Word;
+    cbSizeVft: Word;
+    cbAlignment: Word;
+    wTypeFlags: Word;
+    wMajorVerNum: Word;
+    wMinorVerNum: Word;
+    tdescAlias: tagTYPEDESC;
+    idldescType: tagIDLDESC;
+  end;
+
+  tagARRAYDESC = packed record
+    tdescElem: tagTYPEDESC;
+    cDims: Word;
+    rgbounds: ^tagSAFEARRAYBOUND;
+  end;
+
+// *********************************************************************//
+// Interface: IADs
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {FD8256D0-FD15-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  IADs = interface(IDispatch)
+    ['{FD8256D0-FD15-11CE-ABC4-02608C9E7553}']
+    function  Get_Name: WideString; safecall;
+    function  Get_Class_: WideString; safecall;
+    function  Get_GUID: WideString; safecall;
+    function  Get_ADsPath: WideString; safecall;
+    function  Get_Parent: WideString; safecall;
+    function  Get_Schema: WideString; safecall;
+    procedure GetInfo; safecall;
+    procedure SetInfo; safecall;
+    function  Get(const bstrName: WideString): OleVariant; safecall;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); safecall;
+    function  GetEx(const bstrName: WideString): OleVariant; safecall;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); safecall;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); safecall;
+    property Name: WideString read Get_Name;
+    property Class_: WideString read Get_Class_;
+    property GUID: WideString read Get_GUID;
+    property ADsPath: WideString read Get_ADsPath;
+    property Parent: WideString read Get_Parent;
+    property Schema: WideString read Get_Schema;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {FD8256D0-FD15-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDisp = dispinterface
+    ['{FD8256D0-FD15-11CE-ABC4-02608C9E7553}']
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsContainer
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {001677D0-FD16-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  IADsContainer = interface(IDispatch)
+    ['{001677D0-FD16-11CE-ABC4-02608C9E7553}']
+    function  Get_Count: Integer; safecall;
+    function  Get__NewEnum: IUnknown; safecall;
+    function  Get_Filter: OleVariant; safecall;
+    procedure Set_Filter(pVar: OleVariant); safecall;
+    function  Get_Hints: OleVariant; safecall;
+    procedure Set_Hints(pvFilter: OleVariant); safecall;
+    function  GetObject(const ClassName: WideString; const RelativeName: WideString): IDispatch; safecall;
+    function  Create(const ClassName: WideString; const RelativeName: WideString): IDispatch; safecall;
+    procedure Delete(const bstrClassName: WideString; const bstrRelativeName: WideString); safecall;
+    function  CopyHere(const SourceName: WideString; const NewName: WideString): IDispatch; safecall;
+    function  MoveHere(const SourceName: WideString; const NewName: WideString): IDispatch; safecall;
+    property Count: Integer read Get_Count;
+    property _NewEnum: IUnknown read Get__NewEnum;
+    property Filter: OleVariant read Get_Filter write Set_Filter;
+    property Hints: OleVariant read Get_Hints write Set_Hints;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsContainerDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {001677D0-FD16-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsContainerDisp = dispinterface
+    ['{001677D0-FD16-11CE-ABC4-02608C9E7553}']
+    property Count: Integer readonly dispid 2;
+    property _NewEnum: IUnknown readonly dispid -4;
+    property Filter: OleVariant dispid 3;
+    property Hints: OleVariant dispid 4;
+    function  GetObject(const ClassName: WideString; const RelativeName: WideString): IDispatch; dispid 5;
+    function  Create(const ClassName: WideString; const RelativeName: WideString): IDispatch; dispid 6;
+    procedure Delete(const bstrClassName: WideString; const bstrRelativeName: WideString); dispid 7;
+    function  CopyHere(const SourceName: WideString; const NewName: WideString): IDispatch; dispid 8;
+    function  MoveHere(const SourceName: WideString; const NewName: WideString): IDispatch; dispid 9;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsCollection
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {72B945E0-253B-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  IADsCollection = interface(IDispatch)
+    ['{72B945E0-253B-11CF-A988-00AA006BC149}']
+    function  Get__NewEnum: IUnknown; safecall;
+    procedure Add(const bstrName: WideString; vItem: OleVariant); safecall;
+    procedure Remove(const bstrItemToBeRemoved: WideString); safecall;
+    function  GetObject(const bstrName: WideString): OleVariant; safecall;
+    property _NewEnum: IUnknown read Get__NewEnum;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsCollectionDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {72B945E0-253B-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsCollectionDisp = dispinterface
+    ['{72B945E0-253B-11CF-A988-00AA006BC149}']
+    property _NewEnum: IUnknown readonly dispid -4;
+    procedure Add(const bstrName: WideString; vItem: OleVariant); dispid 4;
+    procedure Remove(const bstrItemToBeRemoved: WideString); dispid 5;
+    function  GetObject(const bstrName: WideString): OleVariant; dispid 6;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsMembers
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {451A0030-72EC-11CF-B03B-00AA006E0975}
+// *********************************************************************//
+  IADsMembers = interface(IDispatch)
+    ['{451A0030-72EC-11CF-B03B-00AA006E0975}']
+    function  Get_Count: Integer; safecall;
+    function  Get__NewEnum: IUnknown; safecall;
+    function  Get_Filter: OleVariant; safecall;
+    procedure Set_Filter(pvFilter: OleVariant); safecall;
+    property Count: Integer read Get_Count;
+    property _NewEnum: IUnknown read Get__NewEnum;
+    property Filter: OleVariant read Get_Filter write Set_Filter;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsMembersDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {451A0030-72EC-11CF-B03B-00AA006E0975}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsMembersDisp = dispinterface
+    ['{451A0030-72EC-11CF-B03B-00AA006E0975}']
+    property Count: Integer readonly dispid 2;
+    property _NewEnum: IUnknown readonly dispid -4;
+    property Filter: OleVariant dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPropertyList
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C6F602B6-8F69-11D0-8528-00C04FD8D503}
+// *********************************************************************//
+  IADsPropertyList = interface(IDispatch)
+    ['{C6F602B6-8F69-11D0-8528-00C04FD8D503}']
+    function  Get_PropertyCount: Integer; safecall;
+    function  Next: OleVariant; safecall;
+    procedure Skip(cElements: Integer); safecall;
+    procedure Reset; safecall;
+    function  Item(varIndex: OleVariant): OleVariant; safecall;
+    function  GetPropertyItem(const bstrName: WideString; lnADsType: Integer): OleVariant; safecall;
+    procedure PutPropertyItem(varData: OleVariant); safecall;
+    procedure ResetPropertyItem(varEntry: OleVariant); safecall;
+    procedure PurgePropertyList; safecall;
+    property PropertyCount: Integer read Get_PropertyCount;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPropertyListDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C6F602B6-8F69-11D0-8528-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyListDisp = dispinterface
+    ['{C6F602B6-8F69-11D0-8528-00C04FD8D503}']
+    property PropertyCount: Integer readonly dispid 2;
+    function  Next: OleVariant; dispid 3;
+    procedure Skip(cElements: Integer); dispid 4;
+    procedure Reset; dispid 5;
+    function  Item(varIndex: OleVariant): OleVariant; dispid 0;
+    function  GetPropertyItem(const bstrName: WideString; lnADsType: Integer): OleVariant; dispid 6;
+    procedure PutPropertyItem(varData: OleVariant); dispid 7;
+    procedure ResetPropertyItem(varEntry: OleVariant); dispid 8;
+    procedure PurgePropertyList; dispid 9;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPropertyEntry
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {05792C8E-941F-11D0-8529-00C04FD8D503}
+// *********************************************************************//
+  IADsPropertyEntry = interface(IDispatch)
+    ['{05792C8E-941F-11D0-8529-00C04FD8D503}']
+    procedure Clear; safecall;
+    function  Get_Name: WideString; safecall;
+    procedure Set_Name(const retval: WideString); safecall;
+    function  Get_ADsType: Integer; safecall;
+    procedure Set_ADsType(retval: Integer); safecall;
+    function  Get_ControlCode: Integer; safecall;
+    procedure Set_ControlCode(retval: Integer); safecall;
+    function  Get_Values: OleVariant; safecall;
+    procedure Set_Values(retval: OleVariant); safecall;
+    property Name: WideString read Get_Name write Set_Name;
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property ControlCode: Integer read Get_ControlCode write Set_ControlCode;
+    property Values: OleVariant read Get_Values write Set_Values;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPropertyEntryDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {05792C8E-941F-11D0-8529-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyEntryDisp = dispinterface
+    ['{05792C8E-941F-11D0-8529-00C04FD8D503}']
+    procedure Clear; dispid 1;
+    property Name: WideString dispid 2;
+    property ADsType: Integer dispid 3;
+    property ControlCode: Integer dispid 4;
+    property Values: OleVariant dispid 5;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPropertyValue
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {79FA9AD0-A97C-11D0-8534-00C04FD8D503}
+// *********************************************************************//
+  IADsPropertyValue = interface(IDispatch)
+    ['{79FA9AD0-A97C-11D0-8534-00C04FD8D503}']
+    procedure Clear; safecall;
+    function  Get_ADsType: Integer; safecall;
+    procedure Set_ADsType(retval: Integer); safecall;
+    function  Get_DNString: WideString; safecall;
+    procedure Set_DNString(const retval: WideString); safecall;
+    function  Get_CaseExactString: WideString; safecall;
+    procedure Set_CaseExactString(const retval: WideString); safecall;
+    function  Get_CaseIgnoreString: WideString; safecall;
+    procedure Set_CaseIgnoreString(const retval: WideString); safecall;
+    function  Get_PrintableString: WideString; safecall;
+    procedure Set_PrintableString(const retval: WideString); safecall;
+    function  Get_NumericString: WideString; safecall;
+    procedure Set_NumericString(const retval: WideString); safecall;
+    function  Get_Boolean: Integer; safecall;
+    procedure Set_Boolean(retval: Integer); safecall;
+    function  Get_Integer: Integer; safecall;
+    procedure Set_Integer(retval: Integer); safecall;
+    function  Get_OctetString: OleVariant; safecall;
+    procedure Set_OctetString(retval: OleVariant); safecall;
+    function  Get_SecurityDescriptor: IDispatch; safecall;
+    procedure Set_SecurityDescriptor(const retval: IDispatch); safecall;
+    function  Get_LargeInteger: IDispatch; safecall;
+    procedure Set_LargeInteger(const retval: IDispatch); safecall;
+    function  Get_UTCTime: TDateTime; safecall;
+    procedure Set_UTCTime(retval: TDateTime); safecall;
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property DNString: WideString read Get_DNString write Set_DNString;
+    property CaseExactString: WideString read Get_CaseExactString write Set_CaseExactString;
+    property CaseIgnoreString: WideString read Get_CaseIgnoreString write Set_CaseIgnoreString;
+    property PrintableString: WideString read Get_PrintableString write Set_PrintableString;
+    property NumericString: WideString read Get_NumericString write Set_NumericString;
+    property Boolean: Integer read Get_Boolean write Set_Boolean;
+    property Integer: Integer read Get_Integer write Set_Integer;
+    property OctetString: OleVariant read Get_OctetString write Set_OctetString;
+    property SecurityDescriptor: IDispatch read Get_SecurityDescriptor write Set_SecurityDescriptor;
+    property LargeInteger: IDispatch read Get_LargeInteger write Set_LargeInteger;
+    property UTCTime: TDateTime read Get_UTCTime write Set_UTCTime;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPropertyValueDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {79FA9AD0-A97C-11D0-8534-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyValueDisp = dispinterface
+    ['{79FA9AD0-A97C-11D0-8534-00C04FD8D503}']
+    procedure Clear; dispid 1;
+    property ADsType: Integer dispid 2;
+    property DNString: WideString dispid 3;
+    property CaseExactString: WideString dispid 4;
+    property CaseIgnoreString: WideString dispid 5;
+    property PrintableString: WideString dispid 6;
+    property NumericString: WideString dispid 7;
+    property Boolean: Integer dispid 8;
+    property Integer: Integer dispid 9;
+    property OctetString: OleVariant dispid 10;
+    property SecurityDescriptor: IDispatch dispid 11;
+    property LargeInteger: IDispatch dispid 12;
+    property UTCTime: TDateTime dispid 13;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPropertyValue2
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {306E831C-5BC7-11D1-A3B8-00C04FB950DC}
+// *********************************************************************//
+  IADsPropertyValue2 = interface(IDispatch)
+    ['{306E831C-5BC7-11D1-A3B8-00C04FB950DC}']
+    function  GetObjectProperty(var lnADsType: Integer): OleVariant; safecall;
+    procedure PutObjectProperty(lnADsType: Integer; vProp: OleVariant); safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPropertyValue2Disp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {306E831C-5BC7-11D1-A3B8-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyValue2Disp = dispinterface
+    ['{306E831C-5BC7-11D1-A3B8-00C04FB950DC}']
+    function  GetObjectProperty(var lnADsType: Integer): OleVariant; dispid 1;
+    procedure PutObjectProperty(lnADsType: Integer; vProp: OleVariant); dispid 2;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IPrivateDispatch
+// Flags:     (0)
+// GUID:      {86AB4BBE-65F6-11D1-8C13-00C04FD8D503}
+// *********************************************************************//
+  IPrivateDispatch = interface(IUnknown)
+    ['{86AB4BBE-65F6-11D1-8C13-00C04FD8D503}']
+    function  ADSIInitializeDispatchManager(dwExtensionId: Integer): HResult; stdcall;
+    function  ADSIGetTypeInfoCount(out pctinfo: SYSUINT): HResult; stdcall;
+    function  ADSIGetTypeInfo(itinfo: SYSUINT; lcid: LongWord; out ppTInfo: ITypeInfo): HResult; stdcall;
+    function  ADSIGetIDsOfNames(var riid: TGUID; rgszNames: PPWord1; cNames: SYSUINT;
+                                lcid: LongWord; out rgdispid: Integer): HResult; stdcall;
+    function  ADSIInvoke(dispidMember: Integer; var riid: TGUID; lcid: LongWord; wFlags: Word;
+                         var pdispparams: TGUID; out pvarResult: OleVariant; out pexcepinfo: TGUID;
+                         out puArgErr: SYSUINT): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: ITypeInfo
+// Flags:     (0)
+// GUID:      {00020401-0000-0000-C000-000000000046}
+// *********************************************************************//
+  ITypeInfo = interface(IUnknown)
+    ['{00020401-0000-0000-C000-000000000046}']
+    function  RemoteGetTypeAttr(out ppTypeAttr: PUserType5; out pDummy: DWORD): HResult; stdcall;
+    function  GetTypeComp(out ppTComp: ITypeComp): HResult; stdcall;
+    function  RemoteGetFuncDesc(index: SYSUINT; out ppFuncDesc: PUserType6; out pDummy: DWORD): HResult; stdcall;
+    function  RemoteGetVarDesc(index: SYSUINT; out ppVarDesc: PUserType7; out pDummy: DWORD): HResult; stdcall;
+    function  RemoteGetNames(memid: Integer; out rgBstrNames: WideString; cMaxNames: SYSUINT;
+                             out pcNames: SYSUINT): HResult; stdcall;
+    function  GetRefTypeOfImplType(index: SYSUINT; out pRefType: LongWord): HResult; stdcall;
+    function  GetImplTypeFlags(index: SYSUINT; out pImplTypeFlags: SYSINT): HResult; stdcall;
+    function  LocalGetIDsOfNames: HResult; stdcall;
+    function  LocalInvoke: HResult; stdcall;
+    function  RemoteGetDocumentation(memid: Integer; refPtrFlags: LongWord;
+                                     out pBstrName: WideString; out pBstrDocString: WideString;
+                                     out pdwHelpContext: LongWord; out pBstrHelpFile: WideString): HResult; stdcall;
+    function  RemoteGetDllEntry(memid: Integer; invkind: tagINVOKEKIND; refPtrFlags: LongWord;
+                                out pBstrDllName: WideString; out pBstrName: WideString;
+                                out pwOrdinal: Word): HResult; stdcall;
+    function  GetRefTypeInfo(hreftype: LongWord; out ppTInfo: ITypeInfo): HResult; stdcall;
+    function  LocalAddressOfMember: HResult; stdcall;
+    function  RemoteCreateInstance(var riid: TGUID; out ppvObj: IUnknown): HResult; stdcall;
+    function  GetMops(memid: Integer; out pBstrMops: WideString): HResult; stdcall;
+    function  RemoteGetContainingTypeLib(out ppTLib: ITypeLib; out pIndex: SYSUINT): HResult; stdcall;
+    function  LocalReleaseTypeAttr: HResult; stdcall;
+    function  LocalReleaseFuncDesc: HResult; stdcall;
+    function  LocalReleaseVarDesc: HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: ITypeComp
+// Flags:     (0)
+// GUID:      {00020403-0000-0000-C000-000000000046}
+// *********************************************************************//
+  ITypeComp = interface(IUnknown)
+    ['{00020403-0000-0000-C000-000000000046}']
+    function  RemoteBind(szName: PWideChar; lHashVal: LongWord; wFlags: Word;
+                         out ppTInfo: ITypeInfo; out pDescKind: tagDESCKIND;
+                         out ppFuncDesc: PUserType6; out ppVarDesc: PUserType7;
+                         out ppTypeComp: ITypeComp; out pDummy: DWORD): HResult; stdcall;
+    function  RemoteBindType(szName: PWideChar; lHashVal: LongWord; out ppTInfo: ITypeInfo): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: ITypeLib
+// Flags:     (0)
+// GUID:      {00020402-0000-0000-C000-000000000046}
+// *********************************************************************//
+  ITypeLib = interface(IUnknown)
+    ['{00020402-0000-0000-C000-000000000046}']
+    function  RemoteGetTypeInfoCount(out pctinfo: SYSUINT): HResult; stdcall;
+    function  GetTypeInfo(index: SYSUINT; out ppTInfo: ITypeInfo): HResult; stdcall;
+    function  GetTypeInfoType(index: SYSUINT; out pTKind: tagTYPEKIND): HResult; stdcall;
+    function  GetTypeInfoOfGuid(var GUID: TGUID; out ppTInfo: ITypeInfo): HResult; stdcall;
+    function  RemoteGetLibAttr(out ppTLibAttr: PUserType10; out pDummy: DWORD): HResult; stdcall;
+    function  GetTypeComp(out ppTComp: ITypeComp): HResult; stdcall;
+    function  RemoteGetDocumentation(index: SYSINT; refPtrFlags: LongWord;
+                                     out pBstrName: WideString; out pBstrDocString: WideString;
+                                     out pdwHelpContext: LongWord; out pBstrHelpFile: WideString): HResult; stdcall;
+    function  RemoteIsName(szNameBuf: PWideChar; lHashVal: LongWord; out pfName: Integer;
+                           out pBstrLibName: WideString): HResult; stdcall;
+    function  RemoteFindName(szNameBuf: PWideChar; lHashVal: LongWord; out ppTInfo: ITypeInfo;
+                             out rgMemId: Integer; var pcFound: Word; out pBstrLibName: WideString): HResult; stdcall;
+    function  LocalReleaseTLibAttr: HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IPrivateUnknown
+// Flags:     (0)
+// GUID:      {89126BAB-6EAD-11D1-8C18-00C04FD8D503}
+// *********************************************************************//
+  IPrivateUnknown = interface(IUnknown)
+    ['{89126BAB-6EAD-11D1-8C18-00C04FD8D503}']
+    function  ADSIInitializeObject(const lpszUserName: WideString; const lpszPassword: WideString;
+                                   lnReserved: Integer): HResult; stdcall;
+    function  ADSIReleaseObject: HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IADsExtension
+// Flags:     (0)
+// GUID:      {3D35553C-D2B0-11D1-B17B-0000F87593A0}
+// *********************************************************************//
+  IADsExtension = interface(IUnknown)
+    ['{3D35553C-D2B0-11D1-B17B-0000F87593A0}']
+    function  Operate(dwCode: LongWord; varData1: OleVariant; varData2: OleVariant;
+                      varData3: OleVariant): HResult; stdcall;
+    function  PrivateGetIDsOfNames(var riid: TGUID; rgszNames: PPWord1; cNames: SYSUINT;
+                                   lcid: LongWord; out rgdispid: Integer): HResult; stdcall;
+    function  PrivateInvoke(dispidMember: Integer; var riid: TGUID; lcid: LongWord; wFlags: Word;
+                            var pdispparams: TGUID; out pvarResult: OleVariant;
+                            out pexcepinfo: TGUID; out puArgErr: SYSUINT): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IADsDeleteOps
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B2BD0902-8878-11D1-8C21-00C04FD8D503}
+// *********************************************************************//
+  IADsDeleteOps = interface(IDispatch)
+    ['{B2BD0902-8878-11D1-8C21-00C04FD8D503}']
+    procedure DeleteObject(lnFlags: Integer); safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsDeleteOpsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B2BD0902-8878-11D1-8C21-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDeleteOpsDisp = dispinterface
+    ['{B2BD0902-8878-11D1-8C21-00C04FD8D503}']
+    procedure DeleteObject(lnFlags: Integer); dispid 2;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsNamespaces
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {28B96BA0-B330-11CF-A9AD-00AA006BC149}
+// *********************************************************************//
+  IADsNamespaces = interface(IADs)
+    ['{28B96BA0-B330-11CF-A9AD-00AA006BC149}']
+    function  Get_DefaultContainer: WideString; safecall;
+    procedure Set_DefaultContainer(const retval: WideString); safecall;
+    property DefaultContainer: WideString read Get_DefaultContainer write Set_DefaultContainer;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsNamespacesDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {28B96BA0-B330-11CF-A9AD-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNamespacesDisp = dispinterface
+    ['{28B96BA0-B330-11CF-A9AD-00AA006BC149}']
+    property DefaultContainer: WideString dispid 1;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsClass
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD0-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  IADsClass = interface(IADs)
+    ['{C8F93DD0-4AE0-11CF-9E73-00AA004A5691}']
+    function  Get_PrimaryInterface: WideString; safecall;
+    function  Get_CLSID: WideString; safecall;
+    procedure Set_CLSID(const retval: WideString); safecall;
+    function  Get_OID: WideString; safecall;
+    procedure Set_OID(const retval: WideString); safecall;
+    function  Get_Abstract: WordBool; safecall;
+    procedure Set_Abstract(retval: WordBool); safecall;
+    function  Get_Auxiliary: WordBool; safecall;
+    procedure Set_Auxiliary(retval: WordBool); safecall;
+    function  Get_MandatoryProperties: OleVariant; safecall;
+    procedure Set_MandatoryProperties(retval: OleVariant); safecall;
+    function  Get_OptionalProperties: OleVariant; safecall;
+    procedure Set_OptionalProperties(retval: OleVariant); safecall;
+    function  Get_NamingProperties: OleVariant; safecall;
+    procedure Set_NamingProperties(retval: OleVariant); safecall;
+    function  Get_DerivedFrom: OleVariant; safecall;
+    procedure Set_DerivedFrom(retval: OleVariant); safecall;
+    function  Get_AuxDerivedFrom: OleVariant; safecall;
+    procedure Set_AuxDerivedFrom(retval: OleVariant); safecall;
+    function  Get_PossibleSuperiors: OleVariant; safecall;
+    procedure Set_PossibleSuperiors(retval: OleVariant); safecall;
+    function  Get_Containment: OleVariant; safecall;
+    procedure Set_Containment(retval: OleVariant); safecall;
+    function  Get_Container: WordBool; safecall;
+    procedure Set_Container(retval: WordBool); safecall;
+    function  Get_HelpFileName: WideString; safecall;
+    procedure Set_HelpFileName(const retval: WideString); safecall;
+    function  Get_HelpFileContext: Integer; safecall;
+    procedure Set_HelpFileContext(retval: Integer); safecall;
+    function  Qualifiers: IADsCollection; safecall;
+    property PrimaryInterface: WideString read Get_PrimaryInterface;
+    property CLSID: WideString read Get_CLSID write Set_CLSID;
+    property OID: WideString read Get_OID write Set_OID;
+    property Abstract: WordBool read Get_Abstract write Set_Abstract;
+    property Auxiliary: WordBool read Get_Auxiliary write Set_Auxiliary;
+    property MandatoryProperties: OleVariant read Get_MandatoryProperties write Set_MandatoryProperties;
+    property OptionalProperties: OleVariant read Get_OptionalProperties write Set_OptionalProperties;
+    property NamingProperties: OleVariant read Get_NamingProperties write Set_NamingProperties;
+    property DerivedFrom: OleVariant read Get_DerivedFrom write Set_DerivedFrom;
+    property AuxDerivedFrom: OleVariant read Get_AuxDerivedFrom write Set_AuxDerivedFrom;
+    property PossibleSuperiors: OleVariant read Get_PossibleSuperiors write Set_PossibleSuperiors;
+    property Containment: OleVariant read Get_Containment write Set_Containment;
+    property Container: WordBool read Get_Container write Set_Container;
+    property HelpFileName: WideString read Get_HelpFileName write Set_HelpFileName;
+    property HelpFileContext: Integer read Get_HelpFileContext write Set_HelpFileContext;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsClassDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD0-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsClassDisp = dispinterface
+    ['{C8F93DD0-4AE0-11CF-9E73-00AA004A5691}']
+    property PrimaryInterface: WideString readonly dispid 15;
+    property CLSID: WideString dispid 16;
+    property OID: WideString dispid 17;
+    property Abstract: WordBool dispid 18;
+    property Auxiliary: WordBool dispid 26;
+    property MandatoryProperties: OleVariant dispid 19;
+    property OptionalProperties: OleVariant dispid 29;
+    property NamingProperties: OleVariant dispid 30;
+    property DerivedFrom: OleVariant dispid 20;
+    property AuxDerivedFrom: OleVariant dispid 27;
+    property PossibleSuperiors: OleVariant dispid 28;
+    property Containment: OleVariant dispid 21;
+    property Container: WordBool dispid 22;
+    property HelpFileName: WideString dispid 23;
+    property HelpFileContext: Integer dispid 24;
+    function  Qualifiers: IADsCollection; dispid 25;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsProperty
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD3-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  IADsProperty = interface(IADs)
+    ['{C8F93DD3-4AE0-11CF-9E73-00AA004A5691}']
+    function  Get_OID: WideString; safecall;
+    procedure Set_OID(const retval: WideString); safecall;
+    function  Get_Syntax: WideString; safecall;
+    procedure Set_Syntax(const retval: WideString); safecall;
+    function  Get_MaxRange: Integer; safecall;
+    procedure Set_MaxRange(retval: Integer); safecall;
+    function  Get_MinRange: Integer; safecall;
+    procedure Set_MinRange(retval: Integer); safecall;
+    function  Get_MultiValued: WordBool; safecall;
+    procedure Set_MultiValued(retval: WordBool); safecall;
+    function  Qualifiers: IADsCollection; safecall;
+    property OID: WideString read Get_OID write Set_OID;
+    property Syntax: WideString read Get_Syntax write Set_Syntax;
+    property MaxRange: Integer read Get_MaxRange write Set_MaxRange;
+    property MinRange: Integer read Get_MinRange write Set_MinRange;
+    property MultiValued: WordBool read Get_MultiValued write Set_MultiValued;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPropertyDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD3-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPropertyDisp = dispinterface
+    ['{C8F93DD3-4AE0-11CF-9E73-00AA004A5691}']
+    property OID: WideString dispid 17;
+    property Syntax: WideString dispid 18;
+    property MaxRange: Integer dispid 19;
+    property MinRange: Integer dispid 20;
+    property MultiValued: WordBool dispid 21;
+    function  Qualifiers: IADsCollection; dispid 22;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsSyntax
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD2-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  IADsSyntax = interface(IADs)
+    ['{C8F93DD2-4AE0-11CF-9E73-00AA004A5691}']
+    function  Get_OleAutoDataType: Integer; safecall;
+    procedure Set_OleAutoDataType(retval: Integer); safecall;
+    property OleAutoDataType: Integer read Get_OleAutoDataType write Set_OleAutoDataType;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsSyntaxDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {C8F93DD2-4AE0-11CF-9E73-00AA004A5691}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSyntaxDisp = dispinterface
+    ['{C8F93DD2-4AE0-11CF-9E73-00AA004A5691}']
+    property OleAutoDataType: Integer dispid 15;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsLocality
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A05E03A2-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  IADsLocality = interface(IADs)
+    ['{A05E03A2-EFFE-11CF-8ABC-00C04FD8D503}']
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_LocalityName: WideString; safecall;
+    procedure Set_LocalityName(const retval: WideString); safecall;
+    function  Get_PostalAddress: WideString; safecall;
+    procedure Set_PostalAddress(const retval: WideString); safecall;
+    function  Get_SeeAlso: OleVariant; safecall;
+    procedure Set_SeeAlso(retval: OleVariant); safecall;
+    property Description: WideString read Get_Description write Set_Description;
+    property LocalityName: WideString read Get_LocalityName write Set_LocalityName;
+    property PostalAddress: WideString read Get_PostalAddress write Set_PostalAddress;
+    property SeeAlso: OleVariant read Get_SeeAlso write Set_SeeAlso;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsLocalityDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A05E03A2-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsLocalityDisp = dispinterface
+    ['{A05E03A2-EFFE-11CF-8ABC-00C04FD8D503}']
+    property Description: WideString dispid 15;
+    property LocalityName: WideString dispid 16;
+    property PostalAddress: WideString dispid 17;
+    property SeeAlso: OleVariant dispid 18;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsO
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  IADsO = interface(IADs)
+    ['{A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503}']
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_LocalityName: WideString; safecall;
+    procedure Set_LocalityName(const retval: WideString); safecall;
+    function  Get_PostalAddress: WideString; safecall;
+    procedure Set_PostalAddress(const retval: WideString); safecall;
+    function  Get_TelephoneNumber: WideString; safecall;
+    procedure Set_TelephoneNumber(const retval: WideString); safecall;
+    function  Get_FaxNumber: WideString; safecall;
+    procedure Set_FaxNumber(const retval: WideString); safecall;
+    function  Get_SeeAlso: OleVariant; safecall;
+    procedure Set_SeeAlso(retval: OleVariant); safecall;
+    property Description: WideString read Get_Description write Set_Description;
+    property LocalityName: WideString read Get_LocalityName write Set_LocalityName;
+    property PostalAddress: WideString read Get_PostalAddress write Set_PostalAddress;
+    property TelephoneNumber: WideString read Get_TelephoneNumber write Set_TelephoneNumber;
+    property FaxNumber: WideString read Get_FaxNumber write Set_FaxNumber;
+    property SeeAlso: OleVariant read Get_SeeAlso write Set_SeeAlso;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsODisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsODisp = dispinterface
+    ['{A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503}']
+    property Description: WideString dispid 15;
+    property LocalityName: WideString dispid 16;
+    property PostalAddress: WideString dispid 17;
+    property TelephoneNumber: WideString dispid 18;
+    property FaxNumber: WideString dispid 19;
+    property SeeAlso: OleVariant dispid 20;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsOU
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A2F733B8-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  IADsOU = interface(IADs)
+    ['{A2F733B8-EFFE-11CF-8ABC-00C04FD8D503}']
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_LocalityName: WideString; safecall;
+    procedure Set_LocalityName(const retval: WideString); safecall;
+    function  Get_PostalAddress: WideString; safecall;
+    procedure Set_PostalAddress(const retval: WideString); safecall;
+    function  Get_TelephoneNumber: WideString; safecall;
+    procedure Set_TelephoneNumber(const retval: WideString); safecall;
+    function  Get_FaxNumber: WideString; safecall;
+    procedure Set_FaxNumber(const retval: WideString); safecall;
+    function  Get_SeeAlso: OleVariant; safecall;
+    procedure Set_SeeAlso(retval: OleVariant); safecall;
+    function  Get_BusinessCategory: WideString; safecall;
+    procedure Set_BusinessCategory(const retval: WideString); safecall;
+    property Description: WideString read Get_Description write Set_Description;
+    property LocalityName: WideString read Get_LocalityName write Set_LocalityName;
+    property PostalAddress: WideString read Get_PostalAddress write Set_PostalAddress;
+    property TelephoneNumber: WideString read Get_TelephoneNumber write Set_TelephoneNumber;
+    property FaxNumber: WideString read Get_FaxNumber write Set_FaxNumber;
+    property SeeAlso: OleVariant read Get_SeeAlso write Set_SeeAlso;
+    property BusinessCategory: WideString read Get_BusinessCategory write Set_BusinessCategory;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsOUDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A2F733B8-EFFE-11CF-8ABC-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOUDisp = dispinterface
+    ['{A2F733B8-EFFE-11CF-8ABC-00C04FD8D503}']
+    property Description: WideString dispid 15;
+    property LocalityName: WideString dispid 16;
+    property PostalAddress: WideString dispid 17;
+    property TelephoneNumber: WideString dispid 18;
+    property FaxNumber: WideString dispid 19;
+    property SeeAlso: OleVariant dispid 20;
+    property BusinessCategory: WideString dispid 21;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsDomain
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {00E4C220-FD16-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  IADsDomain = interface(IADs)
+    ['{00E4C220-FD16-11CE-ABC4-02608C9E7553}']
+    function  Get_IsWorkgroup: WordBool; safecall;
+    function  Get_MinPasswordLength: Integer; safecall;
+    procedure Set_MinPasswordLength(retval: Integer); safecall;
+    function  Get_MinPasswordAge: Integer; safecall;
+    procedure Set_MinPasswordAge(retval: Integer); safecall;
+    function  Get_MaxPasswordAge: Integer; safecall;
+    procedure Set_MaxPasswordAge(retval: Integer); safecall;
+    function  Get_MaxBadPasswordsAllowed: Integer; safecall;
+    procedure Set_MaxBadPasswordsAllowed(retval: Integer); safecall;
+    function  Get_PasswordHistoryLength: Integer; safecall;
+    procedure Set_PasswordHistoryLength(retval: Integer); safecall;
+    function  Get_PasswordAttributes: Integer; safecall;
+    procedure Set_PasswordAttributes(retval: Integer); safecall;
+    function  Get_AutoUnlockInterval: Integer; safecall;
+    procedure Set_AutoUnlockInterval(retval: Integer); safecall;
+    function  Get_LockoutObservationInterval: Integer; safecall;
+    procedure Set_LockoutObservationInterval(retval: Integer); safecall;
+    property IsWorkgroup: WordBool read Get_IsWorkgroup;
+    property MinPasswordLength: Integer read Get_MinPasswordLength write Set_MinPasswordLength;
+    property MinPasswordAge: Integer read Get_MinPasswordAge write Set_MinPasswordAge;
+    property MaxPasswordAge: Integer read Get_MaxPasswordAge write Set_MaxPasswordAge;
+    property MaxBadPasswordsAllowed: Integer read Get_MaxBadPasswordsAllowed write Set_MaxBadPasswordsAllowed;
+    property PasswordHistoryLength: Integer read Get_PasswordHistoryLength write Set_PasswordHistoryLength;
+    property PasswordAttributes: Integer read Get_PasswordAttributes write Set_PasswordAttributes;
+    property AutoUnlockInterval: Integer read Get_AutoUnlockInterval write Set_AutoUnlockInterval;
+    property LockoutObservationInterval: Integer read Get_LockoutObservationInterval write Set_LockoutObservationInterval;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsDomainDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {00E4C220-FD16-11CE-ABC4-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDomainDisp = dispinterface
+    ['{00E4C220-FD16-11CE-ABC4-02608C9E7553}']
+    property IsWorkgroup: WordBool readonly dispid 15;
+    property MinPasswordLength: Integer dispid 16;
+    property MinPasswordAge: Integer dispid 17;
+    property MaxPasswordAge: Integer dispid 18;
+    property MaxBadPasswordsAllowed: Integer dispid 19;
+    property PasswordHistoryLength: Integer dispid 20;
+    property PasswordAttributes: Integer dispid 21;
+    property AutoUnlockInterval: Integer dispid 22;
+    property LockoutObservationInterval: Integer dispid 23;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+   {$endif}
+// *********************************************************************//
+// Interface: IADsComputer
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EFE3CC70-1D9F-11CF-B1F3-02608C9E7553}
+// *********************************************************************//
+  IADsComputer = interface(IADs)
+    ['{EFE3CC70-1D9F-11CF-B1F3-02608C9E7553}']
+    function  Get_ComputerID: WideString; safecall;
+    function  Get_Site: WideString; safecall;
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_Location: WideString; safecall;
+    procedure Set_Location(const retval: WideString); safecall;
+    function  Get_PrimaryUser: WideString; safecall;
+    procedure Set_PrimaryUser(const retval: WideString); safecall;
+    function  Get_Owner: WideString; safecall;
+    procedure Set_Owner(const retval: WideString); safecall;
+    function  Get_Division: WideString; safecall;
+    procedure Set_Division(const retval: WideString); safecall;
+    function  Get_Department: WideString; safecall;
+    procedure Set_Department(const retval: WideString); safecall;
+    function  Get_Role: WideString; safecall;
+    procedure Set_Role(const retval: WideString); safecall;
+    function  Get_OperatingSystem: WideString; safecall;
+    procedure Set_OperatingSystem(const retval: WideString); safecall;
+    function  Get_OperatingSystemVersion: WideString; safecall;
+    procedure Set_OperatingSystemVersion(const retval: WideString); safecall;
+    function  Get_Model: WideString; safecall;
+    procedure Set_Model(const retval: WideString); safecall;
+    function  Get_Processor: WideString; safecall;
+    procedure Set_Processor(const retval: WideString); safecall;
+    function  Get_ProcessorCount: WideString; safecall;
+    procedure Set_ProcessorCount(const retval: WideString); safecall;
+    function  Get_MemorySize: WideString; safecall;
+    procedure Set_MemorySize(const retval: WideString); safecall;
+    function  Get_StorageCapacity: WideString; safecall;
+    procedure Set_StorageCapacity(const retval: WideString); safecall;
+    function  Get_NetAddresses: OleVariant; safecall;
+    procedure Set_NetAddresses(retval: OleVariant); safecall;
+    property ComputerID: WideString read Get_ComputerID;
+    property Site: WideString read Get_Site;
+    property Description: WideString read Get_Description write Set_Description;
+    property Location: WideString read Get_Location write Set_Location;
+    property PrimaryUser: WideString read Get_PrimaryUser write Set_PrimaryUser;
+    property Owner: WideString read Get_Owner write Set_Owner;
+    property Division: WideString read Get_Division write Set_Division;
+    property Department: WideString read Get_Department write Set_Department;
+    property Role: WideString read Get_Role write Set_Role;
+    property OperatingSystem: WideString read Get_OperatingSystem write Set_OperatingSystem;
+    property OperatingSystemVersion: WideString read Get_OperatingSystemVersion write Set_OperatingSystemVersion;
+    property Model: WideString read Get_Model write Set_Model;
+    property Processor: WideString read Get_Processor write Set_Processor;
+    property ProcessorCount: WideString read Get_ProcessorCount write Set_ProcessorCount;
+    property MemorySize: WideString read Get_MemorySize write Set_MemorySize;
+    property StorageCapacity: WideString read Get_StorageCapacity write Set_StorageCapacity;
+    property NetAddresses: OleVariant read Get_NetAddresses write Set_NetAddresses;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsComputerDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EFE3CC70-1D9F-11CF-B1F3-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsComputerDisp = dispinterface
+    ['{EFE3CC70-1D9F-11CF-B1F3-02608C9E7553}']
+    property ComputerID: WideString readonly dispid 16;
+    property Site: WideString readonly dispid 18;
+    property Description: WideString dispid 19;
+    property Location: WideString dispid 20;
+    property PrimaryUser: WideString dispid 21;
+    property Owner: WideString dispid 22;
+    property Division: WideString dispid 23;
+    property Department: WideString dispid 24;
+    property Role: WideString dispid 25;
+    property OperatingSystem: WideString dispid 26;
+    property OperatingSystemVersion: WideString dispid 27;
+    property Model: WideString dispid 28;
+    property Processor: WideString dispid 29;
+    property ProcessorCount: WideString dispid 30;
+    property MemorySize: WideString dispid 31;
+    property StorageCapacity: WideString dispid 32;
+    property NetAddresses: OleVariant dispid 17;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsComputerOperations
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EF497680-1D9F-11CF-B1F3-02608C9E7553}
+// *********************************************************************//
+  IADsComputerOperations = interface(IADs)
+    ['{EF497680-1D9F-11CF-B1F3-02608C9E7553}']
+    function  Status: IDispatch; safecall;
+    procedure Shutdown(bReboot: WordBool); safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsComputerOperationsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EF497680-1D9F-11CF-B1F3-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsComputerOperationsDisp = dispinterface
+    ['{EF497680-1D9F-11CF-B1F3-02608C9E7553}']
+    function  Status: IDispatch; dispid 33;
+    procedure Shutdown(bReboot: WordBool); dispid 34;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsGroup
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {27636B00-410F-11CF-B1FF-02608C9E7553}
+// *********************************************************************//
+  IADsGroup = interface(IADs)
+    ['{27636B00-410F-11CF-B1FF-02608C9E7553}']
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Members: IADsMembers; safecall;
+    function  IsMember(const bstrMember: WideString): WordBool; safecall;
+    procedure Add(const bstrNewItem: WideString); safecall;
+    procedure Remove(const bstrItemToBeRemoved: WideString); safecall;
+    property Description: WideString read Get_Description write Set_Description;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsGroupDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {27636B00-410F-11CF-B1FF-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsGroupDisp = dispinterface
+    ['{27636B00-410F-11CF-B1FF-02608C9E7553}']
+    property Description: WideString dispid 15;
+    function  Members: IADsMembers; dispid 16;
+    function  IsMember(const bstrMember: WideString): WordBool; dispid 17;
+    procedure Add(const bstrNewItem: WideString); dispid 18;
+    procedure Remove(const bstrItemToBeRemoved: WideString); dispid 19;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsUser
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {3E37E320-17E2-11CF-ABC4-02608C9E7553}
+// *********************************************************************//
+  IADsUser = interface(IADs)
+    ['{3E37E320-17E2-11CF-ABC4-02608C9E7553}']
+    function  Get_BadLoginAddress: WideString; safecall;
+    function  Get_BadLoginCount: Integer; safecall;
+    function  Get_LastLogin: TDateTime; safecall;
+    function  Get_LastLogoff: TDateTime; safecall;
+    function  Get_LastFailedLogin: TDateTime; safecall;
+    function  Get_PasswordLastChanged: TDateTime; safecall;
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_Division: WideString; safecall;
+    procedure Set_Division(const retval: WideString); safecall;
+    function  Get_Department: WideString; safecall;
+    procedure Set_Department(const retval: WideString); safecall;
+    function  Get_EmployeeID: WideString; safecall;
+    procedure Set_EmployeeID(const retval: WideString); safecall;
+    function  Get_FullName: WideString; safecall;
+    procedure Set_FullName(const retval: WideString); safecall;
+    function  Get_FirstName: WideString; safecall;
+    procedure Set_FirstName(const retval: WideString); safecall;
+    function  Get_LastName: WideString; safecall;
+    procedure Set_LastName(const retval: WideString); safecall;
+    function  Get_OtherName: WideString; safecall;
+    procedure Set_OtherName(const retval: WideString); safecall;
+    function  Get_NamePrefix: WideString; safecall;
+    procedure Set_NamePrefix(const retval: WideString); safecall;
+    function  Get_NameSuffix: WideString; safecall;
+    procedure Set_NameSuffix(const retval: WideString); safecall;
+    function  Get_Title: WideString; safecall;
+    procedure Set_Title(const retval: WideString); safecall;
+    function  Get_Manager: WideString; safecall;
+    procedure Set_Manager(const retval: WideString); safecall;
+    function  Get_TelephoneHome: OleVariant; safecall;
+    procedure Set_TelephoneHome(retval: OleVariant); safecall;
+    function  Get_TelephoneMobile: OleVariant; safecall;
+    procedure Set_TelephoneMobile(retval: OleVariant); safecall;
+    function  Get_TelephoneNumber: OleVariant; safecall;
+    procedure Set_TelephoneNumber(retval: OleVariant); safecall;
+    function  Get_TelephonePager: OleVariant; safecall;
+    procedure Set_TelephonePager(retval: OleVariant); safecall;
+    function  Get_FaxNumber: OleVariant; safecall;
+    procedure Set_FaxNumber(retval: OleVariant); safecall;
+    function  Get_OfficeLocations: OleVariant; safecall;
+    procedure Set_OfficeLocations(retval: OleVariant); safecall;
+    function  Get_PostalAddresses: OleVariant; safecall;
+    procedure Set_PostalAddresses(retval: OleVariant); safecall;
+    function  Get_PostalCodes: OleVariant; safecall;
+    procedure Set_PostalCodes(retval: OleVariant); safecall;
+    function  Get_SeeAlso: OleVariant; safecall;
+    procedure Set_SeeAlso(retval: OleVariant); safecall;
+    function  Get_AccountDisabled: WordBool; safecall;
+    procedure Set_AccountDisabled(retval: WordBool); safecall;
+    function  Get_AccountExpirationDate: TDateTime; safecall;
+    procedure Set_AccountExpirationDate(retval: TDateTime); safecall;
+    function  Get_GraceLoginsAllowed: Integer; safecall;
+    procedure Set_GraceLoginsAllowed(retval: Integer); safecall;
+    function  Get_GraceLoginsRemaining: Integer; safecall;
+    procedure Set_GraceLoginsRemaining(retval: Integer); safecall;
+    function  Get_IsAccountLocked: WordBool; safecall;
+    procedure Set_IsAccountLocked(retval: WordBool); safecall;
+    function  Get_LoginHours: OleVariant; safecall;
+    procedure Set_LoginHours(retval: OleVariant); safecall;
+    function  Get_LoginWorkstations: OleVariant; safecall;
+    procedure Set_LoginWorkstations(retval: OleVariant); safecall;
+    function  Get_MaxLogins: Integer; safecall;
+    procedure Set_MaxLogins(retval: Integer); safecall;
+    function  Get_MaxStorage: Integer; safecall;
+    procedure Set_MaxStorage(retval: Integer); safecall;
+    function  Get_PasswordExpirationDate: TDateTime; safecall;
+    procedure Set_PasswordExpirationDate(retval: TDateTime); safecall;
+    function  Get_PasswordMinimumLength: Integer; safecall;
+    procedure Set_PasswordMinimumLength(retval: Integer); safecall;
+    function  Get_PasswordRequired: WordBool; safecall;
+    procedure Set_PasswordRequired(retval: WordBool); safecall;
+    function  Get_RequireUniquePassword: WordBool; safecall;
+    procedure Set_RequireUniquePassword(retval: WordBool); safecall;
+    function  Get_EmailAddress: WideString; safecall;
+    procedure Set_EmailAddress(const retval: WideString); safecall;
+    function  Get_HomeDirectory: WideString; safecall;
+    procedure Set_HomeDirectory(const retval: WideString); safecall;
+    function  Get_Languages: OleVariant; safecall;
+    procedure Set_Languages(retval: OleVariant); safecall;
+    function  Get_Profile: WideString; safecall;
+    procedure Set_Profile(const retval: WideString); safecall;
+    function  Get_LoginScript: WideString; safecall;
+    procedure Set_LoginScript(const retval: WideString); safecall;
+    function  Get_Picture: OleVariant; safecall;
+    procedure Set_Picture(retval: OleVariant); safecall;
+    function  Get_HomePage: WideString; safecall;
+    procedure Set_HomePage(const retval: WideString); safecall;
+    function  Groups: IADsMembers; safecall;
+    procedure SetPassword(const NewPassword: WideString); safecall;
+    procedure ChangePassword(const bstrOldPassword: WideString; const bstrNewPassword: WideString); safecall;
+    property BadLoginAddress: WideString read Get_BadLoginAddress;
+    property BadLoginCount: Integer read Get_BadLoginCount;
+    property LastLogin: TDateTime read Get_LastLogin;
+    property LastLogoff: TDateTime read Get_LastLogoff;
+    property LastFailedLogin: TDateTime read Get_LastFailedLogin;
+    property PasswordLastChanged: TDateTime read Get_PasswordLastChanged;
+    property Description: WideString read Get_Description write Set_Description;
+    property Division: WideString read Get_Division write Set_Division;
+    property Department: WideString read Get_Department write Set_Department;
+    property EmployeeID: WideString read Get_EmployeeID write Set_EmployeeID;
+    property FullName: WideString read Get_FullName write Set_FullName;
+    property FirstName: WideString read Get_FirstName write Set_FirstName;
+    property LastName: WideString read Get_LastName write Set_LastName;
+    property OtherName: WideString read Get_OtherName write Set_OtherName;
+    property NamePrefix: WideString read Get_NamePrefix write Set_NamePrefix;
+    property NameSuffix: WideString read Get_NameSuffix write Set_NameSuffix;
+    property Title: WideString read Get_Title write Set_Title;
+    property Manager: WideString read Get_Manager write Set_Manager;
+    property TelephoneHome: OleVariant read Get_TelephoneHome write Set_TelephoneHome;
+    property TelephoneMobile: OleVariant read Get_TelephoneMobile write Set_TelephoneMobile;
+    property TelephoneNumber: OleVariant read Get_TelephoneNumber write Set_TelephoneNumber;
+    property TelephonePager: OleVariant read Get_TelephonePager write Set_TelephonePager;
+    property FaxNumber: OleVariant read Get_FaxNumber write Set_FaxNumber;
+    property OfficeLocations: OleVariant read Get_OfficeLocations write Set_OfficeLocations;
+    property PostalAddresses: OleVariant read Get_PostalAddresses write Set_PostalAddresses;
+    property PostalCodes: OleVariant read Get_PostalCodes write Set_PostalCodes;
+    property SeeAlso: OleVariant read Get_SeeAlso write Set_SeeAlso;
+    property AccountDisabled: WordBool read Get_AccountDisabled write Set_AccountDisabled;
+    property AccountExpirationDate: TDateTime read Get_AccountExpirationDate write Set_AccountExpirationDate;
+    property GraceLoginsAllowed: Integer read Get_GraceLoginsAllowed write Set_GraceLoginsAllowed;
+    property GraceLoginsRemaining: Integer read Get_GraceLoginsRemaining write Set_GraceLoginsRemaining;
+    property IsAccountLocked: WordBool read Get_IsAccountLocked write Set_IsAccountLocked;
+    property LoginHours: OleVariant read Get_LoginHours write Set_LoginHours;
+    property LoginWorkstations: OleVariant read Get_LoginWorkstations write Set_LoginWorkstations;
+    property MaxLogins: Integer read Get_MaxLogins write Set_MaxLogins;
+    property MaxStorage: Integer read Get_MaxStorage write Set_MaxStorage;
+    property PasswordExpirationDate: TDateTime read Get_PasswordExpirationDate write Set_PasswordExpirationDate;
+    property PasswordMinimumLength: Integer read Get_PasswordMinimumLength write Set_PasswordMinimumLength;
+    property PasswordRequired: WordBool read Get_PasswordRequired write Set_PasswordRequired;
+    property RequireUniquePassword: WordBool read Get_RequireUniquePassword write Set_RequireUniquePassword;
+    property EmailAddress: WideString read Get_EmailAddress write Set_EmailAddress;
+    property HomeDirectory: WideString read Get_HomeDirectory write Set_HomeDirectory;
+    property Languages: OleVariant read Get_Languages write Set_Languages;
+    property Profile: WideString read Get_Profile write Set_Profile;
+    property LoginScript: WideString read Get_LoginScript write Set_LoginScript;
+    property Picture: OleVariant read Get_Picture write Set_Picture;
+    property HomePage: WideString read Get_HomePage write Set_HomePage;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsUserDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {3E37E320-17E2-11CF-ABC4-02608C9E7553}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsUserDisp = dispinterface
+    ['{3E37E320-17E2-11CF-ABC4-02608C9E7553}']
+    property BadLoginAddress: WideString readonly dispid 53;
+    property BadLoginCount: Integer readonly dispid 54;
+    property LastLogin: TDateTime readonly dispid 56;
+    property LastLogoff: TDateTime readonly dispid 57;
+    property LastFailedLogin: TDateTime readonly dispid 58;
+    property PasswordLastChanged: TDateTime readonly dispid 59;
+    property Description: WideString dispid 15;
+    property Division: WideString dispid 19;
+    property Department: WideString dispid 122;
+    property EmployeeID: WideString dispid 20;
+    property FullName: WideString dispid 23;
+    property FirstName: WideString dispid 22;
+    property LastName: WideString dispid 25;
+    property OtherName: WideString dispid 27;
+    property NamePrefix: WideString dispid 114;
+    property NameSuffix: WideString dispid 115;
+    property Title: WideString dispid 36;
+    property Manager: WideString dispid 26;
+    property TelephoneHome: OleVariant dispid 32;
+    property TelephoneMobile: OleVariant dispid 33;
+    property TelephoneNumber: OleVariant dispid 34;
+    property TelephonePager: OleVariant dispid 17;
+    property FaxNumber: OleVariant dispid 16;
+    property OfficeLocations: OleVariant dispid 28;
+    property PostalAddresses: OleVariant dispid 30;
+    property PostalCodes: OleVariant dispid 31;
+    property SeeAlso: OleVariant dispid 117;
+    property AccountDisabled: WordBool dispid 37;
+    property AccountExpirationDate: TDateTime dispid 38;
+    property GraceLoginsAllowed: Integer dispid 41;
+    property GraceLoginsRemaining: Integer dispid 42;
+    property IsAccountLocked: WordBool dispid 43;
+    property LoginHours: OleVariant dispid 45;
+    property LoginWorkstations: OleVariant dispid 46;
+    property MaxLogins: Integer dispid 47;
+    property MaxStorage: Integer dispid 48;
+    property PasswordExpirationDate: TDateTime dispid 49;
+    property PasswordMinimumLength: Integer dispid 50;
+    property PasswordRequired: WordBool dispid 51;
+    property RequireUniquePassword: WordBool dispid 52;
+    property EmailAddress: WideString dispid 60;
+    property HomeDirectory: WideString dispid 61;
+    property Languages: OleVariant dispid 62;
+    property Profile: WideString dispid 63;
+    property LoginScript: WideString dispid 64;
+    property Picture: OleVariant dispid 65;
+    property HomePage: WideString dispid 120;
+    function  Groups: IADsMembers; dispid 66;
+    procedure SetPassword(const NewPassword: WideString); dispid 67;
+    procedure ChangePassword(const bstrOldPassword: WideString; const bstrNewPassword: WideString); dispid 68;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPrintQueue
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B15160D0-1226-11CF-A985-00AA006BC149}
+// *********************************************************************//
+  IADsPrintQueue = interface(IADs)
+    ['{B15160D0-1226-11CF-A985-00AA006BC149}']
+    function  Get_PrinterPath: WideString; safecall;
+    procedure Set_PrinterPath(const retval: WideString); safecall;
+    function  Get_Model: WideString; safecall;
+    procedure Set_Model(const retval: WideString); safecall;
+    function  Get_Datatype: WideString; safecall;
+    procedure Set_Datatype(const retval: WideString); safecall;
+    function  Get_PrintProcessor: WideString; safecall;
+    procedure Set_PrintProcessor(const retval: WideString); safecall;
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_Location: WideString; safecall;
+    procedure Set_Location(const retval: WideString); safecall;
+    function  Get_StartTime: TDateTime; safecall;
+    procedure Set_StartTime(retval: TDateTime); safecall;
+    function  Get_UntilTime: TDateTime; safecall;
+    procedure Set_UntilTime(retval: TDateTime); safecall;
+    function  Get_DefaultJobPriority: Integer; safecall;
+    procedure Set_DefaultJobPriority(retval: Integer); safecall;
+    function  Get_Priority: Integer; safecall;
+    procedure Set_Priority(retval: Integer); safecall;
+    function  Get_BannerPage: WideString; safecall;
+    procedure Set_BannerPage(const retval: WideString); safecall;
+    function  Get_PrintDevices: OleVariant; safecall;
+    procedure Set_PrintDevices(retval: OleVariant); safecall;
+    function  Get_NetAddresses: OleVariant; safecall;
+    procedure Set_NetAddresses(retval: OleVariant); safecall;
+    property PrinterPath: WideString read Get_PrinterPath write Set_PrinterPath;
+    property Model: WideString read Get_Model write Set_Model;
+    property Datatype: WideString read Get_Datatype write Set_Datatype;
+    property PrintProcessor: WideString read Get_PrintProcessor write Set_PrintProcessor;
+    property Description: WideString read Get_Description write Set_Description;
+    property Location: WideString read Get_Location write Set_Location;
+    property StartTime: TDateTime read Get_StartTime write Set_StartTime;
+    property UntilTime: TDateTime read Get_UntilTime write Set_UntilTime;
+    property DefaultJobPriority: Integer read Get_DefaultJobPriority write Set_DefaultJobPriority;
+    property Priority: Integer read Get_Priority write Set_Priority;
+    property BannerPage: WideString read Get_BannerPage write Set_BannerPage;
+    property PrintDevices: OleVariant read Get_PrintDevices write Set_PrintDevices;
+    property NetAddresses: OleVariant read Get_NetAddresses write Set_NetAddresses;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPrintQueueDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B15160D0-1226-11CF-A985-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintQueueDisp = dispinterface
+    ['{B15160D0-1226-11CF-A985-00AA006BC149}']
+    property PrinterPath: WideString dispid 15;
+    property Model: WideString dispid 16;
+    property Datatype: WideString dispid 17;
+    property PrintProcessor: WideString dispid 18;
+    property Description: WideString dispid 19;
+    property Location: WideString dispid 20;
+    property StartTime: TDateTime dispid 21;
+    property UntilTime: TDateTime dispid 22;
+    property DefaultJobPriority: Integer dispid 23;
+    property Priority: Integer dispid 24;
+    property BannerPage: WideString dispid 25;
+    property PrintDevices: OleVariant dispid 26;
+    property NetAddresses: OleVariant dispid 27;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPrintQueueOperations
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {124BE5C0-156E-11CF-A986-00AA006BC149}
+// *********************************************************************//
+  IADsPrintQueueOperations = interface(IADs)
+    ['{124BE5C0-156E-11CF-A986-00AA006BC149}']
+    function  Get_Status: Integer; safecall;
+    function  PrintJobs: IADsCollection; safecall;
+    procedure Pause; safecall;
+    procedure Resume; safecall;
+    procedure Purge; safecall;
+    property Status: Integer read Get_Status;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPrintQueueOperationsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {124BE5C0-156E-11CF-A986-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintQueueOperationsDisp = dispinterface
+    ['{124BE5C0-156E-11CF-A986-00AA006BC149}']
+    property Status: Integer readonly dispid 27;
+    function  PrintJobs: IADsCollection; dispid 28;
+    procedure Pause; dispid 29;
+    procedure Resume; dispid 30;
+    procedure Purge; dispid 31;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPrintJob
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {32FB6780-1ED0-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  IADsPrintJob = interface(IADs)
+    ['{32FB6780-1ED0-11CF-A988-00AA006BC149}']
+    function  Get_HostPrintQueue: WideString; safecall;
+    function  Get_User: WideString; safecall;
+    function  Get_UserPath: WideString; safecall;
+    function  Get_TimeSubmitted: TDateTime; safecall;
+    function  Get_TotalPages: Integer; safecall;
+    function  Get_Size: Integer; safecall;
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_Priority: Integer; safecall;
+    procedure Set_Priority(retval: Integer); safecall;
+    function  Get_StartTime: TDateTime; safecall;
+    procedure Set_StartTime(retval: TDateTime); safecall;
+    function  Get_UntilTime: TDateTime; safecall;
+    procedure Set_UntilTime(retval: TDateTime); safecall;
+    function  Get_Notify: WideString; safecall;
+    procedure Set_Notify(const retval: WideString); safecall;
+    function  Get_NotifyPath: WideString; safecall;
+    procedure Set_NotifyPath(const retval: WideString); safecall;
+    property HostPrintQueue: WideString read Get_HostPrintQueue;
+    property User: WideString read Get_User;
+    property UserPath: WideString read Get_UserPath;
+    property TimeSubmitted: TDateTime read Get_TimeSubmitted;
+    property TotalPages: Integer read Get_TotalPages;
+    property Size: Integer read Get_Size;
+    property Description: WideString read Get_Description write Set_Description;
+    property Priority: Integer read Get_Priority write Set_Priority;
+    property StartTime: TDateTime read Get_StartTime write Set_StartTime;
+    property UntilTime: TDateTime read Get_UntilTime write Set_UntilTime;
+    property Notify: WideString read Get_Notify write Set_Notify;
+    property NotifyPath: WideString read Get_NotifyPath write Set_NotifyPath;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPrintJobDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {32FB6780-1ED0-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintJobDisp = dispinterface
+    ['{32FB6780-1ED0-11CF-A988-00AA006BC149}']
+    property HostPrintQueue: WideString readonly dispid 15;
+    property User: WideString readonly dispid 16;
+    property UserPath: WideString readonly dispid 17;
+    property TimeSubmitted: TDateTime readonly dispid 18;
+    property TotalPages: Integer readonly dispid 19;
+    property Size: Integer readonly dispid 234;
+    property Description: WideString dispid 20;
+    property Priority: Integer dispid 21;
+    property StartTime: TDateTime dispid 22;
+    property UntilTime: TDateTime dispid 23;
+    property Notify: WideString dispid 24;
+    property NotifyPath: WideString dispid 25;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPrintJobOperations
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {9A52DB30-1ECF-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  IADsPrintJobOperations = interface(IADs)
+    ['{9A52DB30-1ECF-11CF-A988-00AA006BC149}']
+    function  Get_Status: Integer; safecall;
+    function  Get_TimeElapsed: Integer; safecall;
+    function  Get_PagesPrinted: Integer; safecall;
+    function  Get_Position: Integer; safecall;
+    procedure Set_Position(retval: Integer); safecall;
+    procedure Pause; safecall;
+    procedure Resume; safecall;
+    property Status: Integer read Get_Status;
+    property TimeElapsed: Integer read Get_TimeElapsed;
+    property PagesPrinted: Integer read Get_PagesPrinted;
+    property Position: Integer read Get_Position write Set_Position;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPrintJobOperationsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {9A52DB30-1ECF-11CF-A988-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPrintJobOperationsDisp = dispinterface
+    ['{9A52DB30-1ECF-11CF-A988-00AA006BC149}']
+    property Status: Integer readonly dispid 26;
+    property TimeElapsed: Integer readonly dispid 27;
+    property PagesPrinted: Integer readonly dispid 28;
+    property Position: Integer dispid 29;
+    procedure Pause; dispid 30;
+    procedure Resume; dispid 31;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsService
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {68AF66E0-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  IADsService = interface(IADs)
+    ['{68AF66E0-31CA-11CF-A98A-00AA006BC149}']
+    function  Get_HostComputer: WideString; safecall;
+    procedure Set_HostComputer(const retval: WideString); safecall;
+    function  Get_DisplayName: WideString; safecall;
+    procedure Set_DisplayName(const retval: WideString); safecall;
+    function  Get_Version: WideString; safecall;
+    procedure Set_Version(const retval: WideString); safecall;
+    function  Get_ServiceType: Integer; safecall;
+    procedure Set_ServiceType(retval: Integer); safecall;
+    function  Get_StartType: Integer; safecall;
+    procedure Set_StartType(retval: Integer); safecall;
+    function  Get_Path: WideString; safecall;
+    procedure Set_Path(const retval: WideString); safecall;
+    function  Get_StartupParameters: WideString; safecall;
+    procedure Set_StartupParameters(const retval: WideString); safecall;
+    function  Get_ErrorControl: Integer; safecall;
+    procedure Set_ErrorControl(retval: Integer); safecall;
+    function  Get_LoadOrderGroup: WideString; safecall;
+    procedure Set_LoadOrderGroup(const retval: WideString); safecall;
+    function  Get_ServiceAccountName: WideString; safecall;
+    procedure Set_ServiceAccountName(const retval: WideString); safecall;
+    function  Get_ServiceAccountPath: WideString; safecall;
+    procedure Set_ServiceAccountPath(const retval: WideString); safecall;
+    function  Get_Dependencies: OleVariant; safecall;
+    procedure Set_Dependencies(retval: OleVariant); safecall;
+    property HostComputer: WideString read Get_HostComputer write Set_HostComputer;
+    property DisplayName: WideString read Get_DisplayName write Set_DisplayName;
+    property Version: WideString read Get_Version write Set_Version;
+    property ServiceType: Integer read Get_ServiceType write Set_ServiceType;
+    property StartType: Integer read Get_StartType write Set_StartType;
+    property Path: WideString read Get_Path write Set_Path;
+    property StartupParameters: WideString read Get_StartupParameters write Set_StartupParameters;
+    property ErrorControl: Integer read Get_ErrorControl write Set_ErrorControl;
+    property LoadOrderGroup: WideString read Get_LoadOrderGroup write Set_LoadOrderGroup;
+    property ServiceAccountName: WideString read Get_ServiceAccountName write Set_ServiceAccountName;
+    property ServiceAccountPath: WideString read Get_ServiceAccountPath write Set_ServiceAccountPath;
+    property Dependencies: OleVariant read Get_Dependencies write Set_Dependencies;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsServiceDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {68AF66E0-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsServiceDisp = dispinterface
+    ['{68AF66E0-31CA-11CF-A98A-00AA006BC149}']
+    property HostComputer: WideString dispid 15;
+    property DisplayName: WideString dispid 16;
+    property Version: WideString dispid 17;
+    property ServiceType: Integer dispid 18;
+    property StartType: Integer dispid 19;
+    property Path: WideString dispid 20;
+    property StartupParameters: WideString dispid 21;
+    property ErrorControl: Integer dispid 22;
+    property LoadOrderGroup: WideString dispid 23;
+    property ServiceAccountName: WideString dispid 24;
+    property ServiceAccountPath: WideString dispid 25;
+    property Dependencies: OleVariant dispid 26;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsServiceOperations
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {5D7B33F0-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  IADsServiceOperations = interface(IADs)
+    ['{5D7B33F0-31CA-11CF-A98A-00AA006BC149}']
+    function  Get_Status: Integer; safecall;
+    procedure Start; safecall;
+    procedure Stop; safecall;
+    procedure Pause; safecall;
+    procedure Continue; safecall;
+    procedure SetPassword(const bstrNewPassword: WideString); safecall;
+    property Status: Integer read Get_Status;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsServiceOperationsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {5D7B33F0-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsServiceOperationsDisp = dispinterface
+    ['{5D7B33F0-31CA-11CF-A98A-00AA006BC149}']
+    property Status: Integer readonly dispid 27;
+    procedure Start; dispid 28;
+    procedure Stop; dispid 29;
+    procedure Pause; dispid 30;
+    procedure Continue; dispid 31;
+    procedure SetPassword(const bstrNewPassword: WideString); dispid 32;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsFileService
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A89D1900-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  IADsFileService = interface(IADsService)
+    ['{A89D1900-31CA-11CF-A98A-00AA006BC149}']
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_MaxUserCount: Integer; safecall;
+    procedure Set_MaxUserCount(retval: Integer); safecall;
+    property Description: WideString read Get_Description write Set_Description;
+    property MaxUserCount: Integer read Get_MaxUserCount write Set_MaxUserCount;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsFileServiceDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A89D1900-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileServiceDisp = dispinterface
+    ['{A89D1900-31CA-11CF-A98A-00AA006BC149}']
+    property Description: WideString dispid 33;
+    property MaxUserCount: Integer dispid 34;
+    property HostComputer: WideString dispid 15;
+    property DisplayName: WideString dispid 16;
+    property Version: WideString dispid 17;
+    property ServiceType: Integer dispid 18;
+    property StartType: Integer dispid 19;
+    property Path: WideString dispid 20;
+    property StartupParameters: WideString dispid 21;
+    property ErrorControl: Integer dispid 22;
+    property LoadOrderGroup: WideString dispid 23;
+    property ServiceAccountName: WideString dispid 24;
+    property ServiceAccountPath: WideString dispid 25;
+    property Dependencies: OleVariant dispid 26;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsFileServiceOperations
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A02DED10-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  IADsFileServiceOperations = interface(IADsServiceOperations)
+    ['{A02DED10-31CA-11CF-A98A-00AA006BC149}']
+    function  Sessions: IADsCollection; safecall;
+    function  Resources: IADsCollection; safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsFileServiceOperationsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A02DED10-31CA-11CF-A98A-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileServiceOperationsDisp = dispinterface
+    ['{A02DED10-31CA-11CF-A98A-00AA006BC149}']
+    function  Sessions: IADsCollection; dispid 35;
+    function  Resources: IADsCollection; dispid 36;
+    property Status: Integer readonly dispid 27;
+    procedure Start; dispid 28;
+    procedure Stop; dispid 29;
+    procedure Pause; dispid 30;
+    procedure Continue; dispid 31;
+    procedure SetPassword(const bstrNewPassword: WideString); dispid 32;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsFileShare
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EB6DCAF0-4B83-11CF-A995-00AA006BC149}
+// *********************************************************************//
+  IADsFileShare = interface(IADs)
+    ['{EB6DCAF0-4B83-11CF-A995-00AA006BC149}']
+    function  Get_CurrentUserCount: Integer; safecall;
+    function  Get_Description: WideString; safecall;
+    procedure Set_Description(const retval: WideString); safecall;
+    function  Get_HostComputer: WideString; safecall;
+    procedure Set_HostComputer(const retval: WideString); safecall;
+    function  Get_Path: WideString; safecall;
+    procedure Set_Path(const retval: WideString); safecall;
+    function  Get_MaxUserCount: Integer; safecall;
+    procedure Set_MaxUserCount(retval: Integer); safecall;
+    property CurrentUserCount: Integer read Get_CurrentUserCount;
+    property Description: WideString read Get_Description write Set_Description;
+    property HostComputer: WideString read Get_HostComputer write Set_HostComputer;
+    property Path: WideString read Get_Path write Set_Path;
+    property MaxUserCount: Integer read Get_MaxUserCount write Set_MaxUserCount;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsFileShareDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {EB6DCAF0-4B83-11CF-A995-00AA006BC149}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFileShareDisp = dispinterface
+    ['{EB6DCAF0-4B83-11CF-A995-00AA006BC149}']
+    property CurrentUserCount: Integer readonly dispid 15;
+    property Description: WideString dispid 16;
+    property HostComputer: WideString dispid 17;
+    property Path: WideString dispid 18;
+    property MaxUserCount: Integer dispid 19;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsSession
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {398B7DA0-4AAB-11CF-AE2C-00AA006EBFB9}
+// *********************************************************************//
+  IADsSession = interface(IADs)
+    ['{398B7DA0-4AAB-11CF-AE2C-00AA006EBFB9}']
+    function  Get_User: WideString; safecall;
+    function  Get_UserPath: WideString; safecall;
+    function  Get_Computer: WideString; safecall;
+    function  Get_ComputerPath: WideString; safecall;
+    function  Get_ConnectTime: Integer; safecall;
+    function  Get_IdleTime: Integer; safecall;
+    property User: WideString read Get_User;
+    property UserPath: WideString read Get_UserPath;
+    property Computer: WideString read Get_Computer;
+    property ComputerPath: WideString read Get_ComputerPath;
+    property ConnectTime: Integer read Get_ConnectTime;
+    property IdleTime: Integer read Get_IdleTime;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsSessionDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {398B7DA0-4AAB-11CF-AE2C-00AA006EBFB9}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSessionDisp = dispinterface
+    ['{398B7DA0-4AAB-11CF-AE2C-00AA006EBFB9}']
+    property User: WideString readonly dispid 15;
+    property UserPath: WideString readonly dispid 16;
+    property Computer: WideString readonly dispid 17;
+    property ComputerPath: WideString readonly dispid 18;
+    property ConnectTime: Integer readonly dispid 19;
+    property IdleTime: Integer readonly dispid 20;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsResource
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {34A05B20-4AAB-11CF-AE2C-00AA006EBFB9}
+// *********************************************************************//
+  IADsResource = interface(IADs)
+    ['{34A05B20-4AAB-11CF-AE2C-00AA006EBFB9}']
+    function  Get_User: WideString; safecall;
+    function  Get_UserPath: WideString; safecall;
+    function  Get_Path: WideString; safecall;
+    function  Get_LockCount: Integer; safecall;
+    property User: WideString read Get_User;
+    property UserPath: WideString read Get_UserPath;
+    property Path: WideString read Get_Path;
+    property LockCount: Integer read Get_LockCount;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsResourceDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {34A05B20-4AAB-11CF-AE2C-00AA006EBFB9}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsResourceDisp = dispinterface
+    ['{34A05B20-4AAB-11CF-AE2C-00AA006EBFB9}']
+    property User: WideString readonly dispid 15;
+    property UserPath: WideString readonly dispid 16;
+    property Path: WideString readonly dispid 17;
+    property LockCount: Integer readonly dispid 18;
+    property Name: WideString readonly dispid 2;
+    property Class_: WideString readonly dispid 3;
+    property GUID: WideString readonly dispid 4;
+    property ADsPath: WideString readonly dispid 5;
+    property Parent: WideString readonly dispid 6;
+    property Schema: WideString readonly dispid 7;
+    procedure GetInfo; dispid 8;
+    procedure SetInfo; dispid 9;
+    function  Get(const bstrName: WideString): OleVariant; dispid 10;
+    procedure Put(const bstrName: WideString; vProp: OleVariant); dispid 11;
+    function  GetEx(const bstrName: WideString): OleVariant; dispid 12;
+    procedure PutEx(lnControlCode: Integer; const bstrName: WideString; vProp: OleVariant); dispid 13;
+    procedure GetInfoEx(vProperties: OleVariant; lnReserved: Integer); dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsOpenDSObject
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {DDF2891E-0F9C-11D0-8AD4-00C04FD8D503}
+// *********************************************************************//
+  IADsOpenDSObject = interface(IDispatch)
+    ['{DDF2891E-0F9C-11D0-8AD4-00C04FD8D503}']
+    function  OpenDSObject(const lpszDNName: WideString; const lpszUserName: WideString;
+                           const lpszPassword: WideString; lnReserved: Integer): IDispatch; safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsOpenDSObjectDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {DDF2891E-0F9C-11D0-8AD4-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOpenDSObjectDisp = dispinterface
+    ['{DDF2891E-0F9C-11D0-8AD4-00C04FD8D503}']
+    function  OpenDSObject(const lpszDNName: WideString; const lpszUserName: WideString;
+                           const lpszPassword: WideString; lnReserved: Integer): IDispatch; dispid 1;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IDirectoryObject
+// Flags:     (0)
+// GUID:      {E798DE2C-22E4-11D0-84FE-00C04FD8D503}
+// *********************************************************************//
+  IDirectoryObject = interface(IUnknown)
+    ['{E798DE2C-22E4-11D0-84FE-00C04FD8D503}']
+    function  GetObjectInformation(out ppObjInfo: PUserType11): HResult; stdcall;
+    function  GetObjectAttributes(var pAttributeNames: PWideChar; dwNumberAttributes: LongWord;
+                                  out ppAttributeEntries: PUserType12;
+                                  out pdwNumAttributesReturned: LongWord): HResult; stdcall;
+    function  SetObjectAttributes(var pAttributeEntries: _ads_attr_info; dwNumAttributes: LongWord;
+                                  out pdwNumAttributesModified: LongWord): HResult; stdcall;
+    function  CreateDSObject(pszRDNName: PWideChar; var pAttributeEntries: _ads_attr_info;
+                             dwNumAttributes: LongWord; out ppObject: IDispatch): HResult; stdcall;
+    function  DeleteDSObject(pszRDNName: PWideChar): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IDirectorySearch
+// Flags:     (0)
+// GUID:      {109BA8EC-92F0-11D0-A790-00C04FD8D5A8}
+// *********************************************************************//
+  IDirectorySearch = interface(IUnknown)
+    ['{109BA8EC-92F0-11D0-A790-00C04FD8D5A8}']
+    function  SetSearchPreference(var pSearchPrefs: ads_searchpref_info; dwNumPrefs: LongWord): HResult; stdcall;
+    function  ExecuteSearch(pszSearchFilter: PWideChar; var pAttributeNames: PWideChar;
+                            dwNumberAttributes: LongWord; out phSearchResult: Pointer): HResult; stdcall;
+    function  AbandonSearch(var phSearchResult: Pointer): HResult; stdcall;
+    function  GetFirstRow(var hSearchResult: Pointer): HResult; stdcall;
+    function  GetNextRow(var hSearchResult: Pointer): HResult; stdcall;
+    function  GetPreviousRow(var hSearchResult: Pointer): HResult; stdcall;
+    function  GetNextColumnName(var hSearchHandle: Pointer; out ppszColumnName: PWideChar): HResult; stdcall;
+    function  GetColumn(var hSearchResult: Pointer; szColumnName: PWideChar;
+                        out pSearchColumn: ads_search_column): HResult; stdcall;
+    function  FreeColumn(var pSearchColumn: ads_search_column): HResult; stdcall;
+    function  CloseSearchHandle(var hSearchResult: Pointer): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IDirectorySchemaMgmt
+// Flags:     (0)
+// GUID:      {75DB3B9C-A4D8-11D0-A79C-00C04FD8D5A8}
+// *********************************************************************//
+  IDirectorySchemaMgmt = interface(IUnknown)
+    ['{75DB3B9C-A4D8-11D0-A79C-00C04FD8D5A8}']
+    function  EnumAttributes(var ppszAttrNames: PWideChar; dwNumAttributes: LongWord;
+                             ppAttrDefinition: PPUserType1; var pdwNumAttributes: LongWord): HResult; stdcall;
+    function  CreateAttributeDefinition(pszAttributeName: PWideChar;
+                                        var pAttributeDefinition: _ads_attr_def): HResult; stdcall;
+    function  WriteAttributeDefinition(pszAttributeName: PWideChar;
+                                       var pAttributeDefinition: _ads_attr_def): HResult; stdcall;
+    function  DeleteAttributeDefinition(pszAttributeName: PWideChar): HResult; stdcall;
+    function  EnumClasses(var ppszClassNames: PWideChar; dwNumClasses: LongWord;
+                          ppClassDefinition: PPUserType2; var pdwNumClasses: LongWord): HResult; stdcall;
+    function  WriteClassDefinition(pszClassName: PWideChar; var pClassDefinition: _ads_class_def): HResult; stdcall;
+    function  CreateClassDefinition(pszClassName: PWideChar; var pClassDefinition: _ads_class_def): HResult; stdcall;
+    function  DeleteClassDefinition(pszClassName: PWideChar): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IADsAggregatee
+// Flags:     (0)
+// GUID:      {1346CE8C-9039-11D0-8528-00C04FD8D503}
+// *********************************************************************//
+  IADsAggregatee = interface(IUnknown)
+    ['{1346CE8C-9039-11D0-8528-00C04FD8D503}']
+    function  ConnectAsAggregatee(const pOuterUnknown: IUnknown): HResult; stdcall;
+    function  DisconnectAsAggregatee: HResult; stdcall;
+    function  RelinquishInterface(var riid: TGUID): HResult; stdcall;
+    function  RestoreInterface(var riid: TGUID): HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IADsAggregator
+// Flags:     (0)
+// GUID:      {52DB5FB0-941F-11D0-8529-00C04FD8D503}
+// *********************************************************************//
+  IADsAggregator = interface(IUnknown)
+    ['{52DB5FB0-941F-11D0-8529-00C04FD8D503}']
+    function  ConnectAsAggregator(const pAggregatee: IUnknown): HResult; stdcall;
+    function  DisconnectAsAggregator: HResult; stdcall;
+  end;
+
+// *********************************************************************//
+// Interface: IADsAccessControlEntry
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B4F3A14C-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  IADsAccessControlEntry = interface(IDispatch)
+    ['{B4F3A14C-9BDD-11D0-852C-00C04FD8D503}']
+    function  Get_AccessMask: Integer; safecall;
+    procedure Set_AccessMask(retval: Integer); safecall;
+    function  Get_AceType: Integer; safecall;
+    procedure Set_AceType(retval: Integer); safecall;
+    function  Get_AceFlags: Integer; safecall;
+    procedure Set_AceFlags(retval: Integer); safecall;
+    function  Get_Flags: Integer; safecall;
+    procedure Set_Flags(retval: Integer); safecall;
+    function  Get_ObjectType: WideString; safecall;
+    procedure Set_ObjectType(const retval: WideString); safecall;
+    function  Get_InheritedObjectType: WideString; safecall;
+    procedure Set_InheritedObjectType(const retval: WideString); safecall;
+    function  Get_Trustee: WideString; safecall;
+    procedure Set_Trustee(const retval: WideString); safecall;
+    property AccessMask: Integer read Get_AccessMask write Set_AccessMask;
+    property AceType: Integer read Get_AceType write Set_AceType;
+    property AceFlags: Integer read Get_AceFlags write Set_AceFlags;
+    property Flags: Integer read Get_Flags write Set_Flags;
+    property ObjectType: WideString read Get_ObjectType write Set_ObjectType;
+    property InheritedObjectType: WideString read Get_InheritedObjectType write Set_InheritedObjectType;
+    property Trustee: WideString read Get_Trustee write Set_Trustee;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsAccessControlEntryDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B4F3A14C-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAccessControlEntryDisp = dispinterface
+    ['{B4F3A14C-9BDD-11D0-852C-00C04FD8D503}']
+    property AccessMask: Integer dispid 2;
+    property AceType: Integer dispid 3;
+    property AceFlags: Integer dispid 4;
+    property Flags: Integer dispid 5;
+    property ObjectType: WideString dispid 6;
+    property InheritedObjectType: WideString dispid 7;
+    property Trustee: WideString dispid 8;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsAccessControlList
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B7EE91CC-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  IADsAccessControlList = interface(IDispatch)
+    ['{B7EE91CC-9BDD-11D0-852C-00C04FD8D503}']
+    function  Get_AclRevision: Integer; safecall;
+    procedure Set_AclRevision(retval: Integer); safecall;
+    function  Get_AceCount: Integer; safecall;
+    procedure Set_AceCount(retval: Integer); safecall;
+    procedure AddAce(const pAccessControlEntry: IDispatch); safecall;
+    procedure RemoveAce(const pAccessControlEntry: IDispatch); safecall;
+    function  CopyAccessList: IDispatch; safecall;
+    function  Get__NewEnum: IUnknown; safecall;
+    property AclRevision: Integer read Get_AclRevision write Set_AclRevision;
+    property AceCount: Integer read Get_AceCount write Set_AceCount;
+    property _NewEnum: IUnknown read Get__NewEnum;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsAccessControlListDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B7EE91CC-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAccessControlListDisp = dispinterface
+    ['{B7EE91CC-9BDD-11D0-852C-00C04FD8D503}']
+    property AclRevision: Integer dispid 3;
+    property AceCount: Integer dispid 4;
+    procedure AddAce(const pAccessControlEntry: IDispatch); dispid 5;
+    procedure RemoveAce(const pAccessControlEntry: IDispatch); dispid 6;
+    function  CopyAccessList: IDispatch; dispid 7;
+    property _NewEnum: IUnknown readonly dispid -4;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsSecurityDescriptor
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B8C787CA-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  IADsSecurityDescriptor = interface(IDispatch)
+    ['{B8C787CA-9BDD-11D0-852C-00C04FD8D503}']
+    function  Get_Revision: Integer; safecall;
+    procedure Set_Revision(retval: Integer); safecall;
+    function  Get_Control: Integer; safecall;
+    procedure Set_Control(retval: Integer); safecall;
+    function  Get_Owner: WideString; safecall;
+    procedure Set_Owner(const retval: WideString); safecall;
+    function  Get_OwnerDefaulted: WordBool; safecall;
+    procedure Set_OwnerDefaulted(retval: WordBool); safecall;
+    function  Get_Group: WideString; safecall;
+    procedure Set_Group(const retval: WideString); safecall;
+    function  Get_GroupDefaulted: WordBool; safecall;
+    procedure Set_GroupDefaulted(retval: WordBool); safecall;
+    function  Get_DiscretionaryAcl: IDispatch; safecall;
+    procedure Set_DiscretionaryAcl(const retval: IDispatch); safecall;
+    function  Get_DaclDefaulted: WordBool; safecall;
+    procedure Set_DaclDefaulted(retval: WordBool); safecall;
+    function  Get_SystemAcl: IDispatch; safecall;
+    procedure Set_SystemAcl(const retval: IDispatch); safecall;
+    function  Get_SaclDefaulted: WordBool; safecall;
+    procedure Set_SaclDefaulted(retval: WordBool); safecall;
+    function  CopySecurityDescriptor: IDispatch; safecall;
+    property Revision: Integer read Get_Revision write Set_Revision;
+    property Control: Integer read Get_Control write Set_Control;
+    property Owner: WideString read Get_Owner write Set_Owner;
+    property OwnerDefaulted: WordBool read Get_OwnerDefaulted write Set_OwnerDefaulted;
+    property Group: WideString read Get_Group write Set_Group;
+    property GroupDefaulted: WordBool read Get_GroupDefaulted write Set_GroupDefaulted;
+    property DiscretionaryAcl: IDispatch read Get_DiscretionaryAcl write Set_DiscretionaryAcl;
+    property DaclDefaulted: WordBool read Get_DaclDefaulted write Set_DaclDefaulted;
+    property SystemAcl: IDispatch read Get_SystemAcl write Set_SystemAcl;
+    property SaclDefaulted: WordBool read Get_SaclDefaulted write Set_SaclDefaulted;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsSecurityDescriptorDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B8C787CA-9BDD-11D0-852C-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsSecurityDescriptorDisp = dispinterface
+    ['{B8C787CA-9BDD-11D0-852C-00C04FD8D503}']
+    property Revision: Integer dispid 2;
+    property Control: Integer dispid 3;
+    property Owner: WideString dispid 4;
+    property OwnerDefaulted: WordBool dispid 5;
+    property Group: WideString dispid 6;
+    property GroupDefaulted: WordBool dispid 7;
+    property DiscretionaryAcl: IDispatch dispid 8;
+    property DaclDefaulted: WordBool dispid 9;
+    property SystemAcl: IDispatch dispid 10;
+    property SaclDefaulted: WordBool dispid 11;
+    function  CopySecurityDescriptor: IDispatch; dispid 12;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsLargeInteger
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {9068270B-0939-11D1-8BE1-00C04FD8D503}
+// *********************************************************************//
+  IADsLargeInteger = interface(IDispatch)
+    ['{9068270B-0939-11D1-8BE1-00C04FD8D503}']
+    function  Get_HighPart: Integer; safecall;
+    procedure Set_HighPart(retval: Integer); safecall;
+    function  Get_LowPart: Integer; safecall;
+    procedure Set_LowPart(retval: Integer); safecall;
+    property HighPart: Integer read Get_HighPart write Set_HighPart;
+    property LowPart: Integer read Get_LowPart write Set_LowPart;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsLargeIntegerDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {9068270B-0939-11D1-8BE1-00C04FD8D503}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsLargeIntegerDisp = dispinterface
+    ['{9068270B-0939-11D1-8BE1-00C04FD8D503}']
+    property HighPart: Integer dispid 2;
+    property LowPart: Integer dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsNameTranslate
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B1B272A3-3625-11D1-A3A4-00C04FB950DC}
+// *********************************************************************//
+  IADsNameTranslate = interface(IDispatch)
+    ['{B1B272A3-3625-11D1-A3A4-00C04FB950DC}']
+    procedure Set_ChaseReferral(Param1: Integer); safecall;
+    procedure Init(lnSetType: Integer; const bstrADsPath: WideString); safecall;
+    procedure InitEx(lnSetType: Integer; const bstrADsPath: WideString;
+                     const bstrUserID: WideString; const bstrDomain: WideString;
+                     const bstrPassword: WideString); safecall;
+    procedure Set_(lnSetType: Integer; const bstrADsPath: WideString); safecall;
+    function  Get(lnFormatType: Integer): WideString; safecall;
+    procedure SetEx(lnFormatType: Integer; pVar: OleVariant); safecall;
+    function  GetEx(lnFormatType: Integer): OleVariant; safecall;
+    property ChaseReferral: Integer write Set_ChaseReferral;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsNameTranslateDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B1B272A3-3625-11D1-A3A4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNameTranslateDisp = dispinterface
+    ['{B1B272A3-3625-11D1-A3A4-00C04FB950DC}']
+    property ChaseReferral: Integer writeonly dispid 1;
+    procedure Init(lnSetType: Integer; const bstrADsPath: WideString); dispid 2;
+    procedure InitEx(lnSetType: Integer; const bstrADsPath: WideString;
+                     const bstrUserID: WideString; const bstrDomain: WideString;
+                     const bstrPassword: WideString); dispid 3;
+    procedure Set_(lnSetType: Integer; const bstrADsPath: WideString); dispid 4;
+    function  Get(lnFormatType: Integer): WideString; dispid 5;
+    procedure SetEx(lnFormatType: Integer; pVar: OleVariant); dispid 6;
+    function  GetEx(lnFormatType: Integer): OleVariant; dispid 7;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsCaseIgnoreList
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7B66B533-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  IADsCaseIgnoreList = interface(IDispatch)
+    ['{7B66B533-4680-11D1-A3B4-00C04FB950DC}']
+    function  Get_CaseIgnoreList: OleVariant; safecall;
+    procedure Set_CaseIgnoreList(retval: OleVariant); safecall;
+    property CaseIgnoreList: OleVariant read Get_CaseIgnoreList write Set_CaseIgnoreList;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsCaseIgnoreListDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7B66B533-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsCaseIgnoreListDisp = dispinterface
+    ['{7B66B533-4680-11D1-A3B4-00C04FB950DC}']
+    property CaseIgnoreList: OleVariant dispid 2;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsFaxNumber
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A910DEA9-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  IADsFaxNumber = interface(IDispatch)
+    ['{A910DEA9-4680-11D1-A3B4-00C04FB950DC}']
+    function  Get_TelephoneNumber: WideString; safecall;
+    procedure Set_TelephoneNumber(const retval: WideString); safecall;
+    function  Get_Parameters: OleVariant; safecall;
+    procedure Set_Parameters(retval: OleVariant); safecall;
+    property TelephoneNumber: WideString read Get_TelephoneNumber write Set_TelephoneNumber;
+    property Parameters: OleVariant read Get_Parameters write Set_Parameters;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsFaxNumberDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {A910DEA9-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsFaxNumberDisp = dispinterface
+    ['{A910DEA9-4680-11D1-A3B4-00C04FB950DC}']
+    property TelephoneNumber: WideString dispid 2;
+    property Parameters: OleVariant dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsNetAddress
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B21A50A9-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsNetAddress = interface(IDispatch)
+    ['{B21A50A9-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_AddressType: Integer; safecall;
+    procedure Set_AddressType(retval: Integer); safecall;
+    function  Get_Address: OleVariant; safecall;
+    procedure Set_Address(retval: OleVariant); safecall;
+    property AddressType: Integer read Get_AddressType write Set_AddressType;
+    property Address: OleVariant read Get_Address write Set_Address;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsNetAddressDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B21A50A9-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsNetAddressDisp = dispinterface
+    ['{B21A50A9-4080-11D1-A3AC-00C04FB950DC}']
+    property AddressType: Integer dispid 2;
+    property Address: OleVariant dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsOctetList
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7B28B80F-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  IADsOctetList = interface(IDispatch)
+    ['{7B28B80F-4680-11D1-A3B4-00C04FB950DC}']
+    function  Get_OctetList: OleVariant; safecall;
+    procedure Set_OctetList(retval: OleVariant); safecall;
+    property OctetList: OleVariant read Get_OctetList write Set_OctetList;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsOctetListDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7B28B80F-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsOctetListDisp = dispinterface
+    ['{7B28B80F-4680-11D1-A3B4-00C04FB950DC}']
+    property OctetList: OleVariant dispid 2;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsEmail
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {97AF011A-478E-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  IADsEmail = interface(IDispatch)
+    ['{97AF011A-478E-11D1-A3B4-00C04FB950DC}']
+    function  Get_Type_: Integer; safecall;
+    procedure Set_Type_(retval: Integer); safecall;
+    function  Get_Address: WideString; safecall;
+    procedure Set_Address(const retval: WideString); safecall;
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property Address: WideString read Get_Address write Set_Address;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsEmailDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {97AF011A-478E-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsEmailDisp = dispinterface
+    ['{97AF011A-478E-11D1-A3B4-00C04FB950DC}']
+    property Type_: Integer dispid 2;
+    property Address: WideString dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPath
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B287FCD5-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsPath = interface(IDispatch)
+    ['{B287FCD5-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_Type_: Integer; safecall;
+    procedure Set_Type_(retval: Integer); safecall;
+    function  Get_VolumeName: WideString; safecall;
+    procedure Set_VolumeName(const retval: WideString); safecall;
+    function  Get_Path: WideString; safecall;
+    procedure Set_Path(const retval: WideString); safecall;
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property VolumeName: WideString read Get_VolumeName write Set_VolumeName;
+    property Path: WideString read Get_Path write Set_Path;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPathDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B287FCD5-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPathDisp = dispinterface
+    ['{B287FCD5-4080-11D1-A3AC-00C04FB950DC}']
+    property Type_: Integer dispid 2;
+    property VolumeName: WideString dispid 3;
+    property Path: WideString dispid 4;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsReplicaPointer
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {F60FB803-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsReplicaPointer = interface(IDispatch)
+    ['{F60FB803-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_ServerName: WideString; safecall;
+    procedure Set_ServerName(const retval: WideString); safecall;
+    function  Get_ReplicaType: Integer; safecall;
+    procedure Set_ReplicaType(retval: Integer); safecall;
+    function  Get_ReplicaNumber: Integer; safecall;
+    procedure Set_ReplicaNumber(retval: Integer); safecall;
+    function  Get_Count: Integer; safecall;
+    procedure Set_Count(retval: Integer); safecall;
+    function  Get_ReplicaAddressHints: OleVariant; safecall;
+    procedure Set_ReplicaAddressHints(retval: OleVariant); safecall;
+    property ServerName: WideString read Get_ServerName write Set_ServerName;
+    property ReplicaType: Integer read Get_ReplicaType write Set_ReplicaType;
+    property ReplicaNumber: Integer read Get_ReplicaNumber write Set_ReplicaNumber;
+    property Count: Integer read Get_Count write Set_Count;
+    property ReplicaAddressHints: OleVariant read Get_ReplicaAddressHints write Set_ReplicaAddressHints;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsReplicaPointerDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {F60FB803-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsReplicaPointerDisp = dispinterface
+    ['{F60FB803-4080-11D1-A3AC-00C04FB950DC}']
+    property ServerName: WideString dispid 2;
+    property ReplicaType: Integer dispid 3;
+    property ReplicaNumber: Integer dispid 4;
+    property Count: Integer dispid 5;
+    property ReplicaAddressHints: OleVariant dispid 6;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsAcl
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {8452D3AB-0869-11D1-A377-00C04FB950DC}
+// *********************************************************************//
+  IADsAcl = interface(IDispatch)
+    ['{8452D3AB-0869-11D1-A377-00C04FB950DC}']
+    function  Get_ProtectedAttrName: WideString; safecall;
+    procedure Set_ProtectedAttrName(const retval: WideString); safecall;
+    function  Get_SubjectName: WideString; safecall;
+    procedure Set_SubjectName(const retval: WideString); safecall;
+    function  Get_Privileges: Integer; safecall;
+    procedure Set_Privileges(retval: Integer); safecall;
+    function  CopyAcl: IDispatch; safecall;
+    property ProtectedAttrName: WideString read Get_ProtectedAttrName write Set_ProtectedAttrName;
+    property SubjectName: WideString read Get_SubjectName write Set_SubjectName;
+    property Privileges: Integer read Get_Privileges write Set_Privileges;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsAclDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {8452D3AB-0869-11D1-A377-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsAclDisp = dispinterface
+    ['{8452D3AB-0869-11D1-A377-00C04FB950DC}']
+    property ProtectedAttrName: WideString dispid 2;
+    property SubjectName: WideString dispid 3;
+    property Privileges: Integer dispid 4;
+    function  CopyAcl: IDispatch; dispid 5;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsTimestamp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B2F5A901-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsTimestamp = interface(IDispatch)
+    ['{B2F5A901-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_WholeSeconds: Integer; safecall;
+    procedure Set_WholeSeconds(retval: Integer); safecall;
+    function  Get_EventID: Integer; safecall;
+    procedure Set_EventID(retval: Integer); safecall;
+    property WholeSeconds: Integer read Get_WholeSeconds write Set_WholeSeconds;
+    property EventID: Integer read Get_EventID write Set_EventID;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsTimestampDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B2F5A901-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsTimestampDisp = dispinterface
+    ['{B2F5A901-4080-11D1-A3AC-00C04FB950DC}']
+    property WholeSeconds: Integer dispid 2;
+    property EventID: Integer dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPostalAddress
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7ADECF29-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  IADsPostalAddress = interface(IDispatch)
+    ['{7ADECF29-4680-11D1-A3B4-00C04FB950DC}']
+    function  Get_PostalAddress: OleVariant; safecall;
+    procedure Set_PostalAddress(retval: OleVariant); safecall;
+    property PostalAddress: OleVariant read Get_PostalAddress write Set_PostalAddress;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPostalAddressDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7ADECF29-4680-11D1-A3B4-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPostalAddressDisp = dispinterface
+    ['{7ADECF29-4680-11D1-A3B4-00C04FB950DC}']
+    property PostalAddress: OleVariant dispid 2;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsBackLink
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {FD1302BD-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsBackLink = interface(IDispatch)
+    ['{FD1302BD-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_RemoteID: Integer; safecall;
+    procedure Set_RemoteID(retval: Integer); safecall;
+    function  Get_ObjectName: WideString; safecall;
+    procedure Set_ObjectName(const retval: WideString); safecall;
+    property RemoteID: Integer read Get_RemoteID write Set_RemoteID;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsBackLinkDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {FD1302BD-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsBackLinkDisp = dispinterface
+    ['{FD1302BD-4080-11D1-A3AC-00C04FB950DC}']
+    property RemoteID: Integer dispid 2;
+    property ObjectName: WideString dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsTypedName
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B371A349-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsTypedName = interface(IDispatch)
+    ['{B371A349-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_ObjectName: WideString; safecall;
+    procedure Set_ObjectName(const retval: WideString); safecall;
+    function  Get_Level: Integer; safecall;
+    procedure Set_Level(retval: Integer); safecall;
+    function  Get_Interval: Integer; safecall;
+    procedure Set_Interval(retval: Integer); safecall;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Level: Integer read Get_Level write Set_Level;
+    property Interval: Integer read Get_Interval write Set_Interval;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsTypedNameDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B371A349-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsTypedNameDisp = dispinterface
+    ['{B371A349-4080-11D1-A3AC-00C04FB950DC}']
+    property ObjectName: WideString dispid 2;
+    property Level: Integer dispid 3;
+    property Interval: Integer dispid 4;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsHold
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B3EB3B37-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  IADsHold = interface(IDispatch)
+    ['{B3EB3B37-4080-11D1-A3AC-00C04FB950DC}']
+    function  Get_ObjectName: WideString; safecall;
+    procedure Set_ObjectName(const retval: WideString); safecall;
+    function  Get_Amount: Integer; safecall;
+    procedure Set_Amount(retval: Integer); safecall;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Amount: Integer read Get_Amount write Set_Amount;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsHoldDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {B3EB3B37-4080-11D1-A3AC-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsHoldDisp = dispinterface
+    ['{B3EB3B37-4080-11D1-A3AC-00C04FB950DC}']
+    property ObjectName: WideString dispid 2;
+    property Amount: Integer dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsObjectOptions
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {46F14FDA-232B-11D1-A808-00C04FD8D5A8}
+// *********************************************************************//
+  IADsObjectOptions = interface(IDispatch)
+    ['{46F14FDA-232B-11D1-A808-00C04FD8D5A8}']
+    function  GetOption(lnOption: Integer): OleVariant; safecall;
+    procedure SetOption(lnOption: Integer; vValue: OleVariant); safecall;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsObjectOptionsDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {46F14FDA-232B-11D1-A808-00C04FD8D5A8}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsObjectOptionsDisp = dispinterface
+    ['{46F14FDA-232B-11D1-A808-00C04FD8D5A8}']
+    function  GetOption(lnOption: Integer): OleVariant; dispid 2;
+    procedure SetOption(lnOption: Integer; vValue: OleVariant); dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsPathname
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {D592AED4-F420-11D0-A36E-00C04FB950DC}
+// *********************************************************************//
+  IADsPathname = interface(IDispatch)
+    ['{D592AED4-F420-11D0-A36E-00C04FB950DC}']
+    procedure Set_(const bstrADsPath: WideString; lnSetType: Integer); safecall;
+    procedure SetDisplayType(lnDisplayType: Integer); safecall;
+    function  Retrieve(lnFormatType: Integer): WideString; safecall;
+    function  GetNumElements: Integer; safecall;
+    function  GetElement(lnElementIndex: Integer): WideString; safecall;
+    procedure AddLeafElement(const bstrLeafElement: WideString); safecall;
+    procedure RemoveLeafElement; safecall;
+    function  CopyPath: IDispatch; safecall;
+    function  GetEscapedElement(lnReserved: Integer; const bstrInStr: WideString): WideString; safecall;
+    function  Get_EscapedMode: Integer; safecall;
+    procedure Set_EscapedMode(retval: Integer); safecall;
+    property EscapedMode: Integer read Get_EscapedMode write Set_EscapedMode;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsPathnameDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {D592AED4-F420-11D0-A36E-00C04FB950DC}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsPathnameDisp = dispinterface
+    ['{D592AED4-F420-11D0-A36E-00C04FB950DC}']
+    procedure Set_(const bstrADsPath: WideString; lnSetType: Integer); dispid 2;
+    procedure SetDisplayType(lnDisplayType: Integer); dispid 3;
+    function  Retrieve(lnFormatType: Integer): WideString; dispid 4;
+    function  GetNumElements: Integer; dispid 5;
+    function  GetElement(lnElementIndex: Integer): WideString; dispid 6;
+    procedure AddLeafElement(const bstrLeafElement: WideString); dispid 7;
+    procedure RemoveLeafElement; dispid 8;
+    function  CopyPath: IDispatch; dispid 9;
+    function  GetEscapedElement(lnReserved: Integer; const bstrInStr: WideString): WideString; dispid 10;
+    property EscapedMode: Integer dispid 11;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsADSystemInfo
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {5BB11929-AFD1-11D2-9CB9-0000F87A369E}
+// *********************************************************************//
+  IADsADSystemInfo = interface(IDispatch)
+    ['{5BB11929-AFD1-11D2-9CB9-0000F87A369E}']
+    function  Get_UserName: WideString; safecall;
+    function  Get_ComputerName: WideString; safecall;
+    function  Get_SiteName: WideString; safecall;
+    function  Get_DomainShortName: WideString; safecall;
+    function  Get_DomainDNSName: WideString; safecall;
+    function  Get_ForestDNSName: WideString; safecall;
+    function  Get_PDCRoleOwner: WideString; safecall;
+    function  Get_SchemaRoleOwner: WideString; safecall;
+    function  Get_IsNativeMode: WordBool; safecall;
+    function  GetAnyDCName: WideString; safecall;
+    function  GetDCSiteName(const szServer: WideString): WideString; safecall;
+    procedure RefreshSchemaCache; safecall;
+    function  GetTrees: OleVariant; safecall;
+    property UserName: WideString read Get_UserName;
+    property ComputerName: WideString read Get_ComputerName;
+    property SiteName: WideString read Get_SiteName;
+    property DomainShortName: WideString read Get_DomainShortName;
+    property DomainDNSName: WideString read Get_DomainDNSName;
+    property ForestDNSName: WideString read Get_ForestDNSName;
+    property PDCRoleOwner: WideString read Get_PDCRoleOwner;
+    property SchemaRoleOwner: WideString read Get_SchemaRoleOwner;
+    property IsNativeMode: WordBool read Get_IsNativeMode;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsADSystemInfoDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {5BB11929-AFD1-11D2-9CB9-0000F87A369E}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsADSystemInfoDisp = dispinterface
+    ['{5BB11929-AFD1-11D2-9CB9-0000F87A369E}']
+    property UserName: WideString readonly dispid 2;
+    property ComputerName: WideString readonly dispid 3;
+    property SiteName: WideString readonly dispid 4;
+    property DomainShortName: WideString readonly dispid 5;
+    property DomainDNSName: WideString readonly dispid 6;
+    property ForestDNSName: WideString readonly dispid 7;
+    property PDCRoleOwner: WideString readonly dispid 8;
+    property SchemaRoleOwner: WideString readonly dispid 9;
+    property IsNativeMode: WordBool readonly dispid 10;
+    function  GetAnyDCName: WideString; dispid 11;
+    function  GetDCSiteName(const szServer: WideString): WideString; dispid 12;
+    procedure RefreshSchemaCache; dispid 13;
+    function  GetTrees: OleVariant; dispid 14;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsWinNTSystemInfo
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}
+// *********************************************************************//
+  IADsWinNTSystemInfo = interface(IDispatch)
+    ['{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}']
+    function  Get_UserName: WideString; safecall;
+    function  Get_ComputerName: WideString; safecall;
+    function  Get_DomainName: WideString; safecall;
+    function  Get_PDC: WideString; safecall;
+    property UserName: WideString read Get_UserName;
+    property ComputerName: WideString read Get_ComputerName;
+    property DomainName: WideString read Get_DomainName;
+    property PDC: WideString read Get_PDC;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsWinNTSystemInfoDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsWinNTSystemInfoDisp = dispinterface
+    ['{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}']
+    property UserName: WideString readonly dispid 2;
+    property ComputerName: WideString readonly dispid 3;
+    property DomainName: WideString readonly dispid 4;
+    property PDC: WideString readonly dispid 5;
+  end;
+  {$endif}
+// *********************************************************************//
+// Interface: IADsDNWithBinary
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}
+// *********************************************************************//
+  IADsDNWithBinary = interface(IDispatch)
+    ['{7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}']
+    function  Get_BinaryValue: OleVariant; safecall;
+    procedure Set_BinaryValue(retval: OleVariant); safecall;
+    function  Get_DNString: WideString; safecall;
+    procedure Set_DNString(const retval: WideString); safecall;
+    property BinaryValue: OleVariant read Get_BinaryValue write Set_BinaryValue;
+    property DNString: WideString read Get_DNString write Set_DNString;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsDNWithBinaryDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDNWithBinaryDisp = dispinterface
+    ['{7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}']
+    property BinaryValue: OleVariant dispid 2;
+    property DNString: WideString dispid 3;
+  end;
+  {$endif}
+
+// *********************************************************************//
+// Interface: IADsDNWithString
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {370DF02E-F934-11D2-BA96-00C04FB6D0D1}
+// *********************************************************************//
+  IADsDNWithString = interface(IDispatch)
+    ['{370DF02E-F934-11D2-BA96-00C04FB6D0D1}']
+    function  Get_StringValue: WideString; safecall;
+    procedure Set_StringValue(const retval: WideString); safecall;
+    function  Get_DNString: WideString; safecall;
+    procedure Set_DNString(const retval: WideString); safecall;
+    property StringValue: WideString read Get_StringValue write Set_StringValue;
+    property DNString: WideString read Get_DNString write Set_DNString;
+  end;
+
+// *********************************************************************//
+// DispIntf:  IADsDNWithStringDisp
+// Flags:     (4416) Dual OleAutomation Dispatchable
+// GUID:      {370DF02E-F934-11D2-BA96-00C04FB6D0D1}
+// *********************************************************************//
+  {$ifdef SUPPORTS_DISPINTERFACE}
+  IADsDNWithStringDisp = dispinterface
+    ['{370DF02E-F934-11D2-BA96-00C04FB6D0D1}']
+    property StringValue: WideString dispid 2;
+    property DNString: WideString dispid 3;
+  end;
+  {$endif}
+// *********************************************************************//
+// The Class CoPropertyEntry provides a Create and CreateRemote method to
+// create instances of the default interface IADsPropertyEntry exposed by
+// the CoClass PropertyEntry. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoPropertyEntry = class
+    class function Create: IADsPropertyEntry;
+    class function CreateRemote(const MachineName: string): IADsPropertyEntry;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TPropertyEntry
+// Help String      :
+// Default Interface: IADsPropertyEntry
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TPropertyEntryProperties= class;
+{$ENDIF}
+  TPropertyEntry = class(TOleServer)
+  private
+    FIntf:        IADsPropertyEntry;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TPropertyEntryProperties;
+    function      GetServerProperties: TPropertyEntryProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsPropertyEntry;
+  protected
+    procedure InitServerData; override;
+    function  Get_Name: WideString;
+    procedure Set_Name(const retval: WideString);
+    function  Get_ADsType: Integer;
+    procedure Set_ADsType(retval: Integer);
+    function  Get_ControlCode: Integer;
+    procedure Set_ControlCode(retval: Integer);
+    function  Get_Values: OleVariant;
+    procedure Set_Values(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsPropertyEntry);
+    procedure Disconnect; override;
+    procedure Clear;
+    property  DefaultInterface: IADsPropertyEntry read GetDefaultInterface;
+    property Values: OleVariant read Get_Values write Set_Values;
+    property Name: WideString read Get_Name write Set_Name;
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property ControlCode: Integer read Get_ControlCode write Set_ControlCode;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TPropertyEntryProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TPropertyEntry
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TPropertyEntryProperties = class(TPersistent)
+  private
+    FServer:    TPropertyEntry;
+    function    GetDefaultInterface: IADsPropertyEntry;
+    constructor Create(AServer: TPropertyEntry);
+  protected
+    function  Get_Name: WideString;
+    procedure Set_Name(const retval: WideString);
+    function  Get_ADsType: Integer;
+    procedure Set_ADsType(retval: Integer);
+    function  Get_ControlCode: Integer;
+    procedure Set_ControlCode(retval: Integer);
+    function  Get_Values: OleVariant;
+    procedure Set_Values(retval: OleVariant);
+  public
+    property DefaultInterface: IADsPropertyEntry read GetDefaultInterface;
+  published
+    property Name: WideString read Get_Name write Set_Name;
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property ControlCode: Integer read Get_ControlCode write Set_ControlCode;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoPropertyValue provides a Create and CreateRemote method to
+// create instances of the default interface IADsPropertyValue exposed by
+// the CoClass PropertyValue. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoPropertyValue = class
+    class function Create: IADsPropertyValue;
+    class function CreateRemote(const MachineName: string): IADsPropertyValue;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TPropertyValue
+// Help String      :
+// Default Interface: IADsPropertyValue
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TPropertyValueProperties= class;
+{$ENDIF}
+  TPropertyValue = class(TOleServer)
+  private
+    FIntf:        IADsPropertyValue;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TPropertyValueProperties;
+    function      GetServerProperties: TPropertyValueProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsPropertyValue;
+  protected
+    procedure InitServerData; override;
+    function  Get_ADsType: Integer;
+    procedure Set_ADsType(retval: Integer);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+    function  Get_CaseExactString: WideString;
+    procedure Set_CaseExactString(const retval: WideString);
+    function  Get_CaseIgnoreString: WideString;
+    procedure Set_CaseIgnoreString(const retval: WideString);
+    function  Get_PrintableString: WideString;
+    procedure Set_PrintableString(const retval: WideString);
+    function  Get_NumericString: WideString;
+    procedure Set_NumericString(const retval: WideString);
+    function  Get_Boolean: Integer;
+    procedure Set_Boolean(retval: Integer);
+    function  Get_Integer: Integer;
+    procedure Set_Integer(retval: Integer);
+    function  Get_OctetString: OleVariant;
+    procedure Set_OctetString(retval: OleVariant);
+    function  Get_SecurityDescriptor: IDispatch;
+    procedure Set_SecurityDescriptor(const retval: IDispatch);
+    function  Get_LargeInteger: IDispatch;
+    procedure Set_LargeInteger(const retval: IDispatch);
+    function  Get_UTCTime: TDateTime;
+    procedure Set_UTCTime(retval: TDateTime);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsPropertyValue);
+    procedure Disconnect; override;
+    procedure Clear;
+    property  DefaultInterface: IADsPropertyValue read GetDefaultInterface;
+    property OctetString: OleVariant read Get_OctetString write Set_OctetString;
+    property SecurityDescriptor: IDispatch read Get_SecurityDescriptor write Set_SecurityDescriptor;
+    property LargeInteger: IDispatch read Get_LargeInteger write Set_LargeInteger;
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property DNString: WideString read Get_DNString write Set_DNString;
+    property CaseExactString: WideString read Get_CaseExactString write Set_CaseExactString;
+    property CaseIgnoreString: WideString read Get_CaseIgnoreString write Set_CaseIgnoreString;
+    property PrintableString: WideString read Get_PrintableString write Set_PrintableString;
+    property NumericString: WideString read Get_NumericString write Set_NumericString;
+    property Boolean: Integer read Get_Boolean write Set_Boolean;
+    property Integer: Integer read Get_Integer write Set_Integer;
+    property UTCTime: TDateTime read Get_UTCTime write Set_UTCTime;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TPropertyValueProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TPropertyValue
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TPropertyValueProperties = class(TPersistent)
+  private
+    FServer:    TPropertyValue;
+    function    GetDefaultInterface: IADsPropertyValue;
+    constructor Create(AServer: TPropertyValue);
+  protected
+    function  Get_ADsType: Integer;
+    procedure Set_ADsType(retval: Integer);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+    function  Get_CaseExactString: WideString;
+    procedure Set_CaseExactString(const retval: WideString);
+    function  Get_CaseIgnoreString: WideString;
+    procedure Set_CaseIgnoreString(const retval: WideString);
+    function  Get_PrintableString: WideString;
+    procedure Set_PrintableString(const retval: WideString);
+    function  Get_NumericString: WideString;
+    procedure Set_NumericString(const retval: WideString);
+    function  Get_Boolean: Integer;
+    procedure Set_Boolean(retval: Integer);
+    function  Get_Integer: Integer;
+    procedure Set_Integer(retval: Integer);
+    function  Get_OctetString: OleVariant;
+    procedure Set_OctetString(retval: OleVariant);
+    function  Get_SecurityDescriptor: IDispatch;
+    procedure Set_SecurityDescriptor(const retval: IDispatch);
+    function  Get_LargeInteger: IDispatch;
+    procedure Set_LargeInteger(const retval: IDispatch);
+    function  Get_UTCTime: TDateTime;
+    procedure Set_UTCTime(retval: TDateTime);
+  public
+    property DefaultInterface: IADsPropertyValue read GetDefaultInterface;
+  published
+    property ADsType: Integer read Get_ADsType write Set_ADsType;
+    property DNString: WideString read Get_DNString write Set_DNString;
+    property CaseExactString: WideString read Get_CaseExactString write Set_CaseExactString;
+    property CaseIgnoreString: WideString read Get_CaseIgnoreString write Set_CaseIgnoreString;
+    property PrintableString: WideString read Get_PrintableString write Set_PrintableString;
+    property NumericString: WideString read Get_NumericString write Set_NumericString;
+    property Boolean: Integer read Get_Boolean write Set_Boolean;
+    property Integer: Integer read Get_Integer write Set_Integer;
+    property UTCTime: TDateTime read Get_UTCTime write Set_UTCTime;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoAccessControlEntry provides a Create and CreateRemote method to
+// create instances of the default interface IADsAccessControlEntry exposed by
+// the CoClass AccessControlEntry. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoAccessControlEntry = class
+    class function Create: IADsAccessControlEntry;
+    class function CreateRemote(const MachineName: string): IADsAccessControlEntry;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TAccessControlEntry
+// Help String      :
+// Default Interface: IADsAccessControlEntry
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TAccessControlEntryProperties= class;
+{$ENDIF}
+  TAccessControlEntry = class(TOleServer)
+  private
+    FIntf:        IADsAccessControlEntry;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TAccessControlEntryProperties;
+    function      GetServerProperties: TAccessControlEntryProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsAccessControlEntry;
+  protected
+    procedure InitServerData; override;
+    function  Get_AccessMask: Integer;
+    procedure Set_AccessMask(retval: Integer);
+    function  Get_AceType: Integer;
+    procedure Set_AceType(retval: Integer);
+    function  Get_AceFlags: Integer;
+    procedure Set_AceFlags(retval: Integer);
+    function  Get_Flags: Integer;
+    procedure Set_Flags(retval: Integer);
+    function  Get_ObjectType: WideString;
+    procedure Set_ObjectType(const retval: WideString);
+    function  Get_InheritedObjectType: WideString;
+    procedure Set_InheritedObjectType(const retval: WideString);
+    function  Get_Trustee: WideString;
+    procedure Set_Trustee(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsAccessControlEntry);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsAccessControlEntry read GetDefaultInterface;
+    property AccessMask: Integer read Get_AccessMask write Set_AccessMask;
+    property AceType: Integer read Get_AceType write Set_AceType;
+    property AceFlags: Integer read Get_AceFlags write Set_AceFlags;
+    property Flags: Integer read Get_Flags write Set_Flags;
+    property ObjectType: WideString read Get_ObjectType write Set_ObjectType;
+    property InheritedObjectType: WideString read Get_InheritedObjectType write Set_InheritedObjectType;
+    property Trustee: WideString read Get_Trustee write Set_Trustee;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TAccessControlEntryProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TAccessControlEntry
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TAccessControlEntryProperties = class(TPersistent)
+  private
+    FServer:    TAccessControlEntry;
+    function    GetDefaultInterface: IADsAccessControlEntry;
+    constructor Create(AServer: TAccessControlEntry);
+  protected
+    function  Get_AccessMask: Integer;
+    procedure Set_AccessMask(retval: Integer);
+    function  Get_AceType: Integer;
+    procedure Set_AceType(retval: Integer);
+    function  Get_AceFlags: Integer;
+    procedure Set_AceFlags(retval: Integer);
+    function  Get_Flags: Integer;
+    procedure Set_Flags(retval: Integer);
+    function  Get_ObjectType: WideString;
+    procedure Set_ObjectType(const retval: WideString);
+    function  Get_InheritedObjectType: WideString;
+    procedure Set_InheritedObjectType(const retval: WideString);
+    function  Get_Trustee: WideString;
+    procedure Set_Trustee(const retval: WideString);
+  public
+    property DefaultInterface: IADsAccessControlEntry read GetDefaultInterface;
+  published
+    property AccessMask: Integer read Get_AccessMask write Set_AccessMask;
+    property AceType: Integer read Get_AceType write Set_AceType;
+    property AceFlags: Integer read Get_AceFlags write Set_AceFlags;
+    property Flags: Integer read Get_Flags write Set_Flags;
+    property ObjectType: WideString read Get_ObjectType write Set_ObjectType;
+    property InheritedObjectType: WideString read Get_InheritedObjectType write Set_InheritedObjectType;
+    property Trustee: WideString read Get_Trustee write Set_Trustee;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoAccessControlList provides a Create and CreateRemote method to
+// create instances of the default interface IADsAccessControlList exposed by
+// the CoClass AccessControlList. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoAccessControlList = class
+    class function Create: IADsAccessControlList;
+    class function CreateRemote(const MachineName: string): IADsAccessControlList;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TAccessControlList
+// Help String      :
+// Default Interface: IADsAccessControlList
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TAccessControlListProperties= class;
+{$ENDIF}
+  TAccessControlList = class(TOleServer)
+  private
+    FIntf:        IADsAccessControlList;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TAccessControlListProperties;
+    function      GetServerProperties: TAccessControlListProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsAccessControlList;
+  protected
+    procedure InitServerData; override;
+    function  Get_AclRevision: Integer;
+    procedure Set_AclRevision(retval: Integer);
+    function  Get_AceCount: Integer;
+    procedure Set_AceCount(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsAccessControlList);
+    procedure Disconnect; override;
+    procedure AddAce(const pAccessControlEntry: IDispatch);
+    procedure RemoveAce(const pAccessControlEntry: IDispatch);
+    function  CopyAccessList: IDispatch;
+    property  DefaultInterface: IADsAccessControlList read GetDefaultInterface;
+    property AclRevision: Integer read Get_AclRevision write Set_AclRevision;
+    property AceCount: Integer read Get_AceCount write Set_AceCount;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TAccessControlListProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TAccessControlList
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TAccessControlListProperties = class(TPersistent)
+  private
+    FServer:    TAccessControlList;
+    function    GetDefaultInterface: IADsAccessControlList;
+    constructor Create(AServer: TAccessControlList);
+  protected
+    function  Get_AclRevision: Integer;
+    procedure Set_AclRevision(retval: Integer);
+    function  Get_AceCount: Integer;
+    procedure Set_AceCount(retval: Integer);
+  public
+    property DefaultInterface: IADsAccessControlList read GetDefaultInterface;
+  published
+    property AclRevision: Integer read Get_AclRevision write Set_AclRevision;
+    property AceCount: Integer read Get_AceCount write Set_AceCount;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoSecurityDescriptor provides a Create and CreateRemote method to
+// create instances of the default interface IADsSecurityDescriptor exposed by
+// the CoClass SecurityDescriptor. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoSecurityDescriptor = class
+    class function Create: IADsSecurityDescriptor;
+    class function CreateRemote(const MachineName: string): IADsSecurityDescriptor;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TSecurityDescriptor
+// Help String      :
+// Default Interface: IADsSecurityDescriptor
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TSecurityDescriptorProperties= class;
+{$ENDIF}
+  TSecurityDescriptor = class(TOleServer)
+  private
+    FIntf:        IADsSecurityDescriptor;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TSecurityDescriptorProperties;
+    function      GetServerProperties: TSecurityDescriptorProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsSecurityDescriptor;
+  protected
+    procedure InitServerData; override;
+    function  Get_Revision: Integer;
+    procedure Set_Revision(retval: Integer);
+    function  Get_Control: Integer;
+    procedure Set_Control(retval: Integer);
+    function  Get_Owner: WideString;
+    procedure Set_Owner(const retval: WideString);
+    function  Get_OwnerDefaulted: WordBool;
+    procedure Set_OwnerDefaulted(retval: WordBool);
+    function  Get_Group: WideString;
+    procedure Set_Group(const retval: WideString);
+    function  Get_GroupDefaulted: WordBool;
+    procedure Set_GroupDefaulted(retval: WordBool);
+    function  Get_DiscretionaryAcl: IDispatch;
+    procedure Set_DiscretionaryAcl(const retval: IDispatch);
+    function  Get_DaclDefaulted: WordBool;
+    procedure Set_DaclDefaulted(retval: WordBool);
+    function  Get_SystemAcl: IDispatch;
+    procedure Set_SystemAcl(const retval: IDispatch);
+    function  Get_SaclDefaulted: WordBool;
+    procedure Set_SaclDefaulted(retval: WordBool);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsSecurityDescriptor);
+    procedure Disconnect; override;
+    function  CopySecurityDescriptor: IDispatch;
+    property  DefaultInterface: IADsSecurityDescriptor read GetDefaultInterface;
+    property DiscretionaryAcl: IDispatch read Get_DiscretionaryAcl write Set_DiscretionaryAcl;
+    property SystemAcl: IDispatch read Get_SystemAcl write Set_SystemAcl;
+    property Revision: Integer read Get_Revision write Set_Revision;
+    property Control: Integer read Get_Control write Set_Control;
+    property Owner: WideString read Get_Owner write Set_Owner;
+    property OwnerDefaulted: WordBool read Get_OwnerDefaulted write Set_OwnerDefaulted;
+    property Group: WideString read Get_Group write Set_Group;
+    property GroupDefaulted: WordBool read Get_GroupDefaulted write Set_GroupDefaulted;
+    property DaclDefaulted: WordBool read Get_DaclDefaulted write Set_DaclDefaulted;
+    property SaclDefaulted: WordBool read Get_SaclDefaulted write Set_SaclDefaulted;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TSecurityDescriptorProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TSecurityDescriptor
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TSecurityDescriptorProperties = class(TPersistent)
+  private
+    FServer:    TSecurityDescriptor;
+    function    GetDefaultInterface: IADsSecurityDescriptor;
+    constructor Create(AServer: TSecurityDescriptor);
+  protected
+    function  Get_Revision: Integer;
+    procedure Set_Revision(retval: Integer);
+    function  Get_Control: Integer;
+    procedure Set_Control(retval: Integer);
+    function  Get_Owner: WideString;
+    procedure Set_Owner(const retval: WideString);
+    function  Get_OwnerDefaulted: WordBool;
+    procedure Set_OwnerDefaulted(retval: WordBool);
+    function  Get_Group: WideString;
+    procedure Set_Group(const retval: WideString);
+    function  Get_GroupDefaulted: WordBool;
+    procedure Set_GroupDefaulted(retval: WordBool);
+    function  Get_DiscretionaryAcl: IDispatch;
+    procedure Set_DiscretionaryAcl(const retval: IDispatch);
+    function  Get_DaclDefaulted: WordBool;
+    procedure Set_DaclDefaulted(retval: WordBool);
+    function  Get_SystemAcl: IDispatch;
+    procedure Set_SystemAcl(const retval: IDispatch);
+    function  Get_SaclDefaulted: WordBool;
+    procedure Set_SaclDefaulted(retval: WordBool);
+  public
+    property DefaultInterface: IADsSecurityDescriptor read GetDefaultInterface;
+  published
+    property Revision: Integer read Get_Revision write Set_Revision;
+    property Control: Integer read Get_Control write Set_Control;
+    property Owner: WideString read Get_Owner write Set_Owner;
+    property OwnerDefaulted: WordBool read Get_OwnerDefaulted write Set_OwnerDefaulted;
+    property Group: WideString read Get_Group write Set_Group;
+    property GroupDefaulted: WordBool read Get_GroupDefaulted write Set_GroupDefaulted;
+    property DaclDefaulted: WordBool read Get_DaclDefaulted write Set_DaclDefaulted;
+    property SaclDefaulted: WordBool read Get_SaclDefaulted write Set_SaclDefaulted;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoLargeInteger provides a Create and CreateRemote method to
+// create instances of the default interface IADsLargeInteger exposed by
+// the CoClass LargeInteger. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoLargeInteger = class
+    class function Create: IADsLargeInteger;
+    class function CreateRemote(const MachineName: string): IADsLargeInteger;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TLargeInteger
+// Help String      :
+// Default Interface: IADsLargeInteger
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TLargeIntegerProperties= class;
+{$ENDIF}
+  TLargeInteger = class(TOleServer)
+  private
+    FIntf:        IADsLargeInteger;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TLargeIntegerProperties;
+    function      GetServerProperties: TLargeIntegerProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsLargeInteger;
+  protected
+    procedure InitServerData; override;
+    function  Get_HighPart: Integer;
+    procedure Set_HighPart(retval: Integer);
+    function  Get_LowPart: Integer;
+    procedure Set_LowPart(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsLargeInteger);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsLargeInteger read GetDefaultInterface;
+    property HighPart: Integer read Get_HighPart write Set_HighPart;
+    property LowPart: Integer read Get_LowPart write Set_LowPart;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TLargeIntegerProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TLargeInteger
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TLargeIntegerProperties = class(TPersistent)
+  private
+    FServer:    TLargeInteger;
+    function    GetDefaultInterface: IADsLargeInteger;
+    constructor Create(AServer: TLargeInteger);
+  protected
+    function  Get_HighPart: Integer;
+    procedure Set_HighPart(retval: Integer);
+    function  Get_LowPart: Integer;
+    procedure Set_LowPart(retval: Integer);
+  public
+    property DefaultInterface: IADsLargeInteger read GetDefaultInterface;
+  published
+    property HighPart: Integer read Get_HighPart write Set_HighPart;
+    property LowPart: Integer read Get_LowPart write Set_LowPart;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoNameTranslate provides a Create and CreateRemote method to
+// create instances of the default interface IADsNameTranslate exposed by
+// the CoClass NameTranslate. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoNameTranslate = class
+    class function Create: IADsNameTranslate;
+    class function CreateRemote(const MachineName: string): IADsNameTranslate;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TNameTranslate
+// Help String      :
+// Default Interface: IADsNameTranslate
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TNameTranslateProperties= class;
+{$ENDIF}
+  TNameTranslate = class(TOleServer)
+  private
+    FIntf:        IADsNameTranslate;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TNameTranslateProperties;
+    function      GetServerProperties: TNameTranslateProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsNameTranslate;
+  protected
+    procedure InitServerData; override;
+    procedure Set_ChaseReferral(Param1: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsNameTranslate);
+    procedure Disconnect; override;
+    procedure Init(lnSetType: Integer; const bstrADsPath: WideString);
+    procedure InitEx(lnSetType: Integer; const bstrADsPath: WideString;
+                     const bstrUserID: WideString; const bstrDomain: WideString;
+                     const bstrPassword: WideString);
+    procedure Set_(lnSetType: Integer; const bstrADsPath: WideString);
+    function  Get(lnFormatType: Integer): WideString;
+    procedure SetEx(lnFormatType: Integer; pVar: OleVariant);
+    function  GetEx(lnFormatType: Integer): OleVariant;
+    property  DefaultInterface: IADsNameTranslate read GetDefaultInterface;
+    property ChaseReferral: Integer write Set_ChaseReferral;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TNameTranslateProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TNameTranslate
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TNameTranslateProperties = class(TPersistent)
+  private
+    FServer:    TNameTranslate;
+    function    GetDefaultInterface: IADsNameTranslate;
+    constructor Create(AServer: TNameTranslate);
+  protected
+    procedure Set_ChaseReferral(Param1: Integer);
+  public
+    property DefaultInterface: IADsNameTranslate read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoCaseIgnoreList provides a Create and CreateRemote method to
+// create instances of the default interface IADsCaseIgnoreList exposed by
+// the CoClass CaseIgnoreList. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoCaseIgnoreList = class
+    class function Create: IADsCaseIgnoreList;
+    class function CreateRemote(const MachineName: string): IADsCaseIgnoreList;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TCaseIgnoreList
+// Help String      :
+// Default Interface: IADsCaseIgnoreList
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TCaseIgnoreListProperties= class;
+{$ENDIF}
+  TCaseIgnoreList = class(TOleServer)
+  private
+    FIntf:        IADsCaseIgnoreList;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TCaseIgnoreListProperties;
+    function      GetServerProperties: TCaseIgnoreListProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsCaseIgnoreList;
+  protected
+    procedure InitServerData; override;
+    function  Get_CaseIgnoreList: OleVariant;
+    procedure Set_CaseIgnoreList(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsCaseIgnoreList);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsCaseIgnoreList read GetDefaultInterface;
+    property CaseIgnoreList: OleVariant read Get_CaseIgnoreList write Set_CaseIgnoreList;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TCaseIgnoreListProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TCaseIgnoreList
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TCaseIgnoreListProperties = class(TPersistent)
+  private
+    FServer:    TCaseIgnoreList;
+    function    GetDefaultInterface: IADsCaseIgnoreList;
+    constructor Create(AServer: TCaseIgnoreList);
+  protected
+    function  Get_CaseIgnoreList: OleVariant;
+    procedure Set_CaseIgnoreList(retval: OleVariant);
+  public
+    property DefaultInterface: IADsCaseIgnoreList read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoFaxNumber provides a Create and CreateRemote method to
+// create instances of the default interface IADsFaxNumber exposed by
+// the CoClass FaxNumber. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoFaxNumber = class
+    class function Create: IADsFaxNumber;
+    class function CreateRemote(const MachineName: string): IADsFaxNumber;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TFaxNumber
+// Help String      :
+// Default Interface: IADsFaxNumber
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TFaxNumberProperties= class;
+{$ENDIF}
+  TFaxNumber = class(TOleServer)
+  private
+    FIntf:        IADsFaxNumber;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TFaxNumberProperties;
+    function      GetServerProperties: TFaxNumberProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsFaxNumber;
+  protected
+    procedure InitServerData; override;
+    function  Get_TelephoneNumber: WideString;
+    procedure Set_TelephoneNumber(const retval: WideString);
+    function  Get_Parameters: OleVariant;
+    procedure Set_Parameters(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsFaxNumber);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsFaxNumber read GetDefaultInterface;
+    property Parameters: OleVariant read Get_Parameters write Set_Parameters;
+    property TelephoneNumber: WideString read Get_TelephoneNumber write Set_TelephoneNumber;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TFaxNumberProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TFaxNumber
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TFaxNumberProperties = class(TPersistent)
+  private
+    FServer:    TFaxNumber;
+    function    GetDefaultInterface: IADsFaxNumber;
+    constructor Create(AServer: TFaxNumber);
+  protected
+    function  Get_TelephoneNumber: WideString;
+    procedure Set_TelephoneNumber(const retval: WideString);
+    function  Get_Parameters: OleVariant;
+    procedure Set_Parameters(retval: OleVariant);
+  public
+    property DefaultInterface: IADsFaxNumber read GetDefaultInterface;
+  published
+    property TelephoneNumber: WideString read Get_TelephoneNumber write Set_TelephoneNumber;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoNetAddress provides a Create and CreateRemote method to
+// create instances of the default interface IADsNetAddress exposed by
+// the CoClass NetAddress. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoNetAddress = class
+    class function Create: IADsNetAddress;
+    class function CreateRemote(const MachineName: string): IADsNetAddress;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TNetAddress
+// Help String      :
+// Default Interface: IADsNetAddress
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TNetAddressProperties= class;
+{$ENDIF}
+  TNetAddress = class(TOleServer)
+  private
+    FIntf:        IADsNetAddress;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TNetAddressProperties;
+    function      GetServerProperties: TNetAddressProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsNetAddress;
+  protected
+    procedure InitServerData; override;
+    function  Get_AddressType: Integer;
+    procedure Set_AddressType(retval: Integer);
+    function  Get_Address: OleVariant;
+    procedure Set_Address(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsNetAddress);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsNetAddress read GetDefaultInterface;
+    property Address: OleVariant read Get_Address write Set_Address;
+    property AddressType: Integer read Get_AddressType write Set_AddressType;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TNetAddressProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TNetAddress
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TNetAddressProperties = class(TPersistent)
+  private
+    FServer:    TNetAddress;
+    function    GetDefaultInterface: IADsNetAddress;
+    constructor Create(AServer: TNetAddress);
+  protected
+    function  Get_AddressType: Integer;
+    procedure Set_AddressType(retval: Integer);
+    function  Get_Address: OleVariant;
+    procedure Set_Address(retval: OleVariant);
+  public
+    property DefaultInterface: IADsNetAddress read GetDefaultInterface;
+  published
+    property AddressType: Integer read Get_AddressType write Set_AddressType;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoOctetList provides a Create and CreateRemote method to
+// create instances of the default interface IADsOctetList exposed by
+// the CoClass OctetList. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoOctetList = class
+    class function Create: IADsOctetList;
+    class function CreateRemote(const MachineName: string): IADsOctetList;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TOctetList
+// Help String      :
+// Default Interface: IADsOctetList
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TOctetListProperties= class;
+{$ENDIF}
+  TOctetList = class(TOleServer)
+  private
+    FIntf:        IADsOctetList;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TOctetListProperties;
+    function      GetServerProperties: TOctetListProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsOctetList;
+  protected
+    procedure InitServerData; override;
+    function  Get_OctetList: OleVariant;
+    procedure Set_OctetList(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsOctetList);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsOctetList read GetDefaultInterface;
+    property OctetList: OleVariant read Get_OctetList write Set_OctetList;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TOctetListProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TOctetList
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TOctetListProperties = class(TPersistent)
+  private
+    FServer:    TOctetList;
+    function    GetDefaultInterface: IADsOctetList;
+    constructor Create(AServer: TOctetList);
+  protected
+    function  Get_OctetList: OleVariant;
+    procedure Set_OctetList(retval: OleVariant);
+  public
+    property DefaultInterface: IADsOctetList read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoEmail provides a Create and CreateRemote method to
+// create instances of the default interface IADsEmail exposed by
+// the CoClass Email. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoEmail = class
+    class function Create: IADsEmail;
+    class function CreateRemote(const MachineName: string): IADsEmail;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TEmail
+// Help String      :
+// Default Interface: IADsEmail
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TEmailProperties= class;
+{$ENDIF}
+  TEmail = class(TOleServer)
+  private
+    FIntf:        IADsEmail;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TEmailProperties;
+    function      GetServerProperties: TEmailProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsEmail;
+  protected
+    procedure InitServerData; override;
+    function  Get_Type_: Integer;
+    procedure Set_Type_(retval: Integer);
+    function  Get_Address: WideString;
+    procedure Set_Address(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsEmail);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsEmail read GetDefaultInterface;
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property Address: WideString read Get_Address write Set_Address;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TEmailProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TEmail
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TEmailProperties = class(TPersistent)
+  private
+    FServer:    TEmail;
+    function    GetDefaultInterface: IADsEmail;
+    constructor Create(AServer: TEmail);
+  protected
+    function  Get_Type_: Integer;
+    procedure Set_Type_(retval: Integer);
+    function  Get_Address: WideString;
+    procedure Set_Address(const retval: WideString);
+  public
+    property DefaultInterface: IADsEmail read GetDefaultInterface;
+  published
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property Address: WideString read Get_Address write Set_Address;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoPath provides a Create and CreateRemote method to
+// create instances of the default interface IADsPath exposed by
+// the CoClass Path. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoPath = class
+    class function Create: IADsPath;
+    class function CreateRemote(const MachineName: string): IADsPath;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TPath
+// Help String      :
+// Default Interface: IADsPath
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TPathProperties= class;
+{$ENDIF}
+  TPath = class(TOleServer)
+  private
+    FIntf:        IADsPath;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TPathProperties;
+    function      GetServerProperties: TPathProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsPath;
+  protected
+    procedure InitServerData; override;
+    function  Get_Type_: Integer;
+    procedure Set_Type_(retval: Integer);
+    function  Get_VolumeName: WideString;
+    procedure Set_VolumeName(const retval: WideString);
+    function  Get_Path: WideString;
+    procedure Set_Path(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsPath);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsPath read GetDefaultInterface;
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property VolumeName: WideString read Get_VolumeName write Set_VolumeName;
+    property Path: WideString read Get_Path write Set_Path;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TPathProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TPath
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TPathProperties = class(TPersistent)
+  private
+    FServer:    TPath;
+    function    GetDefaultInterface: IADsPath;
+    constructor Create(AServer: TPath);
+  protected
+    function  Get_Type_: Integer;
+    procedure Set_Type_(retval: Integer);
+    function  Get_VolumeName: WideString;
+    procedure Set_VolumeName(const retval: WideString);
+    function  Get_Path: WideString;
+    procedure Set_Path(const retval: WideString);
+  public
+    property DefaultInterface: IADsPath read GetDefaultInterface;
+  published
+    property Type_: Integer read Get_Type_ write Set_Type_;
+    property VolumeName: WideString read Get_VolumeName write Set_VolumeName;
+    property Path: WideString read Get_Path write Set_Path;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoReplicaPointer provides a Create and CreateRemote method to
+// create instances of the default interface IADsReplicaPointer exposed by
+// the CoClass ReplicaPointer. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoReplicaPointer = class
+    class function Create: IADsReplicaPointer;
+    class function CreateRemote(const MachineName: string): IADsReplicaPointer;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TReplicaPointer
+// Help String      :
+// Default Interface: IADsReplicaPointer
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TReplicaPointerProperties= class;
+{$ENDIF}
+  TReplicaPointer = class(TOleServer)
+  private
+    FIntf:        IADsReplicaPointer;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TReplicaPointerProperties;
+    function      GetServerProperties: TReplicaPointerProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsReplicaPointer;
+  protected
+    procedure InitServerData; override;
+    function  Get_ServerName: WideString;
+    procedure Set_ServerName(const retval: WideString);
+    function  Get_ReplicaType: Integer;
+    procedure Set_ReplicaType(retval: Integer);
+    function  Get_ReplicaNumber: Integer;
+    procedure Set_ReplicaNumber(retval: Integer);
+    function  Get_Count: Integer;
+    procedure Set_Count(retval: Integer);
+    function  Get_ReplicaAddressHints: OleVariant;
+    procedure Set_ReplicaAddressHints(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsReplicaPointer);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsReplicaPointer read GetDefaultInterface;
+    property ReplicaAddressHints: OleVariant read Get_ReplicaAddressHints write Set_ReplicaAddressHints;
+    property ServerName: WideString read Get_ServerName write Set_ServerName;
+    property ReplicaType: Integer read Get_ReplicaType write Set_ReplicaType;
+    property ReplicaNumber: Integer read Get_ReplicaNumber write Set_ReplicaNumber;
+    property Count: Integer read Get_Count write Set_Count;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TReplicaPointerProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TReplicaPointer
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TReplicaPointerProperties = class(TPersistent)
+  private
+    FServer:    TReplicaPointer;
+    function    GetDefaultInterface: IADsReplicaPointer;
+    constructor Create(AServer: TReplicaPointer);
+  protected
+    function  Get_ServerName: WideString;
+    procedure Set_ServerName(const retval: WideString);
+    function  Get_ReplicaType: Integer;
+    procedure Set_ReplicaType(retval: Integer);
+    function  Get_ReplicaNumber: Integer;
+    procedure Set_ReplicaNumber(retval: Integer);
+    function  Get_Count: Integer;
+    procedure Set_Count(retval: Integer);
+    function  Get_ReplicaAddressHints: OleVariant;
+    procedure Set_ReplicaAddressHints(retval: OleVariant);
+  public
+    property DefaultInterface: IADsReplicaPointer read GetDefaultInterface;
+  published
+    property ServerName: WideString read Get_ServerName write Set_ServerName;
+    property ReplicaType: Integer read Get_ReplicaType write Set_ReplicaType;
+    property ReplicaNumber: Integer read Get_ReplicaNumber write Set_ReplicaNumber;
+    property Count: Integer read Get_Count write Set_Count;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoAcl provides a Create and CreateRemote method to
+// create instances of the default interface IADsAcl exposed by
+// the CoClass Acl. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoAcl = class
+    class function Create: IADsAcl;
+    class function CreateRemote(const MachineName: string): IADsAcl;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TAcl
+// Help String      :
+// Default Interface: IADsAcl
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TAclProperties= class;
+{$ENDIF}
+  TAcl = class(TOleServer)
+  private
+    FIntf:        IADsAcl;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TAclProperties;
+    function      GetServerProperties: TAclProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsAcl;
+  protected
+    procedure InitServerData; override;
+    function  Get_ProtectedAttrName: WideString;
+    procedure Set_ProtectedAttrName(const retval: WideString);
+    function  Get_SubjectName: WideString;
+    procedure Set_SubjectName(const retval: WideString);
+    function  Get_Privileges: Integer;
+    procedure Set_Privileges(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsAcl);
+    procedure Disconnect; override;
+    function  CopyAcl: IDispatch;
+    property  DefaultInterface: IADsAcl read GetDefaultInterface;
+    property ProtectedAttrName: WideString read Get_ProtectedAttrName write Set_ProtectedAttrName;
+    property SubjectName: WideString read Get_SubjectName write Set_SubjectName;
+    property Privileges: Integer read Get_Privileges write Set_Privileges;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TAclProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TAcl
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TAclProperties = class(TPersistent)
+  private
+    FServer:    TAcl;
+    function    GetDefaultInterface: IADsAcl;
+    constructor Create(AServer: TAcl);
+  protected
+    function  Get_ProtectedAttrName: WideString;
+    procedure Set_ProtectedAttrName(const retval: WideString);
+    function  Get_SubjectName: WideString;
+    procedure Set_SubjectName(const retval: WideString);
+    function  Get_Privileges: Integer;
+    procedure Set_Privileges(retval: Integer);
+  public
+    property DefaultInterface: IADsAcl read GetDefaultInterface;
+  published
+    property ProtectedAttrName: WideString read Get_ProtectedAttrName write Set_ProtectedAttrName;
+    property SubjectName: WideString read Get_SubjectName write Set_SubjectName;
+    property Privileges: Integer read Get_Privileges write Set_Privileges;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoTimestamp provides a Create and CreateRemote method to
+// create instances of the default interface IADsTimestamp exposed by
+// the CoClass Timestamp. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoTimestamp = class
+    class function Create: IADsTimestamp;
+    class function CreateRemote(const MachineName: string): IADsTimestamp;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TTimestamp
+// Help String      :
+// Default Interface: IADsTimestamp
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TTimestampProperties= class;
+{$ENDIF}
+  TTimestamp = class(TOleServer)
+  private
+    FIntf:        IADsTimestamp;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TTimestampProperties;
+    function      GetServerProperties: TTimestampProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsTimestamp;
+  protected
+    procedure InitServerData; override;
+    function  Get_WholeSeconds: Integer;
+    procedure Set_WholeSeconds(retval: Integer);
+    function  Get_EventID: Integer;
+    procedure Set_EventID(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsTimestamp);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsTimestamp read GetDefaultInterface;
+    property WholeSeconds: Integer read Get_WholeSeconds write Set_WholeSeconds;
+    property EventID: Integer read Get_EventID write Set_EventID;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TTimestampProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TTimestamp
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TTimestampProperties = class(TPersistent)
+  private
+    FServer:    TTimestamp;
+    function    GetDefaultInterface: IADsTimestamp;
+    constructor Create(AServer: TTimestamp);
+  protected
+    function  Get_WholeSeconds: Integer;
+    procedure Set_WholeSeconds(retval: Integer);
+    function  Get_EventID: Integer;
+    procedure Set_EventID(retval: Integer);
+  public
+    property DefaultInterface: IADsTimestamp read GetDefaultInterface;
+  published
+    property WholeSeconds: Integer read Get_WholeSeconds write Set_WholeSeconds;
+    property EventID: Integer read Get_EventID write Set_EventID;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoPostalAddress provides a Create and CreateRemote method to
+// create instances of the default interface IADsPostalAddress exposed by
+// the CoClass PostalAddress. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoPostalAddress = class
+    class function Create: IADsPostalAddress;
+    class function CreateRemote(const MachineName: string): IADsPostalAddress;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TPostalAddress
+// Help String      :
+// Default Interface: IADsPostalAddress
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TPostalAddressProperties= class;
+{$ENDIF}
+  TPostalAddress = class(TOleServer)
+  private
+    FIntf:        IADsPostalAddress;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TPostalAddressProperties;
+    function      GetServerProperties: TPostalAddressProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsPostalAddress;
+  protected
+    procedure InitServerData; override;
+    function  Get_PostalAddress: OleVariant;
+    procedure Set_PostalAddress(retval: OleVariant);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsPostalAddress);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsPostalAddress read GetDefaultInterface;
+    property PostalAddress: OleVariant read Get_PostalAddress write Set_PostalAddress;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TPostalAddressProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TPostalAddress
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TPostalAddressProperties = class(TPersistent)
+  private
+    FServer:    TPostalAddress;
+    function    GetDefaultInterface: IADsPostalAddress;
+    constructor Create(AServer: TPostalAddress);
+  protected
+    function  Get_PostalAddress: OleVariant;
+    procedure Set_PostalAddress(retval: OleVariant);
+  public
+    property DefaultInterface: IADsPostalAddress read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoBackLink provides a Create and CreateRemote method to
+// create instances of the default interface IADsBackLink exposed by
+// the CoClass BackLink. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoBackLink = class
+    class function Create: IADsBackLink;
+    class function CreateRemote(const MachineName: string): IADsBackLink;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TBackLink
+// Help String      :
+// Default Interface: IADsBackLink
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TBackLinkProperties= class;
+{$ENDIF}
+  TBackLink = class(TOleServer)
+  private
+    FIntf:        IADsBackLink;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TBackLinkProperties;
+    function      GetServerProperties: TBackLinkProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsBackLink;
+  protected
+    procedure InitServerData; override;
+    function  Get_RemoteID: Integer;
+    procedure Set_RemoteID(retval: Integer);
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsBackLink);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsBackLink read GetDefaultInterface;
+    property RemoteID: Integer read Get_RemoteID write Set_RemoteID;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TBackLinkProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TBackLink
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TBackLinkProperties = class(TPersistent)
+  private
+    FServer:    TBackLink;
+    function    GetDefaultInterface: IADsBackLink;
+    constructor Create(AServer: TBackLink);
+  protected
+    function  Get_RemoteID: Integer;
+    procedure Set_RemoteID(retval: Integer);
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+  public
+    property DefaultInterface: IADsBackLink read GetDefaultInterface;
+  published
+    property RemoteID: Integer read Get_RemoteID write Set_RemoteID;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoTypedName provides a Create and CreateRemote method to
+// create instances of the default interface IADsTypedName exposed by
+// the CoClass TypedName. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoTypedName = class
+    class function Create: IADsTypedName;
+    class function CreateRemote(const MachineName: string): IADsTypedName;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TTypedName
+// Help String      :
+// Default Interface: IADsTypedName
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TTypedNameProperties= class;
+{$ENDIF}
+  TTypedName = class(TOleServer)
+  private
+    FIntf:        IADsTypedName;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TTypedNameProperties;
+    function      GetServerProperties: TTypedNameProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsTypedName;
+  protected
+    procedure InitServerData; override;
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+    function  Get_Level: Integer;
+    procedure Set_Level(retval: Integer);
+    function  Get_Interval: Integer;
+    procedure Set_Interval(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsTypedName);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsTypedName read GetDefaultInterface;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Level: Integer read Get_Level write Set_Level;
+    property Interval: Integer read Get_Interval write Set_Interval;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TTypedNameProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TTypedName
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TTypedNameProperties = class(TPersistent)
+  private
+    FServer:    TTypedName;
+    function    GetDefaultInterface: IADsTypedName;
+    constructor Create(AServer: TTypedName);
+  protected
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+    function  Get_Level: Integer;
+    procedure Set_Level(retval: Integer);
+    function  Get_Interval: Integer;
+    procedure Set_Interval(retval: Integer);
+  public
+    property DefaultInterface: IADsTypedName read GetDefaultInterface;
+  published
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Level: Integer read Get_Level write Set_Level;
+    property Interval: Integer read Get_Interval write Set_Interval;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoHold provides a Create and CreateRemote method to
+// create instances of the default interface IADsHold exposed by
+// the CoClass Hold. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoHold = class
+    class function Create: IADsHold;
+    class function CreateRemote(const MachineName: string): IADsHold;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : THold
+// Help String      :
+// Default Interface: IADsHold
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  THoldProperties= class;
+{$ENDIF}
+  THold = class(TOleServer)
+  private
+    FIntf:        IADsHold;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       THoldProperties;
+    function      GetServerProperties: THoldProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsHold;
+  protected
+    procedure InitServerData; override;
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+    function  Get_Amount: Integer;
+    procedure Set_Amount(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsHold);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsHold read GetDefaultInterface;
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Amount: Integer read Get_Amount write Set_Amount;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: THoldProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : THold
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ THoldProperties = class(TPersistent)
+  private
+    FServer:    THold;
+    function    GetDefaultInterface: IADsHold;
+    constructor Create(AServer: THold);
+  protected
+    function  Get_ObjectName: WideString;
+    procedure Set_ObjectName(const retval: WideString);
+    function  Get_Amount: Integer;
+    procedure Set_Amount(retval: Integer);
+  public
+    property DefaultInterface: IADsHold read GetDefaultInterface;
+  published
+    property ObjectName: WideString read Get_ObjectName write Set_ObjectName;
+    property Amount: Integer read Get_Amount write Set_Amount;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoPathname provides a Create and CreateRemote method to
+// create instances of the default interface IADsPathname exposed by
+// the CoClass Pathname. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoPathname = class
+    class function Create: IADsPathname;
+    class function CreateRemote(const MachineName: string): IADsPathname;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TPathname
+// Help String      :
+// Default Interface: IADsPathname
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TPathnameProperties= class;
+{$ENDIF}
+  TPathname = class(TOleServer)
+  private
+    FIntf:        IADsPathname;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TPathnameProperties;
+    function      GetServerProperties: TPathnameProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsPathname;
+  protected
+    procedure InitServerData; override;
+    function  Get_EscapedMode: Integer;
+    procedure Set_EscapedMode(retval: Integer);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsPathname);
+    procedure Disconnect; override;
+    procedure Set_(const bstrADsPath: WideString; lnSetType: Integer);
+    procedure SetDisplayType(lnDisplayType: Integer);
+    function  Retrieve(lnFormatType: Integer): WideString;
+    function  GetNumElements: Integer;
+    function  GetElement(lnElementIndex: Integer): WideString;
+    procedure AddLeafElement(const bstrLeafElement: WideString);
+    procedure RemoveLeafElement;
+    function  CopyPath: IDispatch;
+    function  GetEscapedElement(lnReserved: Integer; const bstrInStr: WideString): WideString;
+    property  DefaultInterface: IADsPathname read GetDefaultInterface;
+    property EscapedMode: Integer read Get_EscapedMode write Set_EscapedMode;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TPathnameProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TPathname
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TPathnameProperties = class(TPersistent)
+  private
+    FServer:    TPathname;
+    function    GetDefaultInterface: IADsPathname;
+    constructor Create(AServer: TPathname);
+  protected
+    function  Get_EscapedMode: Integer;
+    procedure Set_EscapedMode(retval: Integer);
+  public
+    property DefaultInterface: IADsPathname read GetDefaultInterface;
+  published
+    property EscapedMode: Integer read Get_EscapedMode write Set_EscapedMode;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoADSystemInfo provides a Create and CreateRemote method to
+// create instances of the default interface IADsADSystemInfo exposed by
+// the CoClass ADSystemInfo. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoADSystemInfo = class
+    class function Create: IADsADSystemInfo;
+    class function CreateRemote(const MachineName: string): IADsADSystemInfo;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TADSystemInfo
+// Help String      :
+// Default Interface: IADsADSystemInfo
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TADSystemInfoProperties= class;
+{$ENDIF}
+  TADSystemInfo = class(TOleServer)
+  private
+    FIntf:        IADsADSystemInfo;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TADSystemInfoProperties;
+    function      GetServerProperties: TADSystemInfoProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsADSystemInfo;
+  protected
+    procedure InitServerData; override;
+    function  Get_UserName: WideString;
+    function  Get_ComputerName: WideString;
+    function  Get_SiteName: WideString;
+    function  Get_DomainShortName: WideString;
+    function  Get_DomainDNSName: WideString;
+    function  Get_ForestDNSName: WideString;
+    function  Get_PDCRoleOwner: WideString;
+    function  Get_SchemaRoleOwner: WideString;
+    function  Get_IsNativeMode: WordBool;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsADSystemInfo);
+    procedure Disconnect; override;
+    function  GetAnyDCName: WideString;
+    function  GetDCSiteName(const szServer: WideString): WideString;
+    procedure RefreshSchemaCache;
+    function  GetTrees: OleVariant;
+    property  DefaultInterface: IADsADSystemInfo read GetDefaultInterface;
+    property UserName: WideString read Get_UserName;
+    property ComputerName: WideString read Get_ComputerName;
+    property SiteName: WideString read Get_SiteName;
+    property DomainShortName: WideString read Get_DomainShortName;
+    property DomainDNSName: WideString read Get_DomainDNSName;
+    property ForestDNSName: WideString read Get_ForestDNSName;
+    property PDCRoleOwner: WideString read Get_PDCRoleOwner;
+    property SchemaRoleOwner: WideString read Get_SchemaRoleOwner;
+    property IsNativeMode: WordBool read Get_IsNativeMode;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TADSystemInfoProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TADSystemInfo
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TADSystemInfoProperties = class(TPersistent)
+  private
+    FServer:    TADSystemInfo;
+    function    GetDefaultInterface: IADsADSystemInfo;
+    constructor Create(AServer: TADSystemInfo);
+  protected
+    function  Get_UserName: WideString;
+    function  Get_ComputerName: WideString;
+    function  Get_SiteName: WideString;
+    function  Get_DomainShortName: WideString;
+    function  Get_DomainDNSName: WideString;
+    function  Get_ForestDNSName: WideString;
+    function  Get_PDCRoleOwner: WideString;
+    function  Get_SchemaRoleOwner: WideString;
+    function  Get_IsNativeMode: WordBool;
+  public
+    property DefaultInterface: IADsADSystemInfo read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoWinNTSystemInfo provides a Create and CreateRemote method to
+// create instances of the default interface IADsWinNTSystemInfo exposed by
+// the CoClass WinNTSystemInfo. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoWinNTSystemInfo = class
+    class function Create: IADsWinNTSystemInfo;
+    class function CreateRemote(const MachineName: string): IADsWinNTSystemInfo;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TWinNTSystemInfo
+// Help String      :
+// Default Interface: IADsWinNTSystemInfo
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TWinNTSystemInfoProperties= class;
+{$ENDIF}
+  TWinNTSystemInfo = class(TOleServer)
+  private
+    FIntf:        IADsWinNTSystemInfo;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TWinNTSystemInfoProperties;
+    function      GetServerProperties: TWinNTSystemInfoProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsWinNTSystemInfo;
+  protected
+    procedure InitServerData; override;
+    function  Get_UserName: WideString;
+    function  Get_ComputerName: WideString;
+    function  Get_DomainName: WideString;
+    function  Get_PDC: WideString;
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsWinNTSystemInfo);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsWinNTSystemInfo read GetDefaultInterface;
+    property UserName: WideString read Get_UserName;
+    property ComputerName: WideString read Get_ComputerName;
+    property DomainName: WideString read Get_DomainName;
+    property PDC: WideString read Get_PDC;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TWinNTSystemInfoProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TWinNTSystemInfo
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TWinNTSystemInfoProperties = class(TPersistent)
+  private
+    FServer:    TWinNTSystemInfo;
+    function    GetDefaultInterface: IADsWinNTSystemInfo;
+    constructor Create(AServer: TWinNTSystemInfo);
+  protected
+    function  Get_UserName: WideString;
+    function  Get_ComputerName: WideString;
+    function  Get_DomainName: WideString;
+    function  Get_PDC: WideString;
+  public
+    property DefaultInterface: IADsWinNTSystemInfo read GetDefaultInterface;
+  published
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoDNWithBinary provides a Create and CreateRemote method to
+// create instances of the default interface IADsDNWithBinary exposed by
+// the CoClass DNWithBinary. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoDNWithBinary = class
+    class function Create: IADsDNWithBinary;
+    class function CreateRemote(const MachineName: string): IADsDNWithBinary;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TDNWithBinary
+// Help String      :
+// Default Interface: IADsDNWithBinary
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TDNWithBinaryProperties= class;
+{$ENDIF}
+  TDNWithBinary = class(TOleServer)
+  private
+    FIntf:        IADsDNWithBinary;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TDNWithBinaryProperties;
+    function      GetServerProperties: TDNWithBinaryProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsDNWithBinary;
+  protected
+    procedure InitServerData; override;
+    function  Get_BinaryValue: OleVariant;
+    procedure Set_BinaryValue(retval: OleVariant);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsDNWithBinary);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsDNWithBinary read GetDefaultInterface;
+    property BinaryValue: OleVariant read Get_BinaryValue write Set_BinaryValue;
+    property DNString: WideString read Get_DNString write Set_DNString;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TDNWithBinaryProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TDNWithBinary
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TDNWithBinaryProperties = class(TPersistent)
+  private
+    FServer:    TDNWithBinary;
+    function    GetDefaultInterface: IADsDNWithBinary;
+    constructor Create(AServer: TDNWithBinary);
+  protected
+    function  Get_BinaryValue: OleVariant;
+    procedure Set_BinaryValue(retval: OleVariant);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+  public
+    property DefaultInterface: IADsDNWithBinary read GetDefaultInterface;
+  published
+    property DNString: WideString read Get_DNString write Set_DNString;
+  end;
+{$ENDIF}
+
+// *********************************************************************//
+// The Class CoDNWithString provides a Create and CreateRemote method to
+// create instances of the default interface IADsDNWithString exposed by
+// the CoClass DNWithString. The functions are intended to be used by
+// clients wishing to automate the CoClass objects exposed by the
+// server of this typelibrary.
+// *********************************************************************//
+  CoDNWithString = class
+    class function Create: IADsDNWithString;
+    class function CreateRemote(const MachineName: string): IADsDNWithString;
+  end;
+
+// *********************************************************************//
+// OLE Server Proxy class declaration
+// Server Object    : TDNWithString
+// Help String      :
+// Default Interface: IADsDNWithString
+// Def. Intf. DISP? : No
+// Event   Interface:
+// TypeFlags        : (2) CanCreate
+// *********************************************************************//
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  TDNWithStringProperties= class;
+{$ENDIF}
+  TDNWithString = class(TOleServer)
+  private
+    FIntf:        IADsDNWithString;
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    FProps:       TDNWithStringProperties;
+    function      GetServerProperties: TDNWithStringProperties;
+{$ENDIF}
+    function      GetDefaultInterface: IADsDNWithString;
+  protected
+    procedure InitServerData; override;
+    function  Get_StringValue: WideString;
+    procedure Set_StringValue(const retval: WideString);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+  public
+    constructor Create(AOwner: TComponent); override;
+    destructor  Destroy; override;
+    procedure Connect; override;
+    procedure ConnectTo(svrIntf: IADsDNWithString);
+    procedure Disconnect; override;
+    property  DefaultInterface: IADsDNWithString read GetDefaultInterface;
+    property StringValue: WideString read Get_StringValue write Set_StringValue;
+    property DNString: WideString read Get_DNString write Set_DNString;
+  published
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+    property Server: TDNWithStringProperties read GetServerProperties;
+{$ENDIF}
+  end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+// *********************************************************************//
+// OLE Server Properties Proxy Class
+// Server Object    : TDNWithString
+// (This object is used by the IDE's Property Inspector to allow editing
+//  of the properties of this server)
+// *********************************************************************//
+ TDNWithStringProperties = class(TPersistent)
+  private
+    FServer:    TDNWithString;
+    function    GetDefaultInterface: IADsDNWithString;
+    constructor Create(AServer: TDNWithString);
+  protected
+    function  Get_StringValue: WideString;
+    procedure Set_StringValue(const retval: WideString);
+    function  Get_DNString: WideString;
+    procedure Set_DNString(const retval: WideString);
+  public
+    property DefaultInterface: IADsDNWithString read GetDefaultInterface;
+  published
+    property StringValue: WideString read Get_StringValue write Set_StringValue;
+    property DNString: WideString read Get_DNString write Set_DNString;
+  end;
+{$ENDIF}
+
+procedure Register;
+
+implementation
+
+uses ComObj;
+
+class function CoPropertyEntry.Create: IADsPropertyEntry;
+begin
+  Result := CreateComObject(CLASS_PropertyEntry) as IADsPropertyEntry;
+end;
+
+class function CoPropertyEntry.CreateRemote(const MachineName: string): IADsPropertyEntry;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_PropertyEntry) as IADsPropertyEntry;
+end;
+
+procedure TPropertyEntry.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{72D3EDC2-A4C4-11D0-8533-00C04FD8D503}';
+    IntfIID:   '{05792C8E-941F-11D0-8529-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TPropertyEntry.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsPropertyEntry;
+  end;
+end;
+
+procedure TPropertyEntry.ConnectTo(svrIntf: IADsPropertyEntry);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TPropertyEntry.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TPropertyEntry.GetDefaultInterface: IADsPropertyEntry;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TPropertyEntry.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TPropertyEntryProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TPropertyEntry.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TPropertyEntry.GetServerProperties: TPropertyEntryProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TPropertyEntry.Get_Name: WideString;
+begin
+  Result := DefaultInterface.Get_Name;
+end;
+
+procedure TPropertyEntry.Set_Name(const retval: WideString);
+begin
+  DefaultInterface.Set_Name(retval);
+end;
+
+function  TPropertyEntry.Get_ADsType: Integer;
+begin
+  Result := DefaultInterface.Get_ADsType;
+end;
+
+procedure TPropertyEntry.Set_ADsType(retval: Integer);
+begin
+  DefaultInterface.Set_ADsType(retval);
+end;
+
+function  TPropertyEntry.Get_ControlCode: Integer;
+begin
+  Result := DefaultInterface.Get_ControlCode;
+end;
+
+procedure TPropertyEntry.Set_ControlCode(retval: Integer);
+begin
+  DefaultInterface.Set_ControlCode(retval);
+end;
+
+function  TPropertyEntry.Get_Values: OleVariant;
+begin
+  Result := DefaultInterface.Get_Values;
+end;
+
+procedure TPropertyEntry.Set_Values(retval: OleVariant);
+begin
+  DefaultInterface.Set_Values(retval);
+end;
+
+procedure TPropertyEntry.Clear;
+begin
+  DefaultInterface.Clear;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TPropertyEntryProperties.Create(AServer: TPropertyEntry);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TPropertyEntryProperties.GetDefaultInterface: IADsPropertyEntry;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TPropertyEntryProperties.Get_Name: WideString;
+begin
+  Result := DefaultInterface.Get_Name;
+end;
+
+procedure TPropertyEntryProperties.Set_Name(const retval: WideString);
+begin
+  DefaultInterface.Set_Name(retval);
+end;
+
+function  TPropertyEntryProperties.Get_ADsType: Integer;
+begin
+  Result := DefaultInterface.Get_ADsType;
+end;
+
+procedure TPropertyEntryProperties.Set_ADsType(retval: Integer);
+begin
+  DefaultInterface.Set_ADsType(retval);
+end;
+
+function  TPropertyEntryProperties.Get_ControlCode: Integer;
+begin
+  Result := DefaultInterface.Get_ControlCode;
+end;
+
+procedure TPropertyEntryProperties.Set_ControlCode(retval: Integer);
+begin
+  DefaultInterface.Set_ControlCode(retval);
+end;
+
+function  TPropertyEntryProperties.Get_Values: OleVariant;
+begin
+  Result := DefaultInterface.Get_Values;
+end;
+
+procedure TPropertyEntryProperties.Set_Values(retval: OleVariant);
+begin
+  DefaultInterface.Set_Values(retval);
+end;
+
+{$ENDIF}
+
+class function CoPropertyValue.Create: IADsPropertyValue;
+begin
+  Result := CreateComObject(CLASS_PropertyValue) as IADsPropertyValue;
+end;
+
+class function CoPropertyValue.CreateRemote(const MachineName: string): IADsPropertyValue;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_PropertyValue) as IADsPropertyValue;
+end;
+
+procedure TPropertyValue.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{7B9E38B0-A97C-11D0-8534-00C04FD8D503}';
+    IntfIID:   '{79FA9AD0-A97C-11D0-8534-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TPropertyValue.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsPropertyValue;
+  end;
+end;
+
+procedure TPropertyValue.ConnectTo(svrIntf: IADsPropertyValue);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TPropertyValue.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TPropertyValue.GetDefaultInterface: IADsPropertyValue;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TPropertyValue.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TPropertyValueProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TPropertyValue.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TPropertyValue.GetServerProperties: TPropertyValueProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TPropertyValue.Get_ADsType: Integer;
+begin
+  Result := DefaultInterface.Get_ADsType;
+end;
+
+procedure TPropertyValue.Set_ADsType(retval: Integer);
+begin
+  DefaultInterface.Set_ADsType(retval);
+end;
+
+function  TPropertyValue.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TPropertyValue.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+function  TPropertyValue.Get_CaseExactString: WideString;
+begin
+  Result := DefaultInterface.Get_CaseExactString;
+end;
+
+procedure TPropertyValue.Set_CaseExactString(const retval: WideString);
+begin
+  DefaultInterface.Set_CaseExactString(retval);
+end;
+
+function  TPropertyValue.Get_CaseIgnoreString: WideString;
+begin
+  Result := DefaultInterface.Get_CaseIgnoreString;
+end;
+
+procedure TPropertyValue.Set_CaseIgnoreString(const retval: WideString);
+begin
+  DefaultInterface.Set_CaseIgnoreString(retval);
+end;
+
+function  TPropertyValue.Get_PrintableString: WideString;
+begin
+  Result := DefaultInterface.Get_PrintableString;
+end;
+
+procedure TPropertyValue.Set_PrintableString(const retval: WideString);
+begin
+  DefaultInterface.Set_PrintableString(retval);
+end;
+
+function  TPropertyValue.Get_NumericString: WideString;
+begin
+  Result := DefaultInterface.Get_NumericString;
+end;
+
+procedure TPropertyValue.Set_NumericString(const retval: WideString);
+begin
+  DefaultInterface.Set_NumericString(retval);
+end;
+
+function  TPropertyValue.Get_Boolean: Integer;
+begin
+  Result := DefaultInterface.Get_Boolean;
+end;
+
+procedure TPropertyValue.Set_Boolean(retval: Integer);
+begin
+  DefaultInterface.Set_Boolean(retval);
+end;
+
+function  TPropertyValue.Get_Integer: Integer;
+begin
+  Result := DefaultInterface.Get_Integer;
+end;
+
+procedure TPropertyValue.Set_Integer(retval: Integer);
+begin
+  DefaultInterface.Set_Integer(retval);
+end;
+
+function  TPropertyValue.Get_OctetString: OleVariant;
+begin
+  Result := DefaultInterface.Get_OctetString;
+end;
+
+procedure TPropertyValue.Set_OctetString(retval: OleVariant);
+begin
+  DefaultInterface.Set_OctetString(retval);
+end;
+
+function  TPropertyValue.Get_SecurityDescriptor: IDispatch;
+begin
+  Result := DefaultInterface.Get_SecurityDescriptor;
+end;
+
+procedure TPropertyValue.Set_SecurityDescriptor(const retval: IDispatch);
+begin
+  DefaultInterface.Set_SecurityDescriptor(retval);
+end;
+
+function  TPropertyValue.Get_LargeInteger: IDispatch;
+begin
+  Result := DefaultInterface.Get_LargeInteger;
+end;
+
+procedure TPropertyValue.Set_LargeInteger(const retval: IDispatch);
+begin
+  DefaultInterface.Set_LargeInteger(retval);
+end;
+
+function  TPropertyValue.Get_UTCTime: TDateTime;
+begin
+  Result := DefaultInterface.Get_UTCTime;
+end;
+
+procedure TPropertyValue.Set_UTCTime(retval: TDateTime);
+begin
+  DefaultInterface.Set_UTCTime(retval);
+end;
+
+procedure TPropertyValue.Clear;
+begin
+  DefaultInterface.Clear;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TPropertyValueProperties.Create(AServer: TPropertyValue);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TPropertyValueProperties.GetDefaultInterface: IADsPropertyValue;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TPropertyValueProperties.Get_ADsType: Integer;
+begin
+  Result := DefaultInterface.Get_ADsType;
+end;
+
+procedure TPropertyValueProperties.Set_ADsType(retval: Integer);
+begin
+  DefaultInterface.Set_ADsType(retval);
+end;
+
+function  TPropertyValueProperties.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TPropertyValueProperties.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+function  TPropertyValueProperties.Get_CaseExactString: WideString;
+begin
+  Result := DefaultInterface.Get_CaseExactString;
+end;
+
+procedure TPropertyValueProperties.Set_CaseExactString(const retval: WideString);
+begin
+  DefaultInterface.Set_CaseExactString(retval);
+end;
+
+function  TPropertyValueProperties.Get_CaseIgnoreString: WideString;
+begin
+  Result := DefaultInterface.Get_CaseIgnoreString;
+end;
+
+procedure TPropertyValueProperties.Set_CaseIgnoreString(const retval: WideString);
+begin
+  DefaultInterface.Set_CaseIgnoreString(retval);
+end;
+
+function  TPropertyValueProperties.Get_PrintableString: WideString;
+begin
+  Result := DefaultInterface.Get_PrintableString;
+end;
+
+procedure TPropertyValueProperties.Set_PrintableString(const retval: WideString);
+begin
+  DefaultInterface.Set_PrintableString(retval);
+end;
+
+function  TPropertyValueProperties.Get_NumericString: WideString;
+begin
+  Result := DefaultInterface.Get_NumericString;
+end;
+
+procedure TPropertyValueProperties.Set_NumericString(const retval: WideString);
+begin
+  DefaultInterface.Set_NumericString(retval);
+end;
+
+function  TPropertyValueProperties.Get_Boolean: Integer;
+begin
+  Result := DefaultInterface.Get_Boolean;
+end;
+
+procedure TPropertyValueProperties.Set_Boolean(retval: Integer);
+begin
+  DefaultInterface.Set_Boolean(retval);
+end;
+
+function  TPropertyValueProperties.Get_Integer: Integer;
+begin
+  Result := DefaultInterface.Get_Integer;
+end;
+
+procedure TPropertyValueProperties.Set_Integer(retval: Integer);
+begin
+  DefaultInterface.Set_Integer(retval);
+end;
+
+function  TPropertyValueProperties.Get_OctetString: OleVariant;
+begin
+  Result := DefaultInterface.Get_OctetString;
+end;
+
+procedure TPropertyValueProperties.Set_OctetString(retval: OleVariant);
+begin
+  DefaultInterface.Set_OctetString(retval);
+end;
+
+function  TPropertyValueProperties.Get_SecurityDescriptor: IDispatch;
+begin
+  Result := DefaultInterface.Get_SecurityDescriptor;
+end;
+
+procedure TPropertyValueProperties.Set_SecurityDescriptor(const retval: IDispatch);
+begin
+  DefaultInterface.Set_SecurityDescriptor(retval);
+end;
+
+function  TPropertyValueProperties.Get_LargeInteger: IDispatch;
+begin
+  Result := DefaultInterface.Get_LargeInteger;
+end;
+
+procedure TPropertyValueProperties.Set_LargeInteger(const retval: IDispatch);
+begin
+  DefaultInterface.Set_LargeInteger(retval);
+end;
+
+function  TPropertyValueProperties.Get_UTCTime: TDateTime;
+begin
+  Result := DefaultInterface.Get_UTCTime;
+end;
+
+procedure TPropertyValueProperties.Set_UTCTime(retval: TDateTime);
+begin
+  DefaultInterface.Set_UTCTime(retval);
+end;
+
+{$ENDIF}
+
+class function CoAccessControlEntry.Create: IADsAccessControlEntry;
+begin
+  Result := CreateComObject(CLASS_AccessControlEntry) as IADsAccessControlEntry;
+end;
+
+class function CoAccessControlEntry.CreateRemote(const MachineName: string): IADsAccessControlEntry;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_AccessControlEntry) as IADsAccessControlEntry;
+end;
+
+procedure TAccessControlEntry.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B75AC000-9BDD-11D0-852C-00C04FD8D503}';
+    IntfIID:   '{B4F3A14C-9BDD-11D0-852C-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TAccessControlEntry.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsAccessControlEntry;
+  end;
+end;
+
+procedure TAccessControlEntry.ConnectTo(svrIntf: IADsAccessControlEntry);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TAccessControlEntry.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TAccessControlEntry.GetDefaultInterface: IADsAccessControlEntry;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TAccessControlEntry.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TAccessControlEntryProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TAccessControlEntry.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TAccessControlEntry.GetServerProperties: TAccessControlEntryProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TAccessControlEntry.Get_AccessMask: Integer;
+begin
+  Result := DefaultInterface.Get_AccessMask;
+end;
+
+procedure TAccessControlEntry.Set_AccessMask(retval: Integer);
+begin
+  DefaultInterface.Set_AccessMask(retval);
+end;
+
+function  TAccessControlEntry.Get_AceType: Integer;
+begin
+  Result := DefaultInterface.Get_AceType;
+end;
+
+procedure TAccessControlEntry.Set_AceType(retval: Integer);
+begin
+  DefaultInterface.Set_AceType(retval);
+end;
+
+function  TAccessControlEntry.Get_AceFlags: Integer;
+begin
+  Result := DefaultInterface.Get_AceFlags;
+end;
+
+procedure TAccessControlEntry.Set_AceFlags(retval: Integer);
+begin
+  DefaultInterface.Set_AceFlags(retval);
+end;
+
+function  TAccessControlEntry.Get_Flags: Integer;
+begin
+  Result := DefaultInterface.Get_Flags;
+end;
+
+procedure TAccessControlEntry.Set_Flags(retval: Integer);
+begin
+  DefaultInterface.Set_Flags(retval);
+end;
+
+function  TAccessControlEntry.Get_ObjectType: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectType;
+end;
+
+procedure TAccessControlEntry.Set_ObjectType(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectType(retval);
+end;
+
+function  TAccessControlEntry.Get_InheritedObjectType: WideString;
+begin
+  Result := DefaultInterface.Get_InheritedObjectType;
+end;
+
+procedure TAccessControlEntry.Set_InheritedObjectType(const retval: WideString);
+begin
+  DefaultInterface.Set_InheritedObjectType(retval);
+end;
+
+function  TAccessControlEntry.Get_Trustee: WideString;
+begin
+  Result := DefaultInterface.Get_Trustee;
+end;
+
+procedure TAccessControlEntry.Set_Trustee(const retval: WideString);
+begin
+  DefaultInterface.Set_Trustee(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TAccessControlEntryProperties.Create(AServer: TAccessControlEntry);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TAccessControlEntryProperties.GetDefaultInterface: IADsAccessControlEntry;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TAccessControlEntryProperties.Get_AccessMask: Integer;
+begin
+  Result := DefaultInterface.Get_AccessMask;
+end;
+
+procedure TAccessControlEntryProperties.Set_AccessMask(retval: Integer);
+begin
+  DefaultInterface.Set_AccessMask(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_AceType: Integer;
+begin
+  Result := DefaultInterface.Get_AceType;
+end;
+
+procedure TAccessControlEntryProperties.Set_AceType(retval: Integer);
+begin
+  DefaultInterface.Set_AceType(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_AceFlags: Integer;
+begin
+  Result := DefaultInterface.Get_AceFlags;
+end;
+
+procedure TAccessControlEntryProperties.Set_AceFlags(retval: Integer);
+begin
+  DefaultInterface.Set_AceFlags(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_Flags: Integer;
+begin
+  Result := DefaultInterface.Get_Flags;
+end;
+
+procedure TAccessControlEntryProperties.Set_Flags(retval: Integer);
+begin
+  DefaultInterface.Set_Flags(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_ObjectType: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectType;
+end;
+
+procedure TAccessControlEntryProperties.Set_ObjectType(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectType(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_InheritedObjectType: WideString;
+begin
+  Result := DefaultInterface.Get_InheritedObjectType;
+end;
+
+procedure TAccessControlEntryProperties.Set_InheritedObjectType(const retval: WideString);
+begin
+  DefaultInterface.Set_InheritedObjectType(retval);
+end;
+
+function  TAccessControlEntryProperties.Get_Trustee: WideString;
+begin
+  Result := DefaultInterface.Get_Trustee;
+end;
+
+procedure TAccessControlEntryProperties.Set_Trustee(const retval: WideString);
+begin
+  DefaultInterface.Set_Trustee(retval);
+end;
+
+{$ENDIF}
+
+class function CoAccessControlList.Create: IADsAccessControlList;
+begin
+  Result := CreateComObject(CLASS_AccessControlList) as IADsAccessControlList;
+end;
+
+class function CoAccessControlList.CreateRemote(const MachineName: string): IADsAccessControlList;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_AccessControlList) as IADsAccessControlList;
+end;
+
+procedure TAccessControlList.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B85EA052-9BDD-11D0-852C-00C04FD8D503}';
+    IntfIID:   '{B7EE91CC-9BDD-11D0-852C-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TAccessControlList.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsAccessControlList;
+  end;
+end;
+
+procedure TAccessControlList.ConnectTo(svrIntf: IADsAccessControlList);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TAccessControlList.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TAccessControlList.GetDefaultInterface: IADsAccessControlList;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TAccessControlList.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TAccessControlListProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TAccessControlList.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TAccessControlList.GetServerProperties: TAccessControlListProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TAccessControlList.Get_AclRevision: Integer;
+begin
+  Result := DefaultInterface.Get_AclRevision;
+end;
+
+procedure TAccessControlList.Set_AclRevision(retval: Integer);
+begin
+  DefaultInterface.Set_AclRevision(retval);
+end;
+
+function  TAccessControlList.Get_AceCount: Integer;
+begin
+  Result := DefaultInterface.Get_AceCount;
+end;
+
+procedure TAccessControlList.Set_AceCount(retval: Integer);
+begin
+  DefaultInterface.Set_AceCount(retval);
+end;
+
+procedure TAccessControlList.AddAce(const pAccessControlEntry: IDispatch);
+begin
+  DefaultInterface.AddAce(pAccessControlEntry);
+end;
+
+procedure TAccessControlList.RemoveAce(const pAccessControlEntry: IDispatch);
+begin
+  DefaultInterface.RemoveAce(pAccessControlEntry);
+end;
+
+function  TAccessControlList.CopyAccessList: IDispatch;
+begin
+  Result := DefaultInterface.CopyAccessList;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TAccessControlListProperties.Create(AServer: TAccessControlList);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TAccessControlListProperties.GetDefaultInterface: IADsAccessControlList;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TAccessControlListProperties.Get_AclRevision: Integer;
+begin
+  Result := DefaultInterface.Get_AclRevision;
+end;
+
+procedure TAccessControlListProperties.Set_AclRevision(retval: Integer);
+begin
+  DefaultInterface.Set_AclRevision(retval);
+end;
+
+function  TAccessControlListProperties.Get_AceCount: Integer;
+begin
+  Result := DefaultInterface.Get_AceCount;
+end;
+
+procedure TAccessControlListProperties.Set_AceCount(retval: Integer);
+begin
+  DefaultInterface.Set_AceCount(retval);
+end;
+
+{$ENDIF}
+
+class function CoSecurityDescriptor.Create: IADsSecurityDescriptor;
+begin
+  Result := CreateComObject(CLASS_SecurityDescriptor) as IADsSecurityDescriptor;
+end;
+
+class function CoSecurityDescriptor.CreateRemote(const MachineName: string): IADsSecurityDescriptor;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_SecurityDescriptor) as IADsSecurityDescriptor;
+end;
+
+procedure TSecurityDescriptor.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B958F73C-9BDD-11D0-852C-00C04FD8D503}';
+    IntfIID:   '{B8C787CA-9BDD-11D0-852C-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TSecurityDescriptor.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsSecurityDescriptor;
+  end;
+end;
+
+procedure TSecurityDescriptor.ConnectTo(svrIntf: IADsSecurityDescriptor);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TSecurityDescriptor.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TSecurityDescriptor.GetDefaultInterface: IADsSecurityDescriptor;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TSecurityDescriptor.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TSecurityDescriptorProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TSecurityDescriptor.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TSecurityDescriptor.GetServerProperties: TSecurityDescriptorProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TSecurityDescriptor.Get_Revision: Integer;
+begin
+  Result := DefaultInterface.Get_Revision;
+end;
+
+procedure TSecurityDescriptor.Set_Revision(retval: Integer);
+begin
+  DefaultInterface.Set_Revision(retval);
+end;
+
+function  TSecurityDescriptor.Get_Control: Integer;
+begin
+  Result := DefaultInterface.Get_Control;
+end;
+
+procedure TSecurityDescriptor.Set_Control(retval: Integer);
+begin
+  DefaultInterface.Set_Control(retval);
+end;
+
+function  TSecurityDescriptor.Get_Owner: WideString;
+begin
+  Result := DefaultInterface.Get_Owner;
+end;
+
+procedure TSecurityDescriptor.Set_Owner(const retval: WideString);
+begin
+  DefaultInterface.Set_Owner(retval);
+end;
+
+function  TSecurityDescriptor.Get_OwnerDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_OwnerDefaulted;
+end;
+
+procedure TSecurityDescriptor.Set_OwnerDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_OwnerDefaulted(retval);
+end;
+
+function  TSecurityDescriptor.Get_Group: WideString;
+begin
+  Result := DefaultInterface.Get_Group;
+end;
+
+procedure TSecurityDescriptor.Set_Group(const retval: WideString);
+begin
+  DefaultInterface.Set_Group(retval);
+end;
+
+function  TSecurityDescriptor.Get_GroupDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_GroupDefaulted;
+end;
+
+procedure TSecurityDescriptor.Set_GroupDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_GroupDefaulted(retval);
+end;
+
+function  TSecurityDescriptor.Get_DiscretionaryAcl: IDispatch;
+begin
+  Result := DefaultInterface.Get_DiscretionaryAcl;
+end;
+
+procedure TSecurityDescriptor.Set_DiscretionaryAcl(const retval: IDispatch);
+begin
+  DefaultInterface.Set_DiscretionaryAcl(retval);
+end;
+
+function  TSecurityDescriptor.Get_DaclDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_DaclDefaulted;
+end;
+
+procedure TSecurityDescriptor.Set_DaclDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_DaclDefaulted(retval);
+end;
+
+function  TSecurityDescriptor.Get_SystemAcl: IDispatch;
+begin
+  Result := DefaultInterface.Get_SystemAcl;
+end;
+
+procedure TSecurityDescriptor.Set_SystemAcl(const retval: IDispatch);
+begin
+  DefaultInterface.Set_SystemAcl(retval);
+end;
+
+function  TSecurityDescriptor.Get_SaclDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_SaclDefaulted;
+end;
+
+procedure TSecurityDescriptor.Set_SaclDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_SaclDefaulted(retval);
+end;
+
+function  TSecurityDescriptor.CopySecurityDescriptor: IDispatch;
+begin
+  Result := DefaultInterface.CopySecurityDescriptor;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TSecurityDescriptorProperties.Create(AServer: TSecurityDescriptor);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TSecurityDescriptorProperties.GetDefaultInterface: IADsSecurityDescriptor;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TSecurityDescriptorProperties.Get_Revision: Integer;
+begin
+  Result := DefaultInterface.Get_Revision;
+end;
+
+procedure TSecurityDescriptorProperties.Set_Revision(retval: Integer);
+begin
+  DefaultInterface.Set_Revision(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_Control: Integer;
+begin
+  Result := DefaultInterface.Get_Control;
+end;
+
+procedure TSecurityDescriptorProperties.Set_Control(retval: Integer);
+begin
+  DefaultInterface.Set_Control(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_Owner: WideString;
+begin
+  Result := DefaultInterface.Get_Owner;
+end;
+
+procedure TSecurityDescriptorProperties.Set_Owner(const retval: WideString);
+begin
+  DefaultInterface.Set_Owner(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_OwnerDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_OwnerDefaulted;
+end;
+
+procedure TSecurityDescriptorProperties.Set_OwnerDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_OwnerDefaulted(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_Group: WideString;
+begin
+  Result := DefaultInterface.Get_Group;
+end;
+
+procedure TSecurityDescriptorProperties.Set_Group(const retval: WideString);
+begin
+  DefaultInterface.Set_Group(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_GroupDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_GroupDefaulted;
+end;
+
+procedure TSecurityDescriptorProperties.Set_GroupDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_GroupDefaulted(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_DiscretionaryAcl: IDispatch;
+begin
+  Result := DefaultInterface.Get_DiscretionaryAcl;
+end;
+
+procedure TSecurityDescriptorProperties.Set_DiscretionaryAcl(const retval: IDispatch);
+begin
+  DefaultInterface.Set_DiscretionaryAcl(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_DaclDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_DaclDefaulted;
+end;
+
+procedure TSecurityDescriptorProperties.Set_DaclDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_DaclDefaulted(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_SystemAcl: IDispatch;
+begin
+  Result := DefaultInterface.Get_SystemAcl;
+end;
+
+procedure TSecurityDescriptorProperties.Set_SystemAcl(const retval: IDispatch);
+begin
+  DefaultInterface.Set_SystemAcl(retval);
+end;
+
+function  TSecurityDescriptorProperties.Get_SaclDefaulted: WordBool;
+begin
+  Result := DefaultInterface.Get_SaclDefaulted;
+end;
+
+procedure TSecurityDescriptorProperties.Set_SaclDefaulted(retval: WordBool);
+begin
+  DefaultInterface.Set_SaclDefaulted(retval);
+end;
+
+{$ENDIF}
+
+class function CoLargeInteger.Create: IADsLargeInteger;
+begin
+  Result := CreateComObject(CLASS_LargeInteger) as IADsLargeInteger;
+end;
+
+class function CoLargeInteger.CreateRemote(const MachineName: string): IADsLargeInteger;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_LargeInteger) as IADsLargeInteger;
+end;
+
+procedure TLargeInteger.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{927971F5-0939-11D1-8BE1-00C04FD8D503}';
+    IntfIID:   '{9068270B-0939-11D1-8BE1-00C04FD8D503}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TLargeInteger.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsLargeInteger;
+  end;
+end;
+
+procedure TLargeInteger.ConnectTo(svrIntf: IADsLargeInteger);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TLargeInteger.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TLargeInteger.GetDefaultInterface: IADsLargeInteger;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TLargeInteger.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TLargeIntegerProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TLargeInteger.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TLargeInteger.GetServerProperties: TLargeIntegerProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TLargeInteger.Get_HighPart: Integer;
+begin
+  Result := DefaultInterface.Get_HighPart;
+end;
+
+procedure TLargeInteger.Set_HighPart(retval: Integer);
+begin
+  DefaultInterface.Set_HighPart(retval);
+end;
+
+function  TLargeInteger.Get_LowPart: Integer;
+begin
+  Result := DefaultInterface.Get_LowPart;
+end;
+
+procedure TLargeInteger.Set_LowPart(retval: Integer);
+begin
+  DefaultInterface.Set_LowPart(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TLargeIntegerProperties.Create(AServer: TLargeInteger);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TLargeIntegerProperties.GetDefaultInterface: IADsLargeInteger;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TLargeIntegerProperties.Get_HighPart: Integer;
+begin
+  Result := DefaultInterface.Get_HighPart;
+end;
+
+procedure TLargeIntegerProperties.Set_HighPart(retval: Integer);
+begin
+  DefaultInterface.Set_HighPart(retval);
+end;
+
+function  TLargeIntegerProperties.Get_LowPart: Integer;
+begin
+  Result := DefaultInterface.Get_LowPart;
+end;
+
+procedure TLargeIntegerProperties.Set_LowPart(retval: Integer);
+begin
+  DefaultInterface.Set_LowPart(retval);
+end;
+
+{$ENDIF}
+
+class function CoNameTranslate.Create: IADsNameTranslate;
+begin
+  Result := CreateComObject(CLASS_NameTranslate) as IADsNameTranslate;
+end;
+
+class function CoNameTranslate.CreateRemote(const MachineName: string): IADsNameTranslate;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_NameTranslate) as IADsNameTranslate;
+end;
+
+procedure TNameTranslate.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{274FAE1F-3626-11D1-A3A4-00C04FB950DC}';
+    IntfIID:   '{B1B272A3-3625-11D1-A3A4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TNameTranslate.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsNameTranslate;
+  end;
+end;
+
+procedure TNameTranslate.ConnectTo(svrIntf: IADsNameTranslate);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TNameTranslate.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TNameTranslate.GetDefaultInterface: IADsNameTranslate;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TNameTranslate.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TNameTranslateProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TNameTranslate.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TNameTranslate.GetServerProperties: TNameTranslateProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+procedure TNameTranslate.Set_ChaseReferral(Param1: Integer);
+begin
+  DefaultInterface.Set_ChaseReferral(Param1);
+end;
+
+procedure TNameTranslate.Init(lnSetType: Integer; const bstrADsPath: WideString);
+begin
+  DefaultInterface.Init(lnSetType, bstrADsPath);
+end;
+
+procedure TNameTranslate.InitEx(lnSetType: Integer; const bstrADsPath: WideString;
+                                const bstrUserID: WideString; const bstrDomain: WideString;
+                                const bstrPassword: WideString);
+begin
+  DefaultInterface.InitEx(lnSetType, bstrADsPath, bstrUserID, bstrDomain, bstrPassword);
+end;
+
+procedure TNameTranslate.Set_(lnSetType: Integer; const bstrADsPath: WideString);
+begin
+  DefaultInterface.Set_(lnSetType, bstrADsPath);
+end;
+
+function  TNameTranslate.Get(lnFormatType: Integer): WideString;
+begin
+  Result := DefaultInterface.Get(lnFormatType);
+end;
+
+procedure TNameTranslate.SetEx(lnFormatType: Integer; pVar: OleVariant);
+begin
+  DefaultInterface.SetEx(lnFormatType, pVar);
+end;
+
+function  TNameTranslate.GetEx(lnFormatType: Integer): OleVariant;
+begin
+  Result := DefaultInterface.GetEx(lnFormatType);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TNameTranslateProperties.Create(AServer: TNameTranslate);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TNameTranslateProperties.GetDefaultInterface: IADsNameTranslate;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+procedure TNameTranslateProperties.Set_ChaseReferral(Param1: Integer);
+begin
+  DefaultInterface.Set_ChaseReferral(Param1);
+end;
+
+{$ENDIF}
+
+class function CoCaseIgnoreList.Create: IADsCaseIgnoreList;
+begin
+  Result := CreateComObject(CLASS_CaseIgnoreList) as IADsCaseIgnoreList;
+end;
+
+class function CoCaseIgnoreList.CreateRemote(const MachineName: string): IADsCaseIgnoreList;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_CaseIgnoreList) as IADsCaseIgnoreList;
+end;
+
+procedure TCaseIgnoreList.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{15F88A55-4680-11D1-A3B4-00C04FB950DC}';
+    IntfIID:   '{7B66B533-4680-11D1-A3B4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TCaseIgnoreList.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsCaseIgnoreList;
+  end;
+end;
+
+procedure TCaseIgnoreList.ConnectTo(svrIntf: IADsCaseIgnoreList);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TCaseIgnoreList.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TCaseIgnoreList.GetDefaultInterface: IADsCaseIgnoreList;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TCaseIgnoreList.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TCaseIgnoreListProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TCaseIgnoreList.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TCaseIgnoreList.GetServerProperties: TCaseIgnoreListProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TCaseIgnoreList.Get_CaseIgnoreList: OleVariant;
+begin
+  Result := DefaultInterface.Get_CaseIgnoreList;
+end;
+
+procedure TCaseIgnoreList.Set_CaseIgnoreList(retval: OleVariant);
+begin
+  DefaultInterface.Set_CaseIgnoreList(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TCaseIgnoreListProperties.Create(AServer: TCaseIgnoreList);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TCaseIgnoreListProperties.GetDefaultInterface: IADsCaseIgnoreList;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TCaseIgnoreListProperties.Get_CaseIgnoreList: OleVariant;
+begin
+  Result := DefaultInterface.Get_CaseIgnoreList;
+end;
+
+procedure TCaseIgnoreListProperties.Set_CaseIgnoreList(retval: OleVariant);
+begin
+  DefaultInterface.Set_CaseIgnoreList(retval);
+end;
+
+{$ENDIF}
+
+class function CoFaxNumber.Create: IADsFaxNumber;
+begin
+  Result := CreateComObject(CLASS_FaxNumber) as IADsFaxNumber;
+end;
+
+class function CoFaxNumber.CreateRemote(const MachineName: string): IADsFaxNumber;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_FaxNumber) as IADsFaxNumber;
+end;
+
+procedure TFaxNumber.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{A5062215-4681-11D1-A3B4-00C04FB950DC}';
+    IntfIID:   '{A910DEA9-4680-11D1-A3B4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TFaxNumber.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsFaxNumber;
+  end;
+end;
+
+procedure TFaxNumber.ConnectTo(svrIntf: IADsFaxNumber);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TFaxNumber.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TFaxNumber.GetDefaultInterface: IADsFaxNumber;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TFaxNumber.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TFaxNumberProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TFaxNumber.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TFaxNumber.GetServerProperties: TFaxNumberProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TFaxNumber.Get_TelephoneNumber: WideString;
+begin
+  Result := DefaultInterface.Get_TelephoneNumber;
+end;
+
+procedure TFaxNumber.Set_TelephoneNumber(const retval: WideString);
+begin
+  DefaultInterface.Set_TelephoneNumber(retval);
+end;
+
+function  TFaxNumber.Get_Parameters: OleVariant;
+begin
+  Result := DefaultInterface.Get_Parameters;
+end;
+
+procedure TFaxNumber.Set_Parameters(retval: OleVariant);
+begin
+  DefaultInterface.Set_Parameters(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TFaxNumberProperties.Create(AServer: TFaxNumber);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TFaxNumberProperties.GetDefaultInterface: IADsFaxNumber;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TFaxNumberProperties.Get_TelephoneNumber: WideString;
+begin
+  Result := DefaultInterface.Get_TelephoneNumber;
+end;
+
+procedure TFaxNumberProperties.Set_TelephoneNumber(const retval: WideString);
+begin
+  DefaultInterface.Set_TelephoneNumber(retval);
+end;
+
+function  TFaxNumberProperties.Get_Parameters: OleVariant;
+begin
+  Result := DefaultInterface.Get_Parameters;
+end;
+
+procedure TFaxNumberProperties.Set_Parameters(retval: OleVariant);
+begin
+  DefaultInterface.Set_Parameters(retval);
+end;
+
+{$ENDIF}
+
+class function CoNetAddress.Create: IADsNetAddress;
+begin
+  Result := CreateComObject(CLASS_NetAddress) as IADsNetAddress;
+end;
+
+class function CoNetAddress.CreateRemote(const MachineName: string): IADsNetAddress;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_NetAddress) as IADsNetAddress;
+end;
+
+procedure TNetAddress.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B0B71247-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{B21A50A9-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TNetAddress.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsNetAddress;
+  end;
+end;
+
+procedure TNetAddress.ConnectTo(svrIntf: IADsNetAddress);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TNetAddress.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TNetAddress.GetDefaultInterface: IADsNetAddress;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TNetAddress.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TNetAddressProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TNetAddress.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TNetAddress.GetServerProperties: TNetAddressProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TNetAddress.Get_AddressType: Integer;
+begin
+  Result := DefaultInterface.Get_AddressType;
+end;
+
+procedure TNetAddress.Set_AddressType(retval: Integer);
+begin
+  DefaultInterface.Set_AddressType(retval);
+end;
+
+function  TNetAddress.Get_Address: OleVariant;
+begin
+  Result := DefaultInterface.Get_Address;
+end;
+
+procedure TNetAddress.Set_Address(retval: OleVariant);
+begin
+  DefaultInterface.Set_Address(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TNetAddressProperties.Create(AServer: TNetAddress);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TNetAddressProperties.GetDefaultInterface: IADsNetAddress;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TNetAddressProperties.Get_AddressType: Integer;
+begin
+  Result := DefaultInterface.Get_AddressType;
+end;
+
+procedure TNetAddressProperties.Set_AddressType(retval: Integer);
+begin
+  DefaultInterface.Set_AddressType(retval);
+end;
+
+function  TNetAddressProperties.Get_Address: OleVariant;
+begin
+  Result := DefaultInterface.Get_Address;
+end;
+
+procedure TNetAddressProperties.Set_Address(retval: OleVariant);
+begin
+  DefaultInterface.Set_Address(retval);
+end;
+
+{$ENDIF}
+
+class function CoOctetList.Create: IADsOctetList;
+begin
+  Result := CreateComObject(CLASS_OctetList) as IADsOctetList;
+end;
+
+class function CoOctetList.CreateRemote(const MachineName: string): IADsOctetList;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_OctetList) as IADsOctetList;
+end;
+
+procedure TOctetList.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{1241400F-4680-11D1-A3B4-00C04FB950DC}';
+    IntfIID:   '{7B28B80F-4680-11D1-A3B4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TOctetList.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsOctetList;
+  end;
+end;
+
+procedure TOctetList.ConnectTo(svrIntf: IADsOctetList);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TOctetList.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TOctetList.GetDefaultInterface: IADsOctetList;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TOctetList.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TOctetListProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TOctetList.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TOctetList.GetServerProperties: TOctetListProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TOctetList.Get_OctetList: OleVariant;
+begin
+  Result := DefaultInterface.Get_OctetList;
+end;
+
+procedure TOctetList.Set_OctetList(retval: OleVariant);
+begin
+  DefaultInterface.Set_OctetList(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TOctetListProperties.Create(AServer: TOctetList);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TOctetListProperties.GetDefaultInterface: IADsOctetList;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TOctetListProperties.Get_OctetList: OleVariant;
+begin
+  Result := DefaultInterface.Get_OctetList;
+end;
+
+procedure TOctetListProperties.Set_OctetList(retval: OleVariant);
+begin
+  DefaultInterface.Set_OctetList(retval);
+end;
+
+{$ENDIF}
+
+class function CoEmail.Create: IADsEmail;
+begin
+  Result := CreateComObject(CLASS_Email) as IADsEmail;
+end;
+
+class function CoEmail.CreateRemote(const MachineName: string): IADsEmail;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Email) as IADsEmail;
+end;
+
+procedure TEmail.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{8F92A857-478E-11D1-A3B4-00C04FB950DC}';
+    IntfIID:   '{97AF011A-478E-11D1-A3B4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TEmail.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsEmail;
+  end;
+end;
+
+procedure TEmail.ConnectTo(svrIntf: IADsEmail);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TEmail.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TEmail.GetDefaultInterface: IADsEmail;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TEmail.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TEmailProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TEmail.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TEmail.GetServerProperties: TEmailProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TEmail.Get_Type_: Integer;
+begin
+  Result := DefaultInterface.Get_Type_;
+end;
+
+procedure TEmail.Set_Type_(retval: Integer);
+begin
+  DefaultInterface.Set_Type_(retval);
+end;
+
+function  TEmail.Get_Address: WideString;
+begin
+  Result := DefaultInterface.Get_Address;
+end;
+
+procedure TEmail.Set_Address(const retval: WideString);
+begin
+  DefaultInterface.Set_Address(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TEmailProperties.Create(AServer: TEmail);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TEmailProperties.GetDefaultInterface: IADsEmail;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TEmailProperties.Get_Type_: Integer;
+begin
+  Result := DefaultInterface.Get_Type_;
+end;
+
+procedure TEmailProperties.Set_Type_(retval: Integer);
+begin
+  DefaultInterface.Set_Type_(retval);
+end;
+
+function  TEmailProperties.Get_Address: WideString;
+begin
+  Result := DefaultInterface.Get_Address;
+end;
+
+procedure TEmailProperties.Set_Address(const retval: WideString);
+begin
+  DefaultInterface.Set_Address(retval);
+end;
+
+{$ENDIF}
+
+class function CoPath.Create: IADsPath;
+begin
+  Result := CreateComObject(CLASS_Path) as IADsPath;
+end;
+
+class function CoPath.CreateRemote(const MachineName: string): IADsPath;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Path) as IADsPath;
+end;
+
+procedure TPath.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B2538919-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{B287FCD5-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TPath.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsPath;
+  end;
+end;
+
+procedure TPath.ConnectTo(svrIntf: IADsPath);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TPath.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TPath.GetDefaultInterface: IADsPath;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TPath.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TPathProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TPath.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TPath.GetServerProperties: TPathProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TPath.Get_Type_: Integer;
+begin
+  Result := DefaultInterface.Get_Type_;
+end;
+
+procedure TPath.Set_Type_(retval: Integer);
+begin
+  DefaultInterface.Set_Type_(retval);
+end;
+
+function  TPath.Get_VolumeName: WideString;
+begin
+  Result := DefaultInterface.Get_VolumeName;
+end;
+
+procedure TPath.Set_VolumeName(const retval: WideString);
+begin
+  DefaultInterface.Set_VolumeName(retval);
+end;
+
+function  TPath.Get_Path: WideString;
+begin
+  Result := DefaultInterface.Get_Path;
+end;
+
+procedure TPath.Set_Path(const retval: WideString);
+begin
+  DefaultInterface.Set_Path(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TPathProperties.Create(AServer: TPath);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TPathProperties.GetDefaultInterface: IADsPath;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TPathProperties.Get_Type_: Integer;
+begin
+  Result := DefaultInterface.Get_Type_;
+end;
+
+procedure TPathProperties.Set_Type_(retval: Integer);
+begin
+  DefaultInterface.Set_Type_(retval);
+end;
+
+function  TPathProperties.Get_VolumeName: WideString;
+begin
+  Result := DefaultInterface.Get_VolumeName;
+end;
+
+procedure TPathProperties.Set_VolumeName(const retval: WideString);
+begin
+  DefaultInterface.Set_VolumeName(retval);
+end;
+
+function  TPathProperties.Get_Path: WideString;
+begin
+  Result := DefaultInterface.Get_Path;
+end;
+
+procedure TPathProperties.Set_Path(const retval: WideString);
+begin
+  DefaultInterface.Set_Path(retval);
+end;
+
+{$ENDIF}
+
+class function CoReplicaPointer.Create: IADsReplicaPointer;
+begin
+  Result := CreateComObject(CLASS_ReplicaPointer) as IADsReplicaPointer;
+end;
+
+class function CoReplicaPointer.CreateRemote(const MachineName: string): IADsReplicaPointer;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_ReplicaPointer) as IADsReplicaPointer;
+end;
+
+procedure TReplicaPointer.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{F5D1BADF-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{F60FB803-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TReplicaPointer.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsReplicaPointer;
+  end;
+end;
+
+procedure TReplicaPointer.ConnectTo(svrIntf: IADsReplicaPointer);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TReplicaPointer.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TReplicaPointer.GetDefaultInterface: IADsReplicaPointer;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TReplicaPointer.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TReplicaPointerProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TReplicaPointer.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TReplicaPointer.GetServerProperties: TReplicaPointerProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TReplicaPointer.Get_ServerName: WideString;
+begin
+  Result := DefaultInterface.Get_ServerName;
+end;
+
+procedure TReplicaPointer.Set_ServerName(const retval: WideString);
+begin
+  DefaultInterface.Set_ServerName(retval);
+end;
+
+function  TReplicaPointer.Get_ReplicaType: Integer;
+begin
+  Result := DefaultInterface.Get_ReplicaType;
+end;
+
+procedure TReplicaPointer.Set_ReplicaType(retval: Integer);
+begin
+  DefaultInterface.Set_ReplicaType(retval);
+end;
+
+function  TReplicaPointer.Get_ReplicaNumber: Integer;
+begin
+  Result := DefaultInterface.Get_ReplicaNumber;
+end;
+
+procedure TReplicaPointer.Set_ReplicaNumber(retval: Integer);
+begin
+  DefaultInterface.Set_ReplicaNumber(retval);
+end;
+
+function  TReplicaPointer.Get_Count: Integer;
+begin
+  Result := DefaultInterface.Get_Count;
+end;
+
+procedure TReplicaPointer.Set_Count(retval: Integer);
+begin
+  DefaultInterface.Set_Count(retval);
+end;
+
+function  TReplicaPointer.Get_ReplicaAddressHints: OleVariant;
+begin
+  Result := DefaultInterface.Get_ReplicaAddressHints;
+end;
+
+procedure TReplicaPointer.Set_ReplicaAddressHints(retval: OleVariant);
+begin
+  DefaultInterface.Set_ReplicaAddressHints(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TReplicaPointerProperties.Create(AServer: TReplicaPointer);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TReplicaPointerProperties.GetDefaultInterface: IADsReplicaPointer;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TReplicaPointerProperties.Get_ServerName: WideString;
+begin
+  Result := DefaultInterface.Get_ServerName;
+end;
+
+procedure TReplicaPointerProperties.Set_ServerName(const retval: WideString);
+begin
+  DefaultInterface.Set_ServerName(retval);
+end;
+
+function  TReplicaPointerProperties.Get_ReplicaType: Integer;
+begin
+  Result := DefaultInterface.Get_ReplicaType;
+end;
+
+procedure TReplicaPointerProperties.Set_ReplicaType(retval: Integer);
+begin
+  DefaultInterface.Set_ReplicaType(retval);
+end;
+
+function  TReplicaPointerProperties.Get_ReplicaNumber: Integer;
+begin
+  Result := DefaultInterface.Get_ReplicaNumber;
+end;
+
+procedure TReplicaPointerProperties.Set_ReplicaNumber(retval: Integer);
+begin
+  DefaultInterface.Set_ReplicaNumber(retval);
+end;
+
+function  TReplicaPointerProperties.Get_Count: Integer;
+begin
+  Result := DefaultInterface.Get_Count;
+end;
+
+procedure TReplicaPointerProperties.Set_Count(retval: Integer);
+begin
+  DefaultInterface.Set_Count(retval);
+end;
+
+function  TReplicaPointerProperties.Get_ReplicaAddressHints: OleVariant;
+begin
+  Result := DefaultInterface.Get_ReplicaAddressHints;
+end;
+
+procedure TReplicaPointerProperties.Set_ReplicaAddressHints(retval: OleVariant);
+begin
+  DefaultInterface.Set_ReplicaAddressHints(retval);
+end;
+
+{$ENDIF}
+
+class function CoAcl.Create: IADsAcl;
+begin
+  Result := CreateComObject(CLASS_Acl) as IADsAcl;
+end;
+
+class function CoAcl.CreateRemote(const MachineName: string): IADsAcl;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Acl) as IADsAcl;
+end;
+
+procedure TAcl.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{7AF1EFB6-0869-11D1-A377-00C04FB950DC}';
+    IntfIID:   '{8452D3AB-0869-11D1-A377-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TAcl.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsAcl;
+  end;
+end;
+
+procedure TAcl.ConnectTo(svrIntf: IADsAcl);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TAcl.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TAcl.GetDefaultInterface: IADsAcl;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TAcl.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TAclProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TAcl.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TAcl.GetServerProperties: TAclProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TAcl.Get_ProtectedAttrName: WideString;
+begin
+  Result := DefaultInterface.Get_ProtectedAttrName;
+end;
+
+procedure TAcl.Set_ProtectedAttrName(const retval: WideString);
+begin
+  DefaultInterface.Set_ProtectedAttrName(retval);
+end;
+
+function  TAcl.Get_SubjectName: WideString;
+begin
+  Result := DefaultInterface.Get_SubjectName;
+end;
+
+procedure TAcl.Set_SubjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_SubjectName(retval);
+end;
+
+function  TAcl.Get_Privileges: Integer;
+begin
+  Result := DefaultInterface.Get_Privileges;
+end;
+
+procedure TAcl.Set_Privileges(retval: Integer);
+begin
+  DefaultInterface.Set_Privileges(retval);
+end;
+
+function  TAcl.CopyAcl: IDispatch;
+begin
+  Result := DefaultInterface.CopyAcl;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TAclProperties.Create(AServer: TAcl);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TAclProperties.GetDefaultInterface: IADsAcl;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TAclProperties.Get_ProtectedAttrName: WideString;
+begin
+  Result := DefaultInterface.Get_ProtectedAttrName;
+end;
+
+procedure TAclProperties.Set_ProtectedAttrName(const retval: WideString);
+begin
+  DefaultInterface.Set_ProtectedAttrName(retval);
+end;
+
+function  TAclProperties.Get_SubjectName: WideString;
+begin
+  Result := DefaultInterface.Get_SubjectName;
+end;
+
+procedure TAclProperties.Set_SubjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_SubjectName(retval);
+end;
+
+function  TAclProperties.Get_Privileges: Integer;
+begin
+  Result := DefaultInterface.Get_Privileges;
+end;
+
+procedure TAclProperties.Set_Privileges(retval: Integer);
+begin
+  DefaultInterface.Set_Privileges(retval);
+end;
+
+{$ENDIF}
+
+class function CoTimestamp.Create: IADsTimestamp;
+begin
+  Result := CreateComObject(CLASS_Timestamp) as IADsTimestamp;
+end;
+
+class function CoTimestamp.CreateRemote(const MachineName: string): IADsTimestamp;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Timestamp) as IADsTimestamp;
+end;
+
+procedure TTimestamp.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B2BED2EB-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{B2F5A901-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TTimestamp.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsTimestamp;
+  end;
+end;
+
+procedure TTimestamp.ConnectTo(svrIntf: IADsTimestamp);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TTimestamp.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TTimestamp.GetDefaultInterface: IADsTimestamp;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TTimestamp.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TTimestampProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TTimestamp.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TTimestamp.GetServerProperties: TTimestampProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TTimestamp.Get_WholeSeconds: Integer;
+begin
+  Result := DefaultInterface.Get_WholeSeconds;
+end;
+
+procedure TTimestamp.Set_WholeSeconds(retval: Integer);
+begin
+  DefaultInterface.Set_WholeSeconds(retval);
+end;
+
+function  TTimestamp.Get_EventID: Integer;
+begin
+  Result := DefaultInterface.Get_EventID;
+end;
+
+procedure TTimestamp.Set_EventID(retval: Integer);
+begin
+  DefaultInterface.Set_EventID(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TTimestampProperties.Create(AServer: TTimestamp);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TTimestampProperties.GetDefaultInterface: IADsTimestamp;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TTimestampProperties.Get_WholeSeconds: Integer;
+begin
+  Result := DefaultInterface.Get_WholeSeconds;
+end;
+
+procedure TTimestampProperties.Set_WholeSeconds(retval: Integer);
+begin
+  DefaultInterface.Set_WholeSeconds(retval);
+end;
+
+function  TTimestampProperties.Get_EventID: Integer;
+begin
+  Result := DefaultInterface.Get_EventID;
+end;
+
+procedure TTimestampProperties.Set_EventID(retval: Integer);
+begin
+  DefaultInterface.Set_EventID(retval);
+end;
+
+{$ENDIF}
+
+class function CoPostalAddress.Create: IADsPostalAddress;
+begin
+  Result := CreateComObject(CLASS_PostalAddress) as IADsPostalAddress;
+end;
+
+class function CoPostalAddress.CreateRemote(const MachineName: string): IADsPostalAddress;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_PostalAddress) as IADsPostalAddress;
+end;
+
+procedure TPostalAddress.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{0A75AFCD-4680-11D1-A3B4-00C04FB950DC}';
+    IntfIID:   '{7ADECF29-4680-11D1-A3B4-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TPostalAddress.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsPostalAddress;
+  end;
+end;
+
+procedure TPostalAddress.ConnectTo(svrIntf: IADsPostalAddress);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TPostalAddress.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TPostalAddress.GetDefaultInterface: IADsPostalAddress;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TPostalAddress.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TPostalAddressProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TPostalAddress.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TPostalAddress.GetServerProperties: TPostalAddressProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TPostalAddress.Get_PostalAddress: OleVariant;
+begin
+  Result := DefaultInterface.Get_PostalAddress;
+end;
+
+procedure TPostalAddress.Set_PostalAddress(retval: OleVariant);
+begin
+  DefaultInterface.Set_PostalAddress(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TPostalAddressProperties.Create(AServer: TPostalAddress);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TPostalAddressProperties.GetDefaultInterface: IADsPostalAddress;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TPostalAddressProperties.Get_PostalAddress: OleVariant;
+begin
+  Result := DefaultInterface.Get_PostalAddress;
+end;
+
+procedure TPostalAddressProperties.Set_PostalAddress(retval: OleVariant);
+begin
+  DefaultInterface.Set_PostalAddress(retval);
+end;
+
+{$ENDIF}
+
+class function CoBackLink.Create: IADsBackLink;
+begin
+  Result := CreateComObject(CLASS_BackLink) as IADsBackLink;
+end;
+
+class function CoBackLink.CreateRemote(const MachineName: string): IADsBackLink;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_BackLink) as IADsBackLink;
+end;
+
+procedure TBackLink.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{FCBF906F-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{FD1302BD-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TBackLink.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsBackLink;
+  end;
+end;
+
+procedure TBackLink.ConnectTo(svrIntf: IADsBackLink);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TBackLink.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TBackLink.GetDefaultInterface: IADsBackLink;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TBackLink.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TBackLinkProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TBackLink.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TBackLink.GetServerProperties: TBackLinkProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TBackLink.Get_RemoteID: Integer;
+begin
+  Result := DefaultInterface.Get_RemoteID;
+end;
+
+procedure TBackLink.Set_RemoteID(retval: Integer);
+begin
+  DefaultInterface.Set_RemoteID(retval);
+end;
+
+function  TBackLink.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure TBackLink.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TBackLinkProperties.Create(AServer: TBackLink);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TBackLinkProperties.GetDefaultInterface: IADsBackLink;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TBackLinkProperties.Get_RemoteID: Integer;
+begin
+  Result := DefaultInterface.Get_RemoteID;
+end;
+
+procedure TBackLinkProperties.Set_RemoteID(retval: Integer);
+begin
+  DefaultInterface.Set_RemoteID(retval);
+end;
+
+function  TBackLinkProperties.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure TBackLinkProperties.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+{$ENDIF}
+
+class function CoTypedName.Create: IADsTypedName;
+begin
+  Result := CreateComObject(CLASS_TypedName) as IADsTypedName;
+end;
+
+class function CoTypedName.CreateRemote(const MachineName: string): IADsTypedName;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_TypedName) as IADsTypedName;
+end;
+
+procedure TTypedName.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B33143CB-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{B371A349-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TTypedName.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsTypedName;
+  end;
+end;
+
+procedure TTypedName.ConnectTo(svrIntf: IADsTypedName);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TTypedName.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TTypedName.GetDefaultInterface: IADsTypedName;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TTypedName.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TTypedNameProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TTypedName.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TTypedName.GetServerProperties: TTypedNameProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TTypedName.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure TTypedName.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+function  TTypedName.Get_Level: Integer;
+begin
+  Result := DefaultInterface.Get_Level;
+end;
+
+procedure TTypedName.Set_Level(retval: Integer);
+begin
+  DefaultInterface.Set_Level(retval);
+end;
+
+function  TTypedName.Get_Interval: Integer;
+begin
+  Result := DefaultInterface.Get_Interval;
+end;
+
+procedure TTypedName.Set_Interval(retval: Integer);
+begin
+  DefaultInterface.Set_Interval(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TTypedNameProperties.Create(AServer: TTypedName);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TTypedNameProperties.GetDefaultInterface: IADsTypedName;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TTypedNameProperties.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure TTypedNameProperties.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+function  TTypedNameProperties.Get_Level: Integer;
+begin
+  Result := DefaultInterface.Get_Level;
+end;
+
+procedure TTypedNameProperties.Set_Level(retval: Integer);
+begin
+  DefaultInterface.Set_Level(retval);
+end;
+
+function  TTypedNameProperties.Get_Interval: Integer;
+begin
+  Result := DefaultInterface.Get_Interval;
+end;
+
+procedure TTypedNameProperties.Set_Interval(retval: Integer);
+begin
+  DefaultInterface.Set_Interval(retval);
+end;
+
+{$ENDIF}
+
+class function CoHold.Create: IADsHold;
+begin
+  Result := CreateComObject(CLASS_Hold) as IADsHold;
+end;
+
+class function CoHold.CreateRemote(const MachineName: string): IADsHold;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Hold) as IADsHold;
+end;
+
+procedure THold.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{B3AD3E13-4080-11D1-A3AC-00C04FB950DC}';
+    IntfIID:   '{B3EB3B37-4080-11D1-A3AC-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure THold.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsHold;
+  end;
+end;
+
+procedure THold.ConnectTo(svrIntf: IADsHold);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure THold.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function THold.GetDefaultInterface: IADsHold;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor THold.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := THoldProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor THold.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function THold.GetServerProperties: THoldProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  THold.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure THold.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+function  THold.Get_Amount: Integer;
+begin
+  Result := DefaultInterface.Get_Amount;
+end;
+
+procedure THold.Set_Amount(retval: Integer);
+begin
+  DefaultInterface.Set_Amount(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor THoldProperties.Create(AServer: THold);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function THoldProperties.GetDefaultInterface: IADsHold;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  THoldProperties.Get_ObjectName: WideString;
+begin
+  Result := DefaultInterface.Get_ObjectName;
+end;
+
+procedure THoldProperties.Set_ObjectName(const retval: WideString);
+begin
+  DefaultInterface.Set_ObjectName(retval);
+end;
+
+function  THoldProperties.Get_Amount: Integer;
+begin
+  Result := DefaultInterface.Get_Amount;
+end;
+
+procedure THoldProperties.Set_Amount(retval: Integer);
+begin
+  DefaultInterface.Set_Amount(retval);
+end;
+
+{$ENDIF}
+
+class function CoPathname.Create: IADsPathname;
+begin
+  Result := CreateComObject(CLASS_Pathname) as IADsPathname;
+end;
+
+class function CoPathname.CreateRemote(const MachineName: string): IADsPathname;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_Pathname) as IADsPathname;
+end;
+
+procedure TPathname.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{080D0D78-F421-11D0-A36E-00C04FB950DC}';
+    IntfIID:   '{D592AED4-F420-11D0-A36E-00C04FB950DC}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TPathname.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsPathname;
+  end;
+end;
+
+procedure TPathname.ConnectTo(svrIntf: IADsPathname);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TPathname.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TPathname.GetDefaultInterface: IADsPathname;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TPathname.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TPathnameProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TPathname.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TPathname.GetServerProperties: TPathnameProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TPathname.Get_EscapedMode: Integer;
+begin
+  Result := DefaultInterface.Get_EscapedMode;
+end;
+
+procedure TPathname.Set_EscapedMode(retval: Integer);
+begin
+  DefaultInterface.Set_EscapedMode(retval);
+end;
+
+procedure TPathname.Set_(const bstrADsPath: WideString; lnSetType: Integer);
+begin
+  DefaultInterface.Set_(bstrADsPath, lnSetType);
+end;
+
+procedure TPathname.SetDisplayType(lnDisplayType: Integer);
+begin
+  DefaultInterface.SetDisplayType(lnDisplayType);
+end;
+
+function  TPathname.Retrieve(lnFormatType: Integer): WideString;
+begin
+  Result := DefaultInterface.Retrieve(lnFormatType);
+end;
+
+function  TPathname.GetNumElements: Integer;
+begin
+  Result := DefaultInterface.GetNumElements;
+end;
+
+function  TPathname.GetElement(lnElementIndex: Integer): WideString;
+begin
+  Result := DefaultInterface.GetElement(lnElementIndex);
+end;
+
+procedure TPathname.AddLeafElement(const bstrLeafElement: WideString);
+begin
+  DefaultInterface.AddLeafElement(bstrLeafElement);
+end;
+
+procedure TPathname.RemoveLeafElement;
+begin
+  DefaultInterface.RemoveLeafElement;
+end;
+
+function  TPathname.CopyPath: IDispatch;
+begin
+  Result := DefaultInterface.CopyPath;
+end;
+
+function  TPathname.GetEscapedElement(lnReserved: Integer; const bstrInStr: WideString): WideString;
+begin
+  Result := DefaultInterface.GetEscapedElement(lnReserved, bstrInStr);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TPathnameProperties.Create(AServer: TPathname);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TPathnameProperties.GetDefaultInterface: IADsPathname;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TPathnameProperties.Get_EscapedMode: Integer;
+begin
+  Result := DefaultInterface.Get_EscapedMode;
+end;
+
+procedure TPathnameProperties.Set_EscapedMode(retval: Integer);
+begin
+  DefaultInterface.Set_EscapedMode(retval);
+end;
+
+{$ENDIF}
+
+class function CoADSystemInfo.Create: IADsADSystemInfo;
+begin
+  Result := CreateComObject(CLASS_ADSystemInfo) as IADsADSystemInfo;
+end;
+
+class function CoADSystemInfo.CreateRemote(const MachineName: string): IADsADSystemInfo;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_ADSystemInfo) as IADsADSystemInfo;
+end;
+
+procedure TADSystemInfo.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{50B6327F-AFD1-11D2-9CB9-0000F87A369E}';
+    IntfIID:   '{5BB11929-AFD1-11D2-9CB9-0000F87A369E}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TADSystemInfo.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsADSystemInfo;
+  end;
+end;
+
+procedure TADSystemInfo.ConnectTo(svrIntf: IADsADSystemInfo);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TADSystemInfo.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TADSystemInfo.GetDefaultInterface: IADsADSystemInfo;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TADSystemInfo.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TADSystemInfoProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TADSystemInfo.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TADSystemInfo.GetServerProperties: TADSystemInfoProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TADSystemInfo.Get_UserName: WideString;
+begin
+  Result := DefaultInterface.Get_UserName;
+end;
+
+function  TADSystemInfo.Get_ComputerName: WideString;
+begin
+  Result := DefaultInterface.Get_ComputerName;
+end;
+
+function  TADSystemInfo.Get_SiteName: WideString;
+begin
+  Result := DefaultInterface.Get_SiteName;
+end;
+
+function  TADSystemInfo.Get_DomainShortName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainShortName;
+end;
+
+function  TADSystemInfo.Get_DomainDNSName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainDNSName;
+end;
+
+function  TADSystemInfo.Get_ForestDNSName: WideString;
+begin
+  Result := DefaultInterface.Get_ForestDNSName;
+end;
+
+function  TADSystemInfo.Get_PDCRoleOwner: WideString;
+begin
+  Result := DefaultInterface.Get_PDCRoleOwner;
+end;
+
+function  TADSystemInfo.Get_SchemaRoleOwner: WideString;
+begin
+  Result := DefaultInterface.Get_SchemaRoleOwner;
+end;
+
+function  TADSystemInfo.Get_IsNativeMode: WordBool;
+begin
+  Result := DefaultInterface.Get_IsNativeMode;
+end;
+
+function  TADSystemInfo.GetAnyDCName: WideString;
+begin
+  Result := DefaultInterface.GetAnyDCName;
+end;
+
+function  TADSystemInfo.GetDCSiteName(const szServer: WideString): WideString;
+begin
+  Result := DefaultInterface.GetDCSiteName(szServer);
+end;
+
+procedure TADSystemInfo.RefreshSchemaCache;
+begin
+  DefaultInterface.RefreshSchemaCache;
+end;
+
+function  TADSystemInfo.GetTrees: OleVariant;
+begin
+  Result := DefaultInterface.GetTrees;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TADSystemInfoProperties.Create(AServer: TADSystemInfo);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TADSystemInfoProperties.GetDefaultInterface: IADsADSystemInfo;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TADSystemInfoProperties.Get_UserName: WideString;
+begin
+  Result := DefaultInterface.Get_UserName;
+end;
+
+function  TADSystemInfoProperties.Get_ComputerName: WideString;
+begin
+  Result := DefaultInterface.Get_ComputerName;
+end;
+
+function  TADSystemInfoProperties.Get_SiteName: WideString;
+begin
+  Result := DefaultInterface.Get_SiteName;
+end;
+
+function  TADSystemInfoProperties.Get_DomainShortName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainShortName;
+end;
+
+function  TADSystemInfoProperties.Get_DomainDNSName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainDNSName;
+end;
+
+function  TADSystemInfoProperties.Get_ForestDNSName: WideString;
+begin
+  Result := DefaultInterface.Get_ForestDNSName;
+end;
+
+function  TADSystemInfoProperties.Get_PDCRoleOwner: WideString;
+begin
+  Result := DefaultInterface.Get_PDCRoleOwner;
+end;
+
+function  TADSystemInfoProperties.Get_SchemaRoleOwner: WideString;
+begin
+  Result := DefaultInterface.Get_SchemaRoleOwner;
+end;
+
+function  TADSystemInfoProperties.Get_IsNativeMode: WordBool;
+begin
+  Result := DefaultInterface.Get_IsNativeMode;
+end;
+
+{$ENDIF}
+
+class function CoWinNTSystemInfo.Create: IADsWinNTSystemInfo;
+begin
+  Result := CreateComObject(CLASS_WinNTSystemInfo) as IADsWinNTSystemInfo;
+end;
+
+class function CoWinNTSystemInfo.CreateRemote(const MachineName: string): IADsWinNTSystemInfo;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_WinNTSystemInfo) as IADsWinNTSystemInfo;
+end;
+
+procedure TWinNTSystemInfo.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{66182EC4-AFD1-11D2-9CB9-0000F87A369E}';
+    IntfIID:   '{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TWinNTSystemInfo.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsWinNTSystemInfo;
+  end;
+end;
+
+procedure TWinNTSystemInfo.ConnectTo(svrIntf: IADsWinNTSystemInfo);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TWinNTSystemInfo.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TWinNTSystemInfo.GetDefaultInterface: IADsWinNTSystemInfo;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TWinNTSystemInfo.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TWinNTSystemInfoProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TWinNTSystemInfo.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TWinNTSystemInfo.GetServerProperties: TWinNTSystemInfoProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TWinNTSystemInfo.Get_UserName: WideString;
+begin
+  Result := DefaultInterface.Get_UserName;
+end;
+
+function  TWinNTSystemInfo.Get_ComputerName: WideString;
+begin
+  Result := DefaultInterface.Get_ComputerName;
+end;
+
+function  TWinNTSystemInfo.Get_DomainName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainName;
+end;
+
+function  TWinNTSystemInfo.Get_PDC: WideString;
+begin
+  Result := DefaultInterface.Get_PDC;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TWinNTSystemInfoProperties.Create(AServer: TWinNTSystemInfo);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TWinNTSystemInfoProperties.GetDefaultInterface: IADsWinNTSystemInfo;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TWinNTSystemInfoProperties.Get_UserName: WideString;
+begin
+  Result := DefaultInterface.Get_UserName;
+end;
+
+function  TWinNTSystemInfoProperties.Get_ComputerName: WideString;
+begin
+  Result := DefaultInterface.Get_ComputerName;
+end;
+
+function  TWinNTSystemInfoProperties.Get_DomainName: WideString;
+begin
+  Result := DefaultInterface.Get_DomainName;
+end;
+
+function  TWinNTSystemInfoProperties.Get_PDC: WideString;
+begin
+  Result := DefaultInterface.Get_PDC;
+end;
+
+{$ENDIF}
+
+class function CoDNWithBinary.Create: IADsDNWithBinary;
+begin
+  Result := CreateComObject(CLASS_DNWithBinary) as IADsDNWithBinary;
+end;
+
+class function CoDNWithBinary.CreateRemote(const MachineName: string): IADsDNWithBinary;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_DNWithBinary) as IADsDNWithBinary;
+end;
+
+procedure TDNWithBinary.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{7E99C0A3-F935-11D2-BA96-00C04FB6D0D1}';
+    IntfIID:   '{7E99C0A2-F935-11D2-BA96-00C04FB6D0D1}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TDNWithBinary.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsDNWithBinary;
+  end;
+end;
+
+procedure TDNWithBinary.ConnectTo(svrIntf: IADsDNWithBinary);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TDNWithBinary.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TDNWithBinary.GetDefaultInterface: IADsDNWithBinary;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TDNWithBinary.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TDNWithBinaryProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TDNWithBinary.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TDNWithBinary.GetServerProperties: TDNWithBinaryProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TDNWithBinary.Get_BinaryValue: OleVariant;
+begin
+  Result := DefaultInterface.Get_BinaryValue;
+end;
+
+procedure TDNWithBinary.Set_BinaryValue(retval: OleVariant);
+begin
+  DefaultInterface.Set_BinaryValue(retval);
+end;
+
+function  TDNWithBinary.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TDNWithBinary.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TDNWithBinaryProperties.Create(AServer: TDNWithBinary);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TDNWithBinaryProperties.GetDefaultInterface: IADsDNWithBinary;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TDNWithBinaryProperties.Get_BinaryValue: OleVariant;
+begin
+  Result := DefaultInterface.Get_BinaryValue;
+end;
+
+procedure TDNWithBinaryProperties.Set_BinaryValue(retval: OleVariant);
+begin
+  DefaultInterface.Set_BinaryValue(retval);
+end;
+
+function  TDNWithBinaryProperties.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TDNWithBinaryProperties.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+{$ENDIF}
+
+class function CoDNWithString.Create: IADsDNWithString;
+begin
+  Result := CreateComObject(CLASS_DNWithString) as IADsDNWithString;
+end;
+
+class function CoDNWithString.CreateRemote(const MachineName: string): IADsDNWithString;
+begin
+  Result := CreateRemoteComObject(MachineName, CLASS_DNWithString) as IADsDNWithString;
+end;
+
+procedure TDNWithString.InitServerData;
+const
+  CServerData: TServerData = (
+    ClassID:   '{334857CC-F934-11D2-BA96-00C04FB6D0D1}';
+    IntfIID:   '{370DF02E-F934-11D2-BA96-00C04FB6D0D1}';
+    EventIID:  '';
+    LicenseKey: nil;
+    Version: 500);
+begin
+  ServerData := @CServerData;
+end;
+
+procedure TDNWithString.Connect;
+var
+  punk: IUnknown;
+begin
+  if FIntf = nil then
+  begin
+    punk := GetServer;
+    Fintf:= punk as IADsDNWithString;
+  end;
+end;
+
+procedure TDNWithString.ConnectTo(svrIntf: IADsDNWithString);
+begin
+  Disconnect;
+  FIntf := svrIntf;
+end;
+
+procedure TDNWithString.DisConnect;
+begin
+  if Fintf <> nil then
+  begin
+    FIntf := nil;
+  end;
+end;
+
+function TDNWithString.GetDefaultInterface: IADsDNWithString;
+begin
+  if FIntf = nil then
+    Connect;
+  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
+  Result := FIntf;
+end;
+
+constructor TDNWithString.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps := TDNWithStringProperties.Create(Self);
+{$ENDIF}
+end;
+
+destructor TDNWithString.Destroy;
+begin
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+  FProps.Free;
+{$ENDIF}
+  inherited Destroy;
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+function TDNWithString.GetServerProperties: TDNWithStringProperties;
+begin
+  Result := FProps;
+end;
+{$ENDIF}
+
+function  TDNWithString.Get_StringValue: WideString;
+begin
+  Result := DefaultInterface.Get_StringValue;
+end;
+
+procedure TDNWithString.Set_StringValue(const retval: WideString);
+begin
+  DefaultInterface.Set_StringValue(retval);
+end;
+
+function  TDNWithString.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TDNWithString.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
+constructor TDNWithStringProperties.Create(AServer: TDNWithString);
+begin
+  inherited Create;
+  FServer := AServer;
+end;
+
+function TDNWithStringProperties.GetDefaultInterface: IADsDNWithString;
+begin
+  Result := FServer.DefaultInterface;
+end;
+
+function  TDNWithStringProperties.Get_StringValue: WideString;
+begin
+  Result := DefaultInterface.Get_StringValue;
+end;
+
+procedure TDNWithStringProperties.Set_StringValue(const retval: WideString);
+begin
+  DefaultInterface.Set_StringValue(retval);
+end;
+
+function  TDNWithStringProperties.Get_DNString: WideString;
+begin
+  Result := DefaultInterface.Get_DNString;
+end;
+
+procedure TDNWithStringProperties.Set_DNString(const retval: WideString);
+begin
+  DefaultInterface.Set_DNString(retval);
+end;
+
+{$ENDIF}
+
+
+{$ifdef FPC} // dummy
+{
+function CreateComObject(ID: TGUID): IUnknown; //empty
+
+begin
+end;
+
+function CreateRemoteComObject(w:widestring; ID: TGUID): IUnknown; //empty
+
+begin
+end;
+}
+function  tOleServer.GetServer:IUnknown;
+begin
+end;
+
+procedure tOleServer.InitServerData;
+begin
+end;
+constructor tOleServer.Create(AOwner: TComponent);
+begin
+end;
+Procedure tOleServer.Connect;
+begin
+end;
+procedure tOleServer.Disconnect;
+begin
+end;
+
+
+{$endif}
+
+
+procedure Register;
+begin
+  RegisterComponents('ActiveX',[TPropertyEntry, TPropertyValue, TAccessControlEntry, TAccessControlList,
+    TSecurityDescriptor, TLargeInteger, TNameTranslate, TCaseIgnoreList, TFaxNumber,
+    TNetAddress, TOctetList, TEmail, TPath, TReplicaPointer,
+    TAcl, TTimestamp, TPostalAddress, TBackLink, TTypedName,
+    THold, TPathname, TADSystemInfo, TWinNTSystemInfo, TDNWithBinary,
+    TDNWithString]);
+end;
+
+
+
+end.

+ 458 - 0
packages/extra/winunits/jwaadtgen.pas

@@ -0,0 +1,458 @@
+{******************************************************************************}
+{                                                                              }
+{ Authz Generic Audits API interface Unit for Object Pascal                    }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: adtgen.h, released August 2001. The original Pascal    }
+{ code is: AdtGen.pas, released October 2001. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAdtGen;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "adtgen.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType;
+
+//
+// type of audit 
+//
+// AUDIT_TYPE_LEGACY 
+//     In this case the audit event schema is stored in a .mc file.
+//
+// AUDIT_TYPE_WMI    
+//     The schema is stored in WMI. (currently not supported)
+//
+
+const
+  AUDIT_TYPE_LEGACY = 1;
+  {$EXTERNALSYM AUDIT_TYPE_LEGACY}
+  AUDIT_TYPE_WMI    = 2;
+  {$EXTERNALSYM AUDIT_TYPE_WMI}
+
+//
+// Type of parameters passed in the AUDIT_PARAMS.Parameters array
+// 
+// Use the AdtInitParams function to initialize and prepare 
+// an array of audit parameters.
+//
+
+type
+  _AUDIT_PARAM_TYPE = (
+
+    APT__0,
+
+    //
+    // do we need this?
+    //
+
+    APT_None,
+
+    //
+    // NULL terminated string 
+    //
+
+    APT_String,
+
+    //
+    // unsigned long
+    //
+
+    APT_Ulong,
+
+    //
+    // a pointer. use for specifying handles/pointers
+    // (32 bit on 32 bit systems and 64 bit on 64 bit systems)
+    // Note that the memory to which the pointer points to
+    // is not marshalled when using this type. Use this when you
+    // are interested in the absolute value of the pointer.
+    // A good example of this is when specifying HANDLE values.
+    //
+
+    APT_Pointer,
+
+    //
+    // SID
+    //
+
+    APT_Sid,
+
+    //
+    // Logon ID (LUID)
+    //
+
+    APT_LogonId,
+
+    //
+    // Object Type List
+    //
+
+    APT_ObjectTypeList,
+
+    //
+    // Luid (not translated to LogonId)
+    //
+    
+    APT_Luid,
+    
+    //
+    // Guid
+    //
+     
+    APT_Guid,
+
+    //
+    // Time (FILETIME)
+    //
+
+    APT_Time,
+
+    //
+    // ULONGLONG
+    // 
+
+    APT_Int64
+    );
+  {$EXTERNALSYM _AUDIT_PARAM_TYPE}
+  AUDIT_PARAM_TYPE = _AUDIT_PARAM_TYPE;
+  {$EXTERNALSYM AUDIT_PARAM_TYPE}
+  TAuditParamType = AUDIT_PARAM_TYPE;
+
+// 
+// There are two types of flags that can be used with a parameter.
+//
+// - formatting flag
+//   This defines the appearance of a parameter when
+//   written to the eventlog. Such flags may become obsolete
+//   when we move to WMI auditing.
+//
+// - control flag
+//   This causes a specified action to be taken that affects 
+//   a parameter value.
+//
+//   For example:
+//   If you use the AP_PrimaryLogonId/AP_ClientLogonId flag,
+//   the system will capture the logon-id from the process/thread token.
+//
+
+const
+  AP_ParamTypeBits = 8;
+  {$EXTERNALSYM AP_ParamTypeBits}
+  AP_ParamTypeMask = $000000ff;
+  {$EXTERNALSYM AP_ParamTypeMask}
+
+//
+// the flags values below have overlapping values. this is ok since
+// the scope of each flag is limited to the type to which it applies.
+//
+
+//
+// APT_Ulong : format flag : causes a number to appear in hex
+//
+
+  AP_FormatHex = $0001 shl AP_ParamTypeBits;
+  {$EXTERNALSYM AP_FormatHex}
+
+//
+// APT_Ulong : format flag : causes a number to be treated as access-mask.
+//                           The meaning of each bit depends on the associated
+//                           object type.
+//
+
+  AP_AccessMask = $0002 shl AP_ParamTypeBits;
+  {$EXTERNALSYM AP_AccessMask}
+
+                                                       
+//
+// APT_String : format flag : causes a string to be treated as a file-path
+//
+
+  AP_Filespec = $0001 shl AP_ParamTypeBits;
+  {$EXTERNALSYM AP_Filespec}
+
+//
+// APT_LogonId : control flag : logon-id is captured from the process token
+//
+
+  AP_PrimaryLogonId = $0001 shl AP_ParamTypeBits;
+  {$EXTERNALSYM AP_PrimaryLogonId}
+
+//
+// APT_LogonId : control flag : logon-id is captured from the thread token
+//
+
+  AP_ClientLogonId = $0002 shl AP_ParamTypeBits;
+  {$EXTERNALSYM AP_ClientLogonId}
+
+//
+// internal helper macros
+//
+
+// (rom) MACRO
+function ApExtractType(TypeFlags: DWORD): AUDIT_PARAM_TYPE;
+{$EXTERNALSYM ApExtractType}
+
+// (rom) MACRO
+function ApExtractFlags(TypeFlags: DWORD): DWORD;
+{$EXTERNALSYM ApExtractFlags}
+
+//
+// Element of an object-type-list
+//
+// The AUDIT_OBJECT_TYPES structure identifies an object type element 
+// in a hierarchy of object types. The AccessCheckByType functions use 
+// an array of such structures to define a hierarchy of an object and 
+// its subobjects, such as property sets and properties.
+//
+
+type
+  PAUDIT_OBJECT_TYPE = ^AUDIT_OBJECT_TYPE;
+  {$EXTERNALSYM PAUDIT_OBJECT_TYPE}
+  _AUDIT_OBJECT_TYPE = record
+    ObjectType: GUID; // guid of the (sub)object
+    Flags: USHORT; // currently not defined
+    Level: USHORT; // level within the hierarchy.
+    // 0 is the root level
+    AccessMask: ACCESS_MASK; // access-mask for this (sub)object
+  end;
+  {$EXTERNALSYM _AUDIT_OBJECT_TYPE}
+  AUDIT_OBJECT_TYPE = _AUDIT_OBJECT_TYPE;
+  {$EXTERNALSYM AUDIT_OBJECT_TYPE}
+  TAuditObjectType = AUDIT_OBJECT_TYPE;
+  PAuditObjectType = PAUDIT_OBJECT_TYPE;
+
+  PAUDIT_OBJECT_TYPES = ^AUDIT_OBJECT_TYPES;
+  {$EXTERNALSYM PAUDIT_OBJECT_TYPES}
+  _AUDIT_OBJECT_TYPES = record
+    Count: USHORT; // number of object-types in pObjectTypes
+    Flags: USHORT; // currently not defined
+    pObjectTypes: PAUDIT_OBJECT_TYPE; // array of object-types
+  end;
+  {$EXTERNALSYM _AUDIT_OBJECT_TYPES}
+  AUDIT_OBJECT_TYPES = _AUDIT_OBJECT_TYPES;
+  {$EXTERNALSYM AUDIT_OBJECT_TYPES}
+  TAuditObjectTypes = AUDIT_OBJECT_TYPES;
+  PAuditObjectTypes = PAUDIT_OBJECT_TYPES;
+
+//
+// Structure that defines a single audit parameter.
+//
+// LsaGenAuditEvent accepts an array of such elements to
+// represent the parameters of the audit to be generated.
+//
+// It is best to initialize this structure using AdtInitParams function.
+// This will ensure compatibility with any future changes to this
+// structure.
+//
+
+type
+  _AUDIT_PARAM = record
+    Type_: AUDIT_PARAM_TYPE;     // type
+    Length: ULONG;               // currently unused
+    Flags: DWORD;                // currently unused
+    U: record
+    case Integer of
+      0: (Data0: ULONG_PTR);
+      1: (String_: PWSTR);
+      2: (u: ULONG_PTR);
+      3: (psid: PSID);
+      4: (pguid: LPGUID);      
+      5: (LogonId_LowPart: ULONG);
+      6: (pObjectTypes: PAUDIT_OBJECT_TYPES);
+    end;
+    case Integer of
+      0: (Data1: ULONG_PTR);
+      1: (LogonId_HighPart: LONG);
+  end;
+  {$EXTERNALSYM _AUDIT_PARAM}
+  AUDIT_PARAM = _AUDIT_PARAM;
+  {$EXTERNALSYM AUDIT_PARAM}
+  PAUDIT_PARAM = ^AUDIT_PARAM;
+  {$EXTERNALSYM PAUDIT_PARAM}
+  TAuditParam = AUDIT_PARAM;
+  PAuditParam = PAUDIT_PARAM;
+
+//
+// Audit control flags. To be used with AUDIT_PARAMS.Flags
+//
+
+const
+  APF_AuditFailure = $00000000; // generate a failure audit
+  {$EXTERNALSYM APF_AuditFailure}
+  APF_AuditSuccess = $00000001; // generate a success audit when set, a failure audit otherwise.
+  {$EXTERNALSYM APF_AuditSuccess}
+
+//
+// set of valid audit control flags 
+//
+
+  APF_ValidFlags = APF_AuditSuccess;
+  {$EXTERNALSYM APF_ValidFlags}
+
+//
+// Audit parameters passed to LsaGenAuditEvent
+//
+
+type
+  PAUDIT_PARAMS = ^AUDIT_PARAMS;
+  {$EXTERNALSYM PAUDIT_PARAMS}
+  _AUDIT_PARAMS = record
+    Length: ULONG; // size in bytes
+    Flags: DWORD; // currently unused
+    Count: USHORT; // number of parameters
+    Parameters: PAUDIT_PARAM; // array of parameters
+  end;
+  {$EXTERNALSYM _AUDIT_PARAMS}
+  AUDIT_PARAMS = _AUDIT_PARAMS;
+  {$EXTERNALSYM AUDIT_PARAMS}
+  TAuditParams = AUDIT_PARAMS;
+  PAuditParams = PAUDIT_PARAMS;
+
+//
+// Defines the elements of a legacy audit event.
+//
+
+  PAUTHZ_AUDIT_EVENT_TYPE_LEGACY = ^AUTHZ_AUDIT_EVENT_TYPE_LEGACY;
+  {$EXTERNALSYM PAUTHZ_AUDIT_EVENT_TYPE_LEGACY}
+  _AUTHZ_AUDIT_EVENT_TYPE_LEGACY = record
+    //
+    // Audit category ID
+    //
+    CategoryId: USHORT;
+    //
+    // Audit event ID
+    //
+    AuditId: USHORT;
+    //
+    // Parameter count
+    //
+    ParameterCount: USHORT;
+  end;
+  {$EXTERNALSYM _AUTHZ_AUDIT_EVENT_TYPE_LEGACY}
+  AUTHZ_AUDIT_EVENT_TYPE_LEGACY = _AUTHZ_AUDIT_EVENT_TYPE_LEGACY;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_TYPE_LEGACY}
+  TAuthzAuditEventTypeLegacy = AUTHZ_AUDIT_EVENT_TYPE_LEGACY;
+  PAuthzAuditEventTypeLegacy = PAUTHZ_AUDIT_EVENT_TYPE_LEGACY;
+
+  _AUTHZ_AUDIT_EVENT_TYPE_UNION = record
+    case Integer of
+      0: (Legacy: AUTHZ_AUDIT_EVENT_TYPE_LEGACY);
+  end;
+  {$EXTERNALSYM _AUTHZ_AUDIT_EVENT_TYPE_UNION}
+  AUTHZ_AUDIT_EVENT_TYPE_UNION = _AUTHZ_AUDIT_EVENT_TYPE_UNION;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_TYPE_UNION}
+  PAUTHZ_AUDIT_EVENT_TYPE_UNION = ^AUTHZ_AUDIT_EVENT_TYPE_UNION;
+  {$EXTERNALSYM PAUTHZ_AUDIT_EVENT_TYPE_UNION}
+  TAuthzAuditEventTypeUnion = AUTHZ_AUDIT_EVENT_TYPE_UNION;
+  PAuthzAuditEventTypeUnion = PAUTHZ_AUDIT_EVENT_TYPE_UNION;  
+
+//
+// description of an audit event
+//
+
+  _AUTHZ_AUDIT_EVENT_TYPE_OLD = record
+    // version number
+    Version: ULONG;
+    dwFlags: DWORD;
+    RefCount: LONG;
+    hAudit: ULONG_PTR;
+    LinkId: LUID;
+    u: AUTHZ_AUDIT_EVENT_TYPE_UNION;
+  end;
+  {$EXTERNALSYM _AUTHZ_AUDIT_EVENT_TYPE_OLD}
+  AUTHZ_AUDIT_EVENT_TYPE_OLD = _AUTHZ_AUDIT_EVENT_TYPE_OLD;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_TYPE_OLD}
+  TAuthzAuditEventTypeOld = AUTHZ_AUDIT_EVENT_TYPE_OLD;
+  PAuthzAuditEventTypeOld = ^AUTHZ_AUDIT_EVENT_TYPE_OLD;
+
+  PAUTHZ_AUDIT_EVENT_TYPE_OLD = ^AUTHZ_AUDIT_EVENT_TYPE_OLD;
+  {$EXTERNALSYM PAUTHZ_AUDIT_EVENT_TYPE_OLD}
+  AUDIT_HANDLE = PVOID;
+  {$EXTERNALSYM AUDIT_HANDLE}
+  PAUDIT_HANDLE = ^AUDIT_HANDLE;
+  {$EXTERNALSYM PAUDIT_HANDLE}
+
+(* todo
+function AuthzpRegisterAuditEvent(pAuditEventType: PAUTHZ_AUDIT_EVENT_TYPE_OLD; var phAuditContext: AUDIT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzpRegisterAuditEvent}
+
+function AuthzpUnregisterAuditEvent(var phAuditContext: AUDIT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzpUnregisterAuditEvent}
+*)
+
+//
+// Begin support for extensible auditing.
+//
+
+const
+  AUTHZ_ALLOW_MULTIPLE_SOURCE_INSTANCES = $1;
+  {$EXTERNALSYM AUTHZ_ALLOW_MULTIPLE_SOURCE_INSTANCES}
+
+  AUTHZ_AUDIT_INSTANCE_INFORMATION = $2;
+  {$EXTERNALSYM AUTHZ_AUDIT_INSTANCE_INFORMATION}
+
+implementation
+
+const
+  authzlib = 'authz.dll';
+
+// (rom) MACRO implementation
+function ApExtractType(TypeFlags: DWORD): AUDIT_PARAM_TYPE;
+begin
+  Result := AUDIT_PARAM_TYPE(TypeFlags and AP_ParamTypeMask);
+end;
+
+// (rom) MACRO implementation
+function ApExtractFlags(TypeFlags: DWORD): DWORD;
+begin
+  Result := TypeFlags and not AP_ParamTypeMask;
+end;
+
+{
+AuthzpRegisterAuditEvent
+AuthzpUnregisterAuditEvent
+}
+end.

+ 446 - 0
packages/extra/winunits/jwaaf_irda.pas

@@ -0,0 +1,446 @@
+{******************************************************************************}
+{                                                                              }
+{ Winsock2 IRDA API interface Unit for Object Pascal                           }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: ad_irda.h, released June 2000. The original Pascal     }
+{ code is: AD_Irda.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAF_Irda;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "af_irda.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinSock2;
+
+//
+// Winsock1.1, IrDA1.1, WindowsNT5.0, Windows98 and WindowsCE1.0.
+// Define one of _WIN32_WINNT, _WIN32_WINDOWS, _WIN32_WCE.
+//  Copyright (C) Microsoft Corporation, 1994-1999.
+//
+
+const
+  WINDOWS_AF_IRDA = 26;
+  {$EXTERNALSYM WINDOWS_AF_IRDA}
+  WINDOWS_PF_IRDA = WINDOWS_AF_IRDA;
+  {$EXTERNALSYM WINDOWS_PF_IRDA}
+
+  WCE_AF_IRDA = 22;
+  {$EXTERNALSYM WCE_AF_IRDA}
+  WCE_PF_IRDA = WCE_AF_IRDA;
+  {$EXTERNALSYM WCE_PF_IRDA}
+
+  //AF_IRDA = WINDOWS_AF_IRDA;
+  //{$EXTERNALSYM AF_IRDA}
+
+  IRDA_PROTO_SOCK_STREAM  = 1;
+  {$EXTERNALSYM IRDA_PROTO_SOCK_STREAM}
+
+  PF_IRDA = WINDOWS_AF_IRDA;
+  {$EXTERNALSYM PF_IRDA}
+
+  // WINNT, WIN98, WINCE
+
+  SOL_IRLMP = $00FF;
+  {$EXTERNALSYM SOL_IRLMP}
+
+  IRLMP_ENUMDEVICES = $00000010;
+  {$EXTERNALSYM IRLMP_ENUMDEVICES}
+  IRLMP_IAS_SET     = $00000011;
+  {$EXTERNALSYM IRLMP_IAS_SET}
+  IRLMP_IAS_QUERY   = $00000012;
+  {$EXTERNALSYM IRLMP_IAS_QUERY}
+
+  // WINNT, WINCE
+
+  IRLMP_SEND_PDU_LEN   = $00000013;
+  {$EXTERNALSYM IRLMP_SEND_PDU_LEN}
+  IRLMP_EXCLUSIVE_MODE = $00000014;
+  {$EXTERNALSYM IRLMP_EXCLUSIVE_MODE}
+  IRLMP_IRLPT_MODE     = $00000015;
+  {$EXTERNALSYM IRLMP_IRLPT_MODE}
+  IRLMP_9WIRE_MODE     = $00000016;
+  {$EXTERNALSYM IRLMP_9WIRE_MODE}
+
+  // WIN98
+
+  IRLMP_TINYTP_MODE    = $00000017;
+  {$EXTERNALSYM IRLMP_TINYTP_MODE}
+  IRLMP_PARAMETERS     = $00000018;
+  {$EXTERNALSYM IRLMP_PARAMETERS}
+  IRLMP_DISCOVERY_MODE = $00000019;
+  {$EXTERNALSYM IRLMP_DISCOVERY_MODE}
+
+  // WINCE
+
+  IRLMP_SHARP_MODE = $00000020;
+  {$EXTERNALSYM IRLMP_SHARP_MODE}
+
+  SIO_LAZY_DISCOVERY = $4004747F; // _IOR('t', 127, u_long)
+  {$EXTERNALSYM SIO_LAZY_DISCOVERY}
+
+  IAS_ATTRIB_NO_CLASS  = $00000010;
+  {$EXTERNALSYM IAS_ATTRIB_NO_CLASS}
+  IAS_ATTRIB_NO_ATTRIB = $00000000;
+  {$EXTERNALSYM IAS_ATTRIB_NO_ATTRIB}
+  IAS_ATTRIB_INT       = $00000001;
+  {$EXTERNALSYM IAS_ATTRIB_INT}
+  IAS_ATTRIB_OCTETSEQ  = $00000002;
+  {$EXTERNALSYM IAS_ATTRIB_OCTETSEQ}
+  IAS_ATTRIB_STR       = $00000003;
+  {$EXTERNALSYM IAS_ATTRIB_STR}
+
+  IAS_MAX_USER_STRING  = 256;
+  {$EXTERNALSYM IAS_MAX_USER_STRING}
+  IAS_MAX_OCTET_STRING = 1024;
+  {$EXTERNALSYM IAS_MAX_OCTET_STRING}
+  IAS_MAX_CLASSNAME    = 64;
+  {$EXTERNALSYM IAS_MAX_CLASSNAME}
+  IAS_MAX_ATTRIBNAME   = 256;
+  {$EXTERNALSYM IAS_MAX_ATTRIBNAME}
+
+const
+  LM_HB_Extension =             128;    // Any hint byte
+  {$EXTERNALSYM LM_HB_Extension}
+
+  LM_HB1_PnP =                  1;      // First hint byte
+  {$EXTERNALSYM LM_HB1_PnP}
+  LM_HB1_PDA_Palmtop =          2;
+  {$EXTERNALSYM LM_HB1_PDA_Palmtop}
+  LM_HB1_Computer =             4;
+  {$EXTERNALSYM LM_HB1_Computer}
+  LM_HB1_Printer =              8;
+  {$EXTERNALSYM LM_HB1_Printer}
+  LM_HB1_Modem =                16;
+  {$EXTERNALSYM LM_HB1_Modem}
+  LM_HB1_Fax =                  32;
+  {$EXTERNALSYM LM_HB1_Fax}
+  LM_HB1_LANAccess =            64;
+  {$EXTERNALSYM LM_HB1_LANAccess}
+
+  LM_HB2_Telephony =            1;      // Second hint byte
+  {$EXTERNALSYM LM_HB2_Telephony}
+  LM_HB2_FileServer =           2;
+  {$EXTERNALSYM LM_HB2_FileServer}
+
+  LmCharSetASCII      = 0;
+  {$EXTERNALSYM LmCharSetASCII}
+  LmCharSetISO_8859_1 = 1;
+  {$EXTERNALSYM LmCharSetISO_8859_1}
+  LmCharSetISO_8859_2 = 2;
+  {$EXTERNALSYM LmCharSetISO_8859_2}
+  LmCharSetISO_8859_3 = 3;
+  {$EXTERNALSYM LmCharSetISO_8859_3}
+  LmCharSetISO_8859_4 = 4;
+  {$EXTERNALSYM LmCharSetISO_8859_4}
+  LmCharSetISO_8859_5 = 5;
+  {$EXTERNALSYM LmCharSetISO_8859_5}
+  LmCharSetISO_8859_6 = 6;
+  {$EXTERNALSYM LmCharSetISO_8859_6}
+  LmCharSetISO_8859_7 = 7;
+  {$EXTERNALSYM LmCharSetISO_8859_7}
+  LmCharSetISO_8859_8 = 8;
+  {$EXTERNALSYM LmCharSetISO_8859_8}
+  LmCharSetISO_8859_9 = 9;
+  {$EXTERNALSYM LmCharSetISO_8859_9}
+  LmCharSetUNICODE    = $ff;
+  {$EXTERNALSYM LmCharSetUNICODE}
+
+type
+  LM_BAUD_RATE = u_long;
+  {$EXTERNALSYM LM_BAUD_RATE}
+  TLMBaudRate = LM_BAUD_RATE;
+  PLMBaudRate = ^LM_BAUD_RATE;
+
+const
+  LM_BAUD_1200   = 1200;
+  {$EXTERNALSYM LM_BAUD_1200}
+  LM_BAUD_2400   = 2400;
+  {$EXTERNALSYM LM_BAUD_2400}
+  LM_BAUD_9600   = 9600;
+  {$EXTERNALSYM LM_BAUD_9600}
+  LM_BAUD_19200  = 19200;
+  {$EXTERNALSYM LM_BAUD_19200}
+  LM_BAUD_38400  = 38400;
+  {$EXTERNALSYM LM_BAUD_38400}
+  LM_BAUD_57600  = 57600;
+  {$EXTERNALSYM LM_BAUD_57600}
+  LM_BAUD_115200 = 115200;
+  {$EXTERNALSYM LM_BAUD_115200}
+  LM_BAUD_576K   = 576000;
+  {$EXTERNALSYM LM_BAUD_576K}
+  LM_BAUD_1152K  = 1152000;
+  {$EXTERNALSYM LM_BAUD_1152K}
+  LM_BAUD_4M     = 4000000;
+  {$EXTERNALSYM LM_BAUD_4M}
+
+type
+  LM_IRPARMS = record
+    nTXDataBytes: u_long;   // Max tx data bytes per packet
+    nRXDataBytes: u_long;   // Max rx data bytes per packet
+    nBaudRate: LM_BAUD_RATE;      // Negotiated baud rate
+    thresholdTime: u_long;  // Threshold (ms)
+    discTime: u_long;       // Disconnect (ms)
+    nMSLinkTurn: u_short;    // Link turn around (ms)
+    nTXPackets: u_char;     // Number packets in transmit window
+    nRXPackets: u_char;     // Number packets in receive window
+  end;
+  {$EXTERNALSYM LM_IRPARMS}
+  PLM_IRPARMS = ^LM_IRPARMS;
+  TLmIrParms = LM_IRPARMS;
+  PLmIrParms = PLM_IRPARMS;
+
+  _SOCKADDR_IRDA = record
+    irdaAddressFamily: u_short;
+    irdaDeviceID: array [0..3] of u_char;
+    irdaServiceName: array [0..24] of Char;
+  end;
+  {$EXTERNALSYM _SOCKADDR_IRDA}
+  SOCKADDR_IRDA = _SOCKADDR_IRDA;
+  {$EXTERNALSYM SOCKADDR_IRDA}
+  PSOCKADDR_IRDA = ^SOCKADDR_IRDA;
+  {$EXTERNALSYM PSOCKADDR_IRDA}
+  LPSOCKADDR_IRDA = ^SOCKADDR_IRDA;
+  {$EXTERNALSYM LPSOCKADDR_IRDA}
+  TSockAddrIrda = SOCKADDR_IRDA;
+  PSockAddrIrda = LPSOCKADDR_IRDA;
+
+  _WINDOWS_IRDA_DEVICE_INFO = record
+    irdaDeviceID: array [0..3] of u_char;
+    irdaDeviceName: array [0..21] of Char;
+    irdaDeviceHints1: u_char;
+    irdaDeviceHints2: u_char;
+    irdaCharSet: u_char;
+  end;
+  {$EXTERNALSYM _WINDOWS_IRDA_DEVICE_INFO}
+  WINDOWS_IRDA_DEVICE_INFO = _WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM WINDOWS_IRDA_DEVICE_INFO}
+  PWINDOWS_IRDA_DEVICE_INFO = ^WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM PWINDOWS_IRDA_DEVICE_INFO}
+  LPWINDOWS_IRDA_DEVICE_INFO = ^WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM LPWINDOWS_IRDA_DEVICE_INFO}
+  TWindowsIrdaDeviceInfo = WINDOWS_IRDA_DEVICE_INFO;
+  PWindowsIrdaDeviceInfo = LPWINDOWS_IRDA_DEVICE_INFO;  
+
+  _WCE_IRDA_DEVICE_INFO = record
+    irdaDeviceID: array [0..3] of u_char;
+    irdaDeviceName: array [0..21] of Char;
+    Reserved: array [0..1] of u_char;
+  end;
+  {$EXTERNALSYM _WCE_IRDA_DEVICE_INFO}
+  WCE_IRDA_DEVICE_INFO = _WCE_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM WCE_IRDA_DEVICE_INFO}
+  PWCE_IRDA_DEVICE_INFO = ^WCE_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM PWCE_IRDA_DEVICE_INFO}
+  TWceIrdaDeviceInfo = WCE_IRDA_DEVICE_INFO;
+  PWceIrdaDeviceInfo = PWCE_IRDA_DEVICE_INFO;
+
+  IRDA_DEVICE_INFO = WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM IRDA_DEVICE_INFO}
+  PIRDA_DEVICE_INFO = ^WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM PIRDA_DEVICE_INFO}
+  LPIRDA_DEVICE_INFO = ^WINDOWS_IRDA_DEVICE_INFO;
+  {$EXTERNALSYM LPIRDA_DEVICE_INFO}
+  TIrdaDeviceInfo = IRDA_DEVICE_INFO;
+  PIrdaDeviceInfo = LPIRDA_DEVICE_INFO;
+
+  _WINDOWS_DEVICELIST = record
+    numDevice: ULONG;
+    Device: array [0..0] of WINDOWS_IRDA_DEVICE_INFO;
+  end;
+  {$EXTERNALSYM _WINDOWS_DEVICELIST}
+  WINDOWS_DEVICELIST = _WINDOWS_DEVICELIST;
+  {$EXTERNALSYM WINDOWS_DEVICELIST}
+  PWINDOWS_DEVICELIST = ^WINDOWS_DEVICELIST;
+  {$EXTERNALSYM PWINDOWS_DEVICELIST}
+  LPWINDOWS_DEVICELIST = ^WINDOWS_DEVICELIST;
+  {$EXTERNALSYM LPWINDOWS_DEVICELIST}
+  TWindowsDeviceList = WINDOWS_DEVICELIST;
+  PWindowsDeviceList = LPWINDOWS_DEVICELIST;
+
+  _WCE_DEVICELIST = record
+    numDevice: ULONG;
+    Device: array [0..0] of WCE_IRDA_DEVICE_INFO;
+  end;
+  {$EXTERNALSYM _WCE_DEVICELIST}
+  WCE_DEVICELIST = _WCE_DEVICELIST;
+  {$EXTERNALSYM WCE_DEVICELIST}
+  PWCE_DEVICELIST = ^WCE_DEVICELIST;
+  {$EXTERNALSYM PWCE_DEVICELIST}
+  TWceDeviceList = WCE_DEVICELIST;
+  PWceDeviceList = PWCE_DEVICELIST;
+
+  DEVICELIST = WINDOWS_DEVICELIST;
+  {$EXTERNALSYM DEVICELIST}
+  PDEVICELIST = ^WINDOWS_DEVICELIST;
+  {$EXTERNALSYM PDEVICELIST}
+  LPDEVICELIST = ^WINDOWS_DEVICELIST;
+  {$EXTERNALSYM LPDEVICELIST}
+  TDeviceList = DEVICELIST;
+
+  _WINDOWS_IAS_SET = record
+    irdaClassName: array [0..IAS_MAX_CLASSNAME - 1] of Char;
+    irdaAttribName: array [0..IAS_MAX_ATTRIBNAME - 1] of Char;
+    irdaAttribType: u_long;
+    case Integer of
+      0: (
+        irdaAttribInt: Longint);
+      1: (
+        Len: u_short;
+        OctetSeq: array [0..IAS_MAX_OCTET_STRING - 1] of u_char);
+      2: (
+        Len_: u_char;
+        CharSet: u_char;
+        UsrStr: array [0..IAS_MAX_USER_STRING - 1] of u_char);
+  end;
+  {$EXTERNALSYM _WINDOWS_IAS_SET}
+  WINDOWS_IAS_SET = _WINDOWS_IAS_SET;
+  {$EXTERNALSYM WINDOWS_IAS_SET}
+  PWINDOWS_IAS_SET = ^WINDOWS_IAS_SET;
+  {$EXTERNALSYM PWINDOWS_IAS_SET}
+  LPWINDOWS_IAS_SET = ^WINDOWS_IAS_SET;
+  {$EXTERNALSYM LPWINDOWS_IAS_SET}
+  TWindowsIasSet = WINDOWS_IAS_SET;
+  PWindowsIasSet = LPWINDOWS_IAS_SET;
+
+  _WINDOWS_IAS_QUERY = record
+    irdaDeviceID: array [0..3] of u_char;
+    irdaClassName: array [0..IAS_MAX_CLASSNAME - 1] of Char;
+    irdaAttribName: array [0..IAS_MAX_ATTRIBNAME - 1] of Char;
+    irdaAttribType: u_long;
+    case Integer of
+      0: (
+        irdaAttribInt: Longint);
+      1: (
+        Len: u_long;
+        OctetSeq: array [0..IAS_MAX_OCTET_STRING - 1] of u_char);
+      2: (
+        Len_: u_long;
+        CharSet: u_long;
+        UsrStr: array [0..IAS_MAX_USER_STRING - 1] of u_char);
+  end;
+  {$EXTERNALSYM _WINDOWS_IAS_QUERY}
+  WINDOWS_IAS_QUERY = _WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM WINDOWS_IAS_QUERY}
+  PWINDOWS_IAS_QUERY = ^WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM PWINDOWS_IAS_QUERY}
+  LPWINDOWS_IAS_QUERY = ^WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM LPWINDOWS_IAS_QUERY}
+  TWindowsIasQuery = WINDOWS_IAS_QUERY;
+  PWindowsIasQuery = LPWINDOWS_IAS_QUERY;
+
+  _WCE_IAS_SET = record
+    irdaClassName: array [0..60] of Char;
+    irdaAttribName: array [0..60] of Char;
+    irdaAttribType: u_short;
+    case Integer of
+      0: (
+        irdaAttribInt: Integer);
+      1: (
+        Len: Integer;
+        OctetSeq: array [0..0] of u_char;
+        Reserved: array [0..2] of u_char);
+      2: (
+        Len_: Integer;
+        CharSet: u_char;
+        UsrStr: array [0..0] of u_char;
+        Reserved_: array [0..1] of u_char);
+  end;
+  {$EXTERNALSYM _WCE_IAS_SET}
+  WCE_IAS_SET = _WCE_IAS_SET;
+  {$EXTERNALSYM WCE_IAS_SET}
+  PWCE_IAS_SET = ^WCE_IAS_SET;
+  {$EXTERNALSYM PWCE_IAS_SET}
+  TWceIasSet = WCE_IAS_SET;
+  PWceIasSet = PWCE_IAS_SET;
+
+  _WCE_IAS_QUERY = record
+    irdaDeviceID: array [0..3] of u_char;
+    irdaClassName: array [0..60] of Char;
+    irdaAttribName: array [0..60] of Char;
+    irdaAttribType: u_short;
+    case Integer of
+      0: (irdaAttribInt: Integer);
+      1: (
+        Len: Integer;
+        OctetSeq: array [0..0] of u_char;
+        Reserved: array [0..2] of u_char);
+      2: (
+        Len_: Integer;
+        CharSet: u_char;
+        UsrStr: array [0..0] of u_char;
+        Reserved_
+        : array [0..1] of u_char);
+  end;
+  {$EXTERNALSYM _WCE_IAS_QUERY}
+  WCE_IAS_QUERY = _WCE_IAS_QUERY;
+  {$EXTERNALSYM WCE_IAS_QUERY}
+  PWCE_IAS_QUERY = ^WCE_IAS_QUERY;
+  {$EXTERNALSYM PWCE_IAS_QUERY}
+  TWceIasQuery = WCE_IAS_QUERY;
+  PWceIasQuery = PWCE_IAS_QUERY;
+
+  IAS_SET = WINDOWS_IAS_SET;
+  {$EXTERNALSYM IAS_SET}
+  PIAS_SET = ^WINDOWS_IAS_SET;
+  {$EXTERNALSYM PIAS_SET}
+  LPIASSET = ^WINDOWS_IAS_SET;
+  TIasSet = IAS_SET;
+  PIasSet = PIAS_SET;
+  {$EXTERNALSYM LPIASSET}
+  IAS_QUERY = WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM IAS_QUERY}
+  PIAS_QUERY = ^WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM PIAS_QUERY}
+  LPIASQUERY = ^WINDOWS_IAS_QUERY;
+  {$EXTERNALSYM LPIASQUERY}
+  TIasQuery = IAS_QUERY;
+  PIasQuery = PIAS_QUERY;  
+
+implementation
+
+end.

+ 326 - 0
packages/extra/winunits/jwaatalkwsh.pas

@@ -0,0 +1,326 @@
+{******************************************************************************}
+{                                                                              }
+{ Winsock2 AppleTalk API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: atalkwsh.h, released June 2000. The original Pascal    }
+{ code is: ATalkWsh.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAtalkWsh;
+
+interface
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "atalkwsh.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+uses
+  JwaWinSock2;
+
+//
+//  All protocol types should be specified in the Decimal base
+//
+
+const
+  DECIMAL_BASE = 10;
+  {$EXTERNALSYM DECIMAL_BASE}
+
+//
+//  Protocol number 0 is invalid in the Appletalk case
+//
+
+  ATPROTO_BASE    = 1000 * AF_APPLETALK;
+  {$EXTERNALSYM ATPROTO_BASE}
+  SOL_APPLETALK   = ATPROTO_BASE;
+  {$EXTERNALSYM SOL_APPLETALK}
+
+  DDPPROTO_RTMP   = ATPROTO_BASE + 1;
+  {$EXTERNALSYM DDPPROTO_RTMP}
+  DDPPROTO_NBP    = ATPROTO_BASE + 2;
+  {$EXTERNALSYM DDPPROTO_NBP}
+  DDPPROTO_ATP    = ATPROTO_BASE + 3;
+  {$EXTERNALSYM DDPPROTO_ATP}
+  DDPPROTO_AEP    = ATPROTO_BASE + 4;
+  {$EXTERNALSYM DDPPROTO_AEP}
+  DDPPROTO_RTMPRQ = ATPROTO_BASE + 5;
+  {$EXTERNALSYM DDPPROTO_RTMPRQ}
+  DDPPROTO_ZIP    = ATPROTO_BASE + 6;
+  {$EXTERNALSYM DDPPROTO_ZIP}
+  DDPPROTO_ADSP   = ATPROTO_BASE + 7;
+  {$EXTERNALSYM DDPPROTO_ADSP}
+
+  DDPPROTO_MAX    = ATPROTO_BASE + 255;
+  {$EXTERNALSYM DDPPROTO_MAX}
+
+//
+//  Define the higher layer appletalk protocol types
+//
+
+  ATPROTO_ADSP = DDPPROTO_MAX + 1;
+  {$EXTERNALSYM ATPROTO_ADSP}
+  ATPROTO_ATP  = DDPPROTO_MAX + 2;
+  {$EXTERNALSYM ATPROTO_ATP}
+  ATPROTO_ASP  = DDPPROTO_MAX + 3;
+  {$EXTERNALSYM ATPROTO_ASP}
+  ATPROTO_PAP  = DDPPROTO_MAX + 4;
+  {$EXTERNALSYM ATPROTO_PAP}
+
+  SO_REGISTER_NAME            = $A000;
+  {$EXTERNALSYM SO_REGISTER_NAME}
+  SO_DEREGISTER_NAME          = $A001;
+  {$EXTERNALSYM SO_DEREGISTER_NAME}
+  SO_REMOVE_NAME              = SO_DEREGISTER_NAME;
+  {$EXTERNALSYM SO_REMOVE_NAME}
+  SO_LOOKUP_NAME              = $A002;
+  {$EXTERNALSYM SO_LOOKUP_NAME}
+  SO_CONFIRM_NAME             = $A003;
+  {$EXTERNALSYM SO_CONFIRM_NAME}
+  SO_LOOKUP_MYZONE            = $A004;
+  {$EXTERNALSYM SO_LOOKUP_MYZONE}
+  SO_GETMYZONE                = SO_LOOKUP_MYZONE;
+  {$EXTERNALSYM SO_GETMYZONE}
+  SO_LOOKUP_ZONES             = $A005;
+  {$EXTERNALSYM SO_LOOKUP_ZONES}
+  SO_GETZONELIST              = SO_LOOKUP_ZONES;
+  {$EXTERNALSYM SO_GETZONELIST}
+  SO_LOOKUP_ZONES_ON_ADAPTER  = $A006;
+  {$EXTERNALSYM SO_LOOKUP_ZONES_ON_ADAPTER}
+  SO_GETLOCALZONES            = SO_LOOKUP_ZONES_ON_ADAPTER;
+  {$EXTERNALSYM SO_GETLOCALZONES}
+  SO_LOOKUP_NETDEF_ON_ADAPTER = $A007;
+  {$EXTERNALSYM SO_LOOKUP_NETDEF_ON_ADAPTER}
+  SO_GETNETINFO               = SO_LOOKUP_NETDEF_ON_ADAPTER;
+  {$EXTERNALSYM SO_GETNETINFO}
+
+//
+//  PAP-specific options
+//
+
+  SO_PAP_SET_SERVER_STATUS = $A007;
+  {$EXTERNALSYM SO_PAP_SET_SERVER_STATUS}
+  SO_PAP_GET_SERVER_STATUS = $A008;
+  {$EXTERNALSYM SO_PAP_GET_SERVER_STATUS}
+  SO_PAP_PRIME_READ        = $A009;
+  {$EXTERNALSYM SO_PAP_PRIME_READ}
+
+  ATADDR_ANY       = 0; // Dynamic socket (=0)
+  {$EXTERNALSYM ATADDR_ANY}
+  ATADDR_BROADCAST = $FF; // Broadcast node id (=ff)
+  {$EXTERNALSYM ATADDR_BROADCAST}
+
+//
+// Define flags/error codes peculiar to Appletalk
+//
+
+  WSAEMSGPARTIAL = WSABASEERR + 100;
+  {$EXTERNALSYM WSAEMSGPARTIAL}
+
+// Maximum pap status size
+
+  MAX_PAP_STATUS_SIZE   = 255;
+  {$EXTERNALSYM MAX_PAP_STATUS_SIZE}
+  MIN_PAP_READ_BUF_SIZE = 4096;
+  {$EXTERNALSYM MIN_PAP_READ_BUF_SIZE}
+
+// These are the unused 4 bytes returned in the PAP status packet. If ever
+// they are to be interpreted, they will be available.
+
+  PAP_UNUSED_STATUS_BYTES = 4;
+  {$EXTERNALSYM PAP_UNUSED_STATUS_BYTES}
+
+//
+//  SOCKADDR_AT structure
+//
+
+type
+  SOCKADDR_AT = record
+    sat_family: USHORT;
+    sat_net: USHORT;
+    sat_node: UCHAR;
+    sat_socket: UCHAR;
+  end;
+  {$EXTERNALSYM SOCKADDR_AT}
+  PSOCKADDR_AT = ^SOCKADDR_AT;
+  {$EXTERNALSYM PSOCKADDR_AT}
+  TSockAddrAT = SOCKADDR_AT;
+  PSockAddrAT = PSOCKADDR_AT;  
+
+//
+// ***WARNING***
+// This is defined to be the same as the ATALK ADDRESS defined in atalktdi.h
+// Change this if the other changes.
+//
+
+type
+  WSH_ATALK_ADDRESS = record
+    case Integer of
+      0: (
+        Network: USHORT;
+        Node: UCHAR;
+        Socket: UCHAR);
+      1: (
+        Address: ULONG);
+  end;
+  {$EXTERNALSYM WSH_ATALK_ADDRESS}
+  PWSH_ATALK_ADDRESS = ^WSH_ATALK_ADDRESS;
+  {$EXTERNALSYM PWSH_ATALK_ADDRESS}
+  TWSHATalkAddress = WSH_ATALK_ADDRESS;
+  PWSHATalkAddress = PWSH_ATALK_ADDRESS;  
+
+//
+//  Typedefs for the various options
+//
+
+//
+//  ***WARNING***:
+//  This should be exactly the same as NBP_NAME defined in atalktdi.h
+//
+
+const
+  MAX_ENTITY = 32;
+  {$EXTERNALSYM MAX_ENTITY}
+
+type
+  WSH_NBP_NAME = record
+    ObjectNameLen: CHAR;
+    ObjectName: array [0..MAX_ENTITY - 1] of CHAR;
+    TypeNameLen: CHAR;
+    TypeName: array [0..MAX_ENTITY - 1] of CHAR;
+    ZoneNameLen: CHAR;
+    ZoneName: array [0..MAX_ENTITY - 1] of CHAR;
+  end;
+  {$EXTERNALSYM WSH_NBP_NAME}
+  PWSH_NBP_NAME = ^WSH_NBP_NAME;
+  {$EXTERNALSYM PWSH_NBP_NAME}
+  TWSHNBPName = WSH_NBP_NAME;
+  PWSHNBPName = PWSH_NBP_NAME;
+
+  WSH_NBP_TUPLE = record
+    Address: WSH_ATALK_ADDRESS;
+    Enumerator: USHORT;
+    NbpName: WSH_NBP_NAME;
+  end;
+  {$EXTERNALSYM WSH_NBP_TUPLE}
+  PWSH_NBP_TUPLE = ^WSH_NBP_TUPLE;
+  {$EXTERNALSYM PWSH_NBP_TUPLE}
+  TWSHNBPTuple = WSH_NBP_TUPLE;
+  PWSHNBPTuple = PWSH_NBP_TUPLE;  
+
+  WSH_REGISTER_NAME = WSH_NBP_NAME;
+  {$EXTERNALSYM WSH_REGISTER_NAME}
+  TWSHRegisterName = WSH_REGISTER_NAME;
+  PWSH_REGISTER_NAME = ^WSH_NBP_NAME;
+  {$EXTERNALSYM PWSH_REGISTER_NAME}
+  PWSHRegisterName = PWSH_REGISTER_NAME;
+  WSH_DEREGISTER_NAME = WSH_NBP_NAME;
+  {$EXTERNALSYM WSH_DEREGISTER_NAME}
+  TWSHDeregisterName = WSH_DEREGISTER_NAME;
+  PWSH_DEREGISTER_NAME = ^WSH_NBP_NAME;
+  {$EXTERNALSYM PWSH_DEREGISTER_NAME}
+  PWSHDeregisterName = PWSH_DEREGISTER_NAME;
+  WSH_REMOVE_NAME = WSH_NBP_NAME;
+  {$EXTERNALSYM WSH_REMOVE_NAME}
+  TWSHRemoveName = WSH_REMOVE_NAME;
+  PWSH_REMOVE_NAME = ^WSH_NBP_NAME;
+  {$EXTERNALSYM PWSH_REMOVE_NAME}
+  PWSHRemoveName = PWSH_REMOVE_NAME;
+
+  _WSH_LOOKUP_ZONES = record
+    NoZones: ULONG;
+    //
+    //  CHAR    Zones[] - null separated zones
+    //
+  end;
+  {$EXTERNALSYM _WSH_LOOKUP_ZONES}
+  WSH_LOOKUP_ZONES = _WSH_LOOKUP_ZONES;
+  {$EXTERNALSYM WSH_LOOKUP_ZONES}
+  PWSH_LOOKUP_ZONES = ^WSH_LOOKUP_ZONES;
+  {$EXTERNALSYM PWSH_LOOKUP_ZONES}
+  TWSHLookupZones = WSH_LOOKUP_ZONES;
+  PWSHLookupZones = PWSH_LOOKUP_ZONES;
+
+  _WSH_LOOKUP_NETDEF_ON_ADAPTER = record
+    NetworkRangeLowerEnd: USHORT;
+    NetworkRangeUpperEnd: USHORT;
+    // This will be followed by a null terminated ansi default zone.
+    // PUCHAR DefaultZone[]
+  end;
+  {$EXTERNALSYM _WSH_LOOKUP_NETDEF_ON_ADAPTER}
+  WSH_LOOKUP_NETDEF_ON_ADAPTER = _WSH_LOOKUP_NETDEF_ON_ADAPTER;
+  {$EXTERNALSYM WSH_LOOKUP_NETDEF_ON_ADAPTER}
+  PWSH_LOOKUP_NETDEF_ON_ADAPTER = ^WSH_LOOKUP_NETDEF_ON_ADAPTER;
+  {$EXTERNALSYM PWSH_LOOKUP_NETDEF_ON_ADAPTER}
+  TWSHLookupNetDefOnAdapter = WSH_LOOKUP_NETDEF_ON_ADAPTER;
+  PWSHLookupNetDefOnAdapter = PWSH_LOOKUP_NETDEF_ON_ADAPTER;
+
+  _WSH_LOOKUP_NAME = record
+    LookupTuple: WSH_NBP_TUPLE;
+    NoTuples: ULONG;
+    //
+    //  Array of NoTuple WSH_NBP_TUPLEs
+    //
+  end;
+  {$EXTERNALSYM _WSH_LOOKUP_NAME}
+  WSH_LOOKUP_NAME = _WSH_LOOKUP_NAME;
+  {$EXTERNALSYM WSH_LOOKUP_NAME}
+  PWSH_LOOKUP_NAME = ^WSH_LOOKUP_NAME;
+  {$EXTERNALSYM PWSH_LOOKUP_NAME}
+  TWSHLookupName = WSH_LOOKUP_NAME;
+  PWSHLookupName = PWSH_LOOKUP_NAME;
+
+  _WSH_PAP_GET_SERVER_STATUS = record
+    ServerAddr: SOCKADDR_AT;
+    Reserved: array [0..PAP_UNUSED_STATUS_BYTES - 1] of UCHAR;
+    ServerStatus: array [0..MAX_PAP_STATUS_SIZE] of UCHAR;
+  end;
+  {$EXTERNALSYM _WSH_PAP_GET_SERVER_STATUS}
+  WSH_PAP_GET_SERVER_STATUS = _WSH_PAP_GET_SERVER_STATUS;
+  {$EXTERNALSYM WSH_PAP_GET_SERVER_STATUS}
+  PWSH_PAP_GET_SERVER_STATUS = ^WSH_PAP_GET_SERVER_STATUS;
+  {$EXTERNALSYM PWSH_PAP_GET_SERVER_STATUS}
+  TWSHPapGetServerStatus = WSH_PAP_GET_SERVER_STATUS;
+  PWSHPapGetServerStatus = PWSH_PAP_GET_SERVER_STATUS;
+
+implementation
+
+end.

+ 647 - 0
packages/extra/winunits/jwaauthif.pas

@@ -0,0 +1,647 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Authentication Extensions API interface Unit for Object Pascal      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: authif.h, released June 2000. The original Pascal      }
+{ code is: Authif.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAuthif;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "authif.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+//  Enumerates the attribute types that are passed to the extension DLL.  The
+//  RADIUS standard attributes are included for convenience and should not be
+//  considered exhaustive.
+//
+
+type
+  _RADIUS_ATTRIBUTE_TYPE = DWORD;
+  {$EXTERNALSYM _RADIUS_ATTRIBUTE_TYPE}
+  RADIUS_ATTRIBUTE_TYPE = _RADIUS_ATTRIBUTE_TYPE;
+  {$EXTERNALSYM RADIUS_ATTRIBUTE_TYPE}
+  TRadiusAttributeType = RADIUS_ATTRIBUTE_TYPE;
+
+const
+  // Used to terminate attribute arrays.
+
+  ratMinimum = 0;
+  {$EXTERNALSYM ratMinimum}
+
+  // RADIUS standard attributes.
+
+  ratUserName = 1;
+  {$EXTERNALSYM ratUserName}
+  ratUserPassword = 2;
+  {$EXTERNALSYM ratUserPassword}
+  ratCHAPPassword = 3;
+  {$EXTERNALSYM ratCHAPPassword}
+  ratNASIPAddress = 4;
+  {$EXTERNALSYM ratNASIPAddress}
+  ratNASPort = 5;
+  {$EXTERNALSYM ratNASPort}
+  ratServiceType = 6;
+  {$EXTERNALSYM ratServiceType}
+  ratFramedProtocol = 7;
+  {$EXTERNALSYM ratFramedProtocol}
+  ratFramedIPAddress = 8;
+  {$EXTERNALSYM ratFramedIPAddress}
+  ratFramedIPNetmask = 9;
+  {$EXTERNALSYM ratFramedIPNetmask}
+  ratFramedRouting = 10;
+  {$EXTERNALSYM ratFramedRouting}
+  ratFilterId = 11;
+  {$EXTERNALSYM ratFilterId}
+  ratFramedMTU = 12;
+  {$EXTERNALSYM ratFramedMTU}
+  ratFramedCompression = 13;
+  {$EXTERNALSYM ratFramedCompression}
+  ratLoginIPHost = 14;
+  {$EXTERNALSYM ratLoginIPHost}
+  ratLoginService = 15;
+  {$EXTERNALSYM ratLoginService}
+  ratLoginPort = 16;
+  {$EXTERNALSYM ratLoginPort}
+  ratReplyMessage = 18;
+  {$EXTERNALSYM ratReplyMessage}
+  ratCallbackNumber = 19;
+  {$EXTERNALSYM ratCallbackNumber}
+  ratCallbackId = 20;
+  {$EXTERNALSYM ratCallbackId}
+  ratFramedRoute = 22;
+  {$EXTERNALSYM ratFramedRoute}
+  ratFramedIPXNetwork = 23;
+  {$EXTERNALSYM ratFramedIPXNetwork}
+  ratState = 24;
+  {$EXTERNALSYM ratState}
+  ratClass = 25;
+  {$EXTERNALSYM ratClass}
+  ratVendorSpecific = 26;
+  {$EXTERNALSYM ratVendorSpecific}
+  ratSessionTimeout = 27;
+  {$EXTERNALSYM ratSessionTimeout}
+  ratIdleTimeout = 28;
+  {$EXTERNALSYM ratIdleTimeout}
+  ratTerminationAction = 29;
+  {$EXTERNALSYM ratTerminationAction}
+  ratCalledStationId = 30;
+  {$EXTERNALSYM ratCalledStationId}
+  ratCallingStationId = 31;
+  {$EXTERNALSYM ratCallingStationId}
+  ratNASIdentifier = 32;
+  {$EXTERNALSYM ratNASIdentifier}
+  ratProxyState = 33;
+  {$EXTERNALSYM ratProxyState}
+  ratLoginLATService = 34;
+  {$EXTERNALSYM ratLoginLATService}
+  ratLoginLATNode = 35;
+  {$EXTERNALSYM ratLoginLATNode}
+  ratLoginLATGroup = 36;
+  {$EXTERNALSYM ratLoginLATGroup}
+  ratFramedAppleTalkLink = 37;
+  {$EXTERNALSYM ratFramedAppleTalkLink}
+  ratFramedAppleTalkNetwork = 38;
+  {$EXTERNALSYM ratFramedAppleTalkNetwork}
+  ratFramedAppleTalkZone = 39;
+  {$EXTERNALSYM ratFramedAppleTalkZone}
+  ratAcctStatusType = 40;
+  {$EXTERNALSYM ratAcctStatusType}
+  ratAcctDelayTime = 41;
+  {$EXTERNALSYM ratAcctDelayTime}
+  ratAcctInputOctets = 42;
+  {$EXTERNALSYM ratAcctInputOctets}
+  ratAcctOutputOctets = 43;
+  {$EXTERNALSYM ratAcctOutputOctets}
+  ratAcctSessionId = 44;
+  {$EXTERNALSYM ratAcctSessionId}
+  ratAcctAuthentic = 45;
+  {$EXTERNALSYM ratAcctAuthentic}
+  ratAcctSessionTime = 46;
+  {$EXTERNALSYM ratAcctSessionTime}
+  ratAcctInputPackets = 47;
+  {$EXTERNALSYM ratAcctInputPackets}
+  ratAcctOutputPackets = 48;
+  {$EXTERNALSYM ratAcctOutputPackets}
+  ratAcctTerminationCause = 49;
+  {$EXTERNALSYM ratAcctTerminationCause}
+  ratCHAPChallenge = 60;
+  {$EXTERNALSYM ratCHAPChallenge}
+  ratNASPortType = 61;
+  {$EXTERNALSYM ratNASPortType}
+  ratPortLimit = 62;
+  {$EXTERNALSYM ratPortLimit}
+
+  // Extended attribute types used to pass additional information.
+
+  ratCode = 262;             // Request type code.
+  {$EXTERNALSYM ratCode}
+  ratIdentifier = 263;       // Request identifier.
+  {$EXTERNALSYM ratIdentifier}
+  ratAuthenticator = 264;    // Request authenticator.
+  {$EXTERNALSYM ratAuthenticator}
+  ratSrcIPAddress = 265;     // Source IP address.
+  {$EXTERNALSYM ratSrcIPAddress}
+  ratSrcPort = 266;          // Source IP port.
+  {$EXTERNALSYM ratSrcPort}
+  ratProvider = 267;         // Authentication provider.
+  {$EXTERNALSYM ratProvider}
+  ratStrippedUserName = 268; // User-Name with realm stripped.
+  {$EXTERNALSYM ratStrippedUserName}
+  ratFQUserName = 269;       // Fully-Qualified-User-Name.
+  {$EXTERNALSYM ratFQUserName}
+  ratPolicyName = 270;       // Remote Access Policy name.
+  {$EXTERNALSYM ratPolicyName}
+  ratUniqueId   = 271;       // Unique ID identifying the request.
+  {$EXTERNALSYM ratUniqueId}
+  ratExtensionState = 272;   // Used to pass state between extensions.
+  {$EXTERNALSYM ratExtensionState}
+
+//
+//  Enumerates the different RADIUS packet codes. Used for the ratCode extended
+//  attribute.
+//
+
+type
+  _RADIUS_CODE = DWORD;
+  {$EXTERNALSYM _RADIUS_CODE}
+  RADIUS_CODE = _RADIUS_CODE;
+  {$EXTERNALSYM RADIUS_CODE}
+  TRadiusCode = RADIUS_CODE;
+
+const
+  rcUnknown = 0;
+  {$EXTERNALSYM rcUnknown}
+  rcAccessRequest = 1;
+  {$EXTERNALSYM rcAccessRequest}
+  rcAccessAccept = 2;
+  {$EXTERNALSYM rcAccessAccept}
+  rcAccessReject = 3;
+  {$EXTERNALSYM rcAccessReject}
+  rcAccountingRequest = 4;
+  {$EXTERNALSYM rcAccountingRequest}
+  rcAccountingResponse = 5;
+  {$EXTERNALSYM rcAccountingResponse}
+  rcAccessChallenge = 11;
+  {$EXTERNALSYM rcAccessChallenge}
+  rcDiscard = 256;
+  {$EXTERNALSYM rcDiscard}
+
+//
+//  Enumerates the different authentication providers used for processing a
+//  request. Used for the ratProvider extended attribute.
+//
+
+type
+  _RADIUS_AUTHENTICATION_PROVIDER = (
+    rapUnknown,
+    rapUsersFile,
+    rapProxy,
+    rapWindowsNT,
+    rapMCIS,
+    rapODBC,
+    rapNone);
+  {$EXTERNALSYM _RADIUS_AUTHENTICATION_PROVIDER}
+  RADIUS_AUTHENTICATION_PROVIDER = _RADIUS_AUTHENTICATION_PROVIDER;
+  {$EXTERNALSYM RADIUS_AUTHENTICATION_PROVIDER}
+  TRadiusAuthenticationProvider = RADIUS_AUTHENTICATION_PROVIDER;
+
+//
+//  Enumerates the different RADIUS data types. A type of 'rdtUnknown' means
+//  the attribute was not recognized by the dictionary.
+//
+
+  _RADIUS_DATA_TYPE = (
+   rdtUnknown,
+   rdtString,
+   rdtAddress,
+   rdtInteger,
+   rdtTime);
+  {$EXTERNALSYM _RADIUS_DATA_TYPE}
+  RADIUS_DATA_TYPE = _RADIUS_DATA_TYPE;
+  {$EXTERNALSYM RADIUS_DATA_TYPE}
+  TRadiusDataType = RADIUS_DATA_TYPE;
+
+//
+//  Struct representing a RADIUS or extended attribute.
+//
+
+  _RADIUS_ATTRIBUTE  = record
+    dwAttrType: DWORD;            // Attribute type
+    fDataType: RADIUS_DATA_TYPE;  // RADIUS_DATA_TYPE of the value
+    cbDataLength: DWORD;          // Length of the value (in bytes)
+    case Integer of
+      0: (dwValue: DWORD);        // For rdtAddress, rdtInteger, and rdtTime
+      1: (lpValue: PCSTR);        // For rdtUnknown, and rdtString
+  end;
+  {$EXTERNALSYM _RADIUS_ATTRIBUTE}
+  RADIUS_ATTRIBUTE = _RADIUS_ATTRIBUTE;
+  {$EXTERNALSYM RADIUS_ATTRIBUTE}
+  PRADIUS_ATTRIBUTE = ^RADIUS_ATTRIBUTE;
+  {$EXTERNALSYM PRADIUS_ATTRIBUTE}
+  TRadiusAttribute = RADIUS_ATTRIBUTE;
+  PRadiusAttribute = PRADIUS_ATTRIBUTE;
+
+//
+//  Struct representing the layout of a RADIUS Vendor-Specific attribute. This
+//  is useful when interpreting the RADIUS_ATTRIBUTE lpValue field when
+//  dwAttrType is ratVendorSpecific.
+//
+
+  _RADIUS_VSA_FORMAT = record
+   VendorId: array [0..3] of BYTE;
+   VendorType: BYTE;
+   VendorLength: BYTE;
+   AttributeSpecific: array [0..0] of BYTE;
+  end;
+  {$EXTERNALSYM _RADIUS_VSA_FORMAT}
+  RADIUS_VSA_FORMAT = _RADIUS_VSA_FORMAT;
+  {$EXTERNALSYM RADIUS_VSA_FORMAT}
+  TRadiusVsaFormat = RADIUS_VSA_FORMAT;
+
+//
+//  Enumerates the different actions an extension DLL can generate in
+//  response to an Access-Request.
+//
+
+  _RADIUS_ACTION = (
+   raContinue,
+   raReject,
+   raAccept);
+  {$EXTERNALSYM _RADIUS_ACTION}
+  RADIUS_ACTION = _RADIUS_ACTION;
+  {$EXTERNALSYM RADIUS_ACTION}
+  PRADIUS_ACTION = ^RADIUS_ACTION;
+  {$EXTERNALSYM PRADIUS_ACTION}
+  TRadiusAction = RADIUS_ACTION;
+  PRadiusAction = PRADIUS_ACTION;
+
+//
+// Routines exported by a RADIUS extension DLL.
+//
+
+//
+// RadiusExtensionInit is optional. If it exists, it will be invoked prior to
+// the service coming on-line. A return value other than NO_ERROR prevents the
+// service from initializing.
+//
+
+const
+  RADIUS_EXTENSION_INIT = 'RadiusExtensionInit';
+  {$EXTERNALSYM RADIUS_EXTENSION_INIT}
+
+type
+  PRADIUS_EXTENSION_INIT = function: DWORD; stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_INIT}
+  PRadiusExtensionInit = PRADIUS_EXTENSION_INIT;
+
+//
+// RadiusExtensionTerm is optional. If it exists, it will be invoked prior to
+// unloading the DLL to give the extension a chance to clean-up.
+//
+
+const
+  RADIUS_EXTENSION_TERM = 'RadiusExtensionTerm';
+  {$EXTERNALSYM RADIUS_EXTENSION_TERM}
+
+type
+  PRADIUS_EXTENSION_TERM = procedure; stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_TERM}
+  PRadiusExtensionTerm = PRADIUS_EXTENSION_TERM;
+
+//
+// RadiusExtensionProcess is mandatory for NT4. For Windows 2000, an
+// extension may export RadiusExtensionProcessEx (q.v.) instead.
+//
+// Parameters:
+//   pAttrs      Array of attributes from the request. It is terminated by an
+//               attribute with dwAttrType set to ratMinimum. These attributes
+//               should be treated as read-only and must not be referenced
+//               after the function returns.
+//   pfAction    For Access-Requests, this parameter will be non-NULL with
+//               *pfAction == raContinue. The extension DLL can set *pfAction
+//               to abort further processing and force an Access-Accept or
+//               Access-Reject.  For all other request types, this parameter
+//               will be NULL.
+//
+// Return Value:
+//     A return value other than NO_ERROR causes the request to be discarded.
+//
+
+const
+  RADIUS_EXTENSION_PROCESS = 'RadiusExtensionProcess';
+  {$EXTERNALSYM RADIUS_EXTENSION_PROCESS}
+
+type
+  PRADIUS_EXTENSION_PROCESS = function(pAttrs: PRADIUS_ATTRIBUTE; pfAction: PRADIUS_ACTION): DWORD; stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_PROCESS}
+  PRadiusExtensionProcess = PRADIUS_EXTENSION_PROCESS;
+
+//
+// RadiusExtensionProcessEx is only supported on Windows 2000. If it exits,
+// RadiusExtensionProcess is ignored.
+//
+// Parameters:
+//   pInAttrs    Array of attributes from the request. It is terminated by an
+//               attribute with dwAttrType set to ratMinimum. These attributes
+//               should be treated as read-only and must not be referenced
+//               after the function returns.
+//   pOutAttrs   Array of attributes to add to the response. It is terminated
+//               by an attribute with dwAttrType set to ratMinimum.
+//               *pOutAttrs may be set to NULL if no attributes are returned.
+//   pfAction    For Access-Requests, this parameter will be non-NULL with
+//               *pfAction == raContinue. The extension DLL can set *pfAction
+//               to abort further processing and force an Access-Accept or
+//               Access-Reject.  For all other request types, this parameter
+//               will be NULL.
+//
+// Return Value:
+//     A return value other than NO_ERROR causes the request to be discarded.
+//
+
+const
+  RADIUS_EXTENSION_PROCESS_EX = 'RadiusExtensionProcessEx';
+  {$EXTERNALSYM RADIUS_EXTENSION_PROCESS_EX}
+
+type
+  PRADIUS_EXTENSION_PROCESS_EX = function(pInAttrs: PRADIUS_ATTRIBUTE;
+    pOutAttrs: PRADIUS_ATTRIBUTE; pfAction: PRADIUS_ACTION): DWORD; stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_PROCESS_EX}
+  PRadiusExtensionProcessEx = PRADIUS_EXTENSION_PROCESS_EX;
+  
+//
+// RadiusExtensionFreeAttributes must be defined if RadiusExtensionProcessEx
+// is defined. It is used to free the attributes returned by
+// RadiusExtensionProcessEx
+//
+// Parameters:
+//   pAttrs     Array of attributes to be freed.
+//
+
+const
+  RADIUS_EXTENSION_FREE_ATTRIBUTES = 'RadiusExtensionFreeAttributes';
+  {$EXTERNALSYM RADIUS_EXTENSION_FREE_ATTRIBUTES}
+
+type
+  PRADIUS_EXTENSION_FREE_ATTRIBUTES = procedure(pAttrs: PRADIUS_ATTRIBUTE); stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_FREE_ATTRIBUTES}
+  PRadiusExtensionFreeAttributes = PRADIUS_EXTENSION_FREE_ATTRIBUTES;
+
+//
+//  Defines used for installation of an extension DLL.
+//  The following registry values are used for loading extensions:
+//
+//      HKLM\System\CurrentControlSet\Services\AuthSrv\Parameters
+//          ExtensionDLLs      (REG_MULTI_SZ)  <list of DLL paths>
+//          AuthorizationDLLs  (REG_MULTI_SZ)  <list of DLL paths>
+//
+//  ExtensionDLLs are invoked before any of the built-in authentication
+//  providers. They receive all the attributes from the request plus all
+//  the extended attribute types.
+//
+//  AuthorizationDLLs are invoked after the built-in authentication and
+//  authorization providers. They receive all the attributes from the
+//  response plus all the extended attributes types. AuthorizationDLLs may
+//  not return an action of raAccept.
+//
+
+const
+  AUTHSRV_PARAMETERS_KEY_W = WideString('System\CurrentControlSet\Services\AuthSrv\Parameters');
+  {$EXTERNALSYM AUTHSRV_PARAMETERS_KEY_W}
+
+  AUTHSRV_EXTENSIONS_VALUE_W = WideString('ExtensionDLLs');
+  {$EXTERNALSYM AUTHSRV_EXTENSIONS_VALUE_W}
+
+  AUTHSRV_AUTHORIZATION_VALUE_W = WideString('AuthorizationDLLs');
+  {$EXTERNALSYM AUTHSRV_AUTHORIZATION_VALUE_W}
+
+// #if _WIN32_WINNT >= 0x0501
+
+// Version of this spec.
+
+const
+  RADIUS_EXTENSION_VERSION = 1;
+  {$EXTERNALSYM RADIUS_EXTENSION_VERSION}
+
+//
+//  Enumerates the different points during request processing where an
+//  extension can be invoked.
+//
+
+type
+  _RADIUS_EXTENSION_POINT = (
+   repAuthentication,     // ExtensionDLLs
+   repAuthorization);     // AuthorizationDLLs
+  {$EXTERNALSYM _RADIUS_EXTENSION_POINT}
+  RADIUS_EXTENSION_POINT = _RADIUS_EXTENSION_POINT;
+  {$EXTERNALSYM RADIUS_EXTENSION_POINT}
+  TRadiusExtensionPoint = RADIUS_EXTENSION_POINT;
+
+//
+// Struct representing an array of RADIUS_ATTRIBUTE structs. All the functions
+// for adding attributes to a request copy the supplied memory, so there is no
+// need for the extension to export RadiusExtensionFreeAttributes.  The
+// extension must not modify this struct. All changes must be made by using the
+// supplied callback functions.
+//
+
+  PRADIUS_ATTRIBUTE_ARRAY = ^RADIUS_ATTRIBUTE_ARRAY;
+  {$EXTERNALSYM PRADIUS_ATTRIBUTE_ARRAY}
+  PPRADIUS_ATTRIBUTE_ARRAY = ^PRADIUS_ATTRIBUTE_ARRAY;
+  _RADIUS_ATTRIBUTE_ARRAY = record
+
+   // Size of this structure in bytes.
+
+   cbSize: DWORD;
+
+   // Adds a new attribute to the end of the array.
+
+   Add: function(This: PRADIUS_ATTRIBUTE_ARRAY; pAttr: PRADIUS_ATTRIBUTE): DWORD; stdcall;
+
+   //
+   // Returns a const pointer to the specified attribute within the array or
+   // NULL if the index is out of range.
+   //
+
+   AttributeAt: function(This: PPRADIUS_ATTRIBUTE_ARRAY; dwIndex: DWORD): PRADIUS_ATTRIBUTE; stdcall;
+
+   //
+   // Returns the size of the array. Since indexes are zero-based, the size is
+   // 1 greater than the largest index.
+   //
+
+   GetSize: function(This: PRADIUS_ATTRIBUTE_ARRAY): DWORD; stdcall;
+
+   //
+   // Inserts a new attribute at a specified index in the array. In the
+   // process, it shifts up (by incrementing the index) the existing attribute
+   // at this index, and it shifts up all the attributes above it. Returns
+   // ERROR_INVALID_PARAMETER if the index is out of range.
+   //
+
+   InsertAt: function(This: PRADIUS_ATTRIBUTE_ARRAY; dwIndex: DWORD; pAttr: PRADIUS_ATTRIBUTE): DWORD; stdcall;
+
+   //
+   // Removes the attribute at the specified index in the array. In the
+   // process, it shifts down all the attributes above the removed attribute.
+   // Returns ERROR_ACCESS_DENIED if the specified attribute is read-only.
+   // Returns ERROR_INVALID_PARAMETER if the index is out of range.
+   //
+
+   RemoveAt: function(This: PRADIUS_ATTRIBUTE_ARRAY; dwIndex: DWORD): DWORD; stdcall;
+
+   //
+   // Sets the array element at the specified index, replacing the existing
+   // attribute.  Returns ERROR_INVALID_PARAMETER if the index is out of range.
+   //
+
+   SetAt: function(This: PPRADIUS_ATTRIBUTE_ARRAY; dwIndex: DWORD; pAttr: PRADIUS_ATTRIBUTE): DWORD; stdcall;
+
+  end;
+  {$EXTERNALSYM _RADIUS_ATTRIBUTE_ARRAY}
+  RADIUS_ATTRIBUTE_ARRAY = _RADIUS_ATTRIBUTE_ARRAY;
+  {$EXTERNALSYM RADIUS_ATTRIBUTE_ARRAY}
+  TRadiusAttributeArray = RADIUS_ATTRIBUTE_ARRAY;
+  PRadiusAttributeArray = PRADIUS_ATTRIBUTE_ARRAY;  
+
+//
+// Struct used to exchange information with the extension during request
+// processing. The extension must not modify this struct. All changes must be
+// made by using the supplied callback functions.
+//
+
+  PRADIUS_EXTENSION_CONTROL_BLOCK = ^RADIUS_EXTENSION_CONTROL_BLOCK;
+  {$EXTERNALSYM PRADIUS_EXTENSION_CONTROL_BLOCK}
+  _RADIUS_EXTENSION_CONTROL_BLOCK = record
+
+    // Size of this structure.
+
+    cbSize: DWORD;
+
+    // Version info of this specification.
+
+    dwVersion: DWORD;
+
+    // Point during request processing where the extension is being invoked.
+
+    repPoint: RADIUS_EXTENSION_POINT;
+
+    // Type of RADIUS request being processed.
+
+    rcRequestType: RADIUS_CODE;
+
+    //
+    // Final disposition of the request. This field must not be modified
+    // directly; use the SetResponseType callback function instead. At the
+    // repAuthentication point, this may be set to rcUnknown to indicate that no
+    // decision has been made yet.
+    //
+
+    rcResponseType: RADIUS_CODE;
+
+    //
+    // Returns the attributes received in the RADIUS request and any internal
+    // attributes describing the request state. The extenstion can modify the
+    // request attributes. For example, when IAS is acting as a RADIUS proxy, an
+    // extension could filter which attributes are forwarded to a remote RADIUS
+    // server.
+    //
+
+    GetRequest: function(This: PRADIUS_EXTENSION_CONTROL_BLOCK): PRADIUS_ATTRIBUTE_ARRAY; stdcall;
+
+    //
+    // Returns the attributes that will be sent in the response if the final
+    // outcome of request processing matches the specified response type.
+    // Returns NULL if rcResponseType is invalid. Note that an extension may
+    // retrieve and modify the attributes for any valid response type regardless
+    // of the request's current disposition. For example, an extension can set
+    // the response type to rcAccessAccept, but still add attributes to the
+    // Access-Reject in case the response type is overridden during further
+    // processing.
+    //
+
+    GetResponse: function(This: PRADIUS_EXTENSION_CONTROL_BLOCK; rcResponseType: RADIUS_CODE): PRADIUS_ATTRIBUTE_ARRAY; stdcall;
+
+    //
+    // Sets the final disposition of the request.
+    // Returns ERROR_INVALID_PARAMETER if the specified response type is invalid
+    // for the request type.
+    //
+
+    SetResponseType: function(This: PRADIUS_EXTENSION_CONTROL_BLOCK; rcResponseType: RADIUS_CODE): DWORD; stdcall;
+  end;
+  {$EXTERNALSYM _RADIUS_EXTENSION_CONTROL_BLOCK}
+  RADIUS_EXTENSION_CONTROL_BLOCK = _RADIUS_EXTENSION_CONTROL_BLOCK;
+  {$EXTERNALSYM RADIUS_EXTENSION_CONTROL_BLOCK}
+  TRadiusExtensionControlBlock = RADIUS_EXTENSION_CONTROL_BLOCK;
+  PRadiusExtensionControlBlock = PRADIUS_EXTENSION_CONTROL_BLOCK;
+
+//
+// If RadiusExtensionProcess2 exists, RadiusExtensionProcess and
+// RadiusExtensionProcessEx are ignored.
+//
+// Parameters:
+//   pECB      Info exchanged with the extension.
+//
+// Return Value:
+//     A return value other than NO_ERROR causes the request to be discarded.
+///
+
+const
+  RADIUS_EXTENSION_PROCESS2 = 'RadiusExtensionProcess2';
+  {$EXTERNALSYM RADIUS_EXTENSION_PROCESS2}
+
+type
+  PRADIUS_EXTENSION_PROCESS_2 = function(pECB: PRADIUS_EXTENSION_CONTROL_BLOCK): DWORD; stdcall;
+  {$EXTERNALSYM PRADIUS_EXTENSION_PROCESS_2}
+
+implementation
+
+end.

+ 705 - 0
packages/extra/winunits/jwaauthz.pas

@@ -0,0 +1,705 @@
+{******************************************************************************}
+{                                                                              }
+{ Authorization Framework API interface Unit for Object Pascal                 }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: authz.h, released August 2001. The original Pascal     }
+{ code is: Authz.pas, released October 2001. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaAuthz;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "authz.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType;
+
+//
+// Flags which may be used at the time of client context creation using a sid.
+//
+
+const
+  AUTHZ_SKIP_TOKEN_GROUPS = $2;
+  {$EXTERNALSYM AUTHZ_SKIP_TOKEN_GROUPS}
+  AUTHZ_REQUIRE_S4U_LOGON = $4;
+  {$EXTERNALSYM AUTHZ_REQUIRE_S4U_LOGON}
+
+type
+  AUTHZ_ACCESS_CHECK_RESULTS_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_ACCESS_CHECK_RESULTS_HANDLE}
+  AUTHZ_CLIENT_CONTEXT_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_CLIENT_CONTEXT_HANDLE}
+  AUTHZ_RESOURCE_MANAGER_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_RESOURCE_MANAGER_HANDLE}
+  AUTHZ_AUDIT_EVENT_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_HANDLE}
+  AUTHZ_AUDIT_EVENT_TYPE_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_TYPE_HANDLE}
+  AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE = HANDLE;
+  {$EXTERNALSYM AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE}
+
+  PAUTHZ_ACCESS_CHECK_RESULTS_HANDLE = ^AUTHZ_ACCESS_CHECK_RESULTS_HANDLE;
+  {$EXTERNALSYM PAUTHZ_ACCESS_CHECK_RESULTS_HANDLE}
+  PAUTHZ_CLIENT_CONTEXT_HANDLE = ^AUTHZ_CLIENT_CONTEXT_HANDLE;
+  {$EXTERNALSYM PAUTHZ_CLIENT_CONTEXT_HANDLE}
+  PAUTHZ_RESOURCE_MANAGER_HANDLE = ^AUTHZ_RESOURCE_MANAGER_HANDLE;
+  {$EXTERNALSYM PAUTHZ_RESOURCE_MANAGER_HANDLE}
+  PAUTHZ_AUDIT_EVENT_HANDLE = ^AUTHZ_AUDIT_EVENT_HANDLE;
+  {$EXTERNALSYM PAUTHZ_AUDIT_EVENT_HANDLE}
+  PAUTHZ_AUDIT_EVENT_TYPE_HANDLE = ^AUTHZ_AUDIT_EVENT_TYPE_HANDLE;
+  {$EXTERNALSYM PAUTHZ_AUDIT_EVENT_TYPE_HANDLE}
+  PAUTHZ_SECURITY_EVENT_PROVIDER_HANDLE = ^AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE;
+  {$EXTERNALSYM PAUTHZ_SECURITY_EVENT_PROVIDER_HANDLE}
+
+//
+// Structure defining the access check request.
+//
+
+  PAUTHZ_ACCESS_REQUEST = ^AUTHZ_ACCESS_REQUEST;
+  {$EXTERNALSYM PAUTHZ_ACCESS_REQUEST}
+  _AUTHZ_ACCESS_REQUEST = record
+    DesiredAccess: ACCESS_MASK;
+    //
+    // To replace the principal self sid in the acl.
+    //
+    PrincipalSelfSid: PSID;
+    //
+    // Object type list represented by an array of (level, guid) pair and the
+    // number of elements in the array. This is a post-fix representation of the
+    // object tree.
+    // These fields should be set to NULL and 0 respectively except when per
+    // property access is desired.
+    //
+    ObjectTypeList: POBJECT_TYPE_LIST;
+    ObjectTypeListLength: DWORD;
+    //
+    // To support completely business rules based access. This will be passed as
+    // input to the callback access check function. Access check algorithm does
+    // not interpret these.
+    //
+    OptionalArguments: PVOID;
+  end;
+  {$EXTERNALSYM _AUTHZ_ACCESS_REQUEST}
+  AUTHZ_ACCESS_REQUEST = _AUTHZ_ACCESS_REQUEST;
+  {$EXTERNALSYM AUTHZ_ACCESS_REQUEST}
+  TAuthzAccessRequest = AUTHZ_ACCESS_REQUEST;
+  PAuthzAccessRequest = PAUTHZ_ACCESS_REQUEST;
+
+//
+// Structure to return the results of the access check call.
+//
+
+const
+  AUTHZ_GENERATE_SUCCESS_AUDIT = $1;
+  {$EXTERNALSYM AUTHZ_GENERATE_SUCCESS_AUDIT}
+  AUTHZ_GENERATE_FAILURE_AUDIT = $2;
+  {$EXTERNALSYM AUTHZ_GENERATE_FAILURE_AUDIT}
+
+type
+  PAUTHZ_ACCESS_REPLY = ^AUTHZ_ACCESS_REPLY;
+  {$EXTERNALSYM PAUTHZ_ACCESS_REPLY}
+  _AUTHZ_ACCESS_REPLY = record
+    //
+    // The length of the array representing the object type list structure. If
+    // no object type is used to represent the object, then the length must be
+    // set to 1.
+    //
+    // Note: This parameter must be filled!
+    //
+    ResultListLength: DWORD;
+    //
+    // Array of granted access masks. This memory is allocated by the RM. Access
+    // check routines just fill in the values.
+    //
+    GrantedAccessMask: PACCESS_MASK;
+    //
+    // Array of SACL evaluation results.  This memory is allocated by the RM, if SACL
+    // evaluation results are desired. Access check routines just fill in the values.
+    // Sacl evaluation will only be performed if auditing is requested.
+    //
+    SaclEvaluationResults: PDWORD;
+    //
+    // Array of results for each element of the array. This memory is allocated
+    // by the RM. Access check routines just fill in the values.
+    //
+    Error: PDWORD;
+  end;
+  {$EXTERNALSYM _AUTHZ_ACCESS_REPLY}
+  AUTHZ_ACCESS_REPLY = _AUTHZ_ACCESS_REPLY;
+  {$EXTERNALSYM AUTHZ_ACCESS_REPLY}
+  TAuthzAccessReply = AUTHZ_ACCESS_REPLY;
+  PAuthzAccessReply = PAUTHZ_ACCESS_REPLY;
+
+//
+// Typedefs for callback functions to be provided by the resource manager.
+//
+
+//
+// Callback access check function takes in
+//     AuthzClientContext - a client context
+//     pAce - pointer to a callback ace
+//     pArgs - Optional arguments that were passed to AuthzAccessCheck thru
+//             AuthzAccessRequest->OptionalArguments are passed back here.
+//     pbAceApplicable - The resource manager must supply whether the ace should
+//         be used in the computation of access evaluation
+//
+// Returns
+//     TRUE if the API succeeded.
+//     FALSE on any intermediate errors (like failed memory allocation)
+//         In case of failure, the caller must use SetLastError(ErrorValue).
+//
+
+type
+  PFN_AUTHZ_DYNAMIC_ACCESS_CHECK = function(hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE;
+    pAce: PACE_HEADER; pArgs: PVOID; var pbAceApplicable: BOOL): BOOL; stdcall;
+  {$EXTERNALSYM PFN_AUTHZ_DYNAMIC_ACCESS_CHECK}
+  PFnAuthzDynamicAccessCheck = PFN_AUTHZ_DYNAMIC_ACCESS_CHECK;
+
+//
+// Callback compute dynamic groups function takes in
+//     AuthzClientContext - a client context
+//     pArgs - Optional arguments that supplied to AuthzInitializeClientContext*
+//         thru DynamicGroupArgs are passed back here..
+//     pSidAttrArray - To allocate and return an array of (sids, attribute)
+//         pairs to be added to the normal part of the client context.
+//     pSidCount - Number of elements in pSidAttrArray
+//     pRestrictedSidAttrArray - To allocate and return an array of (sids, attribute)
+//         pairs to be added to the restricted part of the client context.
+//     pRestrictedSidCount - Number of elements in pRestrictedSidAttrArray
+//
+// Note:
+//    Memory returned thru both these array will be freed by the callback
+//    free function defined by the resource manager.
+//
+// Returns
+//     TRUE if the API succeeded.
+//     FALSE on any intermediate errors (like failed memory allocation)
+//         In case of failure, the caller must use SetLastError(ErrorValue).
+//
+
+type
+  PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS = function(hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE;
+    Args: PVOID; var pSidAttrArray: PSID_AND_ATTRIBUTES; var pSidCount: DWORD;
+    var pRestrictedSidAttrArray: PSID_AND_ATTRIBUTES; var pRestrictedSidCount: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS}
+  PFnAuthzComputeDynamicGroups = PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS;
+
+//
+// Callback free function takes in
+//     pSidAttrArray - To be freed. This has been allocated by the compute
+//     dynamic groups function.
+//
+
+  PFN_AUTHZ_FREE_DYNAMIC_GROUPS = procedure(pSidAttrArray: PSID_AND_ATTRIBUTES); stdcall;
+  {$EXTERNALSYM PFN_AUTHZ_FREE_DYNAMIC_GROUPS}
+  PFnAuthzFreeDynamicGroups = PFN_AUTHZ_FREE_DYNAMIC_GROUPS;
+
+//
+// Valid flags for AuthzAccessCheck
+//
+
+const
+  AUTHZ_ACCESS_CHECK_NO_DEEP_COPY_SD = $00000001;
+  {$EXTERNALSYM AUTHZ_ACCESS_CHECK_NO_DEEP_COPY_SD}
+
+function AuthzAccessCheck(Flags: DWORD; hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE; pRequest: PAUTHZ_ACCESS_REQUEST;
+  hAuditEvent: AUTHZ_AUDIT_EVENT_HANDLE; pSecurityDescriptor: PSECURITY_DESCRIPTOR; OptionalSecurityDescriptorArray: PPSECURITY_DESCRIPTOR;
+  OptionalSecurityDescriptorCount: DWORD; pReply: PAUTHZ_ACCESS_REPLY; phAccessCheckResultsOPTIONAL: PAUTHZ_ACCESS_CHECK_RESULTS_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzAccessCheck}
+
+function AuthzCachedAccessCheck(Flags: DWORD; hAccessCheckResults: AUTHZ_ACCESS_CHECK_RESULTS_HANDLE; pRequest: PAUTHZ_ACCESS_REQUEST; hAuditEvent: AUTHZ_AUDIT_EVENT_HANDLE; pReply: PAUTHZ_ACCESS_REPLY): BOOL; stdcall;
+{$EXTERNALSYM AuthzCachedAccessCheck}
+
+function AuthzOpenObjectAudit(Flags: DWORD; hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE; pRequest: PAUTHZ_ACCESS_REQUEST; hAuditEvent: AUTHZ_AUDIT_EVENT_HANDLE; pSecurityDescriptor: PSECURITY_DESCRIPTOR; OptionalSecurityDescriptorArray: PPSECURITY_DESCRIPTOR; OptionalSecurityDescriptorCount: DWORD; pReply: PAUTHZ_ACCESS_REPLY): BOOL; stdcall;
+{$EXTERNALSYM AuthzOpenObjectAudit}
+
+function AuthzFreeHandle(hAccessCheckResults: AUTHZ_ACCESS_CHECK_RESULTS_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzFreeHandle}
+
+//
+// Flags for AuthzInitializeResourceManager
+//
+
+const
+  AUTHZ_RM_FLAG_NO_AUDIT = $1;
+  {$EXTERNALSYM AUTHZ_RM_FLAG_NO_AUDIT}
+
+  AUTHZ_RM_FLAG_INITIALIZE_UNDER_IMPERSONATION = $2;
+  {$EXTERNALSYM AUTHZ_RM_FLAG_INITIALIZE_UNDER_IMPERSONATION}
+
+  AUTHZ_VALID_RM_INIT_FLAGS = AUTHZ_RM_FLAG_NO_AUDIT or AUTHZ_RM_FLAG_INITIALIZE_UNDER_IMPERSONATION;
+  {$EXTERNALSYM AUTHZ_VALID_RM_INIT_FLAGS}
+
+function AuthzInitializeResourceManager(Flags: DWORD; pfnDynamicAccessCheck: PFN_AUTHZ_DYNAMIC_ACCESS_CHECK; pfnComputeDynamicGroups: PFN_AUTHZ_COMPUTE_DYNAMIC_GROUPS; pfnFreeDynamicGroups: PFN_AUTHZ_FREE_DYNAMIC_GROUPS; szResourceManagerName: LPCWSTR; phAuthzResourceManager: PAUTHZ_RESOURCE_MANAGER_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeResourceManager}
+
+function AuthzFreeResourceManager(hAuthzResourceManager: AUTHZ_RESOURCE_MANAGER_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzFreeResourceManager}
+
+function AuthzInitializeContextFromToken(Flags: DWORD; TokenHandle: HANDLE; hAuthzResourceManager: AUTHZ_RESOURCE_MANAGER_HANDLE; pExpirationTime: PLARGE_INTEGER; Identifier: LUID; DynamicGroupArgs: PVOID; phAuthzClientContext: PAUTHZ_CLIENT_CONTEXT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeContextFromToken}
+
+function AuthzInitializeContextFromSid(Flags: DWORD; UserSid: PSID; hAuthzResourceManager: AUTHZ_RESOURCE_MANAGER_HANDLE; pExpirationTime: PLARGE_INTEGER; Identifier: LUID; DynamicGroupArgs: PVOID; phAuthzClientContext: PAUTHZ_CLIENT_CONTEXT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeContextFromSid}
+
+function AuthzInitializeContextFromAuthzContext(Flags: DWORD; hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE; pExpirationTime: PLARGE_INTEGER; Identifier: LUID; DynamicGroupArgs: PVOID; phNewAuthzClientContext: PAUTHZ_CLIENT_CONTEXT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeContextFromAuthzContext}
+
+function AuthzAddSidsToContext(hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE; Sids: PSID_AND_ATTRIBUTES; SidCount: DWORD; RestrictedSids: PSID_AND_ATTRIBUTES; RestrictedSidCount: DWORD; phNewAuthzClientContext: PAUTHZ_CLIENT_CONTEXT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzAddSidsToContext}
+
+//
+// Enumeration type to be used to specify the type of information to be
+// retrieved from an existing AuthzClientContext.
+//
+
+type
+  _AUTHZ_CONTEXT_INFORMATION_CLASS = (
+    AuthzContextInfo__0,
+    AuthzContextInfoUserSid,
+    AuthzContextInfoGroupsSids,
+    AuthzContextInfoRestrictedSids,
+    AuthzContextInfoPrivileges,
+    AuthzContextInfoExpirationTime,
+    AuthzContextInfoServerContext,
+    AuthzContextInfoIdentifier,
+    AuthzContextInfoSource,
+    AuthzContextInfoAll,
+    AuthzContextInfoAuthenticationId);
+  {$EXTERNALSYM _AUTHZ_CONTEXT_INFORMATION_CLASS}
+  AUTHZ_CONTEXT_INFORMATION_CLASS = _AUTHZ_CONTEXT_INFORMATION_CLASS;
+  {$EXTERNALSYM AUTHZ_CONTEXT_INFORMATION_CLASS}
+  TAuthzContextInformationClass = AUTHZ_CONTEXT_INFORMATION_CLASS;
+
+function AuthzGetInformationFromContext(hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE;
+  InfoClass: AUTHZ_CONTEXT_INFORMATION_CLASS; BufferSize: DWORD; pSizeRequired: PDWORD;
+  Buffer: PVOID): BOOL; stdcall;
+{$EXTERNALSYM AuthzGetInformationFromContext}
+
+function AuthzFreeContext(hAuthzClientContext: AUTHZ_CLIENT_CONTEXT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzFreeContext}
+
+//
+// Valid flags that may be used in AuthzInitializeObjectAccessAuditEvent().
+//
+
+const
+  AUTHZ_NO_SUCCESS_AUDIT = $00000001;
+  {$EXTERNALSYM AUTHZ_NO_SUCCESS_AUDIT}
+  AUTHZ_NO_FAILURE_AUDIT = $00000002;
+  {$EXTERNALSYM AUTHZ_NO_FAILURE_AUDIT}
+  AUTHZ_NO_ALLOC_STRINGS = $00000004;
+  {$EXTERNALSYM AUTHZ_NO_ALLOC_STRINGS}
+
+  AUTHZ_VALID_OBJECT_ACCESS_AUDIT_FLAGS = AUTHZ_NO_SUCCESS_AUDIT or AUTHZ_NO_FAILURE_AUDIT or AUTHZ_NO_ALLOC_STRINGS;
+  {$EXTERNALSYM AUTHZ_VALID_OBJECT_ACCESS_AUDIT_FLAGS}
+
+function AuthzInitializeObjectAccessAuditEvent(Flags: DWORD; hAuditEventType: AUTHZ_AUDIT_EVENT_TYPE_HANDLE;
+  szOperationType: PWSTR; szObjectType: PWSTR; szObjectName: PWSTR; szAdditionalInfo: PWSTR;
+  phAuditEvent: PAUTHZ_AUDIT_EVENT_HANDLE; dwAdditionalParameterCount: DWORD {, ...}): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeObjectAccessAuditEvent}
+
+function AuthzInitializeObjectAccessAuditEvent2(Flags: DWORD; hAuditEventType: AUTHZ_AUDIT_EVENT_TYPE_HANDLE;
+  szOperationType: PWSTR; szObjectType: PWSTR; szObjectName: PWSTR; szAdditionalInfo, szAdditionalInfo2: PWSTR;
+  phAuditEvent: PAUTHZ_AUDIT_EVENT_HANDLE; dwAdditionalParameterCount: DWORD {, ...}): BOOL; stdcall;
+{$EXTERNALSYM AuthzInitializeObjectAccessAuditEvent2}
+
+//
+// Enumeration type to be used to specify the type of information to be
+// retrieved from an existing AUTHZ_AUDIT_EVENT_HANDLE.
+//
+
+type
+  _AUTHZ_AUDIT_EVENT_INFORMATION_CLASS = (
+    AuthzAuditEvent__0,
+    AuthzAuditEventInfoFlags,
+    AuthzAuditEventInfoOperationType,
+    AuthzAuditEventInfoObjectType,
+    AuthzAuditEventInfoObjectName,
+    AuthzAuditEventInfoAdditionalInfo);
+  {$EXTERNALSYM _AUTHZ_AUDIT_EVENT_INFORMATION_CLASS}
+  AUTHZ_AUDIT_EVENT_INFORMATION_CLASS = _AUTHZ_AUDIT_EVENT_INFORMATION_CLASS;
+  {$EXTERNALSYM AUTHZ_AUDIT_EVENT_INFORMATION_CLASS}
+  AuthzAuditEventInformationClass = AUTHZ_AUDIT_EVENT_INFORMATION_CLASS;
+
+// todo this one seems not to be exported from authz.dll
+
+function AuthzGetInformationFromAuditEvent(hAuditEvent: AUTHZ_AUDIT_EVENT_HANDLE; InfoClass: AUTHZ_AUDIT_EVENT_INFORMATION_CLASS; BufferSize: DWORD; pSizeRequired: PDWORD; Buffer: PVOID): BOOL; stdcall;
+{$EXTERNALSYM AuthzGetInformationFromAuditEvent}
+
+function AuthzFreeAuditEvent(hAuditEvent: AUTHZ_AUDIT_EVENT_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM AuthzFreeAuditEvent}
+
+(* TODO
+//
+// Support for generic auditing.
+//
+
+typedef struct _AUTHZ_REGISTRATION_OBJECT_TYPE_NAME_OFFSET
+{
+    PWSTR szObjectTypeName;
+    DWORD dwOffset;
+} AUTHZ_REGISTRATION_OBJECT_TYPE_NAME_OFFSET, *PAUTHZ_REGISTRATION_OBJECT_TYPE_NAME_OFFSET;
+
+typedef struct _AUTHZ_SOURCE_SCHEMA_REGISTRATION
+{
+    DWORD dwFlags;
+    PWSTR szEventSourceName;
+    PWSTR szEventMessageFile;
+    PWSTR szEventSourceXmlSchemaFile;
+    PWSTR szEventAccessStringsFile;
+    PWSTR szExecutableImagePath;
+    PVOID pReserved;
+    DWORD dwObjectTypeNameCount;
+    AUTHZ_REGISTRATION_OBJECT_TYPE_NAME_OFFSET ObjectTypeNames[ANYSIZE_ARRAY];
+} AUTHZ_SOURCE_SCHEMA_REGISTRATION, *PAUTHZ_SOURCE_SCHEMA_REGISTRATION;
+
+#define AUTHZ_FLAG_ALLOW_MULTIPLE_SOURCE_INSTANCES 0x1
+
+AUTHZAPI
+BOOL 
+WINAPI
+AuthzInstallSecurityEventSource(
+    IN DWORD                             dwFlags,
+    IN PAUTHZ_SOURCE_SCHEMA_REGISTRATION pRegistration
+    );
+
+AUTHZAPI
+BOOL
+WINAPI
+AuthzUninstallSecurityEventSource(
+    IN DWORD  dwFlags,
+    IN PCWSTR szEventSourceName
+    );
+
+AUTHZAPI
+BOOL
+WINAPI
+AuthzEnumerateSecurityEventSources(
+    IN     DWORD                             dwFlags,
+    OUT    PAUTHZ_SOURCE_SCHEMA_REGISTRATION Buffer,
+    OUT    PDWORD                            pdwCount,
+    IN OUT PDWORD                            pdwLength
+    );
+    
+AUTHZAPI
+BOOL
+WINAPI
+AuthzRegisterSecurityEventSource(
+    IN  DWORD                                 dwFlags,
+    IN  PCWSTR                                szEventSourceName,
+    OUT PAUTHZ_SECURITY_EVENT_PROVIDER_HANDLE phEventProvider
+    );
+    
+AUTHZAPI
+BOOL
+WINAPI
+AuthzUnregisterSecurityEventSource(
+    IN     DWORD                                 dwFlags,
+    IN OUT PAUTHZ_SECURITY_EVENT_PROVIDER_HANDLE phEventProvider
+    );
+
+AUTHZAPI
+BOOL
+WINAPI
+AuthzReportSecurityEvent(
+    IN     DWORD                                dwFlags,
+    IN OUT AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE hEventProvider,
+    IN     DWORD                                dwAuditId,
+    IN     PSID                                 pUserSid        OPTIONAL,
+    IN     DWORD                                dwCount,
+    ...    
+    );
+
+AUTHZAPI
+BOOL
+WINAPI
+AuthzReportSecurityEventFromParams(
+    IN     DWORD                                dwFlags,
+    IN OUT AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE hEventProvider,
+    IN     DWORD                                dwAuditId,
+    IN     PSID                                 pUserSid       OPTIONAL,
+    IN     PAUDIT_PARAMS                        pParams
+    );
+*)
+
+implementation
+
+const
+  authzlib = 'authz.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _AuthzAccessCheck: Pointer;
+
+function AuthzAccessCheck;
+begin
+  GetProcedureAddress(_AuthzAccessCheck, authzlib, 'AuthzAccessCheck');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzAccessCheck]
+  end;
+end;
+
+var
+  _AuthzCachedAccessCheck: Pointer;
+
+function AuthzCachedAccessCheck;
+begin
+  GetProcedureAddress(_AuthzCachedAccessCheck, authzlib, 'AuthzCachedAccessCheck');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzCachedAccessCheck]
+  end;
+end;
+
+var
+  _AuthzOpenObjectAudit: Pointer;
+
+function AuthzOpenObjectAudit;
+begin
+  GetProcedureAddress(_AuthzOpenObjectAudit, authzlib, 'AuthzOpenObjectAudit');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzOpenObjectAudit]
+  end;
+end;
+
+var
+  _AuthzFreeHandle: Pointer;
+
+function AuthzFreeHandle;
+begin
+  GetProcedureAddress(_AuthzFreeHandle, authzlib, 'AuthzFreeHandle');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzFreeHandle]
+  end;
+end;
+
+var
+  _AuthzInitializeResourceManager: Pointer;
+
+function AuthzInitializeResourceManager;
+begin
+  GetProcedureAddress(_AuthzInitializeResourceManager, authzlib, 'AuthzInitializeResourceManager');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitializeResourceManager]
+  end;
+end;
+
+var
+  _AuthzFreeResourceManager: Pointer;
+
+function AuthzFreeResourceManager;
+begin
+  GetProcedureAddress(_AuthzFreeResourceManager, authzlib, 'AuthzFreeResourceManager');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzFreeResourceManager]
+  end;
+end;
+
+var
+  _AuthzInitializeContextFromToken: Pointer;
+
+function AuthzInitializeContextFromToken;
+begin
+  GetProcedureAddress(_AuthzInitializeContextFromToken, authzlib, 'AuthzInitializeContextFromToken');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitializeContextFromToken]
+  end;
+end;
+
+var
+  _AuthzInitializeContextFromSid: Pointer;
+
+function AuthzInitializeContextFromSid;
+begin
+  GetProcedureAddress(_AuthzInitializeContextFromSid, authzlib, 'AuthzInitializeContextFromSid');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitializeContextFromSid]
+  end;
+end;
+
+var
+  _AuthzInitCxtFromAuthzCxt: Pointer;
+
+function AuthzInitializeContextFromAuthzContext;
+begin
+  GetProcedureAddress(_AuthzInitCxtFromAuthzCxt, authzlib, 'AuthzInitializeContextFromAuthzContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitCxtFromAuthzCxt]
+  end;
+end;
+
+var
+  _AuthzAddSidsToContext: Pointer;
+
+function AuthzAddSidsToContext;
+begin
+  GetProcedureAddress(_AuthzAddSidsToContext, authzlib, 'AuthzAddSidsToContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzAddSidsToContext]
+  end;
+end;
+
+var
+  _AuthzGetInformationFromContext: Pointer;
+
+function AuthzGetInformationFromContext;
+begin
+  GetProcedureAddress(_AuthzGetInformationFromContext, authzlib, 'AuthzGetInformationFromContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzGetInformationFromContext]
+  end;
+end;
+
+var
+  _AuthzFreeContext: Pointer;
+
+function AuthzFreeContext;
+begin
+  GetProcedureAddress(_AuthzFreeContext, authzlib, 'AuthzFreeContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzFreeContext]
+  end;
+end;
+
+var
+  _AuthzInitObjAccAuditEvent: Pointer;
+
+function AuthzInitializeObjectAccessAuditEvent;
+begin
+  GetProcedureAddress(_AuthzInitObjAccAuditEvent, authzlib, 'AuthzInitializeObjectAccessAuditEvent');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitObjAccAuditEvent]
+  end;
+end;
+
+var
+  _AuthzInitObjAccAuditEvent2: Pointer;
+
+function AuthzInitializeObjectAccessAuditEvent2;
+begin
+  GetProcedureAddress(_AuthzInitObjAccAuditEvent2, authzlib, 'AuthzInitializeObjectAccessAuditEvent2');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzInitObjAccAuditEvent2]
+  end;
+end;
+
+var
+  _AuthzGetInfoFromAuditEvent: Pointer;
+
+function AuthzGetInformationFromAuditEvent;
+begin
+  GetProcedureAddress(_AuthzGetInfoFromAuditEvent, authzlib, 'AuthzGetInformationFromAuditEvent');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzGetInfoFromAuditEvent]
+  end;
+end;
+
+var
+  _AuthzFreeAuditEvent: Pointer;
+
+function AuthzFreeAuditEvent;
+begin
+  GetProcedureAddress(_AuthzFreeAuditEvent, authzlib, 'AuthzFreeAuditEvent');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AuthzFreeAuditEvent]
+  end;
+end;
+
+{$ELSE}
+
+function AuthzAccessCheck; external authzlib name 'AuthzAccessCheck';
+function AuthzCachedAccessCheck; external authzlib name 'AuthzCachedAccessCheck';
+function AuthzOpenObjectAudit; external authzlib name 'AuthzOpenObjectAudit';
+function AuthzFreeHandle; external authzlib name 'AuthzFreeHandle';
+function AuthzInitializeResourceManager; external authzlib name 'AuthzInitializeResourceManager';
+function AuthzFreeResourceManager; external authzlib name 'AuthzFreeResourceManager';
+function AuthzInitializeContextFromToken; external authzlib name 'AuthzInitializeContextFromToken';
+function AuthzInitializeContextFromSid; external authzlib name 'AuthzInitializeContextFromSid';
+function AuthzInitializeContextFromAuthzContext; external authzlib name 'AuthzInitializeContextFromAuthzContext';
+function AuthzAddSidsToContext; external authzlib name 'AuthzAddSidsToContext';
+function AuthzGetInformationFromContext; external authzlib name 'AuthzGetInformationFromContext';
+function AuthzFreeContext; external authzlib name 'AuthzFreeContext';
+function AuthzInitializeObjectAccessAuditEvent; external authzlib name 'AuthzInitializeObjectAccessAuditEvent';
+function AuthzInitializeObjectAccessAuditEvent2; external authzlib name 'AuthzInitializeObjectAccessAuditEvent2';
+function AuthzGetInformationFromAuditEvent; external authzlib name 'AuthzGetInformationFromAuditEvent';
+function AuthzFreeAuditEvent; external authzlib name 'AuthzFreeAuditEvent';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 323 - 0
packages/extra/winunits/jwabatclass.pas

@@ -0,0 +1,323 @@
+{******************************************************************************}
+{                                                                              }
+{ Battery class driver API interface Unit for Object Pascal                    }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: batclass.h, released June 2000. The original Pascal    }
+{ code is: BatClass.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBatClass;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "BatClass.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinIoctl, JwaWinType;
+
+//
+// Battery device GUID
+//
+
+const
+  GUID_DEVICE_BATTERY: TGUID = (D1:$72631e54; D2:$78A4; D3:$11d0; D4:($bc, $f7, $00, $aa, $00, $b7, $b3, $2a));
+  {$EXTERNALSYM GUID_DEVICE_BATTERY}
+  BATTERY_STATUS_WMI_GUID: TGUID = (D1:$fc4670d1; D2:$ebbf; D3:$416e; D4:($87, $ce, $37, $4a, $4e, $bc, $11, $1a));
+  {$EXTERNALSYM BATTERY_STATUS_WMI_GUID}
+  BATTERY_RUNTIME_WMI_GUID: TGUID = (D1:$535a3767; D2:$1ac2; D3:$49bc; D4:($a0, $77, $3f, $7a, $02, $e4, $0a, $ec));
+  {$EXTERNALSYM BATTERY_RUNTIME_WMI_GUID}
+  BATTERY_TEMPERATURE_WMI_GUID: TGUID = (D1:$1a52a14d; D2:$adce; D3:$4a44; D4:($9a, $3e, $c8, $d8, $f1, $5f, $f2, $c2));
+  {$EXTERNALSYM BATTERY_TEMPERATURE_WMI_GUID}
+  BATTERY_FULL_CHARGED_CAPACITY_WMI_GUID: TGUID = (D1:$40b40565; D2:$96f7; D3:$4435; D4:($86, $94, $97, $e0, $e4, $39, $59, $05));
+  {$EXTERNALSYM BATTERY_FULL_CHARGED_CAPACITY_WMI_GUID}
+  BATTERY_CYCLE_COUNT_WMI_GUID: TGUID = (D1:$ef98db24; D2:$0014; D3:$4c25; D4:($a5, $0b, $c7, $24, $ae, $5c, $d3, $71));
+  {$EXTERNALSYM BATTERY_CYCLE_COUNT_WMI_GUID}
+  BATTERY_STATIC_DATA_WMI_GUID: TGUID = (D1:$05e1e463; D2:$e4e2; D3:$4ea9; D4:($80, $cb, $9b, $d4, $b3, $ca, $06, $55));
+  {$EXTERNALSYM BATTERY_STATIC_DATA_WMI_GUID}
+  BATTERY_STATUS_CHANGE_WMI_GUID: TGUID = (D1:$cddfa0c3; D2:$7c5b; D3:$4e43; D4:($a0, $34, $05, $9f, $a5, $b8, $43, $64));
+  {$EXTERNALSYM BATTERY_STATUS_CHANGE_WMI_GUID}
+  BATTERY_TAG_CHANGE_WMI_GUID: TGUID = (D1:$5e1f6e19; D2:$8786; D3:$4d23; D4:($94, $fc, $9e, $74, $6b, $d5, $d8, $88));
+  {$EXTERNALSYM BATTERY_TAG_CHANGE_WMI_GUID}
+
+//
+// Battery driver interface
+//
+// IOCTL_BATTERY_QUERY_TAG
+// IOCTL_BATTERY_QUERY_INFORMATION
+// IOCTL_BATTERY_SET_INFORMATION
+// IOCTL_BATTERY_QUERY_STATUS
+//
+
+//
+// IOCTL_BATTERY_QUERY_TAG
+//
+
+  IOCTL_BATTERY_QUERY_TAG = (FILE_DEVICE_BATTERY shl 16) or (FILE_READ_ACCESS shl 14) or ($10 shl 2) or METHOD_BUFFERED;
+  {$EXTERNALSYM IOCTL_BATTERY_QUERY_TAG}
+
+  BATTERY_TAG_INVALID = 0;
+  {$EXTERNALSYM BATTERY_TAG_INVALID}
+
+//
+// IOCTL_BATTERY_QUERY_INFORMATION
+//
+
+  IOCTL_BATTERY_QUERY_INFORMATION = (FILE_DEVICE_BATTERY shl 16) or (FILE_READ_ACCESS shl 14) or ($11 shl 2) or METHOD_BUFFERED;
+  {$EXTERNALSYM IOCTL_BATTERY_QUERY_INFORMATION}
+
+type
+  BATTERY_QUERY_INFORMATION_LEVEL = (
+    BatteryInformation,
+    BatteryGranularityInformation,
+    BatteryTemperature,
+    BatteryEstimatedTime,
+    BatteryDeviceName,
+    BatteryManufactureDate,
+    BatteryManufactureName,
+    BatteryUniqueID,
+    BatterySerialNumber);
+  {$EXTERNALSYM BATTERY_QUERY_INFORMATION_LEVEL}
+  TBatteryQueryInformationLevel = BATTERY_QUERY_INFORMATION_LEVEL;
+
+  _BATTERY_QUERY_INFORMATION = record
+    BatteryTag: ULONG;
+    InformationLevel: BATTERY_QUERY_INFORMATION_LEVEL;
+    AtRate: LONG;
+  end;
+  {$EXTERNALSYM _BATTERY_QUERY_INFORMATION}
+  BATTERY_QUERY_INFORMATION = _BATTERY_QUERY_INFORMATION;
+  {$EXTERNALSYM BATTERY_QUERY_INFORMATION}
+  PBATTERY_QUERY_INFORMATION = ^BATTERY_QUERY_INFORMATION;
+  {$EXTERNALSYM PBATTERY_QUERY_INFORMATION}
+  TBatteryQueryInformation = BATTERY_QUERY_INFORMATION;
+  PBatteryQueryInformation = PBATTERY_QUERY_INFORMATION;
+
+//
+// Format of data returned when
+// BATTERY_INFORMATION_LEVEL = BatteryInformation
+//
+
+  _BATTERY_INFORMATION = record
+    Capabilities: ULONG;
+    Technology: UCHAR;
+    Reserved: array [0..2] of UCHAR;
+    Chemistry: array [0..3] of UCHAR;
+    DesignedCapacity: ULONG;
+    FullChargedCapacity: ULONG;
+    DefaultAlert1: ULONG;
+    DefaultAlert2: ULONG;
+    CriticalBias: ULONG;
+    CycleCount: ULONG;
+  end;
+  {$EXTERNALSYM _BATTERY_INFORMATION}
+  BATTERY_INFORMATION = _BATTERY_INFORMATION;
+  {$EXTERNALSYM BATTERY_INFORMATION}
+  PBATTERY_INFORMATION = ^BATTERY_INFORMATION;
+  {$EXTERNALSYM PBATTERY_INFORMATION}
+  TBatteryInformation = BATTERY_INFORMATION;
+  PBatteryInformation = PBATTERY_INFORMATION;
+
+//
+// BATTERY_INFORMATION.Capabilities flags
+//
+
+const
+  BATTERY_SYSTEM_BATTERY          = DWORD($80000000);
+  {$EXTERNALSYM BATTERY_SYSTEM_BATTERY}
+  BATTERY_CAPACITY_RELATIVE       = $40000000;
+  {$EXTERNALSYM BATTERY_CAPACITY_RELATIVE}
+  BATTERY_IS_SHORT_TERM           = $20000000;
+  {$EXTERNALSYM BATTERY_IS_SHORT_TERM}
+  BATTERY_SET_CHARGE_SUPPORTED    = $00000001;
+  {$EXTERNALSYM BATTERY_SET_CHARGE_SUPPORTED}
+  BATTERY_SET_DISCHARGE_SUPPORTED = $00000002;
+  {$EXTERNALSYM BATTERY_SET_DISCHARGE_SUPPORTED}
+  BATTERY_SET_RESUME_SUPPORTED    = $00000004;
+  {$EXTERNALSYM BATTERY_SET_RESUME_SUPPORTED}
+
+//
+// BATTERY_INFORMATION.XXXCapacity constants
+//
+
+  BATTERY_UNKNOWN_CAPACITY = DWORD($FFFFFFFF);
+  {$EXTERNALSYM BATTERY_UNKNOWN_CAPACITY}
+
+//
+// BatteryEstimatedTime constant
+//
+
+  BATTERY_UNKNOWN_TIME = DWORD($FFFFFFFF);
+  {$EXTERNALSYM BATTERY_UNKNOWN_TIME}
+
+//
+// Max battery driver BATTERY_QUERY_INFORMATION_LEVEL string storage
+// size in bytes.
+//
+
+  MAX_BATTERY_STRING_SIZE = 128;
+  {$EXTERNALSYM MAX_BATTERY_STRING_SIZE}
+
+//
+// Struct for accessing the packed date format in BatteryManufactureDate.
+//
+
+type
+  _BATTERY_MANUFACTURE_DATE = record
+    Day: UCHAR;
+    Month: UCHAR;
+    Year: USHORT;
+  end;
+  {$EXTERNALSYM _BATTERY_MANUFACTURE_DATE}
+  BATTERY_MANUFACTURE_DATE = _BATTERY_MANUFACTURE_DATE;
+  {$EXTERNALSYM BATTERY_MANUFACTURE_DATE}
+  PBATTERY_MANUFACTURE_DATE = ^BATTERY_MANUFACTURE_DATE;
+  {$EXTERNALSYM PBATTERY_MANUFACTURE_DATE}
+  TBatteryManufactureDate = BATTERY_MANUFACTURE_DATE;
+  PBatteryManufactureDate = PBATTERY_MANUFACTURE_DATE;
+
+//
+// IOCTL_BATTERY_SET_INFORMATION
+//
+
+const
+  IOCTL_BATTERY_SET_INFORMATION = (FILE_DEVICE_BATTERY shl 16) or (FILE_WRITE_ACCESS shl 14) or ($12 shl 2) or METHOD_BUFFERED;
+  {$EXTERNALSYM IOCTL_BATTERY_SET_INFORMATION}
+
+type
+  BATTERY_SET_INFORMATION_LEVEL = (
+    BatteryCriticalBias,
+    BatteryCharge,
+    BatteryDischarge);
+  {$EXTERNALSYM BATTERY_SET_INFORMATION_LEVEL}
+  TBatterySetInformationLevel = BATTERY_SET_INFORMATION_LEVEL;
+
+  _BATTERY_SET_INFORMATION = record
+    BatteryTag: ULONG;
+    InformationLevel: BATTERY_SET_INFORMATION_LEVEL;
+    Buffer: array [0..0] of UCHAR;
+  end;
+  {$EXTERNALSYM _BATTERY_SET_INFORMATION}
+  BATTERY_SET_INFORMATION = _BATTERY_SET_INFORMATION;
+  {$EXTERNALSYM BATTERY_SET_INFORMATION}
+  PBATTERY_SET_INFORMATION = ^BATTERY_SET_INFORMATION;
+  {$EXTERNALSYM PBATTERY_SET_INFORMATION}
+  TBatterySetInformation = BATTERY_SET_INFORMATION;
+  PBatterySetInformation = PBATTERY_SET_INFORMATION;
+
+//
+// IOCTL_BATTERY_QUERY_STATUS
+//
+
+const
+  IOCTL_BATTERY_QUERY_STATUS = (FILE_DEVICE_BATTERY shl 16) or (FILE_READ_ACCESS shl 14) or ($13 shl 2) or METHOD_BUFFERED;
+  {$EXTERNALSYM IOCTL_BATTERY_QUERY_STATUS}
+
+//
+// Structure of input buffer to IOCTL_BATTERY_QUERY_STATUS
+//
+
+type
+  _BATTERY_WAIT_STATUS = record
+    BatteryTag: ULONG;
+    Timeout: ULONG;
+    PowerState: ULONG;
+    LowCapacity: ULONG;
+    HighCapacity: ULONG;
+  end;
+  {$EXTERNALSYM _BATTERY_WAIT_STATUS}
+  BATTERY_WAIT_STATUS = _BATTERY_WAIT_STATUS;
+  {$EXTERNALSYM BATTERY_WAIT_STATUS}
+  PBATTERY_WAIT_STATUS = ^BATTERY_WAIT_STATUS;
+  {$EXTERNALSYM PBATTERY_WAIT_STATUS}
+  TBatteryWaitStatus = BATTERY_WAIT_STATUS;
+  PBatteryWaitStatus = PBATTERY_WAIT_STATUS;
+
+//
+// Structure of output buffer from IOCTL_BATTERY_QUERY_STATUS
+//
+
+  _BATTERY_STATUS = record
+    PowerState: ULONG;
+    Capacity: ULONG;
+    Voltage: ULONG;
+    Rate: LONG;
+  end;
+  {$EXTERNALSYM _BATTERY_STATUS}
+  BATTERY_STATUS = _BATTERY_STATUS;
+  {$EXTERNALSYM BATTERY_STATUS}
+  PBATTERY_STATUS = ^BATTERY_STATUS;
+  {$EXTERNALSYM PBATTERY_STATUS}
+  TBatteryStatus = BATTERY_STATUS;
+  PBatteryStatus = PBATTERY_STATUS;
+
+//
+// BATTERY_STATUS.PowerState flags
+//
+
+const
+  BATTERY_POWER_ON_LINE = $00000001;
+  {$EXTERNALSYM BATTERY_POWER_ON_LINE}
+  BATTERY_DISCHARGING   = $00000002;
+  {$EXTERNALSYM BATTERY_DISCHARGING}
+  BATTERY_CHARGING      = $00000004;
+  {$EXTERNALSYM BATTERY_CHARGING}
+  BATTERY_CRITICAL      = $00000008;
+  {$EXTERNALSYM BATTERY_CRITICAL}
+
+//
+// BATTERY_STATUS Constant
+// BATTERY_UNKNOWN_CAPACITY defined above for IOCTL_BATTERY_QUERY_INFORMATION
+//
+
+  BATTERY_UNKNOWN_VOLTAGE = DWORD($FFFFFFFF);
+  {$EXTERNALSYM BATTERY_UNKNOWN_VOLTAGE}
+  BATTERY_UNKNOWN_RATE    = DWORD($80000000);
+  {$EXTERNALSYM BATTERY_UNKNOWN_RATE}
+
+// mvb remainder of header file is kernel mode only
+
+implementation
+
+end.

+ 447 - 0
packages/extra/winunits/jwabits.pas

@@ -0,0 +1,447 @@
+{******************************************************************************}
+{                                                                              }
+{ Background Intelligent Transfer Service API interface Unit for Object Pascal }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: bits.h, released August 2001. The original Pascal      }
+{ code is: Bits.pas, released October 2001. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBits;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bits.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinBase, JwaWinType, JwaBitsMsg;
+
+const
+  BG_SIZE_UNKNOWN = Int64(-1);
+  {$EXTERNALSYM BG_SIZE_UNKNOWN}
+
+//
+// =============================
+// Marshalled interfaces
+// =============================
+
+type
+  _BG_FILE_PROGRESS = record
+    BytesTotal: UINT64;
+    BytesTransferred: UINT64;
+    Completed: BOOL;
+  end;
+  {$EXTERNALSYM _BG_FILE_PROGRESS}
+  BG_FILE_PROGRESS = _BG_FILE_PROGRESS;
+  {$EXTERNALSYM BG_FILE_PROGRESS}
+  TBgFileProgress = BG_FILE_PROGRESS;
+  PBgFileProgress = ^BG_FILE_PROGRESS;
+
+const
+  IID_IBackgroundCopyFile: TGUID = '{01B7BD23-FB88-4A77-8490-5891D3E4653A}';
+  {$EXTERNALSYM IID_IBackgroundCopyFile}
+
+type
+  IBackgroundCopyFile = interface(IUnknown)
+  ['{01b7bd23-fb88-4a77-8490-5891d3e4653a}']
+    function GetRemoteName(out pVal: LPWSTR): HRESULT; stdcall;
+    function GetLocalName(out pVal: LPWSTR): HRESULT; stdcall;
+    function GetProgress(out pVal: BG_FILE_PROGRESS): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBackgroundCopyFile}
+
+//--------------------------------------------------------------------
+//
+
+const
+  IID_IEnumBackgroundCopyFiles: TGUID = '{CA51E165-C365-424C-8D41-24AAA4FF3C40}';
+  {$EXTERNALSYM IID_IEnumBackgroundCopyFiles}
+
+type
+  IEnumBackgroundCopyFiles = interface(IUnknown)
+  ['{ca51e165-c365-424c-8d41-24aaa4ff3c40}']
+    function Next(celt: ULONG; out rgelt: IBackgroundCopyFile;  pceltFetched: PULONG): HRESULT; stdcall;
+    function Skip(celt: ULONG): HRESULT; stdcall;
+    function Reset: HRESULT; stdcall;
+    function Clone(out ppenum: IEnumBackgroundCopyFiles): HRESULT; stdcall;
+    function GetCount(out puCount: ULONG): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEnumBackgroundCopyFiles}
+
+//--------------------------------------------------------------------
+//
+
+type
+  BG_ERROR_CONTEXT = (
+    BG_ERROR_CONTEXT_NONE,
+    BG_ERROR_CONTEXT_UNKNOWN,
+    BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER,
+    BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION,
+    BG_ERROR_CONTEXT_LOCAL_FILE,
+    BG_ERROR_CONTEXT_REMOTE_FILE,
+    BG_ERROR_CONTEXT_GENERAL_TRANSPORT,
+    BG_ERROR_CONTEXT_REMOTE_APPLICATION);
+  {$EXTERNALSYM BG_ERROR_CONTEXT}
+  TBgErrorContext = BG_ERROR_CONTEXT;
+
+const
+  IID_IBackgroundCopyError: TGUID = '{19C613A0-FCB8-4F28-81AE-897C3D078F81}';
+  {$EXTERNALSYM IID_IBackgroundCopyError}
+
+type
+  IBackgroundCopyError = interface(IUnknown)
+  ['{19c613a0-fcb8-4f28-81ae-897c3d078f81}']
+    function GetError(out pContext: BG_ERROR_CONTEXT; out pCode: HRESULT): HRESULT; stdcall;
+    // Returns BG_E_FILE_NOT_AVAILABLE if no file is available
+    function GetFile(out ppVal: IBackgroundCopyFile): HRESULT; stdcall;
+    // Return a human readable description of the error.
+    // Use CoTaskMemFree to free the description.
+    function GetErrorDescription(LanguageId: DWORD; out pErrorDescription: LPWSTR): HRESULT; stdcall;
+    // Return a human readable description of the error context.
+    // Use CoTaskMemFree to free the description.
+    function GetErrorContextDescription(LanguageId: DWORD; out pContextDescription: LPWSTR): HRESULT; stdcall;
+    // Returns BG_E_PROTOCOL_NOT_AVAILABLE if no protocol is available
+    function GetProtocol(out pProtocol: LPWSTR): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBackgroundCopyError}
+
+// ==============================================
+// Job Interface
+
+type
+  _BG_FILE_INFO = record
+    RemoteName: LPWSTR;
+    LocalName: LPWSTR;
+  end;
+  {$EXTERNALSYM _BG_FILE_INFO}
+  BG_FILE_INFO = _BG_FILE_INFO;
+  {$EXTERNALSYM BG_FILE_INFO}
+  TBgFileInfo = BG_FILE_INFO;
+  PBgFileInfo = ^BG_FILE_INFO;
+
+  _BG_JOB_PROGRESS = record
+    BytesTotal: UINT64;
+    BytesTransferred: UINT64;
+    FilesTotal: ULONG;
+    FilesTransferred: ULONG;
+  end;
+  {$EXTERNALSYM _BG_JOB_PROGRESS}
+  BG_JOB_PROGRESS = _BG_JOB_PROGRESS;
+  {$EXTERNALSYM BG_JOB_PROGRESS}
+  TBgJobProgress = BG_JOB_PROGRESS;
+  PBgJobProgress = ^BG_JOB_PROGRESS;
+
+  _BG_JOB_TIMES = record
+    CreationTime: FILETIME;
+    ModificationTime: FILETIME;
+    TransferCompletionTime: FILETIME;
+  end;
+  {$EXTERNALSYM _BG_JOB_TIMES}
+  BG_JOB_TIMES = _BG_JOB_TIMES;
+  {$EXTERNALSYM BG_JOB_TIMES}
+  TBgJobTimes = BG_JOB_TIMES;
+  PBgJobTimes = ^BG_JOB_TIMES;
+
+  BG_JOB_PRIORITY = (
+    BG_JOB_PRIORITY_FOREGROUND,
+    BG_JOB_PRIORITY_HIGH,
+    BG_JOB_PRIORITY_NORMAL,
+    BG_JOB_PRIORITY_LOW);
+  {$EXTERNALSYM BG_JOB_PRIORITY}
+  TBgJobPriority = BG_JOB_PRIORITY;
+  PBgJobPriority = ^BG_JOB_PRIORITY;
+
+  BG_JOB_STATE = (
+    BG_JOB_STATE_QUEUED,
+    BG_JOB_STATE_CONNECTING,
+    BG_JOB_STATE_TRANSFERRING,
+    BG_JOB_STATE_SUSPENDED,
+    BG_JOB_STATE_ERROR,
+    BG_JOB_STATE_TRANSIENT_ERROR,
+    BG_JOB_STATE_TRANSFERRED,
+    BG_JOB_STATE_ACKNOWLEDGED,
+    BG_JOB_STATE_CANCELLED);
+  {$EXTERNALSYM BG_JOB_STATE}
+  TBgJobState = BG_JOB_STATE;
+  PBgJobState = ^BG_JOB_STATE;  
+
+  BG_JOB_TYPE = (
+    BG_JOB_TYPE_DOWNLOAD,
+    BG_JOB_TYPE_UPLOAD,
+    BG_JOB_TYPE_UPLOAD_REPLY);
+  {$EXTERNALSYM BG_JOB_TYPE}
+  TBgJobType = BG_JOB_TYPE;
+
+  BG_JOB_PROXY_USAGE = (
+    BG_JOB_PROXY_USAGE_PRECONFIG,
+    BG_JOB_PROXY_USAGE_NO_PROXY,
+    BG_JOB_PROXY_USAGE_OVERRIDE);
+  {$EXTERNALSYM BG_JOB_PROXY_USAGE}
+  TBgJobProxyUsage = BG_JOB_PROXY_USAGE;
+  PBgJobProxyUsage = ^BG_JOB_PROXY_USAGE;
+
+const
+  IID_IBackgroundCopyJob: TGUID = '{37668D37-507E-4160-9316-26306D150B12}';
+  {$EXTERNALSYM IID_IBackgroundCopyJob}
+
+type
+  IBackgroundCopyJob = interface(IUnknown)
+  ['{37668d37-507e-4160-9316-26306d150b12}']
+
+    //--------------------------------------------------------------------
+
+    //
+    // Returns E_INVALIDARG if one of the filesets has
+    //      - local name is blank
+    //      - local name contains invalid characters
+    //      - remote name is blank
+    //      - remote name has invalid format
+    //
+    // Returns CO_E_NOT_SUPPORTED if
+    //      - remote URL contains unsupported protocol
+    //
+    function AddFileSet(cFileCount: ULONG; pFileSet: PBgFileInfo): HRESULT; stdcall;
+
+    function AddFile(RemoteUrl, LocalName: LPCWSTR): HRESULT; stdcall;
+
+    //
+    // Gets an enumerator object for all files in the job.
+    //
+    function EnumFiles(out pEnum: IEnumBackgroundCopyFiles): HRESULT; stdcall;
+
+    //
+    // Pause all activity on the job.  The service will take no action until one of
+    // Resume(), Cancel(), Complete() is called.
+    //
+    // if already suspended, just returns S_OK.
+    //
+    function Suspend: HRESULT; stdcall;
+
+    //
+    // Enable downloading for this job.  Job properties cannot be modified
+    // after Resume() until the app calls Suspend().
+    //
+    // if already running, just returns S_OK.
+    //
+    function Resume: HRESULT; stdcall;
+
+    //
+    // Permanently stop the job.  The service will delete the job metadata and downloaded files.
+    //
+    // If already cancelled or resumed, returns ???
+    //
+    function Cancel: HRESULT; stdcall;
+
+    //
+    // Acknowledges receipt of the job-complete notification.  The service will delete
+    // the job metadata and leave the downloaded files.
+    //
+    function Complete: HRESULT; stdcall;
+
+    //--------------------------------------------------------------------
+
+    function GetId(out pVal: GUID): HRESULT; stdcall;
+
+    function GetType(out pVal: BG_JOB_TYPE): HRESULT; stdcall;
+
+    function GetProgress(out pVal: BG_JOB_PROGRESS): HRESULT; stdcall;
+
+    function GetTimes(out pVal: BG_JOB_TIMES): HRESULT; stdcall;
+
+    function GetState(out pVal: BG_JOB_STATE): HRESULT; stdcall;
+
+    function GetError(out ppError: IBackgroundCopyError): HRESULT; stdcall;
+
+    //
+    // The owner of the job, represented as a string.
+    // Only the owner and admins are allowed to see or change the job.
+    //
+    function GetOwner(out pVal: LPWSTR): HRESULT; stdcall;
+
+    //
+    // name of the job, suitable for display in UI
+    //
+    function SetDisplayName(Val: LPCWSTR): HRESULT; stdcall;
+    function GetDisplayName(out pVal: LPWSTR): HRESULT; stdcall;
+
+    //
+    // a field for use by the app
+    //
+    function SetDescription(Val: LPCWSTR): HRESULT; stdcall;
+    function GetDescription(out pVal: LPWSTR): HRESULT; stdcall;
+
+    //
+    // the priority of the job in the queue.
+    // default = PRIORITY_NORMAL
+    // values not in BG_JOB_PRIORITY return E_NOTIMPL.
+    //
+    function SetPriority(Val: BG_JOB_PRIORITY): HRESULT; stdcall;
+    function GetPriority(out pVal: BG_JOB_PRIORITY): HRESULT; stdcall;
+
+    //
+    // ignores extra flags?
+    //
+    function SetNotifyFlags(Val: ULONG): HRESULT; stdcall;
+    function GetNotifyFlags(out pVal: ULONG): HRESULT; stdcall;
+
+    // interface pointer that implements the IBackgroundCallback interface for notifications.
+    // If the pointer becomes invalid, the service will try to create a new notification object
+    // with the notify CLSID.
+    function SetNotifyInterface(Val: IUnknown): HRESULT; stdcall;
+    function GetNotifyInterface(out pVal: IUnknown): HRESULT; stdcall;
+
+    function SetMinimumRetryDelay(Seconds: ULONG): HRESULT; stdcall;
+    function GetMinimumRetryDelay(out Seconds: ULONG): HRESULT; stdcall;
+
+    function SetNoProgressTimeout(Seconds: ULONG): HRESULT; stdcall;
+    function GetNoProgressTimeout(out Seconds: ULONG): HRESULT; stdcall;
+
+    function GetErrorCount(out Errors: ULONG): HRESULT; stdcall;
+
+    function SetProxySettings(ProxyUsage: BG_JOB_PROXY_USAGE; ProxyList, ProxyBypassList: PWCHAR): HRESULT; stdcall;
+
+    function GetProxySettings(pProxyUsage: BG_JOB_PROXY_USAGE; pProxyList, pProxyBypassList: LPWSTR): HRESULT; stdcall;
+
+    function TakeOwnership(): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBackgroundCopyJob}
+
+// ==============================================
+// IEnumJobs Interface
+//     This interface allows enumerating the jobs under a Job
+
+const
+  IID_IEnumBackgroundCopyJobs: TGUID = '{1AF4F612-3B71-466F-8F58-7B6F73AC57AD}';
+  {$EXTERNALSYM IID_IEnumBackgroundCopyJobs}
+
+type
+  IEnumBackgroundCopyJobs = interface(IUnknown)
+  ['{1af4f612-3b71-466f-8f58-7b6f73ac57ad}']
+    function Next(celt: ULONG; out rgelt: IBackgroundCopyJob; pceltFetched: PULONG): HRESULT; stdcall;
+    function Skip(celt: ULONG): HRESULT; stdcall;
+    function Reset: HRESULT; stdcall;
+    function Clone(out ppenum: IEnumBackgroundCopyJobs): HRESULT; stdcall;
+    function GetCount(out puCount: ULONG): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEnumBackgroundCopyJobs}
+
+const
+  BG_NOTIFY_JOB_TRANSFERRED   = $0001;
+  {$EXTERNALSYM BG_NOTIFY_JOB_TRANSFERRED}
+  BG_NOTIFY_JOB_ERROR         = $0002;
+  {$EXTERNALSYM BG_NOTIFY_JOB_ERROR}
+  BG_NOTIFY_DISABLE           = $0004;
+  {$EXTERNALSYM BG_NOTIFY_DISABLE}
+  BG_NOTIFY_JOB_MODIFICATION  = $0008;
+  {$EXTERNALSYM BG_NOTIFY_JOB_MODIFICATION}
+
+// ==============================================
+// IBackgroundCallback Interface
+//     This interface is implemented by the client and is used by the queue manager
+//     to supply progress information to the client.
+
+const
+  IID_IBackgroundCopyCallback: TGUID = '{97EA99C7-0186-4AD4-8DF9-C5B4E0ED6B22}';
+  {$EXTERNALSYM IID_IBackgroundCopyCallback}
+
+type
+  IBackgroundCopyCallback = interface(IUnknown)
+  ['{97ea99c7-0186-4ad4-8df9-c5b4e0ed6b22}']
+    //
+    // A job has transferred successfully.
+    //
+    function JobTransferred(pJob: IBackgroundCopyJob): HRESULT; stdcall;
+
+    //
+    // An error occurred, and the service has suspended the job.
+    // Fix the error and resume the job.
+    // Get error details by calling (*pFailingJob)->GetStatus().
+    //
+    function JobError(pJob: IBackgroundCopyJob; pError: IBackgroundCopyError): HRESULT; stdcall;
+
+    //
+    // The job has been modified.   Intendended for user interfaces.
+    //
+    function JobModification(pJob: IBackgroundCopyJob; dwReserved: DWORD): HRESULT; stdcall;
+
+  end;
+  {$EXTERNALSYM IBackgroundCopyCallback}
+
+//
+// IBackgroundCopyManager is the "root" interface to the background file copy component.
+//
+
+const
+  BG_JOB_ENUM_ALL_USERS = $0001;
+  {$EXTERNALSYM BG_JOB_ENUM_ALL_USERS}
+
+  IID_IBackgroundCopyManager: TGUID = '{5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C}';
+  {$EXTERNALSYM IID_IBackgroundCopyManager}
+
+type
+  IBackgroundCopyManager = interface(IUnknown)
+  ['{5ce34c0d-0dc9-4c1f-897c-daa1b78cee7c}']
+    function CreateJob(DisplayName: LPCWSTR; Type_: BG_JOB_TYPE; out pJobId: GUID; out ppJob: IBackgroundCopyJob): HRESULT; stdcall;
+    function GetJob(const jobID: GUID; out ppJob: IBackgroundCopyJob): HRESULT; stdcall;
+
+    //
+    // Without this flag, jobs not owned by the caller are excluded from the enumeration.
+    // With this flag, those jobs are included.  Only works if the caller is an administrator.
+    //
+    function EnumJobs(dwFlags: DWORD; out ppEnum: IEnumBackgroundCopyJobs): HRESULT; stdcall;
+    function GetErrorDescription(hResult: HRESULT; LanguageId: DWORD; out pErrorDescription: LPWSTR): HRESULT; stdcall;
+ end;
+ {$EXTERNALSYM IBackgroundCopyManager}
+
+//---------------------------------------------------------------------------
+
+const
+  LIBID_BackgroundCopyManager: GUID = '{4991d34b-80a1-4291-83b6-3328366b9097}';
+  {$EXTERNALSYM LIBID_BackgroundCopyManager}
+  CLSID_BackgroundCopyManager: GUID = '{4991d34b-80a1-4291-83b6-3328366b9097}';
+  {$EXTERNALSYM CLSID_BackgroundCopyManager}
+
+implementation
+
+end.

+ 133 - 0
packages/extra/winunits/jwabits1_5.pas

@@ -0,0 +1,133 @@
+{******************************************************************************}
+{                                                                              }
+{ Background Intelligent Transfer API interface Unit for Object Pascal         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: bitscfg.h, released August 2001. The original Pascal   }
+{ code is: Bits.pas, released October 2001. The initial developer of the       }
+{ Pascal code is Wayne Sherman (body1233 att yahoo dott com).                  }
+{                                                                              }
+{ Portions created by Wayne Sherman are Copyright (C) 1999-2001                }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBits1_5;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bits1_5.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinBase, JwaWinType, JwaBits;
+
+type
+  _BG_JOB_REPLY_PROGRESS = record
+    BytesTotal: UINT64;
+    BytesTransferred: UINT64;
+  end;
+  {$EXTERNALSYM _BG_JOB_REPLY_PROGRESS}
+  BG_JOB_REPLY_PROGRESS = _BG_JOB_REPLY_PROGRESS;
+  {$EXTERNALSYM BG_JOB_REPLY_PROGRESS}
+  TBgJobReplyProgress = BG_JOB_REPLY_PROGRESS;
+  PBgJobReplyProgress = ^BG_JOB_REPLY_PROGRESS;
+
+  BG_AUTH_TARGET = (
+    VOID1_BG_AUTH,
+    BG_AUTH_TARGET_SERVER,
+    BG_AUTH_TARGET_PROXY);
+  {$EXTERNALSYM BG_AUTH_TARGET}
+  TBgAuthTarget = BG_AUTH_TARGET;
+
+  BG_AUTH_SCHEME = (
+    VOID2_BG_AUTH,
+    BG_AUTH_SCHEME_BASIC,
+    BG_AUTH_SCHEME_DIGEST,
+    BG_AUTH_SCHEME_NTLM,
+    BG_AUTH_SCHEME_NEGOTIATE,
+    BG_AUTH_SCHEME_PASSPORT);
+  {$EXTERNALSYM BG_AUTH_SCHEME}
+  TBgAuthScheme = BG_AUTH_SCHEME;
+
+  BG_BASIC_CREDENTIALS = record
+    UserName: LPWSTR;
+    Password: LPWSTR;
+  end;
+  {$EXTERNALSYM BG_BASIC_CREDENTIALS}
+  TBgBasicCredentials = BG_BASIC_CREDENTIALS;
+  PBgBasicCredentials = ^BG_BASIC_CREDENTIALS;
+
+  BG_AUTH_CREDENTIALS = record
+    Target: BG_AUTH_TARGET;
+    Scheme: BG_AUTH_SCHEME;
+    Credentials: BG_BASIC_CREDENTIALS;
+  end;
+  {$EXTERNALSYM BG_AUTH_CREDENTIALS}
+  TBgAuthCredentials = BG_AUTH_CREDENTIALS;
+  PBgAuthCredentials = ^BG_AUTH_CREDENTIALS;
+
+const
+  IID_IBackgroundCopyJob2: TGUID = '{54b50739-686f-45eb-9dff-d6a9a0faa9af}';
+  {$EXTERNALSYM IID_IBackgroundCopyJob2}
+
+type
+  IBackgroundCopyJob2 = interface(IBackgroundCopyJob)
+  ['{54b50739-686f-45eb-9dff-d6a9a0faa9af}']
+    function SetNotifyCmdLine(_Program: LPCWSTR; Parameters: LPCWSTR): HRESULT; stdcall;
+    function GetNotifyCmdLine(out _Program: LPCWSTR; out Parameters: LPCWSTR): HRESULT; stdcall;
+    function GetReplyProgress(out pProgress: BG_JOB_REPLY_PROGRESS): HRESULT; stdcall;
+    function GetReplyData(out ppBuffer: PByte; out pLength: UINT64): HRESULT; stdcall;
+    function SetReplyFileName(ReplyFileName: LPCWSTR): HRESULT; stdcall;
+    function GetReplyFileName(out pReplyFileName: LPCWSTR): HRESULT; stdcall;
+    function SetCredentials(var credentials: BG_AUTH_CREDENTIALS): HRESULT; stdcall;
+    function RemoveCredentials(Target: BG_AUTH_TARGET; Scheme: BG_AUTH_SCHEME): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBackgroundCopyJob2}
+
+//---------------------------------------------------------------------------
+
+const
+  LIBID_BackgroundCopyManager1_5: GUID = '{f087771f-d74f-4c1a-bb8a-e16aca9124ea}';
+  {$EXTERNALSYM LIBID_BackgroundCopyManager1_5}
+  CLSID_BackgroundCopyManager1_5: GUID = '{f087771f-d74f-4c1a-bb8a-e16aca9124ea}';
+  {$EXTERNALSYM CLSID_BackgroundCopyManager1_5}
+
+implementation
+
+end.

+ 92 - 0
packages/extra/winunits/jwabitscfg.pas

@@ -0,0 +1,92 @@
+{******************************************************************************}
+{                                                                              }
+{ Background Intelligent Transfer API interface Unit for Object Pascal         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: bitscfg.h, released August 2001. The original Pascal   }
+{ code is: Bits.pas, released October 2001. The initial developer of the       }
+{ Pascal code is Wayne Sherman (body1233 att yahoo dott com).                  }
+{                                                                              }
+{ Portions created by Wayne Sherman are Copyright (C) 1999-2001                }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBitscfg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bitscfg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinBase, JwaWinType;
+
+const
+  IID_IBITSExtensionSetup: TGUID = '{29cfbbf7-09e4-4b97-b0bc-f2287e3d8eb3}';
+  {$EXTERNALSYM IID_IBITSExtensionSetup}
+
+type
+  REFIID = TGUID; // also in ActiveDS and another unit
+
+  IBITSExtensionSetup = interface(IDispatch)
+  ['{29cfbbf7-09e4-4b97-b0bc-f2287e3d8eb3}']
+    function EnableBITSUploads: HRESULT; stdcall;
+    function DisableBITSUploads: HRESULT; stdcall;
+    function GetCleanupTaskName(out pTaskName: WideString): HRESULT; stdcall;
+    function GetCleanupTask(riid: REFIID; out ppUnk: IUnknown): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBITSExtensionSetup}
+
+  IBITSExtensionSetupFactory = interface (IDispatch)
+  ['{d5d2d542-5503-4e64-8b48-72ef91a32ee1}']
+    function GetObject(Path: WideString; out ppExtensionSetup: IBITSExtensionSetup): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IBITSExtensionSetupFactory}
+
+//---------------------------------------------------------------------------
+
+const
+  LIBID_BITSExtensionSetup: GUID = '{efbbab68-7286-4783-94bf-9461d8b7e7e9}';
+  {$EXTERNALSYM LIBID_BITSExtensionSetup}
+  CLSID_BITSExtensionSetupFactory: GUID = '{efbbab68-7286-4783-94bf-9461d8b7e7e9}';
+  {$EXTERNALSYM CLSID_BITSExtensionSetupFactory}
+
+implementation
+
+end.

+ 996 - 0
packages/extra/winunits/jwabitsmsg.pas

@@ -0,0 +1,996 @@
+{******************************************************************************}
+{                                                                              }
+{ Background file copier error codes API interface Unit for Object Pascal      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: bitsmsg.h, released June 2000. The original Pascal     }
+{ code is: BitsMsg.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBitsMsg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "BitsMsg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+//  Values are 32 bit values layed out as follows:
+//
+//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+//  +---+-+-+-----------------------+-------------------------------+
+//  |Sev|C|R|     Facility          |               Code            |
+//  +---+-+-+-----------------------+-------------------------------+
+//
+//  where
+//
+//      Sev - is the severity code
+//
+//          00 - Success
+//          01 - Informational
+//          10 - Warning
+//          11 - Error
+//
+//      C - is the Customer code flag
+//
+//      R - is a reserved bit
+//
+//      Facility - is the facility code
+//
+//      Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+//
+// Define the severity codes
+//
+
+const
+
+//
+// MessageId: BG_E_NOT_FOUND
+//
+// MessageText:
+//
+//  The requested job was not found.
+//
+  BG_E_NOT_FOUND = DWORD($80200001);
+  {$EXTERNALSYM BG_E_NOT_FOUND}
+
+//
+// MessageId: BG_E_INVALID_STATE
+//
+// MessageText:
+//
+//  The requested action is not allowed in the current job state. The job might have been canceled or completed transferring. It is in a read-only state now.
+//
+  BG_E_INVALID_STATE = DWORD($80200002);
+  {$EXTERNALSYM BG_E_INVALID_STATE}
+
+//
+// MessageId: BG_E_EMPTY
+//
+// MessageText:
+//
+//  There are no files attached to this job. Attach files to the job, and then try again.
+//
+  BG_E_EMPTY = DWORD($80200003);
+  {$EXTERNALSYM BG_E_EMPTY}
+
+//
+// MessageId: BG_E_FILE_NOT_AVAILABLE
+//
+// MessageText:
+//
+//  No file is available because no URL generated an error.
+//
+  BG_E_FILE_NOT_AVAILABLE = DWORD($80200004);
+  {$EXTERNALSYM BG_E_FILE_NOT_AVAILABLE}
+
+//
+// MessageId: BG_E_PROTOCOL_NOT_AVAILABLE
+//
+// MessageText:
+//
+//  No protocol is available because no URL generated an error.
+//
+  BG_E_PROTOCOL_NOT_AVAILABLE = DWORD($80200005);
+  {$EXTERNALSYM BG_E_PROTOCOL_NOT_AVAILABLE}
+
+//
+// MessageId: BG_S_ERROR_CONTEXT_NONE
+//
+// MessageText:
+//
+//  No errors have occurred.
+//
+  BG_S_ERROR_CONTEXT_NONE = DWORD($00200006);
+  {$EXTERNALSYM BG_S_ERROR_CONTEXT_NONE}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_UNKNOWN
+//
+// MessageText:
+//
+//  The error occurred in an unknown location.
+//
+  BG_E_ERROR_CONTEXT_UNKNOWN = DWORD($80200007);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_UNKNOWN}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER
+//
+// MessageText:
+//
+//  The error occurred in the Background Intelligent Transfer Service (BITS) queue manager.
+//
+  BG_E_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER = DWORD($80200008);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_LOCAL_FILE
+//
+// MessageText:
+//
+//  The error occurred while the local file was being processed. Verify that the file is not in use, and then try again.
+//
+  BG_E_ERROR_CONTEXT_LOCAL_FILE = DWORD($80200009);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_LOCAL_FILE}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_REMOTE_FILE
+//
+// MessageText:
+//
+//  The error occurred while the remote file was being processed.
+//
+  BG_E_ERROR_CONTEXT_REMOTE_FILE = DWORD($8020000A);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_REMOTE_FILE}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_GENERAL_TRANSPORT
+//
+// MessageText:
+//
+//  The error occurred in the transport layer. The client could not connect to the server.
+//
+  BG_E_ERROR_CONTEXT_GENERAL_TRANSPORT = DWORD($8020000B);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_GENERAL_TRANSPORT}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION
+//
+// MessageText:
+//
+//  The error occurred while the notification callback was being processed. Background Intelligent Transfer Service (BITS) will try again later.
+//
+  BG_E_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION = DWORD($8020000C);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION}
+
+//
+// MessageId: BG_E_DESTINATION_LOCKED
+//
+// MessageText:
+//
+//  The destination file system volume is not available. Verify that another program, such as CheckDisk, is not running, which would lock the volume. When the volume is available, Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_DESTINATION_LOCKED = DWORD($8020000D);
+  {$EXTERNALSYM BG_E_DESTINATION_LOCKED}
+
+//
+// MessageId: BG_E_VOLUME_CHANGED
+//
+// MessageText:
+//
+//  The destination volume has changed. If the disk is removable, it might have been replaced with a different disk. Reinsert the original disk and resume the job.
+//
+  BG_E_VOLUME_CHANGED = DWORD($8020000E);
+  {$EXTERNALSYM BG_E_VOLUME_CHANGED}
+
+//
+// MessageId: BG_E_ERROR_INFORMATION_UNAVAILABLE
+//
+// MessageText:
+//
+//  No errors have occurred.
+//
+  BG_E_ERROR_INFORMATION_UNAVAILABLE = DWORD($8020000F);
+  {$EXTERNALSYM BG_E_ERROR_INFORMATION_UNAVAILABLE}
+
+//
+// MessageId: BG_E_NETWORK_DISCONNECTED
+//
+// MessageText:
+//
+//  There are currently no active network connections. Background Intelligent Transfer Service (BITS) will try again when an adapter is connected.
+//
+  BG_E_NETWORK_DISCONNECTED = DWORD($80200010);
+  {$EXTERNALSYM BG_E_NETWORK_DISCONNECTED}
+
+//
+// MessageId: BG_E_MISSING_FILE_SIZE
+//
+// MessageText:
+//
+//  The server did not return the file size. The URL might point to dynamic content. The Content-Length header is not available in the server's HTTP reply.
+//
+  BG_E_MISSING_FILE_SIZE = DWORD($80200011);
+  {$EXTERNALSYM BG_E_MISSING_FILE_SIZE}
+
+//
+// MessageId: BG_E_INSUFFICIENT_HTTP_SUPPORT
+//
+// MessageText:
+//
+//  The server does not support HTTP 1.1.
+//
+  BG_E_INSUFFICIENT_HTTP_SUPPORT = DWORD($80200012);
+  {$EXTERNALSYM BG_E_INSUFFICIENT_HTTP_SUPPORT}
+
+//
+// MessageId: BG_E_INSUFFICIENT_RANGE_SUPPORT
+//
+// MessageText:
+//
+//  The server does not support the necessary HTTP protocol. Background Intelligent Transfer Service (BITS) requires that the server support the Range protocol header.
+//
+  BG_E_INSUFFICIENT_RANGE_SUPPORT = DWORD($80200013);
+  {$EXTERNALSYM BG_E_INSUFFICIENT_RANGE_SUPPORT}
+
+//
+// MessageId: BG_E_REMOTE_NOT_SUPPORTED
+//
+// MessageText:
+//
+//  Background Intelligent Transfer Service (BITS) cannot be used remotely.
+//
+  BG_E_REMOTE_NOT_SUPPORTED = DWORD($80200014);
+  {$EXTERNALSYM BG_E_REMOTE_NOT_SUPPORTED}
+
+//
+// MessageId: BG_E_NEW_OWNER_DIFF_MAPPING
+//
+// MessageText:
+//
+//  The drive mapping for the job is different for the current owner than for the previous owner. Use a UNC path instead.
+//
+  BG_E_NEW_OWNER_DIFF_MAPPING = DWORD($80200015);
+  {$EXTERNALSYM BG_E_NEW_OWNER_DIFF_MAPPING}
+
+//
+// MessageId: BG_E_NEW_OWNER_NO_FILE_ACCESS
+//
+// MessageText:
+//
+//  The new owner has insufficient access to the local files for the job. The new owner might not have permissions to access the job files. Verify that the new owner has sufficient permissions, and then try again.
+//
+  BG_E_NEW_OWNER_NO_FILE_ACCESS = DWORD($80200016);
+  {$EXTERNALSYM BG_E_NEW_OWNER_NO_FILE_ACCESS}
+
+//
+// MessageId: BG_S_PARTIAL_COMPLETE
+//
+// MessageText:
+//
+//  Some of the transferred files were deleted because they were incomplete.
+//
+  BG_S_PARTIAL_COMPLETE = DWORD($00200017);
+  {$EXTERNALSYM BG_S_PARTIAL_COMPLETE}
+
+//
+// MessageId: BG_E_PROXY_LIST_TOO_LARGE
+//
+// MessageText:
+//
+//  The HTTP proxy list cannot be longer than 32,000 characters. Try again with a shorter proxy list.
+//
+  BG_E_PROXY_LIST_TOO_LARGE = DWORD($80200018);
+  {$EXTERNALSYM BG_E_PROXY_LIST_TOO_LARGE}
+
+//
+// MessageId: BG_E_PROXY_BYPASS_LIST_TOO_LARGE
+//
+// MessageText:
+//
+//  The HTTP proxy bypass list cannot be longer than 32,000 characters. Try again with a shorter bypass proxy list.
+//
+  BG_E_PROXY_BYPASS_LIST_TOO_LARGE = DWORD($80200019);
+  {$EXTERNALSYM BG_E_PROXY_BYPASS_LIST_TOO_LARGE}
+
+//
+// MessageId: BG_S_UNABLE_TO_DELETE_FILES
+//
+// MessageText:
+//
+//  Some of the temporary files could not be deleted. Check the system event log for the complete list of files that could not be deleted.
+//
+  BG_S_UNABLE_TO_DELETE_FILES = DWORD($0020001A);
+  {$EXTERNALSYM BG_S_UNABLE_TO_DELETE_FILES}
+
+//
+// MessageId: BG_E_INVALID_SERVER_RESPONSE
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_INVALID_SERVER_RESPONSE = DWORD($8020001B);
+  {$EXTERNALSYM BG_E_INVALID_SERVER_RESPONSE}
+
+//
+// MessageId: BG_E_TOO_MANY_FILES
+//
+// MessageText:
+//
+//  No more files can be added to this job.
+//
+  BG_E_TOO_MANY_FILES = DWORD($8020001C);
+  {$EXTERNALSYM BG_E_TOO_MANY_FILES}
+
+//
+// MessageId: BG_E_LOCAL_FILE_CHANGED
+//
+// MessageText:
+//
+//  The local file was changed during the transfer. Recreate the job, and then try to transfer it again.
+//
+  BG_E_LOCAL_FILE_CHANGED = DWORD($8020001D);
+  {$EXTERNALSYM BG_E_LOCAL_FILE_CHANGED}
+
+//
+// MessageId: BG_E_ERROR_CONTEXT_REMOTE_APPLICATION
+//
+// MessageText:
+//
+//  The program on the remote server reported the error.
+//
+  BG_E_ERROR_CONTEXT_REMOTE_APPLICATION = DWORD($8020001E);
+  {$EXTERNALSYM BG_E_ERROR_CONTEXT_REMOTE_APPLICATION}
+
+//
+// MessageId: BG_E_SESSION_NOT_FOUND
+//
+// MessageText:
+//
+//  The specified session could not be found on the server. Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_SESSION_NOT_FOUND = DWORD($8020001F);
+  {$EXTERNALSYM BG_E_SESSION_NOT_FOUND}
+
+//
+// MessageId: BG_E_TOO_LARGE
+//
+// MessageText:
+//
+//  The job is too large for the server to accept. This job might exceed a job size limit set by the server administrator. Reduce the size of the job, and then try again.
+//
+  BG_E_TOO_LARGE = DWORD($80200020);
+  {$EXTERNALSYM BG_E_TOO_LARGE}
+
+//
+// MessageId: BG_E_STRING_TOO_LONG
+//
+// MessageText:
+//
+//  The specified string is too long.
+//
+  BG_E_STRING_TOO_LONG = DWORD($80200021);
+  {$EXTERNALSYM BG_E_STRING_TOO_LONG}
+
+//
+// MessageId: BG_E_CLIENT_SERVER_PROTOCOL_MISMATCH
+//
+// MessageText:
+//
+//  The client and server versions of Background Intelligent Transfer Service (BITS) are incompatible.
+//
+  BG_E_CLIENT_SERVER_PROTOCOL_MISMATCH = DWORD($80200022);
+  {$EXTERNALSYM BG_E_CLIENT_SERVER_PROTOCOL_MISMATCH}
+
+//
+// MessageId: BG_E_SERVER_EXECUTE_ENABLE
+//
+// MessageText:
+//
+//  Scripting OR execute permissions are enabled on the IIS virtual directory associated with the job. To upload files to the virtual directory, disable the scripting and execute permissions on the virtual directory.
+//
+  BG_E_SERVER_EXECUTE_ENABLE = DWORD($80200023);
+  {$EXTERNALSYM BG_E_SERVER_EXECUTE_ENABLE}
+
+//
+// MessageId: BG_E_NO_PROGRESS
+//
+// MessageText:
+//
+//  The job is not making headway.  The server may be misconfigured.  Background Intelligent Transfer Service (BITS) will try again later.
+//
+  BG_E_NO_PROGRESS = DWORD($80200024);
+  {$EXTERNALSYM BG_E_NO_PROGRESS}
+
+//
+// MessageId: BG_E_USERNAME_TOO_LARGE
+//
+// MessageText:
+//
+//  The user name cannot be longer than 300 characters. Try again with a shorter name.
+//
+  BG_E_USERNAME_TOO_LARGE = DWORD($80200025);
+  {$EXTERNALSYM BG_E_USERNAME_TOO_LARGE}
+
+//
+// MessageId: BG_E_PASSWORD_TOO_LARGE
+//
+// MessageText:
+//
+//  The password cannot be longer than 300 characters. Try again with a shorter password.
+//
+  BG_E_PASSWORD_TOO_LARGE = DWORD($80200026);
+  {$EXTERNALSYM BG_E_PASSWORD_TOO_LARGE}
+
+//
+// MessageId: BG_E_INVALID_AUTH_TARGET
+//
+// MessageText:
+//
+//  The authentication target specified in the credentials is not defined.
+//
+  BG_E_INVALID_AUTH_TARGET = DWORD($80200027);
+  {$EXTERNALSYM BG_E_INVALID_AUTH_TARGET}
+
+//
+// MessageId: BG_E_INVALID_AUTH_SCHEME
+//
+// MessageText:
+//
+//  The authentication scheme specified in the credentials is not defined.
+//
+  BG_E_INVALID_AUTH_SCHEME = DWORD($80200028);
+  {$EXTERNALSYM BG_E_INVALID_AUTH_SCHEME}
+
+//
+// MessageId: BG_E_HTTP_ERROR_100
+//
+// MessageText:
+//
+//  The request can be continued.
+//
+  BG_E_HTTP_ERROR_100 = DWORD($80190064);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_100}
+
+//
+// MessageId: BG_E_HTTP_ERROR_101
+//
+// MessageText:
+//
+//  The server switched protocols in an upgrade header.
+//
+  BG_E_HTTP_ERROR_101 = DWORD($80190065);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_101}
+
+//
+// MessageId: BG_E_HTTP_ERROR_200
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_200 = DWORD($801900C8);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_200}
+
+//
+// MessageId: BG_E_HTTP_ERROR_201
+//
+// MessageText:
+//
+//  The request was fulfilled and resulted in the creation of a new resource.
+//
+  BG_E_HTTP_ERROR_201 = DWORD($801900C9);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_201}
+
+//
+// MessageId: BG_E_HTTP_ERROR_202
+//
+// MessageText:
+//
+//  The request was accepted for processing, but the processing has not been completed yet.
+//
+  BG_E_HTTP_ERROR_202 = DWORD($801900CA);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_202}
+
+//
+// MessageId: BG_E_HTTP_ERROR_203
+//
+// MessageText:
+//
+//  The returned metadata in the entity-header is not the definitive set available from the server of origin.
+//
+  BG_E_HTTP_ERROR_203 = DWORD($801900CB);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_203}
+
+//
+// MessageId: BG_E_HTTP_ERROR_204
+//
+// MessageText:
+//
+//  The server has fulfilled the request, but there is no new information to send back.
+//
+  BG_E_HTTP_ERROR_204 = DWORD($801900CC);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_204}
+
+//
+// MessageId: BG_E_HTTP_ERROR_205
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_205 = DWORD($801900CD);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_205}
+
+//
+// MessageId: BG_E_HTTP_ERROR_206
+//
+// MessageText:
+//
+//  The server fulfilled the partial GET request for the resource.
+//
+  BG_E_HTTP_ERROR_206 = DWORD($801900CE);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_206}
+
+//
+// MessageId: BG_E_HTTP_ERROR_300
+//
+// MessageText:
+//
+//  The server could not return the requested data.
+//
+  BG_E_HTTP_ERROR_300 = DWORD($8019012C);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_300}
+
+//
+// MessageId: BG_E_HTTP_ERROR_301
+//
+// MessageText:
+//
+//  The requested resource was assigned to a new permanent Uniform Resource Identifier (URI), and any future references to this resource should use one of the returned URIs.
+//
+  BG_E_HTTP_ERROR_301 = DWORD($8019012D);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_301}
+
+//
+// MessageId: BG_E_HTTP_ERROR_302
+//
+// MessageText:
+//
+//  The requested resource was assigned a different Uniform Resource Identifier (URI). This change is temporary.
+//
+  BG_E_HTTP_ERROR_302 = DWORD($8019012E);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_302}
+
+//
+// MessageId: BG_E_HTTP_ERROR_303
+//
+// MessageText:
+//
+//  The response to the request is under a different Uniform Resource Identifier (URI) and must be retrieved using a GET method on that resource.
+//
+  BG_E_HTTP_ERROR_303 = DWORD($8019012F);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_303}
+
+//
+// MessageId: BG_E_HTTP_ERROR_304
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_304 = DWORD($80190130);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_304}
+
+//
+// MessageId: BG_E_HTTP_ERROR_305
+//
+// MessageText:
+//
+//  The requested resource must be accessed through the proxy given by the location field.
+//
+  BG_E_HTTP_ERROR_305 = DWORD($80190131);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_305}
+
+//
+// MessageId: BG_E_HTTP_ERROR_307
+//
+// MessageText:
+//
+//  The URL has been temporarily relocated. Try again later.
+//
+  BG_E_HTTP_ERROR_307 = DWORD($80190133);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_307}
+
+//
+// MessageId: BG_E_HTTP_ERROR_400
+//
+// MessageText:
+//
+//  The server cannot process the request because the syntax is not valid.
+//
+  BG_E_HTTP_ERROR_400 = DWORD($80190190);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_400}
+
+//
+// MessageId: BG_E_HTTP_ERROR_401
+//
+// MessageText:
+//
+//  The requested resource requires user authentication.
+//
+  BG_E_HTTP_ERROR_401 = DWORD($80190191);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_401}
+
+//
+// MessageId: BG_E_HTTP_ERROR_402
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_402 = DWORD($80190192);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_402}
+
+//
+// MessageId: BG_E_HTTP_ERROR_403
+//
+// MessageText:
+//
+//  The client does not have sufficient access rights to the requested server object.
+//
+  BG_E_HTTP_ERROR_403 = DWORD($80190193);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_403}
+
+//
+// MessageId: BG_E_HTTP_ERROR_404
+//
+// MessageText:
+//
+//  The requested URL does not exist on the server.
+//
+  BG_E_HTTP_ERROR_404 = DWORD($80190194);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_404}
+
+//
+// MessageId: BG_E_HTTP_ERROR_405
+//
+// MessageText:
+//
+//  The method used is not allowed.
+//
+  BG_E_HTTP_ERROR_405 = DWORD($80190195);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_405}
+
+//
+// MessageId: BG_E_HTTP_ERROR_406
+//
+// MessageText:
+//
+//  No responses acceptable to the client were found.
+//
+  BG_E_HTTP_ERROR_406 = DWORD($80190196);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_406}
+
+//
+// MessageId: BG_E_HTTP_ERROR_407
+//
+// MessageText:
+//
+//  Proxy authentication is required.
+//
+  BG_E_HTTP_ERROR_407 = DWORD($80190197);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_407}
+
+//
+// MessageId: BG_E_HTTP_ERROR_408
+//
+// MessageText:
+//
+//  The server timed out waiting for the request.
+//
+  BG_E_HTTP_ERROR_408 = DWORD($80190198);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_408}
+
+//
+// MessageId: BG_E_HTTP_ERROR_409
+//
+// MessageText:
+//
+//  The request could not be completed because of a conflict with the current state of the resource. The user should resubmit the request with more information.
+//
+  BG_E_HTTP_ERROR_409 = DWORD($80190199);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_409}
+
+//
+// MessageId: BG_E_HTTP_ERROR_410
+//
+// MessageText:
+//
+//  The requested resource is not currently available at the server, and no forwarding address is known.
+//
+  BG_E_HTTP_ERROR_410 = DWORD($8019019A);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_410}
+
+//
+// MessageId: BG_E_HTTP_ERROR_411
+//
+// MessageText:
+//
+//  The server cannot accept the request without a defined content length.
+//
+  BG_E_HTTP_ERROR_411 = DWORD($8019019B);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_411}
+
+//
+// MessageId: BG_E_HTTP_ERROR_412
+//
+// MessageText:
+//
+//  The precondition given in one or more of the request header fields evaluated to false when it was tested on the server.
+//
+  BG_E_HTTP_ERROR_412 = DWORD($8019019C);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_412}
+
+//
+// MessageId: BG_E_HTTP_ERROR_413
+//
+// MessageText:
+//
+//  The server cannot process the request because the request entity is too large.
+//
+  BG_E_HTTP_ERROR_413 = DWORD($8019019D);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_413}
+
+//
+// MessageId: BG_E_HTTP_ERROR_414
+//
+// MessageText:
+//
+//  The server cannot process the request because the request Uniform Resource Identifier (URI) is longer than the server can interpret.
+//
+  BG_E_HTTP_ERROR_414 = DWORD($8019019E);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_414}
+
+//
+// MessageId: BG_E_HTTP_ERROR_415
+//
+// MessageText:
+//
+//  The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_415 = DWORD($8019019F);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_415}
+
+//
+// MessageId: BG_E_HTTP_ERROR_416
+//
+// MessageText:
+//
+//  The server could not satisfy the range request.
+//
+  BG_E_HTTP_ERROR_416 = DWORD($801901A0);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_416}
+
+//
+// MessageId: BG_E_HTTP_ERROR_417
+//
+// MessageText:
+//
+//  The server could not meet the expectation given in an Expect request-header field.
+//
+  BG_E_HTTP_ERROR_417 = DWORD($801901A1);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_417}
+
+//
+// MessageId: BG_E_HTTP_ERROR_449
+//
+// MessageText:
+//
+//   The server's response was not valid. The server was not following the defined protocol. Resume the job, and then Background Intelligent Transfer Service (BITS) will try again.
+//
+  BG_E_HTTP_ERROR_449 = DWORD($801901C1);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_449}
+
+//
+// MessageId: BG_E_HTTP_ERROR_500
+//
+// MessageText:
+//
+//  An unexpected condition prevented the server from fulfilling the request.
+//
+  BG_E_HTTP_ERROR_500 = DWORD($801901F4);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_500}
+
+//
+// MessageId: BG_E_HTTP_ERROR_501
+//
+// MessageText:
+//
+//  The server does not support the functionality required to fulfill the request.
+//
+  BG_E_HTTP_ERROR_501 = DWORD($801901F5);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_501}
+
+//
+// MessageId: BG_E_HTTP_ERROR_502
+//
+// MessageText:
+//
+//  The server, while acting as a gateway or proxy to fulfill the request, received an invalid response from the upstream server it accessed.
+//
+  BG_E_HTTP_ERROR_502 = DWORD($801901F6);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_502}
+
+//
+// MessageId: BG_E_HTTP_ERROR_503
+//
+// MessageText:
+//
+//  The service is temporarily overloaded.
+//
+  BG_E_HTTP_ERROR_503 = DWORD($801901F7);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_503}
+
+//
+// MessageId: BG_E_HTTP_ERROR_504
+//
+// MessageText:
+//
+//  The request was timed out waiting for a gateway.
+//
+  BG_E_HTTP_ERROR_504 = DWORD($801901F8);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_504}
+
+//
+// MessageId: BG_E_HTTP_ERROR_505
+//
+// MessageText:
+//
+//  The server does not support the HTTP protocol version that was used in the request message.
+//
+  BG_E_HTTP_ERROR_505 = DWORD($801901F9);
+  {$EXTERNALSYM BG_E_HTTP_ERROR_505}
+
+//
+// MessageId: MC_JOB_CANCELLED
+//
+// MessageText:
+//
+//  The administrator %4 canceled job "%2" on behalf of %3.  The job ID was %1.
+//
+  MC_JOB_CANCELLED = DWORD($80194000);
+  {$EXTERNALSYM MC_JOB_CANCELLED}
+
+//
+// MessageId: MC_FILE_DELETION_FAILED
+//
+// MessageText:
+//
+//  While canceling job "%2", BITS was not able to remove the temporary files listed below.
+//  If you can delete them, then you will regain some disk space.  The job ID was %1.%\
+//  
+//  %3
+//
+  MC_FILE_DELETION_FAILED = DWORD($80194001);
+  {$EXTERNALSYM MC_FILE_DELETION_FAILED}
+
+//
+// MessageId: MC_FILE_DELETION_FAILED_MORE
+//
+// MessageText:
+//
+//  While canceling job "%2", BITS was not able to remove the temporary files listed below.
+//  If you can delete them, then you will regain some disk space.  The job ID was %1. %\
+//  
+//  %3
+//  %\
+//  Due to space limitations, not all files are listed here.  Check for additional files of the form BITxxx.TMP in the same directory.
+//
+  MC_FILE_DELETION_FAILED_MORE = DWORD($80194002);
+  {$EXTERNALSYM MC_FILE_DELETION_FAILED_MORE}
+
+//
+// MessageId: MC_JOB_PROPERTY_CHANGE
+//
+// MessageText:
+//
+//  The administrator %3 modified the %4 property of job "%2".  The job ID was %1.
+//
+  MC_JOB_PROPERTY_CHANGE = DWORD($80194003);
+  {$EXTERNALSYM MC_JOB_PROPERTY_CHANGE}
+
+//
+// MessageId: MC_JOB_TAKE_OWNERSHIP
+//
+// MessageText:
+//
+//  The administrator %4 took ownership of job "%2" from %3.  The job ID was %1.
+//
+  MC_JOB_TAKE_OWNERSHIP = DWORD($80194004);
+  {$EXTERNALSYM MC_JOB_TAKE_OWNERSHIP}
+
+//
+// MessageId: MC_JOB_SCAVENGED
+//
+// MessageText:
+//
+//  Job "%2" owned by %3 was canceled after being inactive for more than %4 days.  The job ID was %1.
+//
+  MC_JOB_SCAVENGED = DWORD($80194005);
+  {$EXTERNALSYM MC_JOB_SCAVENGED}
+
+//
+// MessageId: MC_JOB_NOTIFICATION_FAILURE
+//
+// MessageText:
+//
+//  Job "%2" owned by %3 failed to notify its associated application.  BITS will retry in %4 minutes.  The job ID was %1.
+//
+  MC_JOB_NOTIFICATION_FAILURE = DWORD($80194006);
+  {$EXTERNALSYM MC_JOB_NOTIFICATION_FAILURE}
+
+//
+// MessageId: MC_STATE_FILE_CORRUPT
+//
+// MessageText:
+//
+//  The BITS job list is not in a recognized format.  It may have been created by a different version of BITS.  The job list has been cleared.
+//
+  MC_STATE_FILE_CORRUPT = DWORD($80194007);
+  {$EXTERNALSYM MC_STATE_FILE_CORRUPT}
+
+implementation
+
+end.

+ 66 - 0
packages/extra/winunits/jwablberr.pas

@@ -0,0 +1,66 @@
+{******************************************************************************}
+{                                                                              }
+{ BLB Error Codes API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: BLBErr.h, released June 2000. The original Pascal      }
+{ code is: BLBErr.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBLBErr;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "BLBErr.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+const
+
+  // First four bits - SEVERITY(11), CUSTOMER FLAG(1), RESERVED(0)
+
+  SDPBLB_CONF_BLOB_DESTROYED = $e0000300;
+  {$EXTERNALSYM SDPBLB_CONF_BLOB_DESTROYED}
+
+implementation
+
+end.

+ 2014 - 0
packages/extra/winunits/jwabluetoothapis.pas

@@ -0,0 +1,2014 @@
+{******************************************************************************}
+{                                                                              }
+{ BlueTooth API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributors: John Penman                                                    }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBluetoothAPIs;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bluetoothapis.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaWinBase, JwaBthSdpDef;
+
+const
+  BLUETOOTH_MAX_NAME_SIZE            = 248;
+  {$EXTERNALSYM BLUETOOTH_MAX_NAME_SIZE}
+  BLUETOOTH_MAX_PASSKEY_SIZE         = 16;
+  {$EXTERNALSYM BLUETOOTH_MAX_PASSKEY_SIZE}
+  BLUETOOTH_MAX_PASSKEY_BUFFER_SIZE  = BLUETOOTH_MAX_PASSKEY_SIZE + 1;
+  {$EXTERNALSYM BLUETOOTH_MAX_PASSKEY_BUFFER_SIZE}
+
+// ***************************************************************************
+//
+//  Bluetooth Address
+//
+// ***************************************************************************
+
+type
+  BTH_ADDR = Int64;
+  {$EXTERNALSYM BTH_ADDR}
+
+  _BLUETOOTH_ADDRESS = record
+    case Integer of
+      0: (ullLong: BTH_ADDR);       //  easier to compare again BLUETOOTH_NULL_ADDRESS
+      1: (rgBytes: array [0..5] of Byte);   //  easier to format when broken out
+  end;
+  {$EXTERNALSYM _BLUETOOTH_ADDRESS}
+  BLUETOOTH_ADDRESS = _BLUETOOTH_ADDRESS;
+  {$EXTERNALSYM BLUETOOTH_ADDRESS}
+  TBlueToothAddress = BLUETOOTH_ADDRESS;
+  PBlueToothAddress = ^BLUETOOTH_ADDRESS;
+
+const
+  BLUETOOTH_NULL_ADDRESS: TBlueToothAddress = (ullLong: 0;);
+  {$EXTERNALSYM BLUETOOTH_NULL_ADDRESS}
+
+// ***************************************************************************
+//
+//  Radio Enumeration
+//
+//  Description:
+//      This group of APIs enumerates the installed Bluetooth radios.
+//
+//  Sample Usage:
+//      HANDLE hRadio;
+//      BLUETOOTH_FIND_RADIO_PARAMS btfrp = { sizeof(btfrp) };
+//
+//      HBLUETOOTH_RADIO_FIND hFind = BluetoothFindFirstRadio( &btfrp, &hRadio );
+//      if ( NULL != hFind )
+//      {
+//          do
+//          {
+//              //
+//              //  TODO: Do something with the radio handle.
+//              //
+//
+//              CloseHandle( hRadio );
+//
+//          } while( BluetoothFindNextRadio( hFind, &hRadio ) );
+//
+//          BluetoothFindRadioClose( hFind );
+//      }
+//
+// ***************************************************************************
+
+type
+  _BLUETOOTH_FIND_RADIO_PARAMS = record
+    dwSize: DWORD;             //  IN  sizeof this structure
+  end;
+  {$EXTERNALSYM _BLUETOOTH_FIND_RADIO_PARAMS}
+  BLUETOOTH_FIND_RADIO_PARAMS = _BLUETOOTH_FIND_RADIO_PARAMS;
+  {$EXTERNALSYM BLUETOOTH_FIND_RADIO_PARAMS}
+  TBlueToothFindRadioParams = BLUETOOTH_FIND_RADIO_PARAMS;
+  PBlueToothFindRadioParams = ^BLUETOOTH_FIND_RADIO_PARAMS;
+
+  HBLUETOOTH_RADIO_FIND = THandle;
+  {$EXTERNALSYM HBLUETOOTH_RADIO_FIND}
+
+//
+//  Description:
+//      Begins the enumeration of local Bluetooth radios.
+//
+//  Parameters:
+//      pbtfrp
+//          A pointer to a BLUETOOTH_FIND_RADIO_PARAMS structure. The dwSize 
+//          member of this structure must match the sizeof the of the structure.
+//
+//      phRadio
+//          A pointer where the first radio HANDLE enumerated will be returned.
+//
+//  Return Values:
+//      NULL
+//          Error opening radios or no devices found. Use GetLastError() for
+//          more info.
+//
+//          ERROR_INVALID_PARAMETER
+//              pbtfrp parameter is NULL.
+//
+//          ERROR_REVISION_MISMATCH
+//              The pbtfrp structure is not the right length.
+//
+//          ERROR_OUTOFMEMORY
+//              Out of memory.
+//
+//          other Win32 errors.
+//
+//      any other
+//          Success. The return handle is valid and phRadio points to a valid handle.
+//
+
+function BluetoothFindFirstRadio(const pbtfrp: PBlueToothFindRadioParams; var phRadio: THandle): HBLUETOOTH_RADIO_FIND; stdcall;
+{$EXTERNALSYM BluetoothFindFirstRadio}
+
+//
+//  Description:
+//      Finds the next installed Bluetooth radio.
+//
+//  Parameters:
+//      hFind
+//          The handle returned by BluetoothFindFirstRadio().
+//
+//      phRadio
+//          A pointer where the next radio HANDLE enumerated will be returned.
+//
+//  Return Values:
+//      TRUE
+//          Next device succesfully found. pHandleOut points to valid handle.
+//
+//      FALSE
+//          No device found. pHandleOut points to an invalid handle. Call
+//          GetLastError() for more details.
+//
+//          ERROR_INVALID_HANDLE
+//              The handle is NULL.
+//
+//          ERROR_NO_MORE_ITEMS
+//              No more radios found.
+//
+//          ERROR_OUTOFMEMORY
+//              Out of memory.
+//
+//          other Win32 errors
+//
+
+function BluetoothFindNextRadio(hFind: HBLUETOOTH_RADIO_FIND; var phRadio: THandle): BOOL; stdcall;
+{$EXTERNALSYM BluetoothFindNextRadio}
+
+//
+//  Description:
+//      Closes the enumeration handle.
+//
+//  Parameters
+//      hFind
+//          The handle returned by BluetoothFindFirstRadio().
+//
+//  Return Values:
+//      TRUE
+//          Handle succesfully closed.
+//
+//      FALSE
+//          Failure. Check GetLastError() for details.
+//
+//          ERROR_INVALID_HANDLE
+//              The handle is NULL.
+//
+
+function BluetoothFindRadioClose(hFind: HBLUETOOTH_RADIO_FIND): BOOL; stdcall;
+{$EXTERNALSYM BluetoothFindRadioClose}
+
+// ***************************************************************************
+//
+//  Radio Information
+//
+// ***************************************************************************
+
+type
+  _BLUETOOTH_RADIO_INFO = record
+    dwSize: DWORD;                               // Size, in bytes, of this entire data structure
+    address: BLUETOOTH_ADDRESS;                  // Address of the local radio
+    szName: array [0..BLUETOOTH_MAX_NAME_SIZE - 1] of WideChar;    // Name of the local radio
+    ulClassofDevice: ULONG;                      // Class of device for the local radio
+    lmpSubversion: Word;                       // lmpSubversion, manufacturer specifc.
+    manufacturer: Word;                        // Manufacturer of the radio, BTH_MFG_Xxx value.  For the most up to date
+                                                // list, goto the Bluetooth specification website and get the Bluetooth
+                                                // assigned numbers document.
+  end;
+  {$EXTERNALSYM _BLUETOOTH_RADIO_INFO}
+  BLUETOOTH_RADIO_INFO = _BLUETOOTH_RADIO_INFO;
+  {$EXTERNALSYM BLUETOOTH_RADIO_INFO}
+  PBLUETOOTH_RADIO_INFO = ^BLUETOOTH_RADIO_INFO;
+  {$EXTERNALSYM PBLUETOOTH_RADIO_INFO}
+  TBlueToothRadioFind = BLUETOOTH_RADIO_INFO;
+  PBlueToothRadioFind = PBLUETOOTH_RADIO_INFO;
+
+//
+//  Description:
+//      Retrieves the information about the radio represented by the handle.
+//
+//  Parameters:
+//      hRadio
+//          Handle to a local radio retrieved through BluetoothFindFirstRadio()
+//          et al or SetupDiEnumerateDeviceInterfaces()
+//
+//      pRadioInfo
+//          Radio information to be filled in. The dwSize member must match the 
+//          size of the structure.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The information was retrieved successfully.
+//
+//      ERROR_INVALID_PARAMETER
+//          pRadioInfo or hRadio is NULL.
+//
+//      ERROR_REVISION_MISMATCH
+//          pRadioInfo->dwSize is invalid.
+//
+//      other Win32 error codes.
+//
+
+function BluetoothGetRadioInfo(hRadio: THandle; var pRadioInfo: BLUETOOTH_RADIO_INFO): DWORD; stdcall;
+{$EXTERNALSYM BluetoothGetRadioInfo}
+
+// ***************************************************************************
+//
+//  Device Information Stuctures
+//
+// ***************************************************************************
+
+type
+  _BLUETOOTH_DEVICE_INFO = record
+    dwSize: DWORD;                             //  size, in bytes, of this structure - must be the sizeof(BLUETOOTH_DEVICE_INFO)
+    Address: BLUETOOTH_ADDRESS;                  //  Bluetooth address
+    ulClassofDevice: ULONG;                    //  Bluetooth "Class of Device"
+    fConnected: BOOL;                         //  Device connected/in use
+    fRemembered: BOOL;                        //  Device remembered
+    fAuthenticated: BOOL;                     //  Device authenticated/paired/bonded
+    stLastSeen: SYSTEMTIME;                     //  Last time the device was seen
+    stLastUsed: SYSTEMTIME;                     //  Last time the device was used for other than RNR, inquiry, or SDP
+    szName: array [0..BLUETOOTH_MAX_NAME_SIZE - 1] of WideChar;  //  Name of the device
+  end;
+  {$EXTERNALSYM _BLUETOOTH_DEVICE_INFO}
+  BLUETOOTH_DEVICE_INFO = _BLUETOOTH_DEVICE_INFO;
+  {$EXTERNALSYM BLUETOOTH_DEVICE_INFO}
+  PBLUETOOTH_DEVICE_INFO = BLUETOOTH_DEVICE_INFO;
+  {$EXTERNALSYM PBLUETOOTH_DEVICE_INFO}
+  TBlueToothDeviceInfo = BLUETOOTH_DEVICE_INFO;
+  PBlueToothDeviceInfo = PBLUETOOTH_DEVICE_INFO;
+
+// ***************************************************************************
+//
+//  Device Enumeration
+//
+//  Description:
+//      Enumerates the Bluetooth devices. The types of returned device depends
+//      on the flags set in the BLUETOOTH_DEVICE_SEARCH_PARAMS (see structure
+//      definition for details).
+//
+//  Sample Usage:
+//      HBLUETOOTH_DEVICE_FIND hFind;
+//      BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = { sizeof(btsp) };
+//      BLUETOOTH_DEVICE_INFO btdi = { sizeof(btdi) };
+//
+//      btsp.fReturnAuthenticated = TRUE;
+//      btsp.fReturnRemembered    = TRUE;
+//
+//      hFind = BluetoothFindFirstDevice( &btsp, &btdi );
+//      if ( NULL != hFind )
+//      {
+//          do
+//          {
+//              //
+//              //  TODO:   Do something useful with the device info.
+//              //
+//
+//          } while( BluetoothFindNextDevice( hFind, &btdi ) );
+//
+//          BluetoothFindDeviceClose( hFind );
+//      }
+//
+// ***************************************************************************
+
+type
+  _BLUETOOTH_DEVICE_SEARCH_PARAMS = record
+    dwSize: DWORD;                 //  IN  sizeof this structure
+
+    fReturnAuthenticated: BOOL;   //  IN  return authenticated devices
+    fReturnRemembered: BOOL;      //  IN  return remembered devices
+    fReturnUnknown: BOOL;         //  IN  return unknown devices
+    fReturnConnected: BOOL;       //  IN  return connected devices
+
+    fIssueInquiry: BOOL;          //  IN  issue a new inquiry
+    cTimeoutMultiplier: UCHAR;     //  IN  timeout for the inquiry
+
+    hRadio: THandle;                 //  IN  handle to radio to enumerate - NULL == all radios will be searched
+  end;
+  {$EXTERNALSYM _BLUETOOTH_DEVICE_SEARCH_PARAMS}
+  BLUETOOTH_DEVICE_SEARCH_PARAMS = _BLUETOOTH_DEVICE_SEARCH_PARAMS;
+  {$EXTERNALSYM BLUETOOTH_DEVICE_SEARCH_PARAMS}
+  TBlueToothDeviceSearchParams = BLUETOOTH_DEVICE_SEARCH_PARAMS;
+
+  HBLUETOOTH_DEVICE_FIND = THandle;
+  {$EXTERNALSYM HBLUETOOTH_DEVICE_FIND}
+
+//
+//  Description:
+//      Begins the enumeration of Bluetooth devices.
+//
+//  Parameters:
+//      pbtsp
+//          A pointer to a BLUETOOTH_DEVICE_SEARCH_PARAMS structure. This
+//          structure contains the flags and inputs used to conduct the search.
+//          See BLUETOOTH_DEVICE_SEARCH_PARAMS for details.
+//
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
+//          about the first Bluetooth device found. Note that the dwSize member
+//          of the structure must be the sizeof(BLUETOOTH_DEVICE_INFO) before
+//          calling because the APIs hast to know the size of the buffer being
+//          past in. The dwSize member must also match the exact 
+//          sizeof(BLUETOOTH_DEVICE_INFO) or the call will fail.
+//
+//  Return Values:
+//      NULL
+//          Error opening radios or not devices found. Use GetLastError for more info.
+//
+//          ERROR_INVALID_PARAMETER
+//              pbtsp parameter or pbtdi parameter is NULL.
+//
+//          ERROR_REVISION_MISMATCH
+//              The pbtfrp structure is not the right length.
+//
+//          other Win32 errors
+//
+//      any other value
+//          Success. The return handle is valid and pbtdi points to valid data.
+//
+
+function BluetoothFindFirstDevice(const pbtsp: BLUETOOTH_DEVICE_SEARCH_PARAMS; var pbtdi: BLUETOOTH_DEVICE_INFO): HBLUETOOTH_DEVICE_FIND; stdcall;
+{$EXTERNALSYM BluetoothFindFirstDevice}
+
+//
+//  Description:
+//      Finds the next Bluetooth device in the enumeration.
+//
+//  Parameters:
+//      hFind
+//          The handle returned from BluetoothFindFirstDevice().
+//
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
+//          about the first Bluetooth device found. Note that the dwSize member
+//          of the structure must be the sizeof(BLUETOOTH_DEVICE_INFO) before
+//          calling because the APIs hast to know the size of the buffer being
+//          past in. The dwSize member must also match the exact
+//          sizeof(BLUETOOTH_DEVICE_INFO) or the call will fail.
+//
+//  Return Values:
+//      TRUE
+//          Next device succesfully found. pHandleOut points to valid handle.
+//
+//      FALSE
+//          No device found. pHandleOut points to an invalid handle. Call
+//          GetLastError() for more details.
+//
+//          ERROR_INVALID_HANDLE
+//              The handle is NULL.
+//
+//          ERROR_NO_MORE_ITEMS
+//              No more radios found.
+//
+//          ERROR_OUTOFMEMORY
+//              Out of memory.
+//
+//          other Win32 errors
+//
+
+function BluetoothFindNextDevice(hFind: HBLUETOOTH_DEVICE_FIND; var pbtdi: BLUETOOTH_DEVICE_INFO): BOOL; stdcall;
+{$EXTERNALSYM BluetoothFindNextDevice}
+
+//
+//  Description:
+//      Closes the enumeration handle.
+//
+//  Parameters:
+//      hFind
+//          The handle returned from BluetoothFindFirstDevice().
+//
+//  Return Values:
+//      TRUE
+//          Handle succesfully closed.
+//
+//      FALSE
+//          Failure. Check GetLastError() for details.
+//
+//          ERROR_INVALID_HANDLE
+//              The handle is NULL.
+//
+
+function BluetoothFindDeviceClose(hFind: HBLUETOOTH_DEVICE_FIND): BOOL; stdcall;
+{$EXTERNALSYM BluetoothFindDeviceClose}
+
+//
+//  Description:
+//      Retrieves information about a remote device.
+//
+//      Fill in the dwSize and the Address members of the pbtdi structure
+//      being passed in. On success, the rest of the members will be filled
+//      out with the information that the system knows.
+//
+//  Parameters:
+//      hRadio
+//          Handle to a local radio retrieved through BluetoothFindFirstRadio()
+//          et al or SetupDiEnumerateDeviceInterfaces()
+//
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure to return information
+//          about the first Bluetooth device found. The dwSize member of the
+//          structure must be the sizeof the structure in bytes. The Address
+//          member must be filled out with the Bluetooth address of the remote
+//          device.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          Success. Information returned.
+//
+//      ERROR_REVISION_MISMATCH
+//          The size of the BLUETOOTH_DEVICE_INFO isn't compatible. Check
+//          the dwSize member of the BLUETOOTH_DEVICE_INFO structure you
+//          passed in.
+//
+//      ERROR_NOT_FOUND
+//          The radio is not known by the system or the Address field of
+//          the BLUETOOTH_DEVICE_INFO structure is all zeros.
+//
+//      ERROR_INVALID_PARAMETER
+//          pbtdi is NULL.
+//
+//      other error codes
+//
+
+function BluetoothGetDeviceInfo(hRadio: THandle; var pbtdi: BLUETOOTH_DEVICE_INFO): DWORD; stdcall;
+{$EXTERNALSYM BluetoothGetDeviceInfo}
+
+//
+//  Description:
+//      Updates the computer local cache about the device.
+//
+//  Parameters:
+//      pbtdi
+//          A pointer to the BLUETOOTH_DEVICE_INFO structure to be updated.
+//          The following members must be valid:
+//              dwSize
+//                  Must match the size of the structure.
+//              Address
+//                  Must be a previously found radio address.
+//              szName
+//                  New name to be stored.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The device information was updated successfully.
+//
+//      ERROR_INVALID_PARAMETER
+//          pbtdi is NULL.
+//
+//      ERROR_REVISION_MISMATCH
+//          pbtdi->dwSize is invalid.
+//
+//      other Win32 error codes.
+//
+
+function BluetoothUpdateDeviceRecord(var pbtdi: BLUETOOTH_DEVICE_INFO): DWORD; stdcall;
+{$EXTERNALSYM BluetoothUpdateDeviceRecord}
+
+//
+//  Description:
+//      Delete the authentication (aka "bond") between the computer and the
+//      device. Also purges any cached information about the device.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The device was removed successfully.
+//
+//      ERROR_NOT_FOUND
+//          The device was not found. If no Bluetooth radio is installed,
+//          the devices could not be enumerated or removed.
+//
+
+function BluetoothRemoveDevice(var pAddress: BLUETOOTH_ADDRESS): DWORD; stdcall;
+{$EXTERNALSYM BluetoothRemoveDevice}
+
+// ***************************************************************************
+//
+//  Device Picker Dialog
+//
+//  Description:
+//      Invokes a common dialog for selecting Bluetooth devices. The list
+//      of devices displayed to the user is determined by the flags and
+//      settings the caller specifies in the BLUETOOTH_SELECT_DEVICE_PARAMS
+//      (see structure definition for more details).
+//
+//      If BluetoothSelectDevices() returns TRUE, the caller must call
+//      BluetoothSelectDevicesFree() or memory will be leaked within the
+//      process.
+//
+//  Sample Usage:
+//
+//      BLUETOOTH_SELECT_DEVICE_PARAMS btsdp = { sizeof(btsdp) };
+//
+//      btsdp.hwndParent = hDlg;
+//      btsdp.fShowUnknown = TRUE;
+//      btsdp.fAddNewDeviceWizard = TRUE;
+//
+//      BOOL b = BluetoothSelectDevices( &btsdp );
+//      if ( b )
+//      {
+//          BLUETOOTH_DEVICE_INFO * pbtdi = btsdp.pDevices;
+//          for ( ULONG cDevice = 0; cDevice < btsdp.cNumDevices; cDevice ++ )
+//          {
+//              if ( pbtdi->fAuthenticated || pbtdi->fRemembered )
+//              {
+//                  //
+//                  //  TODO:   Do something usefull with the device info
+//                  //
+//              }
+//
+//              pbtdi = (BLUETOOTH_DEVICE_INFO *) ((LPBYTE)pbtdi + pbtdi->dwSize);
+//          }
+//
+//          BluetoothSelectDevicesFree( &btsdp );
+//      }
+//
+// ***************************************************************************
+
+type
+  _BLUETOOTH_COD_PAIRS = record
+    ulCODMask: ULONG;                          //  ClassOfDevice mask to compare
+    pcszDescription: LPWSTR;                    //  Descriptive string of mask
+  end;
+  {$EXTERNALSYM _BLUETOOTH_COD_PAIRS}
+  BLUETOOTH_COD_PAIRS = _BLUETOOTH_COD_PAIRS;
+  {$EXTERNALSYM BLUETOOTH_COD_PAIRS}
+  TBlueToothCodPairs = BLUETOOTH_COD_PAIRS;
+  PBlueToothCodPairs = ^BLUETOOTH_COD_PAIRS;
+
+  PFN_DEVICE_CALLBACK = function(pvParam: Pointer; pDevice: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
+  {$EXTERNALSYM PFN_DEVICE_CALLBACK}
+
+  _BLUETOOTH_SELECT_DEVICE_PARAMS = record
+    dwSize: DWORD;                             //  IN  sizeof this structure
+
+    cNumOfClasses: ULONG;                      //  IN  Number in prgClassOfDevice - if ZERO search for all devices
+    prgClassOfDevices: PBlueToothCodPairs;    //  IN  Array of CODs to find.
+
+    pszInfo: LPWSTR;                            //  IN  If not NULL, sets the "information" text
+
+    hwndParent: HWND;                         //  IN  parent window - NULL == no parent
+
+    fForceAuthentication: BOOL;               //  IN  If TRUE, authenication will be forced before returning
+    fShowAuthenticated: BOOL;                 //  IN  If TRUE, authenticated devices will be shown in the picker
+    fShowRemembered: BOOL;                    //  IN  If TRUE, remembered devices will be shown in the picker
+    fShowUnknown: BOOL;                       //  IN  If TRUE, unknown devices that are not authenticated or "remember" will be shown.
+
+    fAddNewDeviceWizard: BOOL;                //  IN  If TRUE, invokes the add new device wizard.
+    fSkipServicesPage: BOOL;                  //  IN  If TRUE, skips the "Services" page in the wizard.
+
+    pfnDeviceCallback: PFN_DEVICE_CALLBACK;      //  IN  If non-NULL, a callback that will be called for each device. If the
+                                                //      the callback returns TRUE, the item will be added. If the callback is
+                                                //      is FALSE, the item will not be shown.
+    pvParam: Pointer;                            //  IN  Parameter to be passed to pfnDeviceCallback as the pvParam.
+
+    cNumDevices: DWORD;                        //  IN  number calles wants - ZERO == no limit.
+                                                //  OUT the number of devices returned.
+
+    pDevices: PBLUETOOTH_DEVICE_INFO;           //  OUT pointer to an array for BLUETOOTH_DEVICE_INFOs.
+                                                //      call BluetoothSelectDevicesFree() to free
+  end;
+  {$EXTERNALSYM _BLUETOOTH_SELECT_DEVICE_PARAMS}
+  BLUETOOTH_SELECT_DEVICE_PARAMS = _BLUETOOTH_SELECT_DEVICE_PARAMS;
+  {$EXTERNALSYM BLUETOOTH_SELECT_DEVICE_PARAMS}
+  TBlueToothSelectDeviceParams = BLUETOOTH_SELECT_DEVICE_PARAMS;
+  PBlueToothSelectDeviceParams = ^BLUETOOTH_SELECT_DEVICE_PARAMS;
+
+//
+//  Description:
+//      (See header above)
+//
+//  Return Values:
+//      TRUE
+//          User selected a device. pbtsdp->pDevices points to valid data.
+//          Caller should check the fAuthenticated && fRemembered flags to
+//          determine which devices we successfuly authenticated or valid
+//          selections by the user.
+//
+//          Use BluetoothSelectDevicesFree() to free the nessecary data
+//          such as pDevices only if this function returns TRUE.
+//
+//      FALSE
+//          No valid data returned. Call GetLastError() for possible details
+//          of the failure. If GLE() is:
+//
+//          ERROR_CANCELLED
+//              The user cancelled  the request.
+//
+//          ERROR_INVALID_PARAMETER
+//              The pbtsdp is NULL.
+//
+//          ERROR_REVISION_MISMATCH
+//              The structure passed in as pbtsdp is of an unknown size.
+//
+//          other WIN32 errors
+//
+
+function BluetoothSelectDevices(pbtsdp: PBlueToothSelectDeviceParams): BOOL; stdcall;
+{$EXTERNALSYM BluetoothSelectDevices}
+
+//
+//  Description:
+//      This function should only be called if BluetoothSelectDevices() returns
+//      TRUE. This function will free any memory and resource returned by the
+//      BluetoothSelectDevices() in the BLUETOOTH_SELECT_DEVICE_PARAMS
+//      structure.
+//
+//  Return Values:
+//      TRUE
+//          Success.
+//
+//      FALSE
+//          Nothing to free.
+//
+
+function BluetoothSelectDevicesFree(pbtsdp: PBlueToothSelectDeviceParams): BOOL; stdcall;
+{$EXTERNALSYM BluetoothSelectDevicesFree}
+
+// ***************************************************************************
+//
+//  Device Property Sheet
+//
+// ***************************************************************************
+
+//
+//  Description:
+//      Invokes the CPLs device info property sheet.
+//
+//  Parameters:
+//      hwndParent
+//          HWND to parent the property sheet.
+//
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure of the device
+//          to be displayed.
+//
+//  Return Values:
+//      TRUE
+//          The property page was successfully displayed.
+//
+//      FALSE
+//          Failure. The property page was not displayed. Check GetLastError
+//          for more details.
+//
+
+function BluetoothDisplayDeviceProperties(hwndParent: HWND; pbtdi: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
+{$EXTERNALSYM BluetoothDisplayDeviceProperties}
+
+// ***************************************************************************
+//
+//  Radio Authentication
+//
+// ***************************************************************************
+
+//
+//  Description:
+//      Sends an authentication request to a remote device. 
+//
+//      There are two modes of operation. "Wizard mode" and "Blind mode."
+//
+//      "Wizard mode" is invoked when the pszPasskey is NULL. This will cause
+//      the "Bluetooth Connection Wizard" to be invoked. The user will be
+//      prompted to enter a passkey during the wizard after which the
+//      authentication request will be sent. The user will see the success
+//      or failure of the authentication attempt. The user will also be
+//      given the oppurtunity to try to fix a failed authentication.
+//
+//      "Blind mode" is invoked when the pszPasskey is non-NULL. This will
+//      cause the computer to send a authentication request to the remote
+//      device. No UI is ever displayed. The Bluetooth status code will be
+//      mapped to a Win32 Error code.
+//
+//  Parameters:
+//
+//      hwndParent
+//          The window to parent the authentication wizard. If NULL, the 
+//          wizard will be parented off the desktop.
+//
+//      hRadio
+//          A valid local radio handle or NULL. If NULL, then all radios will
+//          be tired. If any of the radios succeed, then the call will
+//          succeed.
+//
+//      pbtdi
+//          BLUETOOTH_DEVICE_INFO record of the device to be authenticated.
+//
+//      pszPasskey
+//          PIN to be used to authenticate the device.  If NULL, then UI is
+//          displayed and the user steps through the authentication process.
+//          If not NULL, no UI is shown.  The passkey is NOT NULL terminated.
+//
+//      ulPasskeyLength
+//          Length of szPassKey in bytes. The length must be less than or 
+//          equal to BLUETOOTH_MAX_PASSKEY_SIZE * sizeof(WCHAR).
+//
+//  Return Values:
+//
+//      ERROR_SUCCESS
+//          Success.
+//
+//      ERROR_CANCELLED
+//          User aborted the operation.
+//
+//      ERROR_INVALID_PARAMETER
+//          The device structure in pbtdi is invalid.
+//
+//      ERROR_NO_MORE_ITEMS
+//          The device in pbtdi is already been marked as authenticated.
+//
+//      other WIN32 error
+//          Failure. Return value is the error code.
+//
+//      For "Blind mode," here is the current mapping of Bluetooth status
+//      code to Win32 error codes:
+//
+//          { BTH_ERROR_SUCCESS,                ERROR_SUCCESS },
+//          { BTH_ERROR_NO_CONNECTION,          ERROR_DEVICE_NOT_CONNECTED },
+//          { BTH_ERROR_PAGE_TIMEOUT,           WAIT_TIMEOUT },
+//          { BTH_ERROR_HARDWARE_FAILURE,       ERROR_GEN_FAILURE },
+//          { BTH_ERROR_AUTHENTICATION_FAILURE, ERROR_NOT_AUTHENTICATED },
+//          { BTH_ERROR_MEMORY_FULL,            ERROR_NOT_ENOUGH_MEMORY },
+//          { BTH_ERROR_CONNECTION_TIMEOUT,     WAIT_TIMEOUT },
+//          { BTH_ERROR_LMP_RESPONSE_TIMEOUT,   WAIT_TIMEOUT },
+//          { BTH_ERROR_MAX_NUMBER_OF_CONNECTIONS, ERROR_REQ_NOT_ACCEP },
+//          { BTH_ERROR_PAIRING_NOT_ALLOWED,    ERROR_ACCESS_DENIED },
+//          { BTH_ERROR_UNSPECIFIED_ERROR,      ERROR_NOT_READY },
+//          { BTH_ERROR_LOCAL_HOST_TERMINATED_CONNECTION, ERROR_VC_DISCONNECTED },
+//
+
+function BluetoothAuthenticateDevice(
+    hwndParent: HWND;
+    hRadio: THandle;
+    pbtbi: PBLUETOOTH_DEVICE_INFO;
+    pszPasskey: PWideChar;
+    ulPasskeyLength: ULONG): DWORD; stdcall;
+{$EXTERNALSYM BluetoothAuthenticateDevice}
+
+//
+//  Description:
+//      Allows the caller to prompt for multiple devices to be authenticated
+//      within a single instance of the "Bluetooth Connection Wizard."
+//
+//  Parameters:
+//
+//      hwndParent
+//          The window to parent the authentication wizard. If NULL, the 
+//          wizard will be parented off the desktop.
+//
+//      hRadio
+//          A valid local radio handle or NULL. If NULL, then all radios will
+//          be tired. If any of the radios succeed, then the call will
+//          succeed.
+//
+//      cDevices
+//          Number of devices in the rgbtdi array.
+//
+//      rgbtdi
+//          An array BLUETOOTH_DEVICE_INFO records of the devices to be
+//          authenticated.
+//
+//  Return Values:
+//
+//      ERROR_SUCCESS
+//          Success. Check the fAuthenticate flag on each of the devices.
+//
+//      ERROR_CANCELLED
+//          User aborted the operation. Check the fAuthenticate flags on 
+//          each device to determine if any of the devices were authenticated
+//          before the user cancelled the operation.
+//
+//      ERROR_INVALID_PARAMETER
+//          One of the items in the array of devices is invalid.
+//
+//      ERROR_NO_MORE_ITEMS
+//          All the devices in the array of devices are already been marked as
+//          being authenticated.
+//
+//      other WIN32 error
+//          Failure. Return value is the error code.
+//
+
+function BluetoothAuthenticateMultipleDevices(
+    hwndParent: HWND;
+    hRadio: THandle;
+    cDevices: DWORD;
+    pbtdi: PBLUETOOTH_DEVICE_INFO): DWORD; stdcall;
+{$EXTERNALSYM BluetoothAuthenticateMultipleDevices}
+
+// ***************************************************************************
+//
+//  Bluetooth Services
+//
+// ***************************************************************************
+
+const
+  BLUETOOTH_SERVICE_DISABLE  = $00;
+  {$EXTERNALSYM BLUETOOTH_SERVICE_DISABLE}
+  BLUETOOTH_SERVICE_ENABLE   = $01;
+  {$EXTERNALSYM BLUETOOTH_SERVICE_ENABLE}
+  BLUETOOTH_SERVICE_MASK     = BLUETOOTH_SERVICE_ENABLE or BLUETOOTH_SERVICE_DISABLE;
+  {$EXTERNALSYM BLUETOOTH_SERVICE_MASK}
+
+//
+//  Description:
+//      Enables/disables the services for a particular device.
+//
+//      The system maintains a mapping of service guids to supported drivers for
+//      Bluetooth-enabled devices. Enabling a service installs the corresponding
+//      device driver. Disabling a service removes the corresponding device driver.
+//
+//      If a non-supported service is enabled, a driver will not be installed.
+//
+//  Parameters
+//      hRadio
+//          Handle of the local Bluetooth radio device.
+//
+//      pbtdi
+//          Pointer to a BLUETOOTH_DEVICE_INFO record.
+//
+//      pGuidService
+//          The service GUID on the remote device.
+//
+//      dwServiceFlags
+//          Flags to adjust the service.
+//              BLUETOOTH_SERVICE_DISABLE   -   disable the service
+//              BLUETOOTH_SERVICE_ENABLE    -   enables the service
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The call was successful.
+//
+//      ERROR_INVALID_PARAMETER
+//          dwServiceFlags are invalid.
+//
+//      ERROR_SERVICE_DOES_NOT_EXIST
+//          The GUID in pGuidService is not supported.
+//
+//      other WIN32 error
+//          The call failed.
+//
+
+function BluetoothSetServiceState(
+    hRadio: THandle;
+    pbtdi: PBLUETOOTH_DEVICE_INFO;
+    const pGuidService: TGUID;
+    dwServiceFlags: DWORD): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSetServiceState}
+
+//
+//  Description:
+//      Enumerates the services guids enabled on a particular device. If hRadio
+//      is NULL, all device will be searched for the device and all the services 
+//      enabled will be returned.
+//
+//  Parameters:
+//      hRadio
+//          Handle of the local Bluetooth radio device. If NULL, it will search
+//          all the radios for the address in the pbtdi.
+//
+//      pbtdi
+//          Pointer to a BLUETOOTH_DEVICE_INFO record.
+//
+//      pcService
+//          On input, the number of records pointed to by pGuidServices.
+//          On output, the number of valid records return in pGuidServices.
+//
+//      pGuidServices
+//          Pointer to memory that is at least *pcService in length.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The call succeeded. pGuidServices is valid.
+//
+//      ERROR_MORE_DATA
+//          The call succeeded. pGuidService contains an incomplete list of
+//          enabled service GUIDs.
+//
+//      other WIN32 errors
+//          The call failed.
+//
+
+function BluetoothEnumerateInstalledServices(
+    hRadio: THandle;
+    pbtdi: PBLUETOOTH_DEVICE_INFO;
+    var pcServices: DWORD;
+    pGuidServices: PGUID): DWORD; stdcall;
+{$EXTERNALSYM BluetoothEnumerateInstalledServices}
+
+//
+//  Description:
+//      Change the discovery state of the local radio(s).
+//      If hRadio is NULL, all the radios will be set.
+//
+//      Use BluetoothIsDiscoverable() to determine the radios current state.
+//
+//      The system ensures that a discoverable system is connectable, thus
+//      the radio must allow incoming connections (see 
+//      BluetoothEnableIncomingConnections) prior to making a radio 
+//      discoverable. Failure to do so will result in this call failing
+//      (returns FALSE).
+//
+//  Parameters:
+//      hRadio
+//          If not NULL, changes the state of a specific radio.
+//          If NULL, the API will interate through all the radios.
+//
+//      fEnabled
+//          If FALSE, discovery will be disabled.
+//
+//  Return Values
+//      TRUE
+//          State was successfully changed. If the caller specified NULL for
+//          hRadio, at least of the radios accepted the state change.
+//
+//      FALSE
+//          State was not changed. If the caller specified NULL for hRadio, all
+//          of the radios did not accept the state change.
+//
+
+function BluetoothEnableDiscovery(hRadio: THandle; fEnabled: BOOL): BOOL; stdcall;
+{$EXTERNALSYM BluetoothEnableDiscovery}
+
+//
+//  Description:
+//      Determines if the Bluetooth radios are discoverable. If there are 
+//      multiple radios, the first one to say it is discoverable will cause 
+//      this function to return TRUE.
+//
+//  Parameters:
+//      hRadio
+//          Handle of the radio to check. If NULL, it will check all local
+//          radios.
+//
+//  Return Values:
+//      TRUE
+//          A least one radio is discoverable.
+//
+//      FALSE
+//          No radios are discoverable.
+//
+
+function BluetoothIsDiscoverable(hRadio: THandle): BOOL; stdcall;
+{$EXTERNALSYM BluetoothIsDiscoverable}
+
+//
+//  Description:
+//      Enables/disables the state of a radio to accept incoming connections.
+//      If hRadio is NULL, all the radios will be set.
+//
+//      Use BluetoothIsConnectable() to determine the radios current state.
+//
+//      The system enforces that a radio that is not connectable is not
+//      discoverable too. The radio must be made non-discoverable (see 
+//      BluetoothEnableDiscovery) prior to making a radio non-connectionable. 
+//      Failure to do so will result in this call failing (returns FALSE).
+//
+//  Parameters:
+//      hRadio
+//          If not NULL, changes the state of a specific radio.
+//          If NULL, the API will interate through all the radios.
+//
+//      fEnabled
+//          If FALSE, incoming connection will be disabled.
+//
+//  Return Values
+//      TRUE
+//          State was successfully changed. If the caller specified NULL for
+//          hRadio, at least of the radios accepted the state change.
+//
+//      FALSE
+//          State was not changed. If the caller specified NULL for hRadio, all
+//          of the radios did not accept the state change.
+//
+
+function BluetoothEnableIncomingConnections(hRadio: THandle; fEnabled: BOOL): BOOL; stdcall;
+{$EXTERNALSYM BluetoothEnableIncomingConnections}
+
+//
+//  Description:
+//      Determines if the Bluetooth radios are connectable. If there are 
+//      multiple radios, the first one to say it is connectable will cause 
+//      this function to return TRUE.
+//
+//  Parameters:
+//      hRadio
+//          Handle of the radio to check. If NULL, it will check all local
+//          radios.
+//
+//  Return Values:
+//      TRUE
+//          A least one radio is allowing incoming connections.
+//
+//      FALSE
+//          No radios are allowing incoming connections.
+//
+
+function BluetoothIsConnectable(hRadio: THandle): BOOL; stdcall;
+{$EXTERNALSYM BluetoothIsConnectable}
+
+// ***************************************************************************
+//
+//  Authentication Registration
+//
+// ***************************************************************************
+
+type
+  HBLUETOOTH_AUTHENTICATION_REGISTRATION = THandle;
+  {$EXTERNALSYM HBLUETOOTH_AUTHENTICATION_REGISTRATION}
+
+  PFN_AUTHENTICATION_CALLBACK = function(pvParam: Pointer; pDevice: PBLUETOOTH_DEVICE_INFO): BOOL; stdcall;
+  {$EXTERNALSYM PFN_AUTHENTICATION_CALLBACK}
+
+//
+//  Description:
+//      Registers a callback function to be called when a particular device
+//      requests authentication. The request is sent to the last application
+//      that requested authentication for a particular device.
+//
+//  Parameters:
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure. The Bluetooth
+//          address will be used for comparision.
+//
+//      phRegHandle
+//          A pointer to where the registration HANDLE value will be 
+//          stored. Call BluetoothUnregisterAuthentication() to close
+//          the handle.
+//
+//      pfnCallback
+//          The function that will be called when the authentication event
+//          occurs. This function should match PFN_AUTHENTICATION_CALLBACK's
+//          prototype.
+//
+//      pvParam
+//          Optional parameter to be past through to the callback function.
+//          This can be anything the application was to define.
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          Success. A valid registration handle was returned.
+//
+//      ERROR_OUTOFMEMORY
+//          Out of memory.
+//
+//      other Win32 error.
+//          Failure. The registration handle is invalid.
+//
+
+function BluetoothRegisterForAuthentication(
+    pbtdi: PBLUETOOTH_DEVICE_INFO;
+    var phRegHandle: HBLUETOOTH_AUTHENTICATION_REGISTRATION;
+    pfnCallback: PFN_AUTHENTICATION_CALLBACK;
+    pvParam: Pointer): DWORD; stdcall;
+{$EXTERNALSYM BluetoothRegisterForAuthentication}
+
+//
+//  Description:
+//      Unregisters an authentication callback and closes the handle. See 
+//      BluetoothRegisterForAuthentication() for more information about
+//      authentication registration.
+//
+//  Parameters:
+//      hRegHandle
+//          Handle returned by BluetoothRegisterForAuthentication().
+//
+//  Return Value:
+//      TRUE
+//          The handle was successfully closed.
+//
+//      FALSE
+//          The handle was not successfully closed. Check GetLastError for
+//          more details.
+//
+//          ERROR_INVALID_HANDLE
+//              The handle is NULL.
+//
+//          other Win32 errors.
+//
+
+function BluetoothUnregisterAuthentication(hRegHandle: HBLUETOOTH_AUTHENTICATION_REGISTRATION): BOOL; stdcall;
+{$EXTERNALSYM BluetoothUnregisterAuthentication}
+
+//
+//  Description:
+//      This function should be called after receiving an authentication request
+//      to send the passkey response.
+//
+//  Parameters:
+//
+//      hRadio
+//          Optional handle to the local radio. If NULL, the function will try
+//          each radio until one succeeds.
+//
+//      pbtdi
+//          A pointer to a BLUETOOTH_DEVICE_INFO structure describing the device
+//          being authenticated. This can be the same structure passed to the 
+//          callback function.
+//
+//      pszPasskey
+//          A pointer to UNICODE zero-terminated string of the passkey response
+//          that should be sent back to the authenticating device.
+//
+//  Return Values:
+//      ERROR_SUCESS
+//          The device accepted the passkey response. The device is authenticated.
+//
+//      ERROR_CANCELED
+//          The device denied the passkey reponse. This also will returned if there
+//          is a communications problem with the local radio.
+//
+//      E_FAIL
+//          The device returned a failure code during authentication.
+//
+//      other Win32 error codes
+//
+
+function BluetoothSendAuthenticationResponse(
+    hRadio: THandle;
+    pbtdi: PBLUETOOTH_DEVICE_INFO;
+    pszPasskey: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSendAuthenticationResponse}
+
+// ***************************************************************************
+//
+//  SDP Parsing Functions
+//
+// ***************************************************************************
+
+type
+  TSpdElementDataString = record
+    // raw string buffer, may not be encoded as ANSI, use
+    // BluetoothSdpGetString to convert the value if it is described
+    // by the base language attribute ID list
+    value: PBYTE;
+    // raw length of the string, may not be NULL terminuated
+    length: ULONG;
+  end;
+
+  TSpdElementDataUrl = record
+    value: PBYTE;
+    length: ULONG;
+  end;
+
+  // type == SDP_TYPE_SEQUENCE
+  TSpdElementDataSequence = record
+    // raw sequence, starts at sequence element header
+    value: PBYTE;
+    // raw sequence length
+    length: ULONG;
+  end;
+
+  // type == SDP_TYPE_ALTERNATIVE
+  TSpdElementDataAlternative = record
+    // raw alternative, starts at alternative element header
+    value: PBYTE;
+    // raw alternative length
+    length: ULONG;
+  end;
+
+  _SDP_ELEMENT_DATA = record
+    //
+    // Enumeration of SDP element types.  Generic element types will have a
+    // specificType value other then SDP_ST_NONE.  The generic types are:
+    // o SDP_TYPE_UINT
+    // o SDP_TYPE_INT
+    // o SDP_TYPE_UUID
+    //
+    type_: SDP_TYPE;
+
+    //
+    // Specific types for the generic SDP element types.
+    //
+    specificType: SDP_SPECIFICTYPE;
+
+    //
+    // Union of all possible data types.  type and specificType will indicate
+    // which field is valid.  For types which do not have a valid specificType,
+    // specific type will be SDP_ST_NONE.
+    //
+    case Integer of
+        // type == SDP_TYPE_INT
+        0: (int128: SDP_LARGE_INTEGER_16);        // specificType == SDP_ST_INT128
+        1: (int64: LONGLONG);                     // specificType == SDP_ST_INT64
+        2: (int32: Integer);                         // specificType == SDP_ST_INT32
+        3: (int16: SHORT);                        // specificType == SDP_ST_INT16
+        4: (int8: CHAR);                          // specificType == SDP_ST_INT8
+
+        // type == SDP_TYPE_UINT
+        5: (uint128: SDP_ULARGE_INTEGER_16);      // specificType == SDP_ST_UINT128
+        6: (uint64: Int64);                   // specificType == SDP_ST_UINT64
+        7: (uint32: ULONG);                       // specificType == SDP_ST_UINT32
+        8: (uint16: Word);                      // specificType == SDP_ST_UINT16
+        9: (uint8: UCHAR);                        // specificType == SDP_ST_UINT8
+
+        // type == SDP_TYPE_BOOLEAN
+        10: (booleanVal: UCHAR);
+
+        // type == SDP_TYPE_UUID
+        11: (uuid128: TGUID);                       // specificType == SDP_ST_UUID128
+        12: (uuid32: ULONG);                       // specificType == SDP_ST_UUID32
+        13: (uuid16: Word);                      // specificType == SDP_ST_UUID32
+
+        // type == SDP_TYPE_STRING
+        14: (string_: TSpdElementDataString);
+        // type == SDP_TYPE_URL
+        15: (url: TSpdElementDataUrl);
+
+        // type == SDP_TYPE_SEQUENCE
+        16: (sequence: TSpdElementDataSequence);
+
+        // type == SDP_TYPE_ALTERNATIVE
+        17: (alternative: TSpdElementDataAlternative);
+  end;
+  {$EXTERNALSYM _SDP_ELEMENT_DATA}
+  SDP_ELEMENT_DATA = _SDP_ELEMENT_DATA;
+  {$EXTERNALSYM SDP_ELEMENT_DATA}
+  PSDP_ELEMENT_DATA = ^SDP_ELEMENT_DATA;
+  {$EXTERNALSYM PSDP_ELEMENT_DATA}
+  TSdpElementData = SDP_ELEMENT_DATA;
+  PSdpElementData = PSDP_ELEMENT_DATA;  
+
+//
+// Description:
+//      Retrieves and parses the element found at pSdpStream
+//
+// Parameters:
+//      IN pSdpStream
+//          pointer to valid SDP stream
+//
+//      IN cbSdpStreamLength
+//          length of pSdpStream in bytes
+//
+//      OUT pData
+//          pointer to be filled in with the data of the SDP element at the
+//          beginning of pSdpStream
+//
+// Return Values:
+//      ERROR_INVALID_PARAMETER
+//          one of required parameters is NULL or the pSdpStream is invalid
+//
+//      ERROR_SUCCESS
+//          the sdp element was parsed correctly
+//
+
+function BluetoothSdpGetElementData(
+    pSdpStream: PBYTE;
+    cbSdpStreamLength: ULONG;
+    pData: PSDP_ELEMENT_DATA): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSdpGetElementData}
+
+type
+  HBLUETOOTH_CONTAINER_ELEMENT = THandle;
+  {$EXTERNALSYM HBLUETOOTH_CONTAINER_ELEMENT}
+
+//
+// Description:
+//      Iterates over a container stream, returning each elemetn contained with
+//      in the container element at the beginning of pContainerStream
+//
+// Parameters:
+//      IN pContainerStream
+//          pointer to valid SDP stream whose first element is either a sequence
+//          or alternative
+//
+//      IN cbContainerlength
+//          length in bytes of pContainerStream
+//
+//      IN OUT pElement
+//          Value used to keep track of location within the stream.  The first
+//          time this function is called for a particular container, *pElement
+//          should equal NULL.  Upon subsequent calls, the value should be
+//          unmodified.
+//
+//      OUT pData
+//          pointer to be filled in with the data of the SDP element at the
+//          current element of pContainerStream
+//
+//  Return Values:
+//      ERROR_SUCCESS
+//          The call succeeded, pData contains the data
+//
+//      ERROR_NO_MORE_ITEMS
+//          There are no more items in the list, the caller should cease calling
+//          BluetoothSdpGetContainerElementData for this container.
+//
+//      ERROR_INVALID_PARAMETER
+//          A required pointer is NULL or the container is not a valid SDP
+//          stream
+//
+// Usage example:
+//
+// HBLUETOOTH_CONTAINER_ELEMENT element;
+// SDP_ELEMENT_DATA data;
+// ULONG result;
+//
+// element = NULL;
+//
+// while (TRUE) {
+//      result = BluetoothSdpGetContainerElementData(
+//          pContainer, ulContainerLength, &element, &data);
+//
+//      if (result == ERROR_NO_MORE_ITEMS) {
+//          // We are done
+//          break;
+//      }
+//      else if (result != ERROR_SUCCESS) {
+//          // error
+//      }
+//
+//      // do something with data ...
+// }
+//
+//
+
+function BluetoothSdpGetContainerElementData(
+    pContainerStream: PBYTE;
+    cbContainerLength: ULONG;
+    var pElement: HBLUETOOTH_CONTAINER_ELEMENT;
+    pData: PSDP_ELEMENT_DATA): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSdpGetContainerElementData}
+
+//
+// Description:
+//      Retrieves the attribute value for the given attribute ID.  pRecordStream
+//      must be an SDP stream that is formatted as an SDP record, a SEQUENCE
+//      containing UINT16 + element pairs.
+//
+// Parameters:
+//      IN pRecordStream
+//          pointer to a valid SDP stream which is formatted as a singl SDP
+//          record
+//
+//      IN cbRecordlnegh
+//          length of pRecordStream in bytes
+//
+//      IN usAttributeId
+//          the attribute ID to search for.  see bthdef.h for SDP_ATTRIB_Xxx
+//          values.
+//
+//      OUT pAttributeData
+//          pointer that will contain the attribute ID's value
+//
+// Return Values:
+//      ERRROR_SUCCESS
+//          Call succeeded, pAttributeData contains the attribute value
+//
+//      ERROR_INVALID_PARAMETER
+//          One of the required pointers was NULL, pRecordStream was not a valid
+//          SDP stream, or pRecordStream was not a properly formatted SDP record
+//
+//      ERROR_FILE_NOT_FOUND
+//          usAttributeId was not found in the record
+//
+// Usage:
+//
+// ULONG result;
+// SDP_DATA_ELEMENT data;
+//
+// result = BluetoothSdpGetAttributeValue(
+//      pRecordStream, cbRecordLength, SDP_ATTRIB_RECORD_HANDLE, &data);
+// if (result == ERROR_SUCCESS) {
+//      printf("record handle is 0x%x\n", data.data.uint32);
+// }
+//
+
+function BluetoothSdpGetAttributeValue(
+    pRecordStream: PBYTE;
+    cbRecordLength: ULONG;
+    usAttributeId: Word;
+    pAttributeData: PSDP_ELEMENT_DATA): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSdpGetAttributeValue}
+
+//
+// These three fields correspond one to one with the triplets defined in the
+// SDP specification for the language base attribute ID list.
+//
+
+type
+  _SDP_STRING_TYPE_DATA = record
+    //
+    // How the string is encoded according to ISO 639:1988 (E/F): "Code
+    // for the representation of names of languages".
+    //
+    encoding: Word;
+
+    //
+    // MIBE number from IANA database
+    //
+    mibeNum: Word;
+
+    //
+    // The base attribute where the string is to be found in the record
+    //
+    attributeId: Word;
+  end;
+  {$EXTERNALSYM _SDP_STRING_TYPE_DATA}
+  SDP_STRING_TYPE_DATA = _SDP_STRING_TYPE_DATA;
+  {$EXTERNALSYM SDP_STRING_TYPE_DATA}
+  PSDP_STRING_TYPE_DATA = ^SDP_STRING_TYPE_DATA;
+  {$EXTERNALSYM PSDP_STRING_TYPE_DATA}
+  TSdpStringTypeData = SDP_STRING_TYPE_DATA;
+  PSdpStringTypeData = PSDP_STRING_TYPE_DATA;  
+
+//
+// Description:
+//      Converts a raw string embedded in the SDP record into a UNICODE string
+//
+// Parameters:
+//      IN pRecordStream
+//          a valid SDP stream which is formatted as an SDP record
+//
+//      IN cbRecordLength
+//          length of pRecordStream in bytes
+//
+//      IN pStringData
+//          if NULL, then the calling thread's locale will be used to search
+//          for a matching string in the SDP record.  If not NUL, the mibeNum
+//          and attributeId will be used to find the string to convert.
+//
+//      IN usStringOffset
+//          the SDP string type offset to convert.  usStringOffset is added to
+//          the base attribute id of the string.   SDP specification defined
+//          offsets are: STRING_NAME_OFFSET, STRING_DESCRIPTION_OFFSET, and
+//          STRING_PROVIDER_NAME_OFFSET (found in bthdef.h).
+//
+//      OUT pszString
+//          if NULL, pcchStringLength will be filled in with the required number
+//          of characters (not bytes) to retrieve the converted string.
+//
+//      IN OUT pcchStringLength
+//          Upon input, if pszString is not NULL, will contain the length of
+//          pszString in characters.  Upon output, it will contain either the
+//          number of required characters including NULL if an error is returned
+//          or the number of characters written to pszString (including NULL).
+//
+//  Return Values:
+//      ERROR_SUCCES
+//          Call was successful and pszString contains the converted string
+//
+//      ERROR_MORE_DATA
+//          pszString was NULL or too small to contain the converted string,
+//          pccxhStringLength contains the required length in characters
+//
+//      ERROR_INVALID_DATA
+//          Could not perform the conversion
+//
+//      ERROR_NO_SYSTEM_RESOURCES
+//          Could not allocate memory internally to perform the conversion
+//
+//      ERROR_INVALID_PARAMETER
+//          One of the rquired pointers was NULL, pRecordStream was not a valid
+//          SDP stream, pRecordStream was not a properly formatted record, or
+//          the desired attribute + offset was not a string.
+//
+//      Other HRESULTs returned by COM
+//
+
+function BluetoothSdpGetString(
+    pRecordStream: PBYTE;
+    cbRecordLength: ULONG;
+    pStringData: PSDP_STRING_TYPE_DATA;
+    usStringOffset: Word;
+    pszString: PWideChar;
+    pcchStringLength: PULONG): DWORD; stdcall;
+{$EXTERNALSYM BluetoothSdpGetString}
+
+// ***************************************************************************
+//
+//  Raw Attribute  Enumeration
+//
+// ***************************************************************************
+
+type
+  PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK = function(
+    uAttribId: ULONG;
+    pValueStream: PBYTE;
+    cbStreamSize: ULONG;
+    pvParam: Pointer): BOOL; stdcall;
+  {$EXTERNALSYM PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK}
+
+//
+//  Description:
+//      Enumerates through the SDP record stream calling the Callback function
+//      for each attribute in the record. If the Callback function returns
+//      FALSE, the enumeration is stopped.
+//
+//  Return Values:
+//      TRUE
+//          Success! Something was enumerated.
+//
+//      FALSE
+//          Failure. GetLastError() could be one of the following:
+//
+//          ERROR_INVALID_PARAMETER
+//              pSDPStream or pfnCallback is NULL.
+//
+//          ERROR_INVALID_DATA
+//              The SDP stream is corrupt.
+//
+//          other Win32 errors.
+//
+
+function BluetoothSdpEnumAttributes(
+    pSDPStream: PBYTE;
+    cbStreamSize: ULONG;
+    pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK;
+    pvParam: Pointer): BOOL; stdcall;
+{$EXTERNALSYM BluetoothSdpEnumAttributes}
+
+// (rom) MACRO
+function BluetoothEnumAttributes(
+    pSDPStream: PBYTE;
+    cbStreamSize: ULONG;
+    pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK;
+    pvParam: Pointer): BOOL;
+{$EXTERNALSYM BluetoothEnumAttributes}
+
+implementation
+
+const
+  btapi = 'irprops.cpl';
+
+// (rom) MACRO implementation
+function BluetoothEnumAttributes(pSDPStream: PBYTE; cbStreamSize: ULONG;
+  pfnCallback: PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK; pvParam: Pointer): BOOL;
+begin
+  Result := BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam);
+end;
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _BluetoothFindFirstRadio: Pointer;
+
+function BluetoothFindFirstRadio;
+begin
+  GetProcedureAddress(_BluetoothFindFirstRadio, btapi, 'BluetoothFindFirstRadio');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindFirstRadio]
+  end;
+end;
+
+var
+  _BluetoothFindNextRadio: Pointer;
+
+function BluetoothFindNextRadio;
+begin
+  GetProcedureAddress(_BluetoothFindNextRadio, btapi, 'BluetoothFindNextRadio');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindNextRadio]
+  end;
+end;
+
+var
+  _BluetoothFindRadioClose: Pointer;
+
+function BluetoothFindRadioClose;
+begin
+  GetProcedureAddress(_BluetoothFindRadioClose, btapi, 'BluetoothFindRadioClose');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindRadioClose]
+  end;
+end;
+
+var
+  _BluetoothGetRadioInfo: Pointer;
+
+function BluetoothGetRadioInfo;
+begin
+  GetProcedureAddress(_BluetoothGetRadioInfo, btapi, 'BluetoothGetRadioInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothGetRadioInfo]
+  end;
+end;
+
+var
+  _BluetoothFindFirstDevice: Pointer;
+
+function BluetoothFindFirstDevice;
+begin
+  GetProcedureAddress(_BluetoothFindFirstDevice, btapi, 'BluetoothFindFirstDevice');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindFirstDevice]
+  end;
+end;
+
+var
+  _BluetoothFindNextDevice: Pointer;
+
+function BluetoothFindNextDevice;
+begin
+  GetProcedureAddress(_BluetoothFindNextDevice, btapi, 'BluetoothFindNextDevice');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindNextDevice]
+  end;
+end;
+
+var
+  _BluetoothFindDeviceClose: Pointer;
+
+function BluetoothFindDeviceClose;
+begin
+  GetProcedureAddress(_BluetoothFindDeviceClose, btapi, 'BluetoothFindDeviceClose');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothFindDeviceClose]
+  end;
+end;
+
+var
+  _BluetoothGetDeviceInfo: Pointer;
+
+function BluetoothGetDeviceInfo;
+begin
+  GetProcedureAddress(_BluetoothGetDeviceInfo, btapi, 'BluetoothGetDeviceInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothGetDeviceInfo]
+  end;
+end;
+
+var
+  _BluetoothUpdateDeviceRecord: Pointer;
+
+function BluetoothUpdateDeviceRecord;
+begin
+  GetProcedureAddress(_BluetoothUpdateDeviceRecord, btapi, 'BluetoothUpdateDeviceRecord');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothUpdateDeviceRecord]
+  end;
+end;
+
+var
+  _BluetoothRemoveDevice: Pointer;
+
+function BluetoothRemoveDevice;
+begin
+  GetProcedureAddress(_BluetoothRemoveDevice, btapi, 'BluetoothRemoveDevice');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothRemoveDevice]
+  end;
+end;
+
+var
+  _BluetoothSelectDevices: Pointer;
+
+function BluetoothSelectDevices;
+begin
+  GetProcedureAddress(_BluetoothSelectDevices, btapi, 'BluetoothSelectDevices');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSelectDevices]
+  end;
+end;
+
+var
+  _BluetoothSelectDevicesFree: Pointer;
+
+function BluetoothSelectDevicesFree;
+begin
+  GetProcedureAddress(_BluetoothSelectDevicesFree, btapi, 'BluetoothSelectDevicesFree');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSelectDevicesFree]
+  end;
+end;
+
+var
+  _BluetoothDisplayDeviceProperties: Pointer;
+
+function BluetoothDisplayDeviceProperties;
+begin
+  GetProcedureAddress(_BluetoothDisplayDeviceProperties, btapi, 'BluetoothDisplayDeviceProperties');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothDisplayDeviceProperties]
+  end;
+end;
+
+var
+  _BluetoothAuthenticateDevice: Pointer;
+
+function BluetoothAuthenticateDevice;
+begin
+  GetProcedureAddress(_BluetoothAuthenticateDevice, btapi, 'BluetoothAuthenticateDevice');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothAuthenticateDevice]
+  end;
+end;
+
+var
+  _BluetoothAuthenticateMultipleDevices: Pointer;
+
+function BluetoothAuthenticateMultipleDevices;
+begin
+  GetProcedureAddress(_BluetoothAuthenticateMultipleDevices, btapi, 'BluetoothAuthenticateMultipleDevices');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothAuthenticateMultipleDevices]
+  end;
+end;
+
+var
+  _BluetoothSetServiceState: Pointer;
+
+function BluetoothSetServiceState;
+begin
+  GetProcedureAddress(_BluetoothSetServiceState, btapi, 'BluetoothSetServiceState');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSetServiceState]
+  end;
+end;
+
+var
+  _BluetoothEnumerateInstalledServices: Pointer;
+
+function BluetoothEnumerateInstalledServices;
+begin
+  GetProcedureAddress(_BluetoothEnumerateInstalledServices, btapi, 'BluetoothEnumerateInstalledServices');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothEnumerateInstalledServices]
+  end;
+end;
+
+var
+  _BluetoothEnableDiscovery: Pointer;
+
+function BluetoothEnableDiscovery;
+begin
+  GetProcedureAddress(_BluetoothEnableDiscovery, btapi, 'BluetoothEnableDiscovery');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothEnableDiscovery]
+  end;
+end;
+
+var
+  _BluetoothIsDiscoverable: Pointer;
+
+function BluetoothIsDiscoverable;
+begin
+  GetProcedureAddress(_BluetoothIsDiscoverable, btapi, 'BluetoothIsDiscoverable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothIsDiscoverable]
+  end;
+end;
+
+var
+  _BluetoothEnableIncomingConnections: Pointer;
+
+function BluetoothEnableIncomingConnections;
+begin
+  GetProcedureAddress(_BluetoothEnableIncomingConnections, btapi, 'BluetoothEnableIncomingConnections');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothEnableIncomingConnections]
+  end;
+end;
+
+var
+  _BluetoothIsConnectable: Pointer;
+
+function BluetoothIsConnectable;
+begin
+  GetProcedureAddress(_BluetoothIsConnectable, btapi, 'BluetoothIsConnectable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothIsConnectable]
+  end;
+end;
+
+var
+  _BluetoothRegisterForAuthentication: Pointer;
+
+function BluetoothRegisterForAuthentication;
+begin
+  GetProcedureAddress(_BluetoothRegisterForAuthentication, btapi, 'BluetoothRegisterForAuthentication');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothRegisterForAuthentication]
+  end;
+end;
+
+var
+  _BluetoothUnregisterAuthentication: Pointer;
+
+function BluetoothUnregisterAuthentication;
+begin
+  GetProcedureAddress(_BluetoothUnregisterAuthentication, btapi, 'BluetoothUnregisterAuthentication');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothUnregisterAuthentication]
+  end;
+end;
+
+var
+  _BluetoothSendAuthenticationResponse: Pointer;
+
+function BluetoothSendAuthenticationResponse;
+begin
+  GetProcedureAddress(_BluetoothSendAuthenticationResponse, btapi, 'BluetoothSendAuthenticationResponse');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSendAuthenticationResponse]
+  end;
+end;
+
+var
+  _BluetoothSdpGetElementData: Pointer;
+
+function BluetoothSdpGetElementData;
+begin
+  GetProcedureAddress(_BluetoothSdpGetElementData, btapi, 'BluetoothSdpGetElementData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSdpGetElementData]
+  end;
+end;
+
+var
+  _BluetoothSdpGetContainerElementData: Pointer;
+
+function BluetoothSdpGetContainerElementData;
+begin
+  GetProcedureAddress(_BluetoothSdpGetContainerElementData, btapi, 'BluetoothSdpGetContainerElementData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSdpGetContainerElementData]
+  end;
+end;
+
+var
+  _BluetoothSdpGetAttributeValue: Pointer;
+
+function BluetoothSdpGetAttributeValue;
+begin
+  GetProcedureAddress(_BluetoothSdpGetAttributeValue, btapi, 'BluetoothSdpGetAttributeValue');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSdpGetAttributeValue]
+  end;
+end;
+
+var
+  _BluetoothSdpGetString: Pointer;
+
+function BluetoothSdpGetString;
+begin
+  GetProcedureAddress(_BluetoothSdpGetString, btapi, 'BluetoothSdpGetString');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSdpGetString]
+  end;
+end;
+
+var
+  _BluetoothSdpEnumAttributes: Pointer;
+
+function BluetoothSdpEnumAttributes;
+begin
+  GetProcedureAddress(_BluetoothSdpEnumAttributes, btapi, 'BluetoothSdpEnumAttributes');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BluetoothSdpEnumAttributes]
+  end;
+end;
+
+{$ELSE}
+
+function BluetoothFindFirstRadio; external btapi name 'BluetoothFindFirstRadio';
+function BluetoothFindNextRadio; external btapi name 'BluetoothFindNextRadio';
+function BluetoothFindRadioClose; external btapi name 'BluetoothFindRadioClose';
+function BluetoothGetRadioInfo; external btapi name 'BluetoothGetRadioInfo';
+function BluetoothFindFirstDevice; external btapi name 'BluetoothFindFirstDevice';
+function BluetoothFindNextDevice; external btapi name 'BluetoothFindNextDevice';
+function BluetoothFindDeviceClose; external btapi name 'BluetoothFindDeviceClose';
+function BluetoothGetDeviceInfo; external btapi name 'BluetoothGetDeviceInfo';
+function BluetoothUpdateDeviceRecord; external btapi name 'BluetoothUpdateDeviceRecord';
+function BluetoothRemoveDevice; external btapi name 'BluetoothRemoveDevice';
+function BluetoothSelectDevices; external btapi name 'BluetoothSelectDevices';
+function BluetoothSelectDevicesFree; external btapi name 'BluetoothSelectDevicesFree';
+function BluetoothDisplayDeviceProperties; external btapi name 'BluetoothDisplayDeviceProperties';
+function BluetoothAuthenticateDevice; external btapi name 'BluetoothAuthenticateDevice';
+function BluetoothAuthenticateMultipleDevices; external btapi name 'BluetoothAuthenticateMultipleDevices';
+function BluetoothSetServiceState; external btapi name 'BluetoothSetServiceState';
+function BluetoothEnumerateInstalledServices; external btapi name 'BluetoothEnumerateInstalledServices';
+function BluetoothEnableDiscovery; external btapi name 'BluetoothEnableDiscovery';
+function BluetoothIsDiscoverable; external btapi name 'BluetoothIsDiscoverable';
+function BluetoothEnableIncomingConnections; external btapi name 'BluetoothEnableIncomingConnections';
+function BluetoothIsConnectable; external btapi name 'BluetoothIsConnectable';
+function BluetoothRegisterForAuthentication; external btapi name 'BluetoothRegisterForAuthentication';
+function BluetoothUnregisterAuthentication; external btapi name 'BluetoothUnregisterAuthentication';
+function BluetoothSendAuthenticationResponse; external btapi name 'BluetoothSendAuthenticationResponse';
+function BluetoothSdpGetElementData; external btapi name 'BluetoothSdpGetElementData';
+function BluetoothSdpGetContainerElementData; external btapi name 'BluetoothSdpGetContainerElementData';
+function BluetoothSdpGetAttributeValue; external btapi name 'BluetoothSdpGetAttributeValue';
+function BluetoothSdpGetString; external btapi name 'BluetoothSdpGetString';
+function BluetoothSdpEnumAttributes; external btapi name 'BluetoothSdpEnumAttributes';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 1527 - 0
packages/extra/winunits/jwabthdef.pas

@@ -0,0 +1,1527 @@
+{******************************************************************************}
+{                                                                              }
+{ BlueTooth API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributors: John Penman                                                    }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBtHDef;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bthdef.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaBthSdpDef;
+
+const
+  GUID_BTHPORT_DEVICE_INTERFACE: TGUID =     '{0850302A-B344-4FDA-9BE9-90576B8D46F0}';
+  {$EXTERNALSYM GUID_BTHPORT_DEVICE_INTERFACE}
+  GUID_BLUETOOTH_RADIO_IN_RANGE: TGUID =     '{EA3B5B82-26EE-450E-B0D8-D26FE30A3869}';
+  {$EXTERNALSYM GUID_BLUETOOTH_RADIO_IN_RANGE}
+  GUID_BLUETOOTH_RADIO_OUT_OF_RANGE: TGUID = '{E28867C9-C2AA-4CED-B969-4570866037C4}';
+  {$EXTERNALSYM GUID_BLUETOOTH_RADIO_OUT_OF_RANGE}
+  GUID_BLUETOOTH_PIN_REQUEST: TGUID =        '{BD198B7C-24AB-4B9A-8C0D-A8EA8349AA16}';
+  {$EXTERNALSYM GUID_BLUETOOTH_PIN_REQUEST}
+  GUID_BLUETOOTH_L2CAP_EVENT: TGUID =        '{7EAE4030-B709-4AA8-AC55-E953829C9DAA}';
+  {$EXTERNALSYM GUID_BLUETOOTH_L2CAP_EVENT}
+  GUID_BLUETOOTH_HCI_EVENT: TGUID =          '{FC240062-1541-49BE-B463-84C4DCD7BF7F}';
+  {$EXTERNALSYM GUID_BLUETOOTH_HCI_EVENT}
+
+//
+// Bluetooth base UUID for service discovery
+//
+
+ BLUETOOTH_BASE_UUID = '{00000000-0000-1000-8000-00805F9B34FB}';
+ {$EXTERNALSYM BLUETOOTH_BASE_UUID}
+
+//
+// UUID for the root of the browse group list
+//
+
+  SDP_PROTOCOL_UUID: TGUID        = '{00000001-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM SDP_PROTOCOL_UUID}
+  UDP_PROTOCOL_UUID: TGUID        = '{00000002-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM UDP_PROTOCOL_UUID}
+  RFCOMM_PROTOCOL_UUID: TGUID     = '{00000003-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM RFCOMM_PROTOCOL_UUID}
+  TCP_PROTOCOL_UUID: TGUID        = '{00000004-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM TCP_PROTOCOL_UUID}
+  TCSBIN_PROTOCOL_UUID: TGUID     = '{00000005-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM TCSBIN_PROTOCOL_UUID}
+  TCSAT_PROTOCOL_UUID: TGUID      = '{00000006-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM TCSAT_PROTOCOL_UUID}
+  OBEX_PROTOCOL_UUID: TGUID       = '{00000008-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM OBEX_PROTOCOL_UUID}
+  IP_PROTOCOL_UUID: TGUID         = '{00000009-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM IP_PROTOCOL_UUID}
+  FTP_PROTOCOL_UUID: TGUID        = '{0000000A-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM FTP_PROTOCOL_UUID}
+  HTTP_PROTOCOL_UUID: TGUID       = '{0000000C-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM HTTP_PROTOCOL_UUID}
+  WSP_PROTOCOL_UUID: TGUID        = '{0000000E-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM WSP_PROTOCOL_UUID}
+  BNEP_PROTOCOL_UUID: TGUID       = '{0000000F-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM BNEP_PROTOCOL_UUID}
+  UPNP_PROTOCOL_UUID: TGUID       = '{00000010-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM UPNP_PROTOCOL_UUID}
+  HID_PROTOCOL_UUID: TGUID        = '{00000011-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM HID_PROTOCOL_UUID}
+  HCCC_PROTOCOL_UUID: TGUID       = '{00000012-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM HCCC_PROTOCOL_UUID}
+  HCDC_PROTOCOL_UUID: TGUID       = '{00000014-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM HCDC_PROTOCOL_UUID}
+  HN_PROTOCOL_UUID: TGUID         = '{00000016-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM HN_PROTOCOL_UUID}
+  AVCTP_PROTOCOL_UUID: TGUID      = '{00000017-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM AVCTP_PROTOCOL_UUID}
+  AVDTP_PROTOCOL_UUID: TGUID      = '{00000019-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM AVDTP_PROTOCOL_UUID}
+  CMPT_PROTOCOL_UUID: TGUID       = '{0000001B-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM CMPT_PROTOCOL_UUID}
+  UDI_C_PLANE_PROTOCOL_UUID: TGUID= '{0000001D-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM UDI_C_PLANE_PROTOCOL_UUID}
+  L2CAP_PROTOCOL_UUID: TGUID      = '{00000100-0000-1000-8000-00805F9B34FB}';
+  {$EXTERNALSYM L2CAP_PROTOCOL_UUID}
+
+  SDP_PROTOCOL_UUID16 = $0001;
+  {$EXTERNALSYM SDP_PROTOCOL_UUID16}
+  UDP_PROTOCOL_UUID16 = $0002;
+  {$EXTERNALSYM UDP_PROTOCOL_UUID16}
+  RFCOMM_PROTOCOL_UUID16 = $0003;
+  {$EXTERNALSYM RFCOMM_PROTOCOL_UUID16}
+  TCP_PROTOCOL_UUID16 = $0004;
+  {$EXTERNALSYM TCP_PROTOCOL_UUID16}
+  TCSBIN_PROTOCOL_UUID16 = $0005;
+  {$EXTERNALSYM TCSBIN_PROTOCOL_UUID16}
+  TCSAT_PROTOCOL_UUID16 = $0006;
+  {$EXTERNALSYM TCSAT_PROTOCOL_UUID16}
+  OBEX_PROTOCOL_UUID16 = $0008;
+  {$EXTERNALSYM OBEX_PROTOCOL_UUID16}
+  IP_PROTOCOL_UUID16 = $0009;
+  {$EXTERNALSYM IP_PROTOCOL_UUID16}
+  FTP_PROTOCOL_UUID16 = $000A;
+  {$EXTERNALSYM FTP_PROTOCOL_UUID16}
+  HTTP_PROTOCOL_UUID16 = $000C;
+  {$EXTERNALSYM HTTP_PROTOCOL_UUID16}
+  WSP_PROTOCOL_UUID16 = $000E;
+  {$EXTERNALSYM WSP_PROTOCOL_UUID16}
+  BNEP_PROTOCOL_UUID16 = $000;
+  {$EXTERNALSYM BNEP_PROTOCOL_UUID16}
+  UPNP_PROTOCOL_UUID16 = $0010;
+  {$EXTERNALSYM UPNP_PROTOCOL_UUID16}
+  HID_PROTOCOL_UUID16 = $0011;
+  {$EXTERNALSYM HID_PROTOCOL_UUID16}
+  HCCC_PROTOCOL_UUID16 = $0012;
+  {$EXTERNALSYM HCCC_PROTOCOL_UUID16}
+  HCDC_PROTOCOL_UUID16 = $0014;
+  {$EXTERNALSYM HCDC_PROTOCOL_UUID16}
+  HCN_PROTOCOL_UUID16 = $0016;
+  {$EXTERNALSYM HCN_PROTOCOL_UUID16}
+  AVCTP_PROTOCOL_UUID16 = $0017;
+  {$EXTERNALSYM AVCTP_PROTOCOL_UUID16}
+  AVDTP_PROTOCOL_UUID16 = $0019;
+  {$EXTERNALSYM AVDTP_PROTOCOL_UUID16}
+  CMPT_PROTOCOL_UUID16 = $001B;
+  {$EXTERNALSYM CMPT_PROTOCOL_UUID16}
+  UDI_C_PLANE_PROTOCOL_UUID16 = $001D;
+  {$EXTERNALSYM UDI_C_PLANE_PROTOCOL_UUID16}
+  L2CAP_PROTOCOL_UUID16 = $0100;
+  {$EXTERNALSYM L2CAP_PROTOCOL_UUID16}
+
+  ServiceDiscoveryServerServiceClassID_UUID: TGUID = '{00001000-0000-1000-8000-00805F9B34FB}';
+  BrowseGroupDescriptorServiceClassID_UUID: TGUID = '{00001001-0000-1000-8000-00805F9B34FB}';
+  PublicBrowseGroupServiceClass_UUID: TGUID = '{00001002-0000-1000-8000-00805F9B34FB}';
+  SerialPortServiceClass_UUID: TGUID = '{00001101-0000-1000-8000-00805F9B34FB}';
+  LANAccessUsingPPPServiceClass_UUID: TGUID = '{00001102-0000-1000-8000-00805F9B34FB}';
+  DialupNetworkingServiceClass_UUID: TGUID = '{00001103-0000-1000-8000-00805F9B34FB}';
+  IrMCSyncServiceClass_UUID: TGUID = '{00001104-0000-1000-8000-00805F9B34FB}';
+  OBEXObjectPushServiceClass_UUID: TGUID = '{00001105-0000-1000-8000-00805F9B34FB}';
+  OBEXFileTransferServiceClass_UUID: TGUID = '{00001106-0000-1000-8000-00805F9B34FB}';
+  IrMCSyncCommandServiceClass_UUID: TGUID = '{00001107-0000-1000-8000-00805F9B34FB}';
+  HeadsetServiceClass_UUID: TGUID = '{00001108-0000-1000-8000-00805F9B34FB}';
+  CordlessTelephonyServiceClass_UUID: TGUID = '{00001109-0000-1000-8000-00805F9B34FB}';
+  AudioSourceServiceClass_UUID: TGUID = '{0000110A-0000-1000-8000-00805F9B34FB}';
+  AudioSinkServiceClass_UUID: TGUID = '{0000110B-0000-1000-8000-00805F9B34FB}';
+  AVRemoteControlTargetServiceClass_UUID: TGUID = '{0000110C-0000-1000-8000-00805F9B34FB}';
+  AdvancedAudioDistributionServiceClass_UUID: TGUID = '{0000110D-0000-1000-8000-00805F9B34FB}';
+  AVRemoteControlServiceClass_UUID: TGUID = '{0000110E-0000-1000-8000-00805F9B34FB}';
+  VideoConferencingServiceClass_UUID: TGUID = '{0000110F-0000-1000-8000-00805F9B34FB}';
+  IntercomServiceClass_UUID: TGUID = '{00001110-0000-1000-8000-00805F9B34FB}';
+  FaxServiceClass_UUID: TGUID = '{00001111-0000-1000-8000-00805F9B34FB}';
+  HeadsetAudioGatewayServiceClass_UUID: TGUID = '{00001112-0000-1000-8000-00805F9B34FB}';
+  WAPServiceClass_UUID: TGUID = '{00001113-0000-1000-8000-00805F9B34FB}';
+  WAPClientServiceClass_UUID: TGUID = '{00001114-0000-1000-8000-00805F9B34FB}';
+  PANUServiceClass_UUID: TGUID = '{00001115-0000-1000-8000-00805F9B34FB}';
+  NAPServiceClass_UUID: TGUID = '{00001116-0000-1000-8000-00805F9B34FB}';
+  GNServiceClass_UUID: TGUID = '{00001117-0000-1000-8000-00805F9B34FB}';
+  DirectPrintingServiceClass_UUID: TGUID = '{00001118-0000-1000-8000-00805F9B34FB}';
+  ReferencePrintingServiceClass_UUID: TGUID = '{00001119-0000-1000-8000-00805F9B34FB}';
+  ImagingServiceClass_UUID: TGUID = '{0000111A-0000-1000-8000-00805F9B34FB}';
+  ImagingResponderServiceClass_UUID: TGUID = '{0000111B-0000-1000-8000-00805F9B34FB}';
+  ImagingAutomaticArchiveServiceClass_UUID: TGUID = '{0000111C-0000-1000-8000-00805F9B34FB}';
+  ImagingReferenceObjectsServiceClass_UUID: TGUID = '{0000111D-0000-1000-8000-00805F9B34FB}';
+  HandsfreeServiceClass_UUID: TGUID = '{0000111E-0000-1000-8000-00805F9B34FB}';
+  HandsfreeAudioGatewayServiceClass_UUID: TGUID = '{0000111F-0000-1000-8000-00805F9B34FB}';
+  DirectPrintingReferenceObjectsServiceClass_UUID: TGUID = '{00001120-0000-1000-8000-00805F9B34FB}';
+  ReflectedUIServiceClass_UUID: TGUID = '{00001121-0000-1000-8000-00805F9B34FB}';
+  BasicPringingServiceClass_UUID: TGUID = '{00001122-0000-1000-8000-00805F9B34FB}';
+  PrintingStatusServiceClass_UUID: TGUID = '{00001123-0000-1000-8000-00805F9B34FB}';
+  HumanInterfaceDeviceServiceClass_UUID: TGUID = '{00001124-0000-1000-8000-00805F9B34FB}';
+  HardcopyCableReplacementServiceClass_UUID: TGUID = '{00001125-0000-1000-8000-00805F9B34FB}';
+  HCRPrintServiceClass_UUID: TGUID = '{00001126-0000-1000-8000-00805F9B34FB}';
+  HCRScanServiceClass_UUID: TGUID = '{00001127-0000-1000-8000-00805F9B34FB}';
+  CommonISDNAccessServiceClass_UUID: TGUID = '{00001128-0000-1000-8000-00805F9B34FB}';
+  VideoConferencingGWServiceClass_UUID: TGUID = '{00001129-0000-1000-8000-00805F9B34FB}';
+  UDIMTServiceClass_UUID: TGUID = '{0000112A-0000-1000-8000-00805F9B34FB}';
+  UDITAServiceClass_UUID: TGUID = '{0000112B-0000-1000-8000-00805F9B34FB}';
+  AudioVideoServiceClass_UUID: TGUID = '{0000112C-0000-1000-8000-00805F9B34FB}';
+  PnPInformationServiceClass_UUID: TGUID = '{00001200-0000-1000-8000-00805F9B34FB}';
+  GenericNetworkingServiceClass_UUID: TGUID = '{00001201-0000-1000-8000-00805F9B34FB}';
+  GenericFileTransferServiceClass_UUID: TGUID = '{00001202-0000-1000-8000-00805F9B34FB}';
+  GenericAudioServiceClass_UUID: TGUID = '{00001203-0000-1000-8000-00805F9B34FB}';
+  GenericTelephonyServiceClass_UUID: TGUID = '{00001204-0000-1000-8000-00805F9B34FB}';
+
+  ServiceDiscoveryServerServiceClassID_UUID16 = $1000;
+  BrowseGroupDescriptorServiceClassID_UUID16 = $1001;
+  PublicBrowseGroupServiceClassID_UUID16 = $1002;
+  SerialPortServiceClassID_UUID16 = $1101;
+  LANAccessUsingPPPServiceClassID_UUID16 = $1102;
+  DialupNetworkingServiceClassID_UUID16 = $1103;
+  IrMCSyncServiceClassID_UUID16 = $1104;
+  OBEXObjectPushServiceClassID_UUID16 = $1105;
+  OBEXFileTransferServiceClassID_UUID16 = $1106;
+  IrMcSyncCommandServiceClassID_UUID16 = $1107;
+  HeadsetServiceClassID_UUID16 = $1108;
+  CordlessServiceClassID_UUID16 = $1109;
+  AudioSourceServiceClassID_UUID16 = $110A;
+  AudioSinkSourceServiceClassID_UUID16 = $110B;
+  AVRemoteControlTargetServiceClassID_UUID16 = $110C;
+  AdvancedAudioDistributionServiceClassID_UUID16 = $110D;
+  AVRemoteControlServiceClassID_UUID16 = $110E;
+  VideoConferencingServiceClassID_UUID16 = $110;
+  IntercomServiceClassID_UUID16 = $1110;
+  FaxServiceClassID_UUID16 = $1111;
+  HeadsetAudioGatewayServiceClassID_UUID16 = $1112;
+  WAPServiceClassID_UUID16 = $1113;
+  WAPClientServiceClassID_UUID16 = $1114;
+  PANUServiceClassID_UUID16 = $1115;
+  NAPServiceClassID_UUID16 = $1116;
+  GNServiceClassID_UUID16 = $1117;
+  DirectPrintingServiceClassID_UUID16 = $1118;
+  ReferencePrintingServiceClassID_UUID16 = $1119;
+  ImagingServiceClassID_UUID16 = $111A;
+  ImagingResponderServiceClassID_UUID16 = $111B;
+  ImagingAutomaticArchiveServiceClassID_UUID16 = $111C;
+  ImagingReferenceObjectsServiceClassID_UUID16 = $111D;
+  HandsfreeServiceClassID_UUID16 = $111E;
+  HandsfreeAudioGatewayServiceClassID_UUID16 = $111F;
+  DirectPrintingReferenceObjectsServiceClassID_UUID16 = $1120;
+  ReflectsUIServiceClassID_UUID16 = $1121;
+  BasicPrintingServiceClassID_UUID16 = $1122;
+  PrintingStatusServiceClassID_UUID16 = $1123;
+  HumanInterfaceDeviceServiceClassID_UUID16 = $1124;
+  HardcopyCableReplacementServiceClassID_UUID16 = $1125;
+  HCRPrintServiceClassID_UUID16 = $1126;
+  HCRScanServiceClassID_UUID16 = $1127;
+  CommonISDNAccessServiceClass_UUID16 = $1128;
+  VideoConferencingGWServiceClass_UUID16 = $1129;
+  UDIMTServiceClass_UUID16 = $112A;
+  UDITAServiceClass_UUID16 = $112B;
+  AudioVideoServiceClass_UUID16 = $112C;
+
+  PnPInformationServiceClassID_UUID16 = $1200;
+  {$EXTERNALSYM PnPInformationServiceClassID_UUID16}
+  GenericNetworkingServiceClassID_UUID16 = $1201;
+  {$EXTERNALSYM GenericNetworkingServiceClassID_UUID16}
+  GenericFileTransferServiceClassID_UUID16 = $1202;
+  {$EXTERNALSYM GenericFileTransferServiceClassID_UUID16}
+  GenericAudioServiceClassID_UUID16 = $1203;
+  {$EXTERNALSYM GenericAudioServiceClassID_UUID16}
+  GenericTelephonyServiceClassID_UUID16 = $1204;
+  {$EXTERNALSYM GenericTelephonyServiceClassID_UUID16}
+
+//
+// max length of device friendly name.
+//
+
+  BTH_MAX_NAME_SIZE = 248;
+  {$EXTERNALSYM BTH_MAX_NAME_SIZE}
+
+  BTH_MAX_PIN_SIZE = 16;
+  {$EXTERNALSYM BTH_MAX_PIN_SIZE}
+  BTH_LINK_KEY_LENGTH = 16;
+  {$EXTERNALSYM BTH_LINK_KEY_LENGTH}
+
+  BTH_MFG_ERICSSON = 0;
+  {$EXTERNALSYM BTH_MFG_ERICSSON}
+  BTH_MFG_NOKIA = 1;
+  {$EXTERNALSYM BTH_MFG_NOKIA}
+  BTH_MFG_INTEL = 2;
+  {$EXTERNALSYM BTH_MFG_INTEL}
+  BTH_MFG_IBM = 3;
+  {$EXTERNALSYM BTH_MFG_IBM}
+  BTH_MFG_TOSHIBA = 4;
+  {$EXTERNALSYM BTH_MFG_TOSHIBA}
+  BTH_MFG_3COM = 5;
+  {$EXTERNALSYM BTH_MFG_3COM}
+  BTH_MFG_MICROSOFT = 6;
+  {$EXTERNALSYM BTH_MFG_MICROSOFT}
+  BTH_MFG_LUCENT = 7;
+  {$EXTERNALSYM BTH_MFG_LUCENT}
+  BTH_MFG_MOTOROLA = 8;
+  {$EXTERNALSYM BTH_MFG_MOTOROLA}
+  BTH_MFG_INFINEON = 9;
+  {$EXTERNALSYM BTH_MFG_INFINEON}
+  BTH_MFG_CSR = 10;
+  {$EXTERNALSYM BTH_MFG_CSR}
+  BTH_MFG_SILICONWAVE = 11;
+  {$EXTERNALSYM BTH_MFG_SILICONWAVE}
+  BTH_MFG_DIGIANSWER = 12;
+  {$EXTERNALSYM BTH_MFG_DIGIANSWER}
+  BTH_MFG_TI = 13;
+  {$EXTERNALSYM BTH_MFG_TI}
+  BTH_MFG_PARTHUS = 14;
+  {$EXTERNALSYM BTH_MFG_PARTHUS}
+  BTH_MFG_BROADCOM = 15;
+  {$EXTERNALSYM BTH_MFG_BROADCOM}
+  BTH_MFG_MITEL = 16;
+  {$EXTERNALSYM BTH_MFG_MITEL}
+  BTH_MFG_WIDCOMM = 17;
+  {$EXTERNALSYM BTH_MFG_WIDCOMM}
+  BTH_MFG_ZEEVO = 18;
+  {$EXTERNALSYM BTH_MFG_ZEEVO}
+  BTH_MFG_ATMEL = 19;
+  {$EXTERNALSYM BTH_MFG_ATMEL}
+  BTH_MFG_MITSIBUSHI = 20;
+  {$EXTERNALSYM BTH_MFG_MITSIBUSHI}
+  BTH_MFG_RTX_TELECOM = 21;
+  {$EXTERNALSYM BTH_MFG_RTX_TELECOM}
+  BTH_MFG_KC_TECHNOLOGY = 22;
+  {$EXTERNALSYM BTH_MFG_KC_TECHNOLOGY}
+  BTH_MFG_NEWLOGIC = 23;
+  {$EXTERNALSYM BTH_MFG_NEWLOGIC}
+  BTH_MFG_TRANSILICA = 24;
+  {$EXTERNALSYM BTH_MFG_TRANSILICA}
+  BTH_MFG_ROHDE_SCHWARZ = 25;
+  {$EXTERNALSYM BTH_MFG_ROHDE_SCHWARZ}
+  BTH_MFG_TTPCOM = 26;
+  {$EXTERNALSYM BTH_MFG_TTPCOM}
+  BTH_MFG_SIGNIA = 27;
+  {$EXTERNALSYM BTH_MFG_SIGNIA}
+  BTH_MFG_CONEXANT = 28;
+  {$EXTERNALSYM BTH_MFG_CONEXANT}
+  BTH_MFG_QUALCOMM = 29;
+  {$EXTERNALSYM BTH_MFG_QUALCOMM}
+  BTH_MFG_INVENTEL = 30;
+  {$EXTERNALSYM BTH_MFG_INVENTEL}
+  BTH_MFG_AVM_BERLIN = 31;
+  {$EXTERNALSYM BTH_MFG_AVM_BERLIN}
+  BTH_MFG_BANDSPEED = 32;
+  {$EXTERNALSYM BTH_MFG_BANDSPEED}
+  BTH_MFG_MANSELLA = 33;
+  {$EXTERNALSYM BTH_MFG_MANSELLA}
+  BTH_MFG_NEC = 34;
+  {$EXTERNALSYM BTH_MFG_NEC}
+  BTH_MFG_WAVEPLUS_TECHNOLOGY_CO = 35;
+  {$EXTERNALSYM BTH_MFG_WAVEPLUS_TECHNOLOGY_CO}
+  BTH_MFG_ALCATEL = 36;
+  {$EXTERNALSYM BTH_MFG_ALCATEL}
+  BTH_MFG_PHILIPS_SEMICONDUCTOR = 37;
+  {$EXTERNALSYM BTH_MFG_PHILIPS_SEMICONDUCTOR}
+  BTH_MFG_C_TECHNOLOGIES = 38;
+  {$EXTERNALSYM BTH_MFG_C_TECHNOLOGIES}
+  BTH_MFG_OPEN_INTERFACE = 39;
+  {$EXTERNALSYM BTH_MFG_OPEN_INTERFACE}
+  BTH_MFG_RF_MICRO_DEVICES = 40;
+  {$EXTERNALSYM BTH_MFG_RF_MICRO_DEVICES}
+  BTH_MFG_HITACHI = 41;
+  {$EXTERNALSYM BTH_MFG_HITACHI}
+  BTH_MFG_SYMBOL_TECHNOLOGIES = 42;
+  {$EXTERNALSYM BTH_MFG_SYMBOL_TECHNOLOGIES}
+  BTH_MFG_TENOVIS = 43;
+  {$EXTERNALSYM BTH_MFG_TENOVIS}
+  BTH_MFG_MACRONIX_INTERNATIONAL = 44;
+  {$EXTERNALSYM BTH_MFG_MACRONIX_INTERNATIONAL}
+  BTH_MFG_INTERNAL_USE = 65535;
+  {$EXTERNALSYM BTH_MFG_INTERNAL_USE}
+
+type
+  BTH_ADDR = Int64;
+  {$EXTERNALSYM BTH_ADDR}
+  PBTH_ADDR = ^BTH_ADDR;
+  {$EXTERNALSYM PBTH_ADDR}
+  BTH_COD = ULONG;
+  {$EXTERNALSYM BTH_COD}
+  PBTH_COD = ^BTH_COD;
+  {$EXTERNALSYM PBTH_COD}
+  BTH_LAP = ULONG;
+  {$EXTERNALSYM BTH_LAP}
+  PBTH_LAP = ^BTH_LAP;
+  {$EXTERNALSYM PBTH_LAP}
+
+const
+  BTH_ADDR_NULL = Int64($0000000000000000);
+  {$EXTERNALSYM BTH_ADDR_NULL}
+
+  NAP_MASK = Int64($FFFF00000000);
+  {$EXTERNALSYM NAP_MASK}
+  SAP_MASK = Int64($0000FFFFFFFF);
+  {$EXTERNALSYM SAP_MASK}
+
+  NAP_BIT_OFFSET = 8 * 4;
+  {$EXTERNALSYM NAP_BIT_OFFSET}
+  SAP_BIT_OFFSET = 0;
+  {$EXTERNALSYM SAP_BIT_OFFSET}
+
+function GET_NAP(_bth_addr: BTH_ADDR): Word;
+function GET_SAP(_bth_addr: BTH_ADDR): ULONG;
+function SET_NAP(_nap: Word): Int64; //todo impl
+function SET_SAP(_sap: ULONG): Int64; // todo impl
+function SET_NAP_SAP(_nap, _sap: Word): Int64; // todo impl
+
+const
+  COD_FORMAT_BIT_OFFSET = 0;
+  {$EXTERNALSYM COD_FORMAT_BIT_OFFSET}
+  COD_MINOR_BIT_OFFSET = 2;
+  {$EXTERNALSYM COD_MINOR_BIT_OFFSET}
+  COD_MAJOR_BIT_OFFSET = 8 * 1;
+  {$EXTERNALSYM COD_MAJOR_BIT_OFFSET}
+  COD_SERVICE_BIT_OFFSET = 8 * 1 + 5;
+  {$EXTERNALSYM COD_SERVICE_BIT_OFFSET}
+
+  COD_FORMAT_MASK = $000003;
+  {$EXTERNALSYM COD_FORMAT_MASK}
+  COD_MINOR_MASK = $0000FC;
+  {$EXTERNALSYM COD_MINOR_MASK}
+  COD_MAJOR_MASK = $001F00;
+  {$EXTERNALSYM COD_MAJOR_MASK}
+  COD_SERVICE_MASK = $FFE000;
+  {$EXTERNALSYM COD_SERVICE_MASK}
+
+function GET_COD_FORMAT(_cod: BTH_COD): BTH_COD;
+function GET_COD_MINOR(_cod: BTH_COD): BTH_COD;
+function GET_COD_MAJOR(_cod: BTH_COD): BTH_COD;
+function GET_COD_SERVICE(_cod: BTH_COD): BTH_COD;
+
+procedure SET_COD_MINOR(var _cod: BTH_COD; _minor: BTH_COD);
+procedure SET_COD_MAJOR(var _cod: BTH_COD; _major: BTH_COD);
+procedure SET_COD_SERVICE(var _cod: BTH_COD; _service: BTH_COD);
+
+const
+  COD_VERSION = $0;
+  {$EXTERNALSYM COD_VERSION}
+
+  COD_SERVICE_LIMITED = $0001;
+  {$EXTERNALSYM COD_SERVICE_LIMITED}
+  COD_SERVICE_POSITIONING = $0008;
+  {$EXTERNALSYM COD_SERVICE_POSITIONING}
+  COD_SERVICE_NETWORKING = $0010;
+  {$EXTERNALSYM COD_SERVICE_NETWORKING}
+  COD_SERVICE_RENDERING = $0020;
+  {$EXTERNALSYM COD_SERVICE_RENDERING}
+  COD_SERVICE_CAPTURING = $0040;
+  {$EXTERNALSYM COD_SERVICE_CAPTURING}
+  COD_SERVICE_OBJECT_XFER = $0080;
+  {$EXTERNALSYM COD_SERVICE_OBJECT_XFER}
+  COD_SERVICE_AUDIO = $0100;
+  {$EXTERNALSYM COD_SERVICE_AUDIO}
+  COD_SERVICE_TELEPHONY = $0200;
+  {$EXTERNALSYM COD_SERVICE_TELEPHONY}
+  COD_SERVICE_INFORMATION = $0400;
+  {$EXTERNALSYM COD_SERVICE_INFORMATION}
+
+  COD_SERVICE_VALID_MASK = COD_SERVICE_LIMITED or COD_SERVICE_POSITIONING or
+    COD_SERVICE_NETWORKING or COD_SERVICE_RENDERING or
+    COD_SERVICE_CAPTURING or COD_SERVICE_OBJECT_XFER or
+    COD_SERVICE_AUDIO or COD_SERVICE_TELEPHONY or
+    COD_SERVICE_INFORMATION;   
+  {$EXTERNALSYM COD_SERVICE_VALID_MASK}
+
+  COD_SERVICE_MAX_COUNT = 9;
+  {$EXTERNALSYM COD_SERVICE_MAX_COUNT}
+
+//
+// Major class codes
+//
+
+const
+  COD_MAJOR_MISCELLANEOUS = $00;
+  {$EXTERNALSYM COD_MAJOR_MISCELLANEOUS}
+  COD_MAJOR_COMPUTER = $01;
+  {$EXTERNALSYM COD_MAJOR_COMPUTER}
+  COD_MAJOR_PHONE = $02;
+  {$EXTERNALSYM COD_MAJOR_PHONE}
+  COD_MAJOR_LAN_ACCESS = $03;
+  {$EXTERNALSYM COD_MAJOR_LAN_ACCESS}
+  COD_MAJOR_AUDIO = $04;
+  {$EXTERNALSYM COD_MAJOR_AUDIO}
+  COD_MAJOR_PERIPHERAL = $05;
+  {$EXTERNALSYM COD_MAJOR_PERIPHERAL}
+  COD_MAJOR_IMAGING = $06;
+  {$EXTERNALSYM COD_MAJOR_IMAGING}
+  COD_MAJOR_UNCLASSIFIED = $1;
+  {$EXTERNALSYM COD_MAJOR_UNCLASSIFIED}
+
+//
+// Minor class codes specific to each major class
+//
+
+const
+  COD_COMPUTER_MINOR_UNCLASSIFIED = $00;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_UNCLASSIFIED}
+  COD_COMPUTER_MINOR_DESKTOP = $01;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_DESKTOP}
+  COD_COMPUTER_MINOR_SERVER = $02;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_SERVER}
+  COD_COMPUTER_MINOR_LAPTOP = $03;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_LAPTOP}
+  COD_COMPUTER_MINOR_HANDHELD = $04;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_HANDHELD}
+  COD_COMPUTER_MINOR_PALM = $05;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_PALM}
+  COD_COMPUTER_MINOR_WEARABLE = $06;
+  {$EXTERNALSYM COD_COMPUTER_MINOR_WEARABLE}
+
+  COD_PHONE_MINOR_UNCLASSIFIED = $00;
+  {$EXTERNALSYM COD_PHONE_MINOR_UNCLASSIFIED}
+  COD_PHONE_MINOR_CELLULAR = $01;
+  {$EXTERNALSYM COD_PHONE_MINOR_CELLULAR}
+  COD_PHONE_MINOR_CORDLESS = $02;
+  {$EXTERNALSYM COD_PHONE_MINOR_CORDLESS}
+  COD_PHONE_MINOR_SMART = $03;
+  {$EXTERNALSYM COD_PHONE_MINOR_SMART}
+  COD_PHONE_MINOR_WIRED_MODEM = $04;
+  {$EXTERNALSYM COD_PHONE_MINOR_WIRED_MODEM}
+
+  COD_AUDIO_MINOR_UNCLASSIFIED = $00;
+  {$EXTERNALSYM COD_AUDIO_MINOR_UNCLASSIFIED}
+  COD_AUDIO_MINOR_HEADSET = $01;
+  {$EXTERNALSYM COD_AUDIO_MINOR_HEADSET}
+  COD_AUDIO_MINOR_HANDS_FREE = $02;
+  {$EXTERNALSYM COD_AUDIO_MINOR_HANDS_FREE}
+  COD_AUDIO_MINOR_HEADSET_HANDS_FREE = $03;
+  {$EXTERNALSYM COD_AUDIO_MINOR_HEADSET_HANDS_FREE}
+  COD_AUDIO_MINOR_MICROPHONE = $0;
+  {$EXTERNALSYM COD_AUDIO_MINOR_MICROPHONE}
+  COD_AUDIO_MINOR_LOUDSPEAKER = $05;
+  {$EXTERNALSYM COD_AUDIO_MINOR_LOUDSPEAKER}
+  COD_AUDIO_MINOR_HEADPHONES = $06;
+  {$EXTERNALSYM COD_AUDIO_MINOR_HEADPHONES}
+  COD_AUDIO_MINOR_PORTABLE_AUDIO = $07;
+  {$EXTERNALSYM COD_AUDIO_MINOR_PORTABLE_AUDIO}
+  COD_AUDIO_MINOR_CAR_AUDIO = $08;
+  {$EXTERNALSYM COD_AUDIO_MINOR_CAR_AUDIO}
+  COD_AUDIO_MINOR_SET_TOP_BOX = $09;
+  {$EXTERNALSYM COD_AUDIO_MINOR_SET_TOP_BOX}
+  COD_AUDIO_MINOR_HIFI_AUDIO = $0A;
+  {$EXTERNALSYM COD_AUDIO_MINOR_HIFI_AUDIO}
+  COD_AUDIO_MINOR_VCR = $0B;
+  {$EXTERNALSYM COD_AUDIO_MINOR_VCR}
+  COD_AUDIO_MINOR_VIDEO_CAMERA = $0C;
+  {$EXTERNALSYM COD_AUDIO_MINOR_VIDEO_CAMERA}
+  COD_AUDIO_MINOR_CAMCORDER = $0D;
+  {$EXTERNALSYM COD_AUDIO_MINOR_CAMCORDER}
+  COD_AUDIO_MINOR_VIDEO_MONITOR = $0E;
+  {$EXTERNALSYM COD_AUDIO_MINOR_VIDEO_MONITOR}
+  COD_AUDIO_MINOR_VIDEO_DISPLAY_LOUDSPEAKER = $0F;
+  {$EXTERNALSYM COD_AUDIO_MINOR_VIDEO_DISPLAY_LOUDSPEAKER}
+  COD_AUDIO_MINOR_VIDEO_DISPLAY_CONFERENCING = $10;
+  {$EXTERNALSYM COD_AUDIO_MINOR_VIDEO_DISPLAY_CONFERENCING}  
+  //COD_AUDIO_MINOR_RESERVED = $11:
+  COD_AUDIO_MINOR_GAMING_TOY = $12;
+  {$EXTERNALSYM COD_AUDIO_MINOR_GAMING_TOY}
+
+  COD_PERIPHERAL_MINOR_KEYBOARD_MASK = $10;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_KEYBOARD_MASK}
+  COD_PERIPHERAL_MINOR_POINTER_MASK = $20;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_POINTER_MASK}
+
+  COD_PERIPHERAL_MINOR_NO_CATEGORY = $00;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_NO_CATEGORY}
+  COD_PERIPHERAL_MINOR_JOYSTICK = $01;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_JOYSTICK}
+  COD_PERIPHERAL_MINOR_GAMEPAD = $02;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_GAMEPAD}
+  COD_PERIPHERAL_MINOR_REMOTE_CONTROL = $03;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_REMOTE_CONTROL}
+  COD_PERIPHERAL_MINOR_SENSING = $04;
+  {$EXTERNALSYM COD_PERIPHERAL_MINOR_SENSING}
+
+  COD_IMAGING_MINOR_DISPLAY_MASK = $04;
+  {$EXTERNALSYM COD_IMAGING_MINOR_DISPLAY_MASK}
+  COD_IMAGING_MINOR_CAMERA_MASK = $08;
+  {$EXTERNALSYM COD_IMAGING_MINOR_CAMERA_MASK}
+  COD_IMAGING_MINOR_SCANNER_MASK = $10;
+  {$EXTERNALSYM COD_IMAGING_MINOR_SCANNER_MASK}
+  COD_IMAGING_MINOR_PRINTER_MASK = $20;
+  {$EXTERNALSYM COD_IMAGING_MINOR_PRINTER_MASK}
+
+//
+// Cannot use GET_COD_MINOR for this b/c it is embedded in a different manner
+// than the rest of the major classes
+//
+
+const
+  COD_LAN_ACCESS_BIT_OFFSET = 5;
+  {$EXTERNALSYM COD_LAN_ACCESS_BIT_OFFSET}
+
+  COD_LAN_MINOR_MASK = $00001C;
+  {$EXTERNALSYM COD_LAN_MINOR_MASK}
+  COD_LAN_ACCESS_MASK = $0000E0;
+  {$EXTERNALSYM COD_LAN_ACCESS_MASK}
+
+function GET_COD_LAN_MINOR(_cod: DWORD): DWORD;
+{$EXTERNALSYM GET_COD_LAN_MINOR}
+function GET_COD_LAN_ACCESS(_cod: DWORD): DWORD;
+{$EXTERNALSYM GET_COD_LAN_ACCESS}
+
+//
+// LAN access percent usage subcodes
+//
+
+const
+  COD_LAN_MINOR_UNCLASSIFIED = $00;
+  {$EXTERNALSYM COD_LAN_MINOR_UNCLASSIFIED}
+
+  COD_LAN_ACCESS_0_USED  = $00;
+  {$EXTERNALSYM COD_LAN_ACCESS_0_USED}
+  COD_LAN_ACCESS_17_USED = $01;
+  {$EXTERNALSYM COD_LAN_ACCESS_17_USED}
+  COD_LAN_ACCESS_33_USED = $02;
+  {$EXTERNALSYM COD_LAN_ACCESS_33_USED}
+  COD_LAN_ACCESS_50_USED = $03;
+  {$EXTERNALSYM COD_LAN_ACCESS_50_USED}
+  COD_LAN_ACCESS_67_USED = $04;
+  {$EXTERNALSYM COD_LAN_ACCESS_67_USED}
+  COD_LAN_ACCESS_83_USED = $05;
+  {$EXTERNALSYM COD_LAN_ACCESS_83_USED}
+  COD_LAN_ACCESS_99_USED = $06;
+  {$EXTERNALSYM COD_LAN_ACCESS_99_USED}
+  COD_LAN_ACCESS_FULL    = $07;
+  {$EXTERNALSYM COD_LAN_ACCESS_FULL}
+
+//
+// Used as an initializer of LAP_DATA
+//
+
+(* (rom) not implementable in Delphi
+#define LAP_GIAC_INIT                   { 0x33, 0x8B, 0x9E }
+#define LAP_LIAC_INIT                   { 0x00, 0x8B, 0x9E }
+*)
+
+//
+// General Inquiry Access Code.
+//
+
+const
+  LAP_GIAC_VALUE = $009E8B33;
+  {$EXTERNALSYM LAP_GIAC_VALUE}
+
+//
+// Limited Inquiry Access Code.
+//
+
+const
+  LAP_LIAC_VALUE = $009E8B00;
+  {$EXTERNALSYM LAP_LIAC_VALUE}
+
+  BTH_ADDR_IAC_FIRST = $9E8B00;
+  {$EXTERNALSYM BTH_ADDR_IAC_FIRST}
+  BTH_ADDR_IAC_LAST = $9E8B3;
+  {$EXTERNALSYM BTH_ADDR_IAC_LAST}
+  BTH_ADDR_LIAC = $9E8B00;
+  {$EXTERNALSYM BTH_ADDR_LIAC}
+  BTH_ADDR_GIAC = $9E8B33;
+  {$EXTERNALSYM BTH_ADDR_GIAC}
+
+type
+  BTHSTATUS = UCHAR;
+  {$EXTERNALSYM BTHSTATUS}
+  PBTHSTATUS = ^BTHSTATUS;
+  {$EXTERNALSYM PBTHSTATUS}
+
+function BTH_ERROR(_btStatus: BTHSTATUS): BOOL;
+{$EXTERNALSYM BTH_ERROR}
+function BTH_SUCCESS(_btStatus: BTHSTATUS): BOOL;
+{$EXTERNALSYM BTH_SUCCESS}
+
+const
+  BTH_ERROR_SUCCESS = $00;
+  {$EXTERNALSYM BTH_ERROR_SUCCESS}
+  BTH_ERROR_UNKNOWN_HCI_COMMAND = $01;
+  {$EXTERNALSYM BTH_ERROR_UNKNOWN_HCI_COMMAND}
+  BTH_ERROR_NO_CONNECTION = $02;
+  {$EXTERNALSYM BTH_ERROR_NO_CONNECTION}
+  BTH_ERROR_HARDWARE_FAILURE = $03;
+  {$EXTERNALSYM BTH_ERROR_HARDWARE_FAILURE}
+  BTH_ERROR_PAGE_TIMEOUT = $04;
+  {$EXTERNALSYM BTH_ERROR_PAGE_TIMEOUT}
+  BTH_ERROR_AUTHENTICATION_FAILURE = $05;
+  {$EXTERNALSYM BTH_ERROR_AUTHENTICATION_FAILURE}
+  BTH_ERROR_KEY_MISSING = $06;
+  {$EXTERNALSYM BTH_ERROR_KEY_MISSING}
+  BTH_ERROR_MEMORY_FULL = $07;
+  {$EXTERNALSYM BTH_ERROR_MEMORY_FULL}
+  BTH_ERROR_CONNECTION_TIMEOUT = $08;
+  {$EXTERNALSYM BTH_ERROR_CONNECTION_TIMEOUT}
+  BTH_ERROR_MAX_NUMBER_OF_CONNECTIONS = $09;
+  {$EXTERNALSYM BTH_ERROR_MAX_NUMBER_OF_CONNECTIONS}
+  BTH_ERROR_MAX_NUMBER_OF_SCO_CONNECTIONS = $0a;
+  {$EXTERNALSYM BTH_ERROR_MAX_NUMBER_OF_SCO_CONNECTIONS}
+  BTH_ERROR_ACL_CONNECTION_ALREADY_EXISTS = $0b;
+  {$EXTERNALSYM BTH_ERROR_ACL_CONNECTION_ALREADY_EXISTS}
+  BTH_ERROR_COMMAND_DISALLOWED = $0c;
+  {$EXTERNALSYM BTH_ERROR_COMMAND_DISALLOWED}
+  BTH_ERROR_HOST_REJECTED_LIMITED_RESOURCES = $0d;
+  {$EXTERNALSYM BTH_ERROR_HOST_REJECTED_LIMITED_RESOURCES}
+  BTH_ERROR_HOST_REJECTED_SECURITY_REASONS = $0e;
+  {$EXTERNALSYM BTH_ERROR_HOST_REJECTED_SECURITY_REASONS}
+  BTH_ERROR_HOST_REJECTED_PERSONAL_DEVICE = $0;
+  {$EXTERNALSYM BTH_ERROR_HOST_REJECTED_PERSONAL_DEVICE}
+  BTH_ERROR_HOST_TIMEOUT = $10;
+  {$EXTERNALSYM BTH_ERROR_HOST_TIMEOUT}
+  BTH_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER = $11;
+  {$EXTERNALSYM BTH_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER}
+  BTH_ERROR_INVALID_HCI_PARAMETER = $12;
+  {$EXTERNALSYM BTH_ERROR_INVALID_HCI_PARAMETER}
+  BTH_ERROR_REMOTE_USER_ENDED_CONNECTION = $13;
+  {$EXTERNALSYM BTH_ERROR_REMOTE_USER_ENDED_CONNECTION}
+  BTH_ERROR_REMOTE_LOW_RESOURCES = $14;
+  {$EXTERNALSYM BTH_ERROR_REMOTE_LOW_RESOURCES}
+  BTH_ERROR_REMOTE_POWERING_OFF = $15;
+  {$EXTERNALSYM BTH_ERROR_REMOTE_POWERING_OFF}
+  BTH_ERROR_LOCAL_HOST_TERMINATED_CONNECTION = $16;
+  {$EXTERNALSYM BTH_ERROR_LOCAL_HOST_TERMINATED_CONNECTION}
+  BTH_ERROR_REPEATED_ATTEMPTS = $17;
+  {$EXTERNALSYM BTH_ERROR_REPEATED_ATTEMPTS}
+  BTH_ERROR_PAIRING_NOT_ALLOWED = $18;
+  {$EXTERNALSYM BTH_ERROR_PAIRING_NOT_ALLOWED}
+  BTH_ERROR_UKNOWN_LMP_PDU = $19;
+  {$EXTERNALSYM BTH_ERROR_UKNOWN_LMP_PDU}
+  BTH_ERROR_UNSUPPORTED_REMOTE_FEATURE = $1a;
+  {$EXTERNALSYM BTH_ERROR_UNSUPPORTED_REMOTE_FEATURE}
+  BTH_ERROR_SCO_OFFSET_REJECTED = $1b;
+  {$EXTERNALSYM BTH_ERROR_SCO_OFFSET_REJECTED}
+  BTH_ERROR_SCO_INTERVAL_REJECTED = $1c;
+  {$EXTERNALSYM BTH_ERROR_SCO_INTERVAL_REJECTED}
+  BTH_ERROR_SCO_AIRMODE_REJECTED = $1d;
+  {$EXTERNALSYM BTH_ERROR_SCO_AIRMODE_REJECTED}
+  BTH_ERROR_INVALID_LMP_PARAMETERS = $1e;
+  {$EXTERNALSYM BTH_ERROR_INVALID_LMP_PARAMETERS}
+  BTH_ERROR_UNSPECIFIED_ERROR = $1;
+  {$EXTERNALSYM BTH_ERROR_UNSPECIFIED_ERROR}
+  BTH_ERROR_UNSUPPORTED_LMP_PARM_VALUE = $20;
+  {$EXTERNALSYM BTH_ERROR_UNSUPPORTED_LMP_PARM_VALUE}
+  BTH_ERROR_ROLE_CHANGE_NOT_ALLOWED = $21;
+  {$EXTERNALSYM BTH_ERROR_ROLE_CHANGE_NOT_ALLOWED}
+  BTH_ERROR_LMP_RESPONSE_TIMEOUT = $22;
+  {$EXTERNALSYM BTH_ERROR_LMP_RESPONSE_TIMEOUT}
+  BTH_ERROR_LMP_TRANSACTION_COLLISION = $23;
+  {$EXTERNALSYM BTH_ERROR_LMP_TRANSACTION_COLLISION}
+  BTH_ERROR_LMP_PDU_NOT_ALLOWED = $24;
+  {$EXTERNALSYM BTH_ERROR_LMP_PDU_NOT_ALLOWED}
+  BTH_ERROR_ENCRYPTION_MODE_NOT_ACCEPTABLE = $25;
+  {$EXTERNALSYM BTH_ERROR_ENCRYPTION_MODE_NOT_ACCEPTABLE}
+  BTH_ERROR_UNIT_KEY_NOT_USED = $26;
+  {$EXTERNALSYM BTH_ERROR_UNIT_KEY_NOT_USED}
+  BTH_ERROR_QOS_IS_NOT_SUPPORTED = $27;
+  {$EXTERNALSYM BTH_ERROR_QOS_IS_NOT_SUPPORTED}
+  BTH_ERROR_INSTANT_PASSED = $28;
+  {$EXTERNALSYM BTH_ERROR_INSTANT_PASSED}
+  BTH_ERROR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED = $29;
+  {$EXTERNALSYM BTH_ERROR_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED}  
+
+  BTH_ERROR_UNSPECIFIED = $FF;
+  {$EXTERNALSYM BTH_ERROR_UNSPECIFIED}
+
+//
+// Min, max, and default L2cap MTU.
+//
+
+const
+  L2CAP_MIN_MTU = 48;
+  {$EXTERNALSYM L2CAP_MIN_MTU}
+  L2CAP_MAX_MTU = $FFFF;
+  {$EXTERNALSYM L2CAP_MAX_MTU}
+  L2CAP_DEFAULT_MTU = 672;
+  {$EXTERNALSYM L2CAP_DEFAULT_MTU}
+
+//
+// Max l2cap signal size (48) - size of signal header (4)
+//
+
+const
+  MAX_L2CAP_PING_DATA_LENGTH = 44;
+  {$EXTERNALSYM MAX_L2CAP_PING_DATA_LENGTH}
+  MAX_L2CAP_INFO_DATA_LENGTH = 44;
+  {$EXTERNALSYM MAX_L2CAP_INFO_DATA_LENGTH}
+
+//
+// the following two structures provides information about
+// disocvered remote radios.
+//
+
+const
+  BDIF_ADDRESS = $00000001;
+  {$EXTERNALSYM BDIF_ADDRESS}
+  BDIF_COD = $00000002;
+  {$EXTERNALSYM BDIF_COD}
+  BDIF_NAME = $00000004;
+  {$EXTERNALSYM BDIF_NAME}
+  BDIF_PAIRED = $00000008;
+  {$EXTERNALSYM BDIF_PAIRED}
+  BDIF_PERSONAL = $00000010;
+  {$EXTERNALSYM BDIF_PERSONAL}
+  BDIF_CONNECTED = $00000020;
+  {$EXTERNALSYM BDIF_CONNECTED}
+
+const
+  BDIF_VALID_FLAGS = BDIF_CONNECTED or BDIF_ADDRESS or BDIF_COD or BDIF_NAME or BDIF_PAIRED or BDIF_PERSONAL;
+  {$EXTERNALSYM BDIF_VALID_FLAGS}
+
+type
+  _BTH_DEVICE_INFO = record
+
+    //
+    // Combination BDIF_Xxx flags
+    //
+    flags: ULONG;
+
+    //
+    // Address of remote device.
+    //
+    address: BTH_ADDR;
+
+    //
+    // Class Of Device.
+    //
+    classOfDevice: BTH_COD;
+
+    //
+    // name of the device
+    //
+    name: array [0..BTH_MAX_NAME_SIZE - 1] of CHAR;
+  end;
+  {$EXTERNALSYM _BTH_DEVICE_INFO}
+  BTH_DEVICE_INFO = _BTH_DEVICE_INFO;
+  {$EXTERNALSYM BTH_DEVICE_INFO}
+  PBTH_DEVICE_INFO = ^BTH_DEVICE_INFO;
+  {$EXTERNALSYM PBTH_DEVICE_INFO}
+  TBthDeviceInfo = BTH_DEVICE_INFO;
+  PBthDeviceInfo = PBTH_DEVICE_INFO;
+
+//
+// Buffer associated with GUID_BLUETOOTH_RADIO_IN_RANGE
+//
+
+type
+  _BTH_RADIO_IN_RANGE = record
+    //
+    // Information about the remote radio
+    //
+    deviceInfo: BTH_DEVICE_INFO;
+    //
+    // The previous flags value for the BTH_DEVICE_INFO.  The receiver of this
+    // notification can compare the deviceInfo.flags and previousDeviceFlags
+    // to determine what has changed about this remote radio.
+    //
+    // For instance, if BDIF_NAME is set in deviceInfo.flags and not in
+    // previousDeviceFlags, the remote radio's has just been retrieved.
+    //
+    previousDeviceFlags: ULONG;
+  end;
+  {$EXTERNALSYM _BTH_RADIO_IN_RANGE}
+  BTH_RADIO_IN_RANGE = _BTH_RADIO_IN_RANGE;
+  {$EXTERNALSYM BTH_RADIO_IN_RANGE}
+  PBTH_RADIO_IN_RANGE = ^BTH_RADIO_IN_RANGE;
+  {$EXTERNALSYM PBTH_RADIO_IN_RANGE}
+  TBthRadioInRange = BTH_RADIO_IN_RANGE;
+  PBthRadioInRange = PBTH_RADIO_IN_RANGE;
+
+//
+// Buffer associated with GUID_BLUETOOTH_L2CAP_EVENT
+//
+
+  _BTH_L2CAP_EVENT_INFO = record
+    //
+    // Remote radio address which the L2CAP event is associated with
+    //
+    bthAddress: BTH_ADDR;
+
+    //
+    // The PSM that is either being connected to or disconnected from
+    //
+    psm: Word;
+
+    //
+    // If != 0, then the channel has just been established.  If == 0, then the
+    // channel has been destroyed.  Notifications for a destroyed channel will
+    // only be sent for channels successfully established.
+    //
+    connected: UCHAR;
+
+    //
+    // If != 0, then the local host iniated the l2cap connection.  If == 0, then
+    // the remote host initated the connection.  This field is only valid if
+    // connect is != 0.
+    //
+    initiated: UCHAR;
+  end;
+  {$EXTERNALSYM _BTH_L2CAP_EVENT_INFO}
+  BTH_L2CAP_EVENT_INFO = _BTH_L2CAP_EVENT_INFO;
+  {$EXTERNALSYM BTH_L2CAP_EVENT_INFO}
+  PBTH_L2CAP_EVENT_INFO = ^BTH_L2CAP_EVENT_INFO;
+  {$EXTERNALSYM PBTH_L2CAP_EVENT_INFO}
+  TBthL2CapEventInfo = BTH_L2CAP_EVENT_INFO;
+  PBthL2CapEventInfo = PBTH_L2CAP_EVENT_INFO;
+
+const
+  HCI_CONNNECTION_TYPE_ACL = 1;
+  {$EXTERNALSYM HCI_CONNNECTION_TYPE_ACL}
+  HCI_CONNNECTION_TYPE_SCO = 2;
+  {$EXTERNALSYM HCI_CONNNECTION_TYPE_SCO}
+
+//
+// Buffer associated with GUID_BLUETOOTH_HCI_EVENT
+//
+
+type
+  _BTH_HCI_EVENT_INFO = record
+    //
+    // Remote radio address which the HCI event is associated with
+    //
+    bthAddress: BTH_ADDR;
+
+    //
+    // HCI_CONNNECTION_TYPE_XXX value
+    //
+    connectionType: UCHAR;
+
+    //
+    // If != 0, then the underlying connection to the remote radio has just
+    // been estrablished.  If == 0, then the underlying conneciton has just been
+    // destroyed.
+    //
+    connected: UCHAR;
+  end;
+  {$EXTERNALSYM _BTH_HCI_EVENT_INFO}
+  BTH_HCI_EVENT_INFO = _BTH_HCI_EVENT_INFO;
+  {$EXTERNALSYM BTH_HCI_EVENT_INFO}
+  PBTH_HCI_EVENT_INFO = ^BTH_HCI_EVENT_INFO;
+  {$EXTERNALSYM PBTH_HCI_EVENT_INFO}
+  TBthHciEventInfo = BTH_HCI_EVENT_INFO;
+  PBthHciEventInfo = PBTH_HCI_EVENT_INFO;
+
+const
+  MAX_UUIDS_IN_QUERY = 12;
+  {$EXTERNALSYM MAX_UUIDS_IN_QUERY}
+
+  BTH_VID_DEFAULT_VALUE = $FFFF;
+  {$EXTERNALSYM BTH_VID_DEFAULT_VALUE}
+
+  SDP_ERROR_INVALID_SDP_VERSION = $0001;
+  {$EXTERNALSYM SDP_ERROR_INVALID_SDP_VERSION}
+  SDP_ERROR_INVALID_RECORD_HANDLE = $0002;
+  {$EXTERNALSYM SDP_ERROR_INVALID_RECORD_HANDLE}
+  SDP_ERROR_INVALID_REQUEST_SYNTAX = $0003;
+  {$EXTERNALSYM SDP_ERROR_INVALID_REQUEST_SYNTAX}
+  SDP_ERROR_INVALID_PDU_SIZE = $0004;
+  {$EXTERNALSYM SDP_ERROR_INVALID_PDU_SIZE}
+  SDP_ERROR_INVALID_CONTINUATION_STATE = $0005;
+  {$EXTERNALSYM SDP_ERROR_INVALID_CONTINUATION_STATE}
+  SDP_ERROR_INSUFFICIENT_RESOURCES = $0006;
+  {$EXTERNALSYM SDP_ERROR_INSUFFICIENT_RESOURCES}
+
+//
+// Defined by windows to handle server errors that are not described by the
+// above errors.  Start at 0x0100 so we don't go anywhere near the spec
+// defined values.
+//
+
+//
+// Success, nothing went wrong
+//
+
+const
+  SDP_ERROR_SUCCESS = SDP_ERROR($0000);
+  {$EXTERNALSYM SDP_ERROR_SUCCESS}
+
+//
+// The SDP PDU or parameters other than the SDP stream response was not correct
+//
+
+  SDP_ERROR_SERVER_INVALID_RESPONSE = SDP_ERROR($0100);
+  {$EXTERNALSYM SDP_ERROR_SERVER_INVALID_RESPONSE}
+
+///
+/// The SDP response stream did not parse correctly.
+///
+
+  SDP_ERROR_SERVER_RESPONSE_DID_NOT_PARSE = SDP_ERROR($0200);
+  {$EXTERNALSYM SDP_ERROR_SERVER_RESPONSE_DID_NOT_PARSE}
+
+///
+/// The SDP response stream was successfully parsed, but did not match the
+/// required format for the query.
+///
+
+  SDP_ERROR_SERVER_BAD_FORMAT = SDP_ERROR($0300);
+  {$EXTERNALSYM SDP_ERROR_SERVER_BAD_FORMAT}
+
+///
+/// SDP was unable to send a continued query back to the server
+///
+
+  SDP_ERROR_COULD_NOT_SEND_CONTINUE = SDP_ERROR($0400);
+  {$EXTERNALSYM SDP_ERROR_COULD_NOT_SEND_CONTINUE}
+
+///
+/// Server sent a response that was too large to fit in the caller's buffer.
+///
+
+  SDP_ERROR_RESPONSE_TOO_LARGE = SDP_ERROR($0500);
+  {$EXTERNALSYM SDP_ERROR_RESPONSE_TOO_LARGE}
+
+  SDP_ATTRIB_RECORD_HANDLE = $0000;
+  {$EXTERNALSYM SDP_ATTRIB_RECORD_HANDLE}
+  SDP_ATTRIB_CLASS_ID_LIST = $0001;
+  {$EXTERNALSYM SDP_ATTRIB_CLASS_ID_LIST}
+  SDP_ATTRIB_RECORD_STATE = $0002;
+  {$EXTERNALSYM SDP_ATTRIB_RECORD_STATE}
+  SDP_ATTRIB_SERVICE_ID = $0003;
+  {$EXTERNALSYM SDP_ATTRIB_SERVICE_ID}
+  SDP_ATTRIB_PROTOCOL_DESCRIPTOR_LIST = $0004;
+  {$EXTERNALSYM SDP_ATTRIB_PROTOCOL_DESCRIPTOR_LIST}
+  SDP_ATTRIB_BROWSE_GROUP_LIST = $0005;
+  {$EXTERNALSYM SDP_ATTRIB_BROWSE_GROUP_LIST}
+  SDP_ATTRIB_LANG_BASE_ATTRIB_ID_LIST = $0006;
+  {$EXTERNALSYM SDP_ATTRIB_LANG_BASE_ATTRIB_ID_LIST}
+  SDP_ATTRIB_INFO_TIME_TO_LIVE = $0007;
+  {$EXTERNALSYM SDP_ATTRIB_INFO_TIME_TO_LIVE}
+  SDP_ATTRIB_AVAILABILITY = $0008;
+  {$EXTERNALSYM SDP_ATTRIB_AVAILABILITY}
+  SDP_ATTRIB_PROFILE_DESCRIPTOR_LIST = $0009;
+  {$EXTERNALSYM SDP_ATTRIB_PROFILE_DESCRIPTOR_LIST}
+  SDP_ATTRIB_DOCUMENTATION_URL = $000A;
+  {$EXTERNALSYM SDP_ATTRIB_DOCUMENTATION_URL}
+  SDP_ATTRIB_CLIENT_EXECUTABLE_URL = $000B;
+  {$EXTERNALSYM SDP_ATTRIB_CLIENT_EXECUTABLE_URL}
+  SDP_ATTRIB_ICON_URL = $000C;
+  {$EXTERNALSYM SDP_ATTRIB_ICON_URL}
+  SDP_ATTRIB_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST = $000D;
+  {$EXTERNALSYM SDP_ATTRIB_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST}
+
+//
+// Attribute IDs in the range of 0x000D - 0x01FF are reserved for future use
+//
+
+const
+  SDP_ATTRIB_PROFILE_SPECIFIC = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_PROFILE_SPECIFIC}
+
+  LANG_BASE_LANGUAGE_INDEX = $0000;
+  {$EXTERNALSYM LANG_BASE_LANGUAGE_INDEX}
+  LANG_BASE_ENCODING_INDEX = $0001;
+  {$EXTERNALSYM LANG_BASE_ENCODING_INDEX}
+  LANG_BASE_OFFSET_INDEX = $0002;
+  {$EXTERNALSYM LANG_BASE_OFFSET_INDEX}
+  LANG_DEFAULT_ID = $0100;
+  {$EXTERNALSYM LANG_DEFAULT_ID}
+
+  STRING_NAME_OFFSET = $0000;
+  {$EXTERNALSYM STRING_NAME_OFFSET}
+  STRING_DESCRIPTION_OFFSET = $0001;
+  {$EXTERNALSYM STRING_DESCRIPTION_OFFSET}
+  STRING_PROVIDER_NAME_OFFSET = $0002;
+  {$EXTERNALSYM STRING_PROVIDER_NAME_OFFSET}
+
+  SDP_ATTRIB_SDP_VERSION_NUMBER_LIST = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_SDP_VERSION_NUMBER_LIST}
+  SDP_ATTRIB_SDP_DATABASE_STATE = $0201;
+  {$EXTERNALSYM SDP_ATTRIB_SDP_DATABASE_STATE}
+
+  SDP_ATTRIB_BROWSE_GROUP_ID = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_BROWSE_GROUP_ID}
+
+  SDP_ATTRIB_CORDLESS_EXTERNAL_NETWORK = $0301;
+  {$EXTERNALSYM SDP_ATTRIB_CORDLESS_EXTERNAL_NETWORK}
+
+  SDP_ATTRIB_FAX_CLASS_1_SUPPORT = $0302;
+  {$EXTERNALSYM SDP_ATTRIB_FAX_CLASS_1_SUPPORT}
+  SDP_ATTRIB_FAX_CLASS_2_0_SUPPORT = $0303;
+  {$EXTERNALSYM SDP_ATTRIB_FAX_CLASS_2_0_SUPPORT}
+  SDP_ATTRIB_FAX_CLASS_2_SUPPORT = $0304;
+  {$EXTERNALSYM SDP_ATTRIB_FAX_CLASS_2_SUPPORT}
+  SDP_ATTRIB_FAX_AUDIO_FEEDBACK_SUPPORT = $0305;
+  {$EXTERNALSYM SDP_ATTRIB_FAX_AUDIO_FEEDBACK_SUPPORT}
+
+  SDP_ATTRIB_HEADSET_REMOTE_AUDIO_VOLUME_CONTROL = $0302;
+  {$EXTERNALSYM SDP_ATTRIB_HEADSET_REMOTE_AUDIO_VOLUME_CONTROL}
+
+  SDP_ATTRIB_LAN_LPSUBNET = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_LAN_LPSUBNET}
+
+  SDP_ATTRIB_OBJECT_PUSH_SUPPORTED_FORMATS_LIST = $0303;
+  {$EXTERNALSYM SDP_ATTRIB_OBJECT_PUSH_SUPPORTED_FORMATS_LIST}
+
+  SDP_ATTRIB_SYNCH_SUPPORTED_DATA_STORES_LIST = $0301;
+  {$EXTERNALSYM SDP_ATTRIB_SYNCH_SUPPORTED_DATA_STORES_LIST}
+
+//  this is in the assigned numbers doc, but it does not show up in any profile
+
+const
+  SDP_ATTRIB_SERVICE_VERSION = $0300;
+  {$EXTERNALSYM SDP_ATTRIB_SERVICE_VERSION}
+
+  SDP_ATTRIB_PAN_NETWORK_ADDRESS = $0306;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_NETWORK_ADDRESS}
+  SDP_ATTRIB_PAN_WAP_GATEWAY = $0307;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_WAP_GATEWAY}
+  SDP_ATTRIB_PAN_HOME_PAGE_URL = $0308;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_HOME_PAGE_URL}
+  SDP_ATTRIB_PAN_WAP_STACK_TYPE = $0309;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_WAP_STACK_TYPE}
+  SDP_ATTRIB_PAN_SECURITY_DESCRIPTION = $030A;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_SECURITY_DESCRIPTION}
+  SDP_ATTRIB_PAN_NET_ACCESS_TYPE = $030B;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_NET_ACCESS_TYPE}
+  SDP_ATTRIB_PAN_MAX_NET_ACCESS_RATE = $030C;
+  {$EXTERNALSYM SDP_ATTRIB_PAN_MAX_NET_ACCESS_RATE}
+
+  SDP_ATTRIB_IMAGING_SUPPORTED_CAPABILITIES = $0310;
+  {$EXTERNALSYM SDP_ATTRIB_IMAGING_SUPPORTED_CAPABILITIES}
+  SDP_ATTRIB_IMAGING_SUPPORTED_FEATURES = $0311;
+  {$EXTERNALSYM SDP_ATTRIB_IMAGING_SUPPORTED_FEATURES}
+  SDP_ATTRIB_IMAGING_SUPPORTED_FUNCTIONS = $0312;
+  {$EXTERNALSYM SDP_ATTRIB_IMAGING_SUPPORTED_FUNCTIONS}
+  SDP_ATTRIB_IMAGING_TOTAL_DATA_CAPACITY = $0313;
+  {$EXTERNALSYM SDP_ATTRIB_IMAGING_TOTAL_DATA_CAPACITY}
+
+  SDP_ATTRIB_DI_SPECIFICATION_ID = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_DI_SPECIFICATION_ID}
+  SDP_ATTRIB_DI_VENDOR_ID = $0201;
+  {$EXTERNALSYM SDP_ATTRIB_DI_VENDOR_ID}
+  SDP_ATTRIB_DI_PRODUCT_ID = $0202;
+  {$EXTERNALSYM SDP_ATTRIB_DI_PRODUCT_ID}
+  SDP_ATTRIB_DI_VERSION = $0203;
+  {$EXTERNALSYM SDP_ATTRIB_DI_VERSION}
+  SDP_ATTRIB_DI_PRIMARY_RECORD = $0204;
+  {$EXTERNALSYM SDP_ATTRIB_DI_PRIMARY_RECORD}
+  SDP_ATTRIB_DI_VENDOR_ID_SOURCE = $0205;
+  {$EXTERNALSYM SDP_ATTRIB_DI_VENDOR_ID_SOURCE}
+
+  SDP_ATTRIB_HID_DEVICE_RELEASE_NUMBER = $0200;
+  {$EXTERNALSYM SDP_ATTRIB_HID_DEVICE_RELEASE_NUMBER}
+  SDP_ATTRIB_HID_PARSER_VERSION = $0201;
+  {$EXTERNALSYM SDP_ATTRIB_HID_PARSER_VERSION}
+  SDP_ATTRIB_HID_DEVICE_SUBCLASS = $0202;
+  {$EXTERNALSYM SDP_ATTRIB_HID_DEVICE_SUBCLASS}
+  SDP_ATTRIB_HID_COUNTRY_CODE = $0203;
+  {$EXTERNALSYM SDP_ATTRIB_HID_COUNTRY_CODE}
+  SDP_ATTRIB_HID_VIRTUAL_CABLE = $0204;
+  {$EXTERNALSYM SDP_ATTRIB_HID_VIRTUAL_CABLE}
+  SDP_ATTRIB_HID_RECONNECT_INITIATE = $0205;
+  {$EXTERNALSYM SDP_ATTRIB_HID_RECONNECT_INITIATE}
+  SDP_ATTRIB_HID_DESCRIPTOR_LIST = $0206;
+  {$EXTERNALSYM SDP_ATTRIB_HID_DESCRIPTOR_LIST}
+  SDP_ATTRIB_HID_LANG_ID_BASE_LIST = $0207;
+  {$EXTERNALSYM SDP_ATTRIB_HID_LANG_ID_BASE_LIST}
+  SDP_ATTRIB_HID_SDP_DISABLE = $0208;
+  {$EXTERNALSYM SDP_ATTRIB_HID_SDP_DISABLE}
+  SDP_ATTRIB_HID_BATTERY_POWER = $0209;
+  {$EXTERNALSYM SDP_ATTRIB_HID_BATTERY_POWER}
+  SDP_ATTRIB_HID_REMOTE_WAKE = $020A;
+  {$EXTERNALSYM SDP_ATTRIB_HID_REMOTE_WAKE}
+  SDP_ATTRIB_HID_REPORT_LIST = $020B;
+  {$EXTERNALSYM SDP_ATTRIB_HID_REPORT_LIST}
+  SDP_ATTRIB_HID_SUPERVISION_TIMEOUT = $020C;
+  {$EXTERNALSYM SDP_ATTRIB_HID_SUPERVISION_TIMEOUT}
+  SDP_ATTRIB_HID_NORMALLY_CONNECTABLE = $020D;
+  {$EXTERNALSYM SDP_ATTRIB_HID_NORMALLY_CONNECTABLE}
+  SDP_ATTRIB_HID_BOOT_DEVICE = $020E;
+  {$EXTERNALSYM SDP_ATTRIB_HID_BOOT_DEVICE}
+
+//
+// Profile specific values
+//
+
+  CORDLESS_EXTERNAL_NETWORK_PSTN = $01;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_PSTN}
+  CORDLESS_EXTERNAL_NETWORK_ISDN = $02;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_ISDN}
+  CORDLESS_EXTERNAL_NETWORK_GSM = $03;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_GSM}
+  CORDLESS_EXTERNAL_NETWORK_CDMA = $04;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_CDMA}
+  CORDLESS_EXTERNAL_NETWORK_ANALOG_CELLULAR = $05;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_ANALOG_CELLULAR}
+  CORDLESS_EXTERNAL_NETWORK_PACKET_SWITCHED = $06;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_PACKET_SWITCHED}
+  CORDLESS_EXTERNAL_NETWORK_OTHER = $07;
+  {$EXTERNALSYM CORDLESS_EXTERNAL_NETWORK_OTHER}
+
+  OBJECT_PUSH_FORMAT_VCARD_2_1 = $01;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_VCARD_2_1}
+  OBJECT_PUSH_FORMAT_VCARD_3_0 = $02;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_VCARD_3_0}
+  OBJECT_PUSH_FORMAT_VCAL_1_0 = $03;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_VCAL_1_0}
+  OBJECT_PUSH_FORMAT_ICAL_2_0 = $04;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_ICAL_2_0}
+  OBJECT_PUSH_FORMAT_VNOTE = $05;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_VNOTE}
+  OBJECT_PUSH_FORMAT_VMESSAGE = $06;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_VMESSAGE}
+  OBJECT_PUSH_FORMAT_ANY = $FF;
+  {$EXTERNALSYM OBJECT_PUSH_FORMAT_ANY}
+
+  SYNCH_DATA_STORE_PHONEBOOK = $01;
+  {$EXTERNALSYM SYNCH_DATA_STORE_PHONEBOOK}
+  SYNCH_DATA_STORE_CALENDAR = $03;
+  {$EXTERNALSYM SYNCH_DATA_STORE_CALENDAR}
+  SYNCH_DATA_STORE_NOTES = $05;
+  {$EXTERNALSYM SYNCH_DATA_STORE_NOTES}
+  SYNCH_DATA_STORE_MESSAGES = $06;
+  {$EXTERNALSYM SYNCH_DATA_STORE_MESSAGES}
+
+  DI_VENDOR_ID_SOURCE_BLUETOOTH_SIG = $0001;
+  {$EXTERNALSYM DI_VENDOR_ID_SOURCE_BLUETOOTH_SIG}
+  DI_VENDOR_ID_SOURCE_USB_IF = $0002;
+  {$EXTERNALSYM DI_VENDOR_ID_SOURCE_USB_IF}
+
+  PSM_SDP = $0001;
+  {$EXTERNALSYM PSM_SDP}
+  PSM_RFCOMM = $0003;
+  {$EXTERNALSYM PSM_RFCOMM}
+  PSM_TCS_BIN = $0005;
+  {$EXTERNALSYM PSM_TCS_BIN}
+  PSM_TCS_BIN_CORDLESS = $0007;
+  {$EXTERNALSYM PSM_TCS_BIN_CORDLESS}
+  PSM_BNEP = $000;
+  {$EXTERNALSYM PSM_BNEP}
+  PSM_HID_CONTROL = $0011;
+  {$EXTERNALSYM PSM_HID_CONTROL}
+  PSM_HID_INTERRUPT = $0013;
+  {$EXTERNALSYM PSM_HID_INTERRUPT}
+  PSM_AVCTP = $0017;
+  {$EXTERNALSYM PSM_AVCTP}
+  PSM_AVDTP = $0019;
+  {$EXTERNALSYM PSM_AVDTP}
+  PSM_UDI_C_PLANE = $001D;
+  {$EXTERNALSYM PSM_UDI_C_PLANE}
+
+//
+// Strings
+//
+
+const
+  STR_ADDR_FMTA = '(%02x:%02x:%02x:%02x:%02x:%02x)';
+  {$EXTERNALSYM STR_ADDR_FMTA}
+  STR_ADDR_FMTW = '(%02x:%02x:%02x:%02x:%02x:%02x)';
+  {$EXTERNALSYM STR_ADDR_FMTW}
+
+  STR_ADDR_SHORT_FMTA = '%04x%08x';
+  {$EXTERNALSYM STR_ADDR_SHORT_FMTA}
+  STR_ADDR_SHORT_FMTW = '%04x%08x';
+  {$EXTERNALSYM STR_ADDR_SHORT_FMTW}
+
+{$IFDEF UNICODE}
+  STR_ADDR_FMT = STR_ADDR_FMTW;
+  {$EXTERNALSYM STR_ADDR_FMT}
+  STR_ADDR_SHORT_FMT = STR_ADDR_SHORT_FMTW;
+  {$EXTERNALSYM STR_ADDR_SHORT_FMT}
+{$ELSE}
+  STR_ADDR_FMT = STR_ADDR_FMTA;
+  {$EXTERNALSYM STR_ADDR_FMT}
+  STR_ADDR_SHORT_FMT = STR_ADDR_SHORT_FMTA;
+  {$EXTERNALSYM STR_ADDR_SHORT_FMT}
+{$ENDIF UNICODE}
+
+function GET_BITS(Field, Offset, Mask: Integer): Integer;
+{$EXTERNALSYM GET_BITS}
+function GET_BIT(Field, Offset: Integer): Integer;
+{$EXTERNALSYM GET_BIT}
+
+function LMP_3_SLOT_PACKETS(X: Integer): Integer;
+{$EXTERNALSYM LMP_3_SLOT_PACKETS}
+function LMP_5_SLOT_PACKETS(X: Integer): Integer;
+{$EXTERNALSYM LMP_5_SLOT_PACKETS}
+function LMP_ENCRYPTION(X: Integer): Integer;
+{$EXTERNALSYM LMP_ENCRYPTION}
+function LMP_SLOT_OFFSET(X: Integer): Integer;
+{$EXTERNALSYM LMP_SLOT_OFFSET}
+function LMP_TIMING_ACCURACY(X: Integer): Integer;
+{$EXTERNALSYM LMP_TIMING_ACCURACY}
+function LMP_SWITCH(X: Integer): Integer;
+{$EXTERNALSYM LMP_SWITCH}
+function LMP_HOLD_MODE(X: Integer): Integer;
+{$EXTERNALSYM LMP_HOLD_MODE}
+function LMP_SNIFF_MODE(X: Integer): Integer;
+{$EXTERNALSYM LMP_SNIFF_MODE}
+function LMP_PARK_MODE(X: Integer): Integer;
+{$EXTERNALSYM LMP_PARK_MODE}
+function LMP_RSSI(X: Integer): Integer;
+{$EXTERNALSYM LMP_RSSI}
+function LMP_CHANNEL_QUALITY_DRIVEN_MODE(X: Integer): Integer;
+{$EXTERNALSYM LMP_CHANNEL_QUALITY_DRIVEN_MODE}
+function LMP_SCO_LINK(X: Integer): Integer;
+{$EXTERNALSYM LMP_SCO_LINK}
+function LMP_HV2_PACKETS(X: Integer): Integer;
+{$EXTERNALSYM LMP_HV2_PACKETS}
+function LMP_HV3_PACKETS(X: Integer): Integer;
+{$EXTERNALSYM LMP_HV3_PACKETS}
+function LMP_MU_LAW_LOG(X: Integer): Integer;
+{$EXTERNALSYM LMP_MU_LAW_LOG}
+function LMP_A_LAW_LOG(X: Integer): Integer;
+{$EXTERNALSYM LMP_A_LAW_LOG}
+function LMP_CVSD(X: Integer): Integer;
+{$EXTERNALSYM LMP_CVSD}
+function LMP_PAGING_SCHEME(X: Integer): Integer;
+{$EXTERNALSYM LMP_PAGING_SCHEME}
+function LMP_POWER_CONTROL(X: Integer): Integer;
+{$EXTERNALSYM LMP_POWER_CONTROL}
+function LMP_TRANSPARENT_SCO_DATA(X: Integer): Integer;
+{$EXTERNALSYM LMP_TRANSPARENT_SCO_DATA}
+function LMP_FLOW_CONTROL_LAG(X: Integer): Integer;
+{$EXTERNALSYM LMP_FLOW_CONTROL_LAG}
+
+implementation
+
+function GET_NAP(_bth_addr: BTH_ADDR): Word;
+begin
+  Result := ((_bth_addr and NAP_MASK) shr NAP_BIT_OFFSET);
+end;
+
+function GET_SAP(_bth_addr: BTH_ADDR): ULONG;
+begin
+  Result := ((_bth_addr and SAP_MASK) shr SAP_BIT_OFFSET);
+end;
+
+function SET_NAP(_nap: Word): Int64;
+begin
+  Result := (_nap shl NAP_BIT_OFFSET);
+end;
+
+function SET_SAP(_sap: ULONG): Int64;
+begin
+  Result := (_sap shl SAP_BIT_OFFSET);
+end;
+
+function SET_NAP_SAP(_nap, _sap: Word): Int64;
+begin
+  Result := (SET_NAP(_nap) or SET_SAP(_sap));
+end;
+
+function GET_COD_LAN_MINOR(_cod: DWORD): DWORD;
+begin
+  Result := ((_cod and COD_LAN_MINOR_MASK) shr COD_MINOR_BIT_OFFSET);
+end;
+
+function GET_COD_LAN_ACCESS(_cod: DWORD): DWORD;
+begin
+  Result := ((_cod and COD_LAN_ACCESS_MASK) shr COD_LAN_ACCESS_BIT_OFFSET);
+end;
+
+function BTH_ERROR(_btStatus: BTHSTATUS): BOOL;
+begin
+  Result := _btStatus <> BTH_ERROR_SUCCESS;
+end;
+
+function BTH_SUCCESS(_btStatus: BTHSTATUS): BOOL;
+begin
+  Result := _btStatus = BTH_ERROR_SUCCESS;
+end;
+
+function GET_BITS(Field, Offset, Mask: Integer): Integer;
+begin
+  Result := (Field shr Offset) and Mask;
+end;
+
+function GET_BIT(field,offset: Integer): Integer;
+begin
+  Result := GET_BITS(Field, Offset, $1);
+end;
+
+function LMP_3_SLOT_PACKETS(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 0);
+end;
+
+function LMP_5_SLOT_PACKETS(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 1);
+end;
+
+function LMP_ENCRYPTION(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 2);
+end;
+
+function LMP_SLOT_OFFSET(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 3);
+end;
+
+function LMP_TIMING_ACCURACY(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 4);
+end;
+
+function LMP_SWITCH(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 5);
+end;
+
+function LMP_HOLD_MODE(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 6);
+end;
+
+function LMP_SNIFF_MODE(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 7);
+end;
+
+function LMP_PARK_MODE(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 8);
+end;
+
+function LMP_RSSI(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 9);
+end;
+
+function LMP_CHANNEL_QUALITY_DRIVEN_MODE(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 10);
+end;
+
+function LMP_SCO_LINK(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 11);
+end;
+
+function LMP_HV2_PACKETS(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 12);
+end;
+
+function LMP_HV3_PACKETS(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 13);
+end;
+
+function LMP_MU_LAW_LOG(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 14);
+end;
+
+function LMP_A_LAW_LOG(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 15);
+end;
+
+function LMP_CVSD(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 16);
+end;
+
+function LMP_PAGING_SCHEME(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 17);
+end;
+
+function LMP_POWER_CONTROL(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 18);
+end;
+
+function LMP_TRANSPARENT_SCO_DATA(X: Integer): Integer;
+begin
+  Result := GET_BIT(x, 19);
+end;
+
+function LMP_FLOW_CONTROL_LAG(X: Integer): Integer;
+begin
+  Result := GET_BITS(x, 20, $3);
+end;
+
+function GET_COD_FORMAT(_cod: BTH_COD): BTH_COD;
+begin
+  Result := (_cod and COD_FORMAT_MASK) shr COD_FORMAT_BIT_OFFSET;
+end;
+
+function GET_COD_MINOR(_cod: BTH_COD): BTH_COD;
+begin
+  Result := (_cod and COD_MINOR_MASK) shr COD_MINOR_BIT_OFFSET;
+end;
+
+function GET_COD_MAJOR(_cod: BTH_COD): BTH_COD;
+begin
+  Result := (_cod and COD_MAJOR_MASK) shr COD_MAJOR_BIT_OFFSET;
+end;
+
+function GET_COD_SERVICE(_cod: BTH_COD): BTH_COD;
+begin
+  Result := (_cod and COD_SERVICE_MASK) shr COD_SERVICE_BIT_OFFSET;
+end;
+
+procedure SET_COD_MINOR(var _cod: BTH_COD; _minor: BTH_COD);
+begin
+  _cod := (_cod and not COD_MINOR_MASK) or (_minor shl COD_MINOR_BIT_OFFSET);
+end;
+
+procedure SET_COD_MAJOR(var _cod: BTH_COD; _major: BTH_COD);
+begin
+  _cod := (_cod and not COD_MAJOR_MASK) or (_major shl COD_MAJOR_BIT_OFFSET);
+end;
+
+procedure SET_COD_SERVICE(var _cod: BTH_COD; _service: BTH_COD);
+begin
+  _cod := (_cod and not COD_SERVICE_MASK) or (_service shl COD_SERVICE_BIT_OFFSET);
+end;
+
+end.

+ 192 - 0
packages/extra/winunits/jwabthsdpdef.pas

@@ -0,0 +1,192 @@
+{******************************************************************************}
+{                                                                              }
+{ BlueTooth API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributors: John Penman                                                    }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JWaBthSdpDef;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bthsdpdef.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+type
+  SDP_LARGE_INTEGER_16 = record
+    LowPart: Int64;
+    HighPart: Int64;
+  end;
+  {$EXTERNALSYM SDP_LARGE_INTEGER_16}
+  PSDP_LARGE_INTEGER_16 = ^SDP_LARGE_INTEGER_16;
+  {$EXTERNALSYM PSDP_LARGE_INTEGER_16}
+  LPSDP_LARGE_INTEGER_16 = PSDP_LARGE_INTEGER_16;
+  {$EXTERNALSYM LPSDP_LARGE_INTEGER_16}
+  TSdpLargeInteger = SDP_LARGE_INTEGER_16;
+  PSdpLargeInteger = PSDP_LARGE_INTEGER_16;
+
+  SDP_ULARGE_INTEGER_16 = record
+    LowPart: Int64;
+    HighPart: Int64;
+  end;
+  {$EXTERNALSYM SDP_ULARGE_INTEGER_16}
+  PSDP_ULARGE_INTEGER_16 = ^SDP_ULARGE_INTEGER_16;
+  {$EXTERNALSYM PSDP_ULARGE_INTEGER_16}
+  LPSDP_ULARGE_INTEGER_16 = PSDP_ULARGE_INTEGER_16;
+  {$EXTERNALSYM LPSDP_ULARGE_INTEGER_16}
+  TSdpULargeInteger16 = SDP_ULARGE_INTEGER_16;
+  PSdpULargeInteger16 = PSDP_ULARGE_INTEGER_16;
+
+  NodeContainerType = (NodeContainerTypeSequence, NodeContainerTypeAlternative);
+  TNodeContainerType = NodeContainerType;
+
+  SDP_ERROR = Word;
+  {$EXTERNALSYM SDP_ERROR}
+  PSDP_ERROR = ^SDP_ERROR;
+  {$EXTERNALSYM PSDP_ERROR}
+  TSdpError = SDP_ERROR;
+  PSdpError = PSDP_ERROR;
+
+type
+  SDP_TYPE = DWORD;
+  {$EXTERNALSYM SDP_TYPE}
+  TSdpType = SDP_TYPE;
+
+const
+  SDP_TYPE_NIL = $00;
+  {$EXTERNALSYM SDP_TYPE_NIL}
+  SDP_TYPE_UINT = $01;
+  {$EXTERNALSYM SDP_TYPE_UINT}
+  SDP_TYPE_INT = $02;
+  {$EXTERNALSYM SDP_TYPE_INT}
+  SDP_TYPE_UUID = $03;
+  {$EXTERNALSYM SDP_TYPE_UUID}
+  SDP_TYPE_STRING = $04;
+  {$EXTERNALSYM SDP_TYPE_STRING}
+  SDP_TYPE_BOOLEAN = $05;
+  {$EXTERNALSYM SDP_TYPE_BOOLEAN}
+  SDP_TYPE_SEQUENCE = $06;
+  {$EXTERNALSYM SDP_TYPE_SEQUENCE}
+  SDP_TYPE_ALTERNATIVE = $07;
+  {$EXTERNALSYM SDP_TYPE_ALTERNATIVE}
+  SDP_TYPE_URL = $08;
+  {$EXTERNALSYM SDP_TYPE_URL}
+  // 9 - 31 are reserved
+  SDP_TYPE_CONTAINER = $20;
+  {$EXTERNALSYM SDP_TYPE_CONTAINER}
+
+// allow for a little easier type checking / sizing for integers and UUIDs
+// ((SDP_ST_XXX & 0xF0) >> 4) == SDP_TYPE_XXX
+// size of the data (in bytes) is encoded as ((SDP_ST_XXX & 0xF0) >> 8)
+
+type
+  SDP_SPECIFICTYPE = DWORD;
+  {$EXTERNALSYM SDP_SPECIFICTYPE}
+  TSdpSpecificType = SDP_SPECIFICTYPE;
+
+const
+  SDP_ST_NONE = $0000;
+  {$EXTERNALSYM SDP_ST_NONE}
+
+  SDP_ST_UINT8 = $0010;
+  {$EXTERNALSYM SDP_ST_UINT8}
+  SDP_ST_UINT16 = $0110;
+  {$EXTERNALSYM SDP_ST_UINT16}
+  SDP_ST_UINT32 = $0210;
+  {$EXTERNALSYM SDP_ST_UINT32}
+  SDP_ST_UINT64 = $0310;
+  {$EXTERNALSYM SDP_ST_UINT64}
+  SDP_ST_UINT128 = $0410;
+  {$EXTERNALSYM SDP_ST_UINT128}
+
+  SDP_ST_INT8 = $0020;
+  {$EXTERNALSYM SDP_ST_INT8}
+  SDP_ST_INT16 = $0120;
+  {$EXTERNALSYM SDP_ST_INT16}
+  SDP_ST_INT32 = $0220;
+  {$EXTERNALSYM SDP_ST_INT32}
+  SDP_ST_INT64 = $0320;
+  {$EXTERNALSYM SDP_ST_INT64}
+  SDP_ST_INT128 = $0420;
+  {$EXTERNALSYM SDP_ST_INT128}
+
+  SDP_ST_UUID16 = $0130;
+  {$EXTERNALSYM SDP_ST_UUID16}
+  SDP_ST_UUID32 = $0220;
+  {$EXTERNALSYM SDP_ST_UUID32}
+  SDP_ST_UUID128 = $0430;
+  {$EXTERNALSYM SDP_ST_UUID128}
+
+type
+  _SdpAttributeRange = record
+    minAttribute: Word;
+    maxAttribute: Word;
+  end;
+  {$EXTERNALSYM _SdpAttributeRange}
+  SdpAttributeRange = _SdpAttributeRange;
+  {$EXTERNALSYM SdpAttributeRange}
+  TSdpAttributeRange = SdpAttributeRange;
+
+  SdpQueryUuidUnion = record
+    case Integer of
+      0: (uuid128: TGUID);
+      1: (uuid32: ULONG);
+      2: (uuid16: Word);
+  end;
+  TSdpQueryUuidUnion = SdpQueryUuidUnion;
+
+  _SdpQueryUuid = record
+    u: SdpQueryUuidUnion;
+    uuidType: Word;
+  end;
+  {$EXTERNALSYM _SdpQueryUuid}
+  SdpQueryUuid = _SdpQueryUuid;
+  {$EXTERNALSYM SdpQueryUuid}
+  TSdpQueryUuid = SdpQueryUuid;
+
+implementation
+
+end.

+ 2856 - 0
packages/extra/winunits/jwabugcodes.pas

@@ -0,0 +1,2856 @@
+{******************************************************************************}
+{                                                                              }
+{ NT Bug Codes API interface Unit for Object Pascal                            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: bugcodes.h, released June 2000. The original Pascal    }
+{ code is: BugCodes.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaBugCodes;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "bugcodes.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+{$I jediapilib.inc}
+
+//
+//  Values are 32 bit values layed out as follows:
+//
+//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+//  +---+-+-+-----------------------+-------------------------------+
+//  |Sev|C|R|     Facility          |               Code            |
+//  +---+-+-+-----------------------+-------------------------------+
+//
+//  where
+//
+//      Sev - is the severity code
+//
+//          00 - Success
+//          01 - Informational
+//          10 - Warning
+//          11 - Error
+//
+//      C - is the Customer code flag
+//
+//      R - is a reserved bit
+//
+//      Facility - is the facility code
+//
+//      Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+//
+// Define the severity codes
+//
+
+const
+
+//
+// MessageId: APC_INDEX_MISMATCH
+//
+// MessageText:
+//
+//  APC_INDEX_MISMATCH
+//
+
+  APC_INDEX_MISMATCH = ULONG($00000001);
+  {$EXTERNALSYM APC_INDEX_MISMATCH}
+
+//
+// MessageId: DEVICE_QUEUE_NOT_BUSY
+//
+// MessageText:
+//
+//  DEVICE_QUEUE_NOT_BUSY
+//
+
+  DEVICE_QUEUE_NOT_BUSY = ULONG($00000002);
+  {$EXTERNALSYM DEVICE_QUEUE_NOT_BUSY}
+
+//
+// MessageId: INVALID_AFFINITY_SET
+//
+// MessageText:
+//
+//  INVALID_AFFINITY_SET
+//
+
+  INVALID_AFFINITY_SET = ULONG($00000003);
+  {$EXTERNALSYM INVALID_AFFINITY_SET}
+
+//
+// MessageId: INVALID_DATA_ACCESS_TRAP
+//
+// MessageText:
+//
+//  INVALID_DATA_ACCESS_TRAP
+//
+
+  INVALID_DATA_ACCESS_TRAP = ULONG($00000004);
+  {$EXTERNALSYM INVALID_DATA_ACCESS_TRAP}
+
+//
+// MessageId: INVALID_PROCESS_ATTACH_ATTEMPT
+//
+// MessageText:
+//
+//  INVALID_PROCESS_ATTACH_ATTEMPT
+//
+
+  INVALID_PROCESS_ATTACH_ATTEMPT = ULONG($00000005);
+  {$EXTERNALSYM INVALID_PROCESS_ATTACH_ATTEMPT}
+
+//
+// MessageId: INVALID_PROCESS_DETACH_ATTEMPT
+//
+// MessageText:
+//
+//  INVALID_PROCESS_DETACH_ATTEMPT
+//
+
+  INVALID_PROCESS_DETACH_ATTEMPT = ULONG($00000006);
+  {$EXTERNALSYM INVALID_PROCESS_DETACH_ATTEMPT}
+
+//
+// MessageId: INVALID_SOFTWARE_INTERRUPT
+//
+// MessageText:
+//
+//  INVALID_SOFTWARE_INTERRUPT
+//
+
+  INVALID_SOFTWARE_INTERRUPT = ULONG($00000007);
+  {$EXTERNALSYM INVALID_SOFTWARE_INTERRUPT}
+
+//
+// MessageId: IRQL_NOT_DISPATCH_LEVEL
+//
+// MessageText:
+//
+//  IRQL_NOT_DISPATCH_LEVEL
+//
+
+  IRQL_NOT_DISPATCH_LEVEL = ULONG($00000008);
+  {$EXTERNALSYM IRQL_NOT_DISPATCH_LEVEL}
+
+//
+// MessageId: IRQL_NOT_GREATER_OR_EQUAL
+//
+// MessageText:
+//
+//  IRQL_NOT_GREATER_OR_EQUAL
+//
+
+  IRQL_NOT_GREATER_OR_EQUAL = ULONG($00000009);
+  {$EXTERNALSYM IRQL_NOT_GREATER_OR_EQUAL}
+
+//
+// MessageId: IRQL_NOT_LESS_OR_EQUAL
+//
+// MessageText:
+//
+//  IRQL_NOT_LESS_OR_EQUAL
+//
+
+  IRQL_NOT_LESS_OR_EQUAL = ULONG($0000000A);
+  {$EXTERNALSYM IRQL_NOT_LESS_OR_EQUAL}
+
+//
+// MessageId: NO_EXCEPTION_HANDLING_SUPPORT
+//
+// MessageText:
+//
+//  NO_EXCEPTION_HANDLING_SUPPORT
+//
+
+  NO_EXCEPTION_HANDLING_SUPPORT = ULONG($0000000B);
+  {$EXTERNALSYM NO_EXCEPTION_HANDLING_SUPPORT}
+
+//
+// MessageId: MAXIMUM_WAIT_OBJECTS_EXCEEDED
+//
+// MessageText:
+//
+//  MAXIMUM_WAIT_OBJECTS_EXCEEDED
+//
+
+  MAXIMUM_WAIT_OBJECTS_EXCEEDED = ULONG($0000000C);
+  {$EXTERNALSYM MAXIMUM_WAIT_OBJECTS_EXCEEDED}
+
+//
+// MessageId: MUTEX_LEVEL_NUMBER_VIOLATION
+//
+// MessageText:
+//
+//  MUTEX_LEVEL_NUMBER_VIOLATION
+//
+
+  MUTEX_LEVEL_NUMBER_VIOLATION = ULONG($0000000D);
+  {$EXTERNALSYM MUTEX_LEVEL_NUMBER_VIOLATION}
+
+//
+// MessageId: NO_USER_MODE_CONTEXT
+//
+// MessageText:
+//
+//  NO_USER_MODE_CONTEXT
+//
+
+  NO_USER_MODE_CONTEXT = ULONG($0000000E);
+  {$EXTERNALSYM NO_USER_MODE_CONTEXT}
+
+//
+// MessageId: SPIN_LOCK_ALREADY_OWNED
+//
+// MessageText:
+//
+//  SPIN_LOCK_ALREADY_OWNED
+//
+
+  SPIN_LOCK_ALREADY_OWNED = ULONG($0000000F);
+  {$EXTERNALSYM SPIN_LOCK_ALREADY_OWNED}
+
+//
+// MessageId: SPIN_LOCK_NOT_OWNED
+//
+// MessageText:
+//
+//  SPIN_LOCK_NOT_OWNED
+//
+
+  SPIN_LOCK_NOT_OWNED = ULONG($00000010);
+  {$EXTERNALSYM SPIN_LOCK_NOT_OWNED}
+
+//
+// MessageId: THREAD_NOT_MUTEX_OWNER
+//
+// MessageText:
+//
+//  THREAD_NOT_MUTEX_OWNER
+//
+
+  THREAD_NOT_MUTEX_OWNER = ULONG($00000011);
+  {$EXTERNALSYM THREAD_NOT_MUTEX_OWNER}
+
+//
+// MessageId: TRAP_CAUSE_UNKNOWN
+//
+// MessageText:
+//
+//  TRAP_CAUSE_UNKNOWN
+//
+
+  TRAP_CAUSE_UNKNOWN = ULONG($00000012);
+  {$EXTERNALSYM TRAP_CAUSE_UNKNOWN}
+
+//
+// MessageId: EMPTY_THREAD_REAPER_LIST
+//
+// MessageText:
+//
+//  EMPTY_THREAD_REAPER_LIST
+//
+
+  EMPTY_THREAD_REAPER_LIST = ULONG($00000013);
+  {$EXTERNALSYM EMPTY_THREAD_REAPER_LIST}
+
+//
+// MessageId: CREATE_DELETE_LOCK_NOT_LOCKED
+//
+// MessageText:
+//
+//  CREATE_DELETE_LOCK_NOT_LOCKED
+//
+
+  CREATE_DELETE_LOCK_NOT_LOCKED = ULONG($00000014);
+  {$EXTERNALSYM CREATE_DELETE_LOCK_NOT_LOCKED}
+
+//
+// MessageId: LAST_CHANCE_CALLED_FROM_KMODE
+//
+// MessageText:
+//
+//  LAST_CHANCE_CALLED_FROM_KMODE
+//
+
+  LAST_CHANCE_CALLED_FROM_KMODE = ULONG($00000015);
+  {$EXTERNALSYM LAST_CHANCE_CALLED_FROM_KMODE}
+
+//
+// MessageId: CID_HANDLE_CREATION
+//
+// MessageText:
+//
+//  CID_HANDLE_CREATION
+//
+
+  CID_HANDLE_CREATION = ULONG($00000016);
+  {$EXTERNALSYM CID_HANDLE_CREATION}
+
+//
+// MessageId: CID_HANDLE_DELETION
+//
+// MessageText:
+//
+//  CID_HANDLE_DELETION
+//
+
+  CID_HANDLE_DELETION = ULONG($00000017);
+  {$EXTERNALSYM CID_HANDLE_DELETION}
+
+//
+// MessageId: REFERENCE_BY_POINTER
+//
+// MessageText:
+//
+//  REFERENCE_BY_POINTER
+//
+
+  REFERENCE_BY_POINTER = ULONG($00000018);
+  {$EXTERNALSYM REFERENCE_BY_POINTER}
+
+//
+// MessageId: BAD_POOL_HEADER
+//
+// MessageText:
+//
+//  BAD_POOL_HEADER
+//
+
+  BAD_POOL_HEADER = ULONG($00000019);
+  {$EXTERNALSYM BAD_POOL_HEADER}
+
+//
+// MessageId: MEMORY_MANAGEMENT
+//
+// MessageText:
+//
+//  MEMORY_MANAGEMENT
+//
+
+  MEMORY_MANAGEMENT = ULONG($0000001A);
+  {$EXTERNALSYM MEMORY_MANAGEMENT}
+
+//
+// MessageId: PFN_SHARE_COUNT
+//
+// MessageText:
+//
+//  PFN_SHARE_COUNT
+//
+
+  PFN_SHARE_COUNT = ULONG($0000001B);
+  {$EXTERNALSYM PFN_SHARE_COUNT}
+
+//
+// MessageId: PFN_REFERENCE_COUNT
+//
+// MessageText:
+//
+//  PFN_REFERENCE_COUNT
+//
+
+  PFN_REFERENCE_COUNT = ULONG($0000001C);
+  {$EXTERNALSYM PFN_REFERENCE_COUNT}
+
+//
+// MessageId: NO_SPIN_LOCK_AVAILABLE
+//
+// MessageText:
+//
+//  NO_SPIN_LOCK_AVAILABLE
+//
+
+  NO_SPIN_LOCK_AVAILABLE = ULONG($0000001D);
+  {$EXTERNALSYM NO_SPIN_LOCK_AVAILABLE}
+
+//
+// MessageId: KMODE_EXCEPTION_NOT_HANDLED
+//
+// MessageText:
+//
+//  KMODE_EXCEPTION_NOT_HANDLED
+//
+
+  KMODE_EXCEPTION_NOT_HANDLED = ULONG($0000001E);
+  {$EXTERNALSYM KMODE_EXCEPTION_NOT_HANDLED}
+
+//
+// MessageId: SHARED_RESOURCE_CONV_ERROR
+//
+// MessageText:
+//
+//  SHARED_RESOURCE_CONV_ERROR
+//
+
+  SHARED_RESOURCE_CONV_ERROR = ULONG($0000001F);
+  {$EXTERNALSYM SHARED_RESOURCE_CONV_ERROR}
+
+//
+// MessageId: KERNEL_APC_PENDING_DURING_EXIT
+//
+// MessageText:
+//
+//  KERNEL_APC_PENDING_DURING_EXIT
+//
+
+  KERNEL_APC_PENDING_DURING_EXIT = ULONG($00000020);
+  {$EXTERNALSYM KERNEL_APC_PENDING_DURING_EXIT}
+
+//
+// MessageId: QUOTA_UNDERFLOW
+//
+// MessageText:
+//
+//  QUOTA_UNDERFLOW
+//
+
+  QUOTA_UNDERFLOW = ULONG($00000021);
+  {$EXTERNALSYM QUOTA_UNDERFLOW}
+
+//
+// MessageId: FILE_SYSTEM
+//
+// MessageText:
+//
+//  FILE_SYSTEM
+//
+
+  FILE_SYSTEM = ULONG($00000022);
+  {$EXTERNALSYM FILE_SYSTEM}
+
+//
+// MessageId: FAT_FILE_SYSTEM
+//
+// MessageText:
+//
+//  FAT_FILE_SYSTEM
+//
+
+  FAT_FILE_SYSTEM = ULONG($00000023);
+  {$EXTERNALSYM FAT_FILE_SYSTEM}
+
+//
+// MessageId: NTFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  NTFS_FILE_SYSTEM
+//
+
+  NTFS_FILE_SYSTEM = ULONG($00000024);
+  {$EXTERNALSYM NTFS_FILE_SYSTEM}
+
+//
+// MessageId: NPFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  NPFS_FILE_SYSTEM
+//
+
+  NPFS_FILE_SYSTEM = ULONG($00000025);
+  {$EXTERNALSYM NPFS_FILE_SYSTEM}
+
+//
+// MessageId: CDFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  CDFS_FILE_SYSTEM
+//
+
+  CDFS_FILE_SYSTEM = ULONG($00000026);
+  {$EXTERNALSYM CDFS_FILE_SYSTEM}
+
+//
+// MessageId: RDR_FILE_SYSTEM
+//
+// MessageText:
+//
+//  RDR_FILE_SYSTEM
+//
+
+  RDR_FILE_SYSTEM = ULONG($00000027);
+  {$EXTERNALSYM RDR_FILE_SYSTEM}
+
+//
+// MessageId: CORRUPT_ACCESS_TOKEN
+//
+// MessageText:
+//
+//  CORRUPT_ACCESS_TOKEN
+//
+
+  CORRUPT_ACCESS_TOKEN = ULONG($00000028);
+  {$EXTERNALSYM CORRUPT_ACCESS_TOKEN}
+
+//
+// MessageId: SECURITY_SYSTEM
+//
+// MessageText:
+//
+//  SECURITY_SYSTEM
+//
+
+  SECURITY_SYSTEM = ULONG($00000029);
+  {$EXTERNALSYM SECURITY_SYSTEM}
+
+//
+// MessageId: INCONSISTENT_IRP
+//
+// MessageText:
+//
+//  INCONSISTENT_IRP
+//
+
+  INCONSISTENT_IRP = ULONG($0000002A);
+  {$EXTERNALSYM INCONSISTENT_IRP}
+
+//
+// MessageId: PANIC_STACK_SWITCH
+//
+// MessageText:
+//
+//  PANIC_STACK_SWITCH
+//
+
+  PANIC_STACK_SWITCH = ULONG($0000002B);
+  {$EXTERNALSYM PANIC_STACK_SWITCH}
+
+//
+// MessageId: PORT_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  PORT_DRIVER_INTERNAL
+//
+
+  PORT_DRIVER_INTERNAL = ULONG($0000002C);
+  {$EXTERNALSYM PORT_DRIVER_INTERNAL}
+
+//
+// MessageId: SCSI_DISK_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  SCSI_DISK_DRIVER_INTERNAL
+//
+
+  SCSI_DISK_DRIVER_INTERNAL = ULONG($0000002D);
+  {$EXTERNALSYM SCSI_DISK_DRIVER_INTERNAL}
+
+//
+// MessageId: DATA_BUS_ERROR
+//
+// MessageText:
+//
+//  DATA_BUS_ERROR
+//
+
+  DATA_BUS_ERROR = ULONG($0000002E);
+  {$EXTERNALSYM DATA_BUS_ERROR}
+
+//
+// MessageId: INSTRUCTION_BUS_ERROR
+//
+// MessageText:
+//
+//  INSTRUCTION_BUS_ERROR
+//
+
+  INSTRUCTION_BUS_ERROR = ULONG($0000002F);
+  {$EXTERNALSYM INSTRUCTION_BUS_ERROR}
+
+//
+// MessageId: SET_OF_INVALID_CONTEXT
+//
+// MessageText:
+//
+//  SET_OF_INVALID_CONTEXT
+//
+
+  SET_OF_INVALID_CONTEXT = ULONG($00000030);
+  {$EXTERNALSYM SET_OF_INVALID_CONTEXT}
+
+//
+// MessageId: PHASE0_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PHASE0_INITIALIZATION_FAILED
+//
+
+  PHASE0_INITIALIZATION_FAILED = ULONG($00000031);
+  {$EXTERNALSYM PHASE0_INITIALIZATION_FAILED}
+
+//
+// MessageId: PHASE1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PHASE1_INITIALIZATION_FAILED
+//
+
+  PHASE1_INITIALIZATION_FAILED = ULONG($00000032);
+  {$EXTERNALSYM PHASE1_INITIALIZATION_FAILED}
+
+//
+// MessageId: UNEXPECTED_INITIALIZATION_CALL
+//
+// MessageText:
+//
+//  UNEXPECTED_INITIALIZATION_CALL
+//
+
+  UNEXPECTED_INITIALIZATION_CALL = ULONG($00000033);
+  {$EXTERNALSYM UNEXPECTED_INITIALIZATION_CALL}
+
+//
+// MessageId: CACHE_MANAGER
+//
+// MessageText:
+//
+//  CACHE_MANAGER
+//
+
+  CACHE_MANAGER = ULONG($00000034);
+  {$EXTERNALSYM CACHE_MANAGER}
+
+//
+// MessageId: NO_MORE_IRP_STACK_LOCATIONS
+//
+// MessageText:
+//
+//  NO_MORE_IRP_STACK_LOCATIONS
+//
+
+  NO_MORE_IRP_STACK_LOCATIONS = ULONG($00000035);
+  {$EXTERNALSYM NO_MORE_IRP_STACK_LOCATIONS}
+
+//
+// MessageId: DEVICE_REFERENCE_COUNT_NOT_ZERO
+//
+// MessageText:
+//
+//  DEVICE_REFERENCE_COUNT_NOT_ZERO
+//
+
+  DEVICE_REFERENCE_COUNT_NOT_ZERO = ULONG($00000036);
+  {$EXTERNALSYM DEVICE_REFERENCE_COUNT_NOT_ZERO}
+
+//
+// MessageId: FLOPPY_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  FLOPPY_INTERNAL_ERROR
+//
+
+  FLOPPY_INTERNAL_ERROR = ULONG($00000037);
+  {$EXTERNALSYM FLOPPY_INTERNAL_ERROR}
+
+//
+// MessageId: SERIAL_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  SERIAL_DRIVER_INTERNAL
+//
+
+  SERIAL_DRIVER_INTERNAL = ULONG($00000038);
+  {$EXTERNALSYM SERIAL_DRIVER_INTERNAL}
+
+//
+// MessageId: SYSTEM_EXIT_OWNED_MUTEX
+//
+// MessageText:
+//
+//  SYSTEM_EXIT_OWNED_MUTEX
+//
+
+  SYSTEM_EXIT_OWNED_MUTEX = ULONG($00000039);
+  {$EXTERNALSYM SYSTEM_EXIT_OWNED_MUTEX}
+
+//
+// MessageId: SYSTEM_UNWIND_PREVIOUS_USER
+//
+// MessageText:
+//
+//  SYSTEM_UNWIND_PREVIOUS_USER
+//
+
+  SYSTEM_UNWIND_PREVIOUS_USER = ULONG($0000003A);
+  {$EXTERNALSYM SYSTEM_UNWIND_PREVIOUS_USER}
+
+//
+// MessageId: SYSTEM_SERVICE_EXCEPTION
+//
+// MessageText:
+//
+//  SYSTEM_SERVICE_EXCEPTION
+//
+
+  SYSTEM_SERVICE_EXCEPTION = ULONG($0000003B);
+  {$EXTERNALSYM SYSTEM_SERVICE_EXCEPTION}
+
+//
+// MessageId: INTERRUPT_UNWIND_ATTEMPTED
+//
+// MessageText:
+//
+//  INTERRUPT_UNWIND_ATTEMPTED
+//
+
+  INTERRUPT_UNWIND_ATTEMPTED = ULONG($0000003C);
+  {$EXTERNALSYM INTERRUPT_UNWIND_ATTEMPTED}
+
+//
+// MessageId: INTERRUPT_EXCEPTION_NOT_HANDLED
+//
+// MessageText:
+//
+//  INTERRUPT_EXCEPTION_NOT_HANDLED
+//
+
+  INTERRUPT_EXCEPTION_NOT_HANDLED = ULONG($0000003D);
+  {$EXTERNALSYM INTERRUPT_EXCEPTION_NOT_HANDLED}
+
+//
+// MessageId: MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED
+//
+// MessageText:
+//
+//  MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED
+//
+
+  MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED = ULONG($0000003E);
+  {$EXTERNALSYM MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED}
+
+//
+// MessageId: NO_MORE_SYSTEM_PTES
+//
+// MessageText:
+//
+//  NO_MORE_SYSTEM_PTES
+//
+
+  NO_MORE_SYSTEM_PTES = ULONG($0000003F);
+  {$EXTERNALSYM NO_MORE_SYSTEM_PTES}
+
+//
+// MessageId: TARGET_MDL_TOO_SMALL
+//
+// MessageText:
+//
+//  TARGET_MDL_TOO_SMALL
+//
+
+  TARGET_MDL_TOO_SMALL = ULONG($00000040);
+  {$EXTERNALSYM TARGET_MDL_TOO_SMALL}
+
+//
+// MessageId: MUST_SUCCEED_POOL_EMPTY
+//
+// MessageText:
+//
+//  MUST_SUCCEED_POOL_EMPTY
+//
+
+  MUST_SUCCEED_POOL_EMPTY = ULONG($00000041);
+  {$EXTERNALSYM MUST_SUCCEED_POOL_EMPTY}
+
+//
+// MessageId: ATDISK_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  ATDISK_DRIVER_INTERNAL
+//
+
+  ATDISK_DRIVER_INTERNAL = ULONG($00000042);
+  {$EXTERNALSYM ATDISK_DRIVER_INTERNAL}
+
+//
+// MessageId: NO_SUCH_PARTITION
+//
+// MessageText:
+//
+//  NO_SUCH_PARTITION
+//
+
+  NO_SUCH_PARTITION = ULONG($00000043);
+  {$EXTERNALSYM NO_SUCH_PARTITION}
+
+//
+// MessageId: MULTIPLE_IRP_COMPLETE_REQUESTS
+//
+// MessageText:
+//
+//  MULTIPLE_IRP_COMPLETE_REQUESTS
+//
+
+  MULTIPLE_IRP_COMPLETE_REQUESTS = ULONG($00000044);
+  {$EXTERNALSYM MULTIPLE_IRP_COMPLETE_REQUESTS}
+
+//
+// MessageId: INSUFFICIENT_SYSTEM_MAP_REGS
+//
+// MessageText:
+//
+//  INSUFFICIENT_SYSTEM_MAP_REGS
+//
+
+  INSUFFICIENT_SYSTEM_MAP_REGS = ULONG($00000045);
+  {$EXTERNALSYM INSUFFICIENT_SYSTEM_MAP_REGS}
+
+//
+// MessageId: DEREF_UNKNOWN_LOGON_SESSION
+//
+// MessageText:
+//
+//  DEREF_UNKNOWN_LOGON_SESSION
+//
+
+  DEREF_UNKNOWN_LOGON_SESSION = ULONG($00000046);
+  {$EXTERNALSYM DEREF_UNKNOWN_LOGON_SESSION}
+
+//
+// MessageId: REF_UNKNOWN_LOGON_SESSION
+//
+// MessageText:
+//
+//  REF_UNKNOWN_LOGON_SESSION
+//
+
+  REF_UNKNOWN_LOGON_SESSION = ULONG($00000047);
+  {$EXTERNALSYM REF_UNKNOWN_LOGON_SESSION}
+
+//
+// MessageId: CANCEL_STATE_IN_COMPLETED_IRP
+//
+// MessageText:
+//
+//  CANCEL_STATE_IN_COMPLETED_IRP
+//
+
+  CANCEL_STATE_IN_COMPLETED_IRP = ULONG($00000048);
+  {$EXTERNALSYM CANCEL_STATE_IN_COMPLETED_IRP}
+
+//
+// MessageId: PAGE_FAULT_WITH_INTERRUPTS_OFF
+//
+// MessageText:
+//
+//  PAGE_FAULT_WITH_INTERRUPTS_OFF
+//
+
+  PAGE_FAULT_WITH_INTERRUPTS_OFF = ULONG($00000049);
+  {$EXTERNALSYM PAGE_FAULT_WITH_INTERRUPTS_OFF}
+
+//
+// MessageId: IRQL_GT_ZERO_AT_SYSTEM_SERVICE
+//
+// MessageText:
+//
+//  IRQL_GT_ZERO_AT_SYSTEM_SERVICE
+//
+
+  IRQL_GT_ZERO_AT_SYSTEM_SERVICE = ULONG($0000004A);
+  {$EXTERNALSYM IRQL_GT_ZERO_AT_SYSTEM_SERVICE}
+
+//
+// MessageId: STREAMS_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  STREAMS_INTERNAL_ERROR
+//
+
+  STREAMS_INTERNAL_ERROR = ULONG($0000004B);
+  {$EXTERNALSYM STREAMS_INTERNAL_ERROR}
+
+//
+// MessageId: FATAL_UNHANDLED_HARD_ERROR
+//
+// MessageText:
+//
+//  FATAL_UNHANDLED_HARD_ERROR
+//
+
+  FATAL_UNHANDLED_HARD_ERROR = ULONG($0000004C);
+  {$EXTERNALSYM FATAL_UNHANDLED_HARD_ERROR}
+
+//
+// MessageId: NO_PAGES_AVAILABLE
+//
+// MessageText:
+//
+//  NO_PAGES_AVAILABLE
+//
+
+  NO_PAGES_AVAILABLE = ULONG($0000004D);
+  {$EXTERNALSYM NO_PAGES_AVAILABLE}
+
+//
+// MessageId: PFN_LIST_CORRUPT
+//
+// MessageText:
+//
+//  PFN_LIST_CORRUPT
+//
+
+  PFN_LIST_CORRUPT = ULONG($0000004E);
+  {$EXTERNALSYM PFN_LIST_CORRUPT}
+
+//
+// MessageId: NDIS_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  NDIS_INTERNAL_ERROR
+//
+
+  NDIS_INTERNAL_ERROR = ULONG($0000004F);
+  {$EXTERNALSYM NDIS_INTERNAL_ERROR}
+
+//
+// MessageId: PAGE_FAULT_IN_NONPAGED_AREA
+//
+// MessageText:
+//
+//  PAGE_FAULT_IN_NONPAGED_AREA
+//
+
+  PAGE_FAULT_IN_NONPAGED_AREA = ULONG($00000050);
+  {$EXTERNALSYM PAGE_FAULT_IN_NONPAGED_AREA}
+
+//
+// MessageId: REGISTRY_ERROR
+//
+// MessageText:
+//
+//  REGISTRY_ERROR
+//
+
+  REGISTRY_ERROR = ULONG($00000051);
+  {$EXTERNALSYM REGISTRY_ERROR}
+
+//
+// MessageId: MAILSLOT_FILE_SYSTEM
+//
+// MessageText:
+//
+//  MAILSLOT_FILE_SYSTEM
+//
+
+  MAILSLOT_FILE_SYSTEM = ULONG($00000052);
+  {$EXTERNALSYM MAILSLOT_FILE_SYSTEM}
+
+//
+// MessageId: NO_BOOT_DEVICE
+//
+// MessageText:
+//
+//  NO_BOOT_DEVICE
+//
+
+  NO_BOOT_DEVICE = ULONG($00000053);
+  {$EXTERNALSYM NO_BOOT_DEVICE}
+
+//
+// MessageId: LM_SERVER_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  LM_SERVER_INTERNAL_ERROR
+//
+
+  LM_SERVER_INTERNAL_ERROR = ULONG($00000054);
+  {$EXTERNALSYM LM_SERVER_INTERNAL_ERROR}
+
+//
+// MessageId: DATA_COHERENCY_EXCEPTION
+//
+// MessageText:
+//
+//  DATA_COHERENCY_EXCEPTION
+//
+
+  DATA_COHERENCY_EXCEPTION = ULONG($00000055);
+  {$EXTERNALSYM DATA_COHERENCY_EXCEPTION}
+
+//
+// MessageId: INSTRUCTION_COHERENCY_EXCEPTION
+//
+// MessageText:
+//
+//  INSTRUCTION_COHERENCY_EXCEPTION
+//
+
+  INSTRUCTION_COHERENCY_EXCEPTION = ULONG($00000056);
+  {$EXTERNALSYM INSTRUCTION_COHERENCY_EXCEPTION}
+
+//
+// MessageId: XNS_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  XNS_INTERNAL_ERROR
+//
+
+  XNS_INTERNAL_ERROR = ULONG($00000057);
+  {$EXTERNALSYM XNS_INTERNAL_ERROR}
+
+//
+// MessageId: FTDISK_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  FTDISK_INTERNAL_ERROR
+//
+
+  FTDISK_INTERNAL_ERROR = ULONG($00000058);
+  {$EXTERNALSYM FTDISK_INTERNAL_ERROR}
+
+//
+// MessageId: PINBALL_FILE_SYSTEM
+//
+// MessageText:
+//
+//  PINBALL_FILE_SYSTEM
+//
+
+  PINBALL_FILE_SYSTEM = ULONG($00000059);
+  {$EXTERNALSYM PINBALL_FILE_SYSTEM}
+
+//
+// MessageId: CRITICAL_SERVICE_FAILED
+//
+// MessageText:
+//
+//  CRITICAL_SERVICE_FAILED
+//
+
+  CRITICAL_SERVICE_FAILED = ULONG($0000005A);
+  {$EXTERNALSYM CRITICAL_SERVICE_FAILED}
+
+//
+// MessageId: SET_ENV_VAR_FAILED
+//
+// MessageText:
+//
+//  SET_ENV_VAR_FAILED
+//
+
+  SET_ENV_VAR_FAILED = ULONG($0000005B);
+  {$EXTERNALSYM SET_ENV_VAR_FAILED}
+
+//
+// MessageId: HAL_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  HAL_INITIALIZATION_FAILED
+//
+
+  HAL_INITIALIZATION_FAILED = ULONG($0000005C);
+  {$EXTERNALSYM HAL_INITIALIZATION_FAILED}
+
+//
+// MessageId: UNSUPPORTED_PROCESSOR
+//
+// MessageText:
+//
+//  UNSUPPORTED_PROCESSOR
+//
+
+  UNSUPPORTED_PROCESSOR = ULONG($0000005D);
+  {$EXTERNALSYM UNSUPPORTED_PROCESSOR}
+
+//
+// MessageId: OBJECT_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  OBJECT_INITIALIZATION_FAILED
+//
+
+  OBJECT_INITIALIZATION_FAILED = ULONG($0000005E);
+  {$EXTERNALSYM OBJECT_INITIALIZATION_FAILED}
+
+//
+// MessageId: SECURITY_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SECURITY_INITIALIZATION_FAILED
+//
+
+  SECURITY_INITIALIZATION_FAILED = ULONG($0000005F);
+  {$EXTERNALSYM SECURITY_INITIALIZATION_FAILED}
+
+//
+// MessageId: PROCESS_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PROCESS_INITIALIZATION_FAILED
+//
+
+  PROCESS_INITIALIZATION_FAILED = ULONG($00000060);
+  {$EXTERNALSYM PROCESS_INITIALIZATION_FAILED}
+
+//
+// MessageId: HAL1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  HAL1_INITIALIZATION_FAILED
+//
+
+  HAL1_INITIALIZATION_FAILED = ULONG($00000061);
+  {$EXTERNALSYM HAL1_INITIALIZATION_FAILED}
+
+//
+// MessageId: OBJECT1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  OBJECT1_INITIALIZATION_FAILED
+//
+
+  OBJECT1_INITIALIZATION_FAILED = ULONG($00000062);
+  {$EXTERNALSYM OBJECT1_INITIALIZATION_FAILED}
+
+//
+// MessageId: SECURITY1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SECURITY1_INITIALIZATION_FAILED
+//
+
+  SECURITY1_INITIALIZATION_FAILED = ULONG($00000063);
+  {$EXTERNALSYM SECURITY1_INITIALIZATION_FAILED}
+
+//
+// MessageId: SYMBOLIC_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SYMBOLIC_INITIALIZATION_FAILED
+//
+
+  SYMBOLIC_INITIALIZATION_FAILED = ULONG($00000064);
+  {$EXTERNALSYM SYMBOLIC_INITIALIZATION_FAILED}
+
+//
+// MessageId: MEMORY1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  MEMORY1_INITIALIZATION_FAILED
+//
+
+  MEMORY1_INITIALIZATION_FAILED = ULONG($00000065);
+  {$EXTERNALSYM MEMORY1_INITIALIZATION_FAILED}
+
+//
+// MessageId: CACHE_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  CACHE_INITIALIZATION_FAILED
+//
+
+  CACHE_INITIALIZATION_FAILED = ULONG($00000066);
+  {$EXTERNALSYM CACHE_INITIALIZATION_FAILED}
+
+//
+// MessageId: CONFIG_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  CONFIG_INITIALIZATION_FAILED
+//
+
+  CONFIG_INITIALIZATION_FAILED = ULONG($00000067);
+  {$EXTERNALSYM CONFIG_INITIALIZATION_FAILED}
+
+//
+// MessageId: FILE_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  FILE_INITIALIZATION_FAILED
+//
+
+  FILE_INITIALIZATION_FAILED = ULONG($00000068);
+  {$EXTERNALSYM FILE_INITIALIZATION_FAILED}
+
+//
+// MessageId: IO1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  IO1_INITIALIZATION_FAILED
+//
+
+  IO1_INITIALIZATION_FAILED = ULONG($00000069);
+  {$EXTERNALSYM IO1_INITIALIZATION_FAILED}
+
+//
+// MessageId: LPC_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  LPC_INITIALIZATION_FAILED
+//
+
+  LPC_INITIALIZATION_FAILED = ULONG($0000006A);
+  {$EXTERNALSYM LPC_INITIALIZATION_FAILED}
+
+//
+// MessageId: PROCESS1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PROCESS1_INITIALIZATION_FAILED
+//
+
+  PROCESS1_INITIALIZATION_FAILED = ULONG($0000006B);
+  {$EXTERNALSYM PROCESS1_INITIALIZATION_FAILED}
+
+//
+// MessageId: REFMON_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  REFMON_INITIALIZATION_FAILED
+//
+
+  REFMON_INITIALIZATION_FAILED = ULONG($0000006C);
+  {$EXTERNALSYM REFMON_INITIALIZATION_FAILED}
+
+//
+// MessageId: SESSION1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SESSION1_INITIALIZATION_FAILED
+//
+
+  SESSION1_INITIALIZATION_FAILED = ULONG($0000006D);
+  {$EXTERNALSYM SESSION1_INITIALIZATION_FAILED}
+
+//
+// MessageId: SESSION2_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SESSION2_INITIALIZATION_FAILED
+//
+
+  SESSION2_INITIALIZATION_FAILED = ULONG($0000006E);
+  {$EXTERNALSYM SESSION2_INITIALIZATION_FAILED}
+
+//
+// MessageId: SESSION3_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SESSION3_INITIALIZATION_FAILED
+//
+
+  SESSION3_INITIALIZATION_FAILED = ULONG($0000006F);
+  {$EXTERNALSYM SESSION3_INITIALIZATION_FAILED}
+
+//
+// MessageId: SESSION4_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SESSION4_INITIALIZATION_FAILED
+//
+
+  SESSION4_INITIALIZATION_FAILED = ULONG($00000070);
+  {$EXTERNALSYM SESSION4_INITIALIZATION_FAILED}
+
+//
+// MessageId: SESSION5_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  SESSION5_INITIALIZATION_FAILED
+//
+
+  SESSION5_INITIALIZATION_FAILED = ULONG($00000071);
+  {$EXTERNALSYM SESSION5_INITIALIZATION_FAILED}
+
+//
+// MessageId: ASSIGN_DRIVE_LETTERS_FAILED
+//
+// MessageText:
+//
+//  ASSIGN_DRIVE_LETTERS_FAILED
+//
+
+  ASSIGN_DRIVE_LETTERS_FAILED = ULONG($00000072);
+  {$EXTERNALSYM ASSIGN_DRIVE_LETTERS_FAILED}
+
+//
+// MessageId: CONFIG_LIST_FAILED
+//
+// MessageText:
+//
+//  CONFIG_LIST_FAILED
+//
+
+  CONFIG_LIST_FAILED = ULONG($00000073);
+  {$EXTERNALSYM CONFIG_LIST_FAILED}
+
+//
+// MessageId: BAD_SYSTEM_CONFIG_INFO
+//
+// MessageText:
+//
+//  BAD_SYSTEM_CONFIG_INFO
+//
+
+  BAD_SYSTEM_CONFIG_INFO = ULONG($00000074);
+  {$EXTERNALSYM BAD_SYSTEM_CONFIG_INFO}
+
+//
+// MessageId: CANNOT_WRITE_CONFIGURATION
+//
+// MessageText:
+//
+//  CANNOT_WRITE_CONFIGURATION
+//
+
+  CANNOT_WRITE_CONFIGURATION = ULONG($00000075);
+  {$EXTERNALSYM CANNOT_WRITE_CONFIGURATION}
+
+//
+// MessageId: PROCESS_HAS_LOCKED_PAGES
+//
+// MessageText:
+//
+//  PROCESS_HAS_LOCKED_PAGES
+//
+
+  PROCESS_HAS_LOCKED_PAGES = ULONG($00000076);
+  {$EXTERNALSYM PROCESS_HAS_LOCKED_PAGES}
+
+//
+// MessageId: KERNEL_STACK_INPAGE_ERROR
+//
+// MessageText:
+//
+//  KERNEL_STACK_INPAGE_ERROR
+//
+
+  KERNEL_STACK_INPAGE_ERROR = ULONG($00000077);
+  {$EXTERNALSYM KERNEL_STACK_INPAGE_ERROR}
+
+//
+// MessageId: PHASE0_EXCEPTION
+//
+// MessageText:
+//
+//  PHASE0_EXCEPTION
+//
+
+  PHASE0_EXCEPTION = ULONG($00000078);
+  {$EXTERNALSYM PHASE0_EXCEPTION}
+
+//
+// MessageId: MISMATCHED_HAL
+//
+// MessageText:
+//
+//  Mismatched kernel and hal image.
+//
+
+  MISMATCHED_HAL = ULONG($00000079);
+  {$EXTERNALSYM MISMATCHED_HAL}
+
+//
+// MessageId: KERNEL_DATA_INPAGE_ERROR
+//
+// MessageText:
+//
+//  KERNEL_DATA_INPAGE_ERROR
+//
+
+  KERNEL_DATA_INPAGE_ERROR = ULONG($0000007A);
+  {$EXTERNALSYM KERNEL_DATA_INPAGE_ERROR}
+
+//
+// MessageId: INACCESSIBLE_BOOT_DEVICE
+//
+// MessageText:
+//
+//  INACCESSIBLE_BOOT_DEVICE
+//
+
+  INACCESSIBLE_BOOT_DEVICE = ULONG($0000007B);
+  {$EXTERNALSYM INACCESSIBLE_BOOT_DEVICE}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check to make sure any new hardware or software is properly installed.
+//  If this is a new installation, ask your hardware or software manufacturer
+//  for any Windows 2000 updates you might need.
+//  
+//  If problems continue, disable or remove any newly installed hardware
+//  or software. Disable BIOS memory options such as caching or shadowing.
+//  If you need to use Safe Mode to remove or disable components, restart
+//  your computer, press F8 to select Advanced Startup Options, and then
+//  select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE = ULONG($0000007C);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE}
+
+//
+// MessageId: INSTALL_MORE_MEMORY
+//
+// MessageText:
+//
+//  INSTALL_MORE_MEMORY
+//
+
+  INSTALL_MORE_MEMORY = ULONG($0000007D);
+  {$EXTERNALSYM INSTALL_MORE_MEMORY}
+
+//
+// MessageId: WINDOWS_NT_BANNER
+//
+// MessageText:
+//
+//  Microsoft (R) Windows 2000 (R) Version %hs (Build %u%hs)
+//
+
+  WINDOWS_NT_BANNER = ULONG($4000007E);
+  {$EXTERNALSYM WINDOWS_NT_BANNER}
+
+//
+// MessageId: UNEXPECTED_KERNEL_MODE_TRAP
+//
+// MessageText:
+//
+//  UNEXPECTED_KERNEL_MODE_TRAP
+//
+
+  UNEXPECTED_KERNEL_MODE_TRAP = ULONG($0000007F);
+  {$EXTERNALSYM UNEXPECTED_KERNEL_MODE_TRAP}
+
+//
+// MessageId: NMI_HARDWARE_FAILURE
+//
+// MessageText:
+//
+//  Hardware malfunction.
+//
+
+  NMI_HARDWARE_FAILURE = ULONG($00000080);
+  {$EXTERNALSYM NMI_HARDWARE_FAILURE}
+
+//
+// MessageId: SPIN_LOCK_INIT_FAILURE
+//
+// MessageText:
+//
+//  SPIN_LOCK_INIT_FAILURE
+//
+
+  SPIN_LOCK_INIT_FAILURE = ULONG($00000081);
+  {$EXTERNALSYM SPIN_LOCK_INIT_FAILURE}
+
+//
+// MessageId: DFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  DFS_FILE_SYSTEM
+//
+
+  DFS_FILE_SYSTEM = ULONG($00000082);
+  {$EXTERNALSYM DFS_FILE_SYSTEM}
+
+//
+// MessageId: OFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  OFS_FILE_SYSTEM
+//
+
+  OFS_FILE_SYSTEM = ULONG($00000083);
+  {$EXTERNALSYM OFS_FILE_SYSTEM}
+
+//
+// MessageId: RECOM_DRIVER
+//
+// MessageText:
+//
+//  RECOM_DRIVER
+//
+
+  RECOM_DRIVER = ULONG($00000084);
+  {$EXTERNALSYM RECOM_DRIVER}
+
+//
+// MessageId: SETUP_FAILURE
+//
+// MessageText:
+//
+//  SETUP_FAILURE
+//
+
+  SETUP_FAILURE = ULONG($00000085);
+  {$EXTERNALSYM SETUP_FAILURE}
+
+//
+// MessageId: AUDIT_FAILURE
+//
+// MessageText:
+//
+//  Audit attempt has failed.
+//
+
+  AUDIT_FAILURE = ULONG($00000086);
+  {$EXTERNALSYM AUDIT_FAILURE}
+
+//
+// MessageId: WINDOWS_NT_CSD_STRING
+//
+// MessageText:
+//
+//  Service Pack
+//
+
+  WINDOWS_NT_CSD_STRING = ULONG($40000087);
+  {$EXTERNALSYM WINDOWS_NT_CSD_STRING}
+
+//
+// MessageId: WINDOWS_NT_INFO_STRING
+//
+// MessageText:
+//
+//  %u System Processor [%u MB Memory] %Z
+//
+
+  WINDOWS_NT_INFO_STRING = ULONG($40000088);
+  {$EXTERNALSYM WINDOWS_NT_INFO_STRING}
+
+//
+// MessageId: WINDOWS_NT_MP_STRING
+//
+// MessageText:
+//
+//  MultiProcessor Kernel
+//
+
+  WINDOWS_NT_MP_STRING = ULONG($40000089);
+  {$EXTERNALSYM WINDOWS_NT_MP_STRING}
+
+//
+// MessageId: THREAD_TERMINATE_HELD_MUTEX
+//
+// MessageText:
+//
+//  A kernel thread terminated while holding a mutex
+//
+
+  THREAD_TERMINATE_HELD_MUTEX = ULONG($4000008A);
+  {$EXTERNALSYM THREAD_TERMINATE_HELD_MUTEX}
+
+//
+// MessageId: MBR_CHECKSUM_MISMATCH
+//
+// MessageText:
+//
+//  This system may be infected with a virus.
+//
+
+  MBR_CHECKSUM_MISMATCH = ULONG($0000008B);
+  {$EXTERNALSYM MBR_CHECKSUM_MISMATCH}
+
+//
+// MessageId: BUGCODE_PSS_CRASH_INIT
+//
+// MessageText:
+//
+//  Beginning dump of physical memory
+//
+
+  BUGCODE_PSS_CRASH_INIT = ULONG($0000008C);
+  {$EXTERNALSYM BUGCODE_PSS_CRASH_INIT}
+
+//
+// MessageId: BUGCODE_PSS_CRASH_PROGRESS
+//
+// MessageText:
+//
+//  Dumping physical memory to disk
+//
+
+  BUGCODE_PSS_CRASH_PROGRESS = ULONG($0000008D);
+  {$EXTERNALSYM BUGCODE_PSS_CRASH_PROGRESS}
+
+//
+// MessageId: BUGCODE_PSS_CRASH_DONE
+//
+// MessageText:
+//
+//  Physical memory dump complete. Contact your system administrator or
+//  technical support group.
+//
+
+  BUGCODE_PSS_CRASH_DONE = ULONG($0000008E);
+  {$EXTERNALSYM BUGCODE_PSS_CRASH_DONE}
+
+//
+// MessageId: PP0_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PP0_INITIALIZATION_FAILED
+//
+
+  PP0_INITIALIZATION_FAILED = ULONG($0000008F);
+  {$EXTERNALSYM PP0_INITIALIZATION_FAILED}
+
+//
+// MessageId: PP1_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  PP1_INITIALIZATION_FAILED
+//
+
+  PP1_INITIALIZATION_FAILED = ULONG($00000090);
+  {$EXTERNALSYM PP1_INITIALIZATION_FAILED}
+
+//
+// MessageId: WIN32K_INIT_OR_RIT_FAILURE
+//
+// MessageText:
+//
+//  WIN32K_INIT_OR_RIT_FAILURE
+//
+
+  WIN32K_INIT_OR_RIT_FAILURE = ULONG($00000091);
+  {$EXTERNALSYM WIN32K_INIT_OR_RIT_FAILURE}
+
+//
+// MessageId: UP_DRIVER_ON_MP_SYSTEM
+//
+// MessageText:
+//
+//  UP_DRIVER_ON_MP_SYSTEM
+//
+
+  UP_DRIVER_ON_MP_SYSTEM = ULONG($00000092);
+  {$EXTERNALSYM UP_DRIVER_ON_MP_SYSTEM}
+
+//
+// MessageId: INVALID_KERNEL_HANDLE
+//
+// MessageText:
+//
+//  INVALID_KERNEL_HANDLE
+//
+
+  INVALID_KERNEL_HANDLE = ULONG($00000093);
+  {$EXTERNALSYM INVALID_KERNEL_HANDLE}
+
+//
+// MessageId: KERNEL_STACK_LOCKED_AT_EXIT
+//
+// MessageText:
+//
+//  KERNEL_STACK_LOCKED_AT_EXIT
+//
+
+  KERNEL_STACK_LOCKED_AT_EXIT = ULONG($00000094);
+  {$EXTERNALSYM KERNEL_STACK_LOCKED_AT_EXIT}
+
+//
+// MessageId: PNP_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  PNP_INTERNAL_ERROR
+//
+
+  PNP_INTERNAL_ERROR = ULONG($00000095);
+  {$EXTERNALSYM PNP_INTERNAL_ERROR}
+
+//
+// MessageId: INVALID_WORK_QUEUE_ITEM
+//
+// MessageText:
+//
+//  INVALID_WORK_QUEUE_ITEM
+//
+
+  INVALID_WORK_QUEUE_ITEM = ULONG($00000096);
+  {$EXTERNALSYM INVALID_WORK_QUEUE_ITEM}
+
+//
+// MessageId: BOUND_IMAGE_UNSUPPORTED
+//
+// MessageText:
+//
+//  BOUND_IMAGE_UNSUPPORTED
+//
+
+  BOUND_IMAGE_UNSUPPORTED = ULONG($00000097);
+  {$EXTERNALSYM BOUND_IMAGE_UNSUPPORTED}
+
+//
+// MessageId: END_OF_NT_EVALUATION_PERIOD
+//
+// MessageText:
+//
+//  END_OF_NT_EVALUATION_PERIOD
+//
+
+  END_OF_NT_EVALUATION_PERIOD = ULONG($00000098);
+  {$EXTERNALSYM END_OF_NT_EVALUATION_PERIOD}
+
+//
+// MessageId: INVALID_REGION_OR_SEGMENT
+//
+// MessageText:
+//
+//  INVALID_REGION_OR_SEGMENT
+//
+
+  INVALID_REGION_OR_SEGMENT = ULONG($00000099);
+  {$EXTERNALSYM INVALID_REGION_OR_SEGMENT}
+
+//
+// MessageId: SYSTEM_LICENSE_VIOLATION
+//
+// MessageText:
+//
+//  SYSTEM_LICENSE_VIOLATION
+//
+
+  SYSTEM_LICENSE_VIOLATION = ULONG($0000009A);
+  {$EXTERNALSYM SYSTEM_LICENSE_VIOLATION}
+
+//
+// MessageId: UDFS_FILE_SYSTEM
+//
+// MessageText:
+//
+//  UDFS_FILE_SYSTEM
+//
+
+  UDFS_FILE_SYSTEM = ULONG($0000009B);
+  {$EXTERNALSYM UDFS_FILE_SYSTEM}
+
+//
+// MessageId: MACHINE_CHECK_EXCEPTION
+//
+// MessageText:
+//
+//  MACHINE_CHECK_EXCEPTION
+//
+
+  MACHINE_CHECK_EXCEPTION = ULONG($0000009C);
+  {$EXTERNALSYM MACHINE_CHECK_EXCEPTION}
+
+//
+// MessageId: WINDOWS_NT_INFO_STRING_PLURAL
+//
+// MessageText:
+//
+//  %u System Processors [%u MB Memory] %Z
+//
+
+  WINDOWS_NT_INFO_STRING_PLURAL = ULONG($4000009D);
+  {$EXTERNALSYM WINDOWS_NT_INFO_STRING_PLURAL}
+
+//
+// MessageId: WINDOWS_NT_RC_STRING
+//
+// MessageText:
+//
+//  RC
+//
+
+  WINDOWS_NT_RC_STRING = ULONG($4000009E);
+  {$EXTERNALSYM WINDOWS_NT_RC_STRING}
+
+//
+// MessageId: DRIVER_POWER_STATE_FAILURE
+//
+// MessageText:
+//
+//  DRIVER_POWER_STATE_FAILURE
+//
+
+  DRIVER_POWER_STATE_FAILURE = ULONG($0000009F);
+  {$EXTERNALSYM DRIVER_POWER_STATE_FAILURE}
+
+//
+// MessageId: INTERNAL_POWER_ERROR
+//
+// MessageText:
+//
+//  INTERNAL_POWER_ERROR
+//
+
+  INTERNAL_POWER_ERROR = ULONG($000000A0);
+  {$EXTERNALSYM INTERNAL_POWER_ERROR}
+
+//
+// MessageId: PCI_BUS_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  Inconsistency detected in the PCI Bus driver's internal structures.
+//
+
+  PCI_BUS_DRIVER_INTERNAL = ULONG($000000A1);
+  {$EXTERNALSYM PCI_BUS_DRIVER_INTERNAL}
+
+//
+// MessageId: MEMORY_IMAGE_CORRUPT
+//
+// MessageText:
+//
+//  A CRC check on the memory range has failed
+//
+
+  MEMORY_IMAGE_CORRUPT = ULONG($000000A2);
+  {$EXTERNALSYM MEMORY_IMAGE_CORRUPT}
+
+//
+// MessageId: ACPI_DRIVER_INTERNAL
+//
+// MessageText:
+//
+//  ACPI_DRIVER_INTERNAL
+//
+
+  ACPI_DRIVER_INTERNAL = ULONG($000000A3);
+  {$EXTERNALSYM ACPI_DRIVER_INTERNAL}
+
+//
+// MessageId: CNSS_FILE_SYSTEM_FILTER
+//
+// MessageText:
+//
+//  Internal inconsistency while representing
+//  Ntfs Structured Storage as a DOCFILE.
+//
+
+  CNSS_FILE_SYSTEM_FILTER = ULONG($000000A4);
+  {$EXTERNALSYM CNSS_FILE_SYSTEM_FILTER}
+
+//
+// MessageId: ACPI_BIOS_ERROR
+//
+// MessageText:
+//
+//  The ACPI BIOS in this system is not fully compliant with the ACPI 
+//  specification. Please read the README.TXT for possible workarounds.  You
+//  can also contact your system's manufacturer for an updated BIOS, or visit
+//  http://www.hardware-update.com to see if a new BIOS is available.  
+//
+
+  ACPI_BIOS_ERROR = ULONG($000000A5);
+  {$EXTERNALSYM ACPI_BIOS_ERROR}
+
+//
+// MessageId: FP_EMULATION_ERROR
+//
+// MessageText:
+//
+//  FP_EMULATION_ERROR
+//
+
+  FP_EMULATION_ERROR = ULONG($000000A6);
+  {$EXTERNALSYM FP_EMULATION_ERROR}
+
+//
+// MessageId: BAD_EXHANDLE
+//
+// MessageText:
+//
+//  BAD_EXHANDLE
+//
+
+  BAD_EXHANDLE = ULONG($000000A7);
+  {$EXTERNALSYM BAD_EXHANDLE}
+
+//
+// MessageId: BOOTING_IN_SAFEMODE_MINIMAL
+//
+// MessageText:
+//
+//  The system is booting in safemode - Minimal Services
+//
+
+  BOOTING_IN_SAFEMODE_MINIMAL = ULONG($000000A8);
+  {$EXTERNALSYM BOOTING_IN_SAFEMODE_MINIMAL}
+
+//
+// MessageId: BOOTING_IN_SAFEMODE_NETWORK
+//
+// MessageText:
+//
+//  The system is booting in safemode - Minimal Services with Network
+//
+
+  BOOTING_IN_SAFEMODE_NETWORK = ULONG($000000A9);
+  {$EXTERNALSYM BOOTING_IN_SAFEMODE_NETWORK}
+
+//
+// MessageId: BOOTING_IN_SAFEMODE_DSREPAIR
+//
+// MessageText:
+//
+//  The system is booting in safemode - Directory Services Repair
+//
+
+  BOOTING_IN_SAFEMODE_DSREPAIR = ULONG($000000AA);
+  {$EXTERNALSYM BOOTING_IN_SAFEMODE_DSREPAIR}
+
+//
+// MessageId: SESSION_HAS_VALID_POOL_ON_EXIT
+//
+// MessageText:
+//
+//  SESSION_HAS_VALID_POOL_ON_EXIT
+//
+
+  SESSION_HAS_VALID_POOL_ON_EXIT = ULONG($000000AB);
+  {$EXTERNALSYM SESSION_HAS_VALID_POOL_ON_EXIT}
+
+//
+// MessageId: HAL_MEMORY_ALLOCATION
+//
+// MessageText:
+//
+//  Allocate from NonPaged Pool failed for a HAL critical allocation.
+//
+
+  HAL_MEMORY_ALLOCATION = ULONG($000000AC);
+  {$EXTERNALSYM HAL_MEMORY_ALLOCATION}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_A
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check to make sure any new hardware or software is properly installed.
+//  If this is a new installation, ask your hardware or software manufacturer
+//  for any Windows 2000 updates you might need.
+//  
+//  If problems continue, disable or remove any newly installed hardware
+//  or software. Disable BIOS memory options such as caching or shadowing.
+//  Check your hard drive to make sure it is properly configured and
+//  terminated. If you need to use Safe Mode to remove or disable components,
+//  restart your computer, press F8 to select Advanced Startup Options,
+//  and then select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_A = ULONG($000000AD);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_A}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_1E
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check to be sure you have adequate disk space. If a driver is
+//  identified in the Stop message, disable the driver or check
+//  with the manufacturer for driver updates. Try changing video
+//  adapters.
+//  
+//  Check with your hardware vendor for any BIOS updates. Disable
+//  BIOS memory options such as caching or shadowing. If you need
+//  to use Safe Mode to remove or disable components, restart your
+//  computer, press F8 to select Advanced Startup Options, and then
+//  select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_1E = ULONG($000000AE);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_1E}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_23
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Disable or uninstall any anti-virus, disk defragmentation
+//  or backup utilities. Check your hard drive configuration,
+//  and check for any updated drivers. Run CHKDSK /F to check
+//  for hard drive corruption, and then restart your computer.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_23 = ULONG($000000AF);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_23}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_2E
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Run system diagnostics supplied by your hardware manufacturer.
+//  In particular, run a memory check, and check for faulty or
+//  mismatched memory. Try changing video adapters.
+//  
+//  Check with your hardware vendor for any BIOS updates. Disable
+//  BIOS memory options such as caching or shadowing. If you need
+//  to use Safe Mode to remove or disable components, restart your
+//  computer, press F8 to select Advanced Startup Options, and then
+//  select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_2E = ULONG($000000B0);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_2E}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_3F
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Remove any recently installed software including backup
+//  utilities or disk-intensive applications.
+//  
+//  If you need to use Safe Mode to remove or disable components,
+//  restart your computer, press F8 to select Advanced Startup
+//  Options, and then select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_3F = ULONG($000000B1);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_3F}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_7B
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check for viruses on your computer. Remove any newly installed
+//  hard drives or hard drive controllers. Check your hard drive
+//  to make sure it is properly configured and terminated.
+//  Run CHKDSK /F to check for hard drive corruption, and then
+//  restart your computer.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_7B = ULONG($000000B2);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_7B}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_7F
+//
+// MessageText:
+//
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Run a system diagnostic utility supplied by your hardware manufacturer.
+//  In particular, run a memory check, and check for faulty or mismatched
+//  memory. Try changing video adapters.
+//  
+//  Disable or remove any newly installed hardware and drivers. Disable or
+//  remove any newly installed software. If you need to use Safe Mode to
+//  remove or disable components, restart your computer, press F8 to select
+//  Advanced Startup Options, and then select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  BUGCODE_PSS_MESSAGE_7F = ULONG($000000B3);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_7F}
+
+//
+// MessageId: VIDEO_DRIVER_INIT_FAILURE
+//
+// MessageText:
+//
+//  The video driver failed to initialize
+//
+
+  VIDEO_DRIVER_INIT_FAILURE = ULONG($000000B4);
+  {$EXTERNALSYM VIDEO_DRIVER_INIT_FAILURE}
+
+//
+// MessageId: BOOTLOG_LOADED
+//
+// MessageText:
+//
+//  Loaded driver
+//
+
+  BOOTLOG_LOADED = ULONG($000000B5);
+  {$EXTERNALSYM BOOTLOG_LOADED}
+
+//
+// MessageId: BOOTLOG_NOT_LOADED
+//
+// MessageText:
+//
+//  Did not load driver
+//
+
+  BOOTLOG_NOT_LOADED = ULONG($000000B6);
+  {$EXTERNALSYM BOOTLOG_NOT_LOADED}
+
+//
+// MessageId: BOOTLOG_ENABLED
+//
+// MessageText:
+//
+//  Boot Logging Enabled
+//
+
+  BOOTLOG_ENABLED = ULONG($000000B7);
+  {$EXTERNALSYM BOOTLOG_ENABLED}
+
+//
+// MessageId: ATTEMPTED_SWITCH_FROM_DPC
+//
+// MessageText:
+//
+//  A wait operation, attach process, or yield was attempted from a DPC routine.
+//
+
+  ATTEMPTED_SWITCH_FROM_DPC = ULONG($000000B8);
+  {$EXTERNALSYM ATTEMPTED_SWITCH_FROM_DPC}
+
+//
+// MessageId: CHIPSET_DETECTED_ERROR
+//
+// MessageText:
+//
+//  A parity error in the system memory or I/O system was detected.
+//
+
+  CHIPSET_DETECTED_ERROR = ULONG($000000B9);
+  {$EXTERNALSYM CHIPSET_DETECTED_ERROR}
+
+//
+// MessageId: SESSION_HAS_VALID_VIEWS_ON_EXIT
+//
+// MessageText:
+//
+//  SESSION_HAS_VALID_VIEWS_ON_EXIT
+//
+
+  SESSION_HAS_VALID_VIEWS_ON_EXIT = ULONG($000000BA);
+  {$EXTERNALSYM SESSION_HAS_VALID_VIEWS_ON_EXIT}
+
+//
+// MessageId: NETWORK_BOOT_INITIALIZATION_FAILED
+//
+// MessageText:
+//
+//  An initialization failure occurred while attempting to boot from the network.
+//
+
+  NETWORK_BOOT_INITIALIZATION_FAILED = ULONG($000000BB);
+  {$EXTERNALSYM NETWORK_BOOT_INITIALIZATION_FAILED}
+
+//
+// MessageId: NETWORK_BOOT_DUPLICATE_ADDRESS
+//
+// MessageText:
+//
+//  A duplicate IP address was assigned to this machine while attempting to
+//  boot from the network.
+//
+
+  NETWORK_BOOT_DUPLICATE_ADDRESS = ULONG($000000BC);
+  {$EXTERNALSYM NETWORK_BOOT_DUPLICATE_ADDRESS}
+
+//
+// MessageId: INVALID_HIBERNATED_STATE
+//
+// MessageText:
+//
+//  The hibernated memory image does not match the current hardware configuration.
+//
+
+  INVALID_HIBERNATED_STATE = ULONG($000000BD);
+  {$EXTERNALSYM INVALID_HIBERNATED_STATE}
+
+//
+// MessageId: ATTEMPTED_WRITE_TO_READONLY_MEMORY
+//
+// MessageText:
+//
+//  An attempt was made to write to read-only memory.
+//
+
+  ATTEMPTED_WRITE_TO_READONLY_MEMORY = ULONG($000000BE);
+  {$EXTERNALSYM ATTEMPTED_WRITE_TO_READONLY_MEMORY}
+
+//
+// MessageId: MUTEX_ALREADY_OWNED
+//
+// MessageText:
+//
+//  MUTEX_ALREADY_OWNED
+//
+
+  MUTEX_ALREADY_OWNED = ULONG($000000BF);
+  {$EXTERNALSYM MUTEX_ALREADY_OWNED}
+
+//
+// MessageId: PCI_CONFIG_SPACE_ACCESS_FAILURE
+//
+// MessageText:
+//
+//  An attempt to access PCI configuration space failed.
+//
+
+  PCI_CONFIG_SPACE_ACCESS_FAILURE = ULONG($000000C0);
+  {$EXTERNALSYM PCI_CONFIG_SPACE_ACCESS_FAILURE}
+
+//
+// MessageId: SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION
+//
+// MessageText:
+//
+//  SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION
+//
+
+  SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION = ULONG($000000C1);
+  {$EXTERNALSYM SPECIAL_POOL_DETECTED_MEMORY_CORRUPTION}
+
+//
+// MessageId: BAD_POOL_CALLER
+//
+// MessageText:
+//
+//  BAD_POOL_CALLER
+//
+
+  BAD_POOL_CALLER = ULONG($000000C2);
+  {$EXTERNALSYM BAD_POOL_CALLER}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_SIGNATURE
+//
+// MessageText:
+//
+//  
+//  A system file that is owned by Windows 2000 was replaced by an application
+//  running on your system.  The operating system detected this and tried to
+//  verify the validity of the file's signature.  The operating system found that
+//  the file signature is not valid and put the original, correct file back
+//  so that your operating system will continue to function properly.
+//
+
+  BUGCODE_PSS_MESSAGE_SIGNATURE = ULONG($000000C3);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_SIGNATURE}
+
+//
+// MessageId: DRIVER_VERIFIER_DETECTED_VIOLATION
+//
+// MessageText:
+//
+//  
+//  A device driver attempting to corrupt the system has been caught.
+//  The faulty driver currently on the kernel stack must be replaced
+//  with a working version.
+//
+
+  DRIVER_VERIFIER_DETECTED_VIOLATION = ULONG($000000C4);
+  {$EXTERNALSYM DRIVER_VERIFIER_DETECTED_VIOLATION}
+
+//
+// MessageId: DRIVER_CORRUPTED_EXPOOL
+//
+// MessageText:
+//
+//  
+//  A device driver has corrupted the executive memory pool.
+//  
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check to make sure any new hardware or software is properly installed.
+//  If this is a new installation, ask your hardware or software manufacturer
+//  for any Windows 2000 updates you might need.
+//  
+//  Run the driver verifier against any new (or suspect) drivers.
+//  If that doesn't reveal the corrupting driver, try enabling special pool.
+//  Both of these features are intended to catch the corruption at an earlier
+//  point where the offending driver can be identified.
+//  
+//  If you need to use Safe Mode to remove or disable components,
+//  restart your computer, press F8 to select Advanced Startup Options,
+//  and then select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  DRIVER_CORRUPTED_EXPOOL = ULONG($000000C5);
+  {$EXTERNALSYM DRIVER_CORRUPTED_EXPOOL}
+
+//
+// MessageId: DRIVER_CAUGHT_MODIFYING_FREED_POOL
+//
+// MessageText:
+//
+//  
+//  A device driver attempting to corrupt the system has been caught.
+//  The faulty driver currently on the kernel stack must be replaced
+//  with a working version.
+//
+
+  DRIVER_CAUGHT_MODIFYING_FREED_POOL = ULONG($000000C6);
+  {$EXTERNALSYM DRIVER_CAUGHT_MODIFYING_FREED_POOL}
+
+//
+// MessageId: TIMER_OR_DPC_INVALID
+//
+// MessageText:
+//
+//  
+//  A kernel timer or DPC was found in memory which must not contain such
+//  items.  Usually this is memory being freed.  This is usually caused by
+//  a device driver that has not cleaned up properly before freeing memory.
+//
+
+  TIMER_OR_DPC_INVALID = ULONG($000000C7);
+  {$EXTERNALSYM TIMER_OR_DPC_INVALID}
+
+//
+// MessageId: IRQL_UNEXPECTED_VALUE
+//
+// MessageText:
+//
+//  
+//  The processor's IRQL is not valid for the currently executing context.
+//  This is a software error condition and is usually caused by a device
+//  driver changing IRQL and not restoring it to its previous value when
+//  it has finished its task.
+//
+
+  IRQL_UNEXPECTED_VALUE = ULONG($000000C8);
+  {$EXTERNALSYM IRQL_UNEXPECTED_VALUE}
+
+//
+// MessageId: DRIVER_VERIFIER_IOMANAGER_VIOLATION
+//
+// MessageText:
+//
+//  
+//  The IO manager has detected a violation by a driver that is being verified.
+//  The faulty driver that is being verified must be debugged and
+//  replaced with a working version.
+//
+
+  DRIVER_VERIFIER_IOMANAGER_VIOLATION = ULONG($000000C9);
+  {$EXTERNALSYM DRIVER_VERIFIER_IOMANAGER_VIOLATION}
+
+//
+// MessageId: PNP_DETECTED_FATAL_ERROR
+//
+// MessageText:
+//
+//  
+//  Plug and Play detected an error most likely caused by a faulty driver.
+//
+
+  PNP_DETECTED_FATAL_ERROR = ULONG($000000CA);
+  {$EXTERNALSYM PNP_DETECTED_FATAL_ERROR}
+
+//
+// MessageId: DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS
+//
+// MessageText:
+//
+//  DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS
+//
+
+  DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS = ULONG($000000CB);
+  {$EXTERNALSYM DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS}
+
+//
+// MessageId: PAGE_FAULT_IN_FREED_SPECIAL_POOL
+//
+// MessageText:
+//
+//  
+//  The system is attempting to access memory after it has been freed.
+//  This usually indicates a system-driver synchronization issue.
+//
+
+  PAGE_FAULT_IN_FREED_SPECIAL_POOL = ULONG($000000CC);
+  {$EXTERNALSYM PAGE_FAULT_IN_FREED_SPECIAL_POOL}
+
+//
+// MessageId: PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+//
+// MessageText:
+//
+//  
+//  The system is attempting to access memory beyond the end of the allocation.
+//  This usually indicates a system-driver synchronization issue.
+//
+
+  PAGE_FAULT_BEYOND_END_OF_ALLOCATION = ULONG($000000CD);
+  {$EXTERNALSYM PAGE_FAULT_BEYOND_END_OF_ALLOCATION}
+
+//
+// MessageId: DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS
+//
+// MessageText:
+//
+//  DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS
+//
+
+  DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS = ULONG($000000CE);
+  {$EXTERNALSYM DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS}
+
+//
+// MessageId: TERMINAL_SERVER_DRIVER_MADE_INCORRECT_MEMORY_REFERENCE
+//
+// MessageText:
+//
+//  TERMINAL_SERVER_DRIVER_MADE_INCORRECT_MEMORY_REFERENCE
+//
+
+  TERMINAL_SERVER_DRIVER_MADE_INCORRECT_MEMORY_REFERENCE = ULONG($000000CF);
+  {$EXTERNALSYM TERMINAL_SERVER_DRIVER_MADE_INCORRECT_MEMORY_REFERENCE}
+
+//
+// MessageId: DRIVER_CORRUPTED_MMPOOL
+//
+// MessageText:
+//
+//  
+//  A device driver has corrupted the system memory management pool.
+//  
+//  If this is the first time you've seen this Stop error screen,
+//  restart your computer. If this screen appears again, follow
+//  these steps:
+//  
+//  Check to make sure any new hardware or software is properly installed.
+//  If this is a new installation, ask your hardware or software manufacturer
+//  for any Windows 2000 updates you might need.
+//  
+//  Run the driver verifier against any new (or suspect) drivers.
+//  If that doesn't reveal the corrupting driver, try enabling special pool.
+//  Both of these features are intended to catch the corruption at an earlier
+//  point where the offending driver can be identified.
+//  
+//  If you need to use Safe Mode to remove or disable components,
+//  restart your computer, press F8 to select Advanced Startup Options,
+//  and then select Safe Mode.
+//  
+//  Refer to your Getting Started manual for more information on
+//  troubleshooting Stop errors.
+//
+
+  DRIVER_CORRUPTED_MMPOOL = ULONG($000000D0);
+  {$EXTERNALSYM DRIVER_CORRUPTED_MMPOOL}
+
+//
+// MessageId: DRIVER_IRQL_NOT_LESS_OR_EQUAL
+//
+// MessageText:
+//
+//  DRIVER_IRQL_NOT_LESS_OR_EQUAL
+//
+
+  DRIVER_IRQL_NOT_LESS_OR_EQUAL = ULONG($000000D1);
+  {$EXTERNALSYM DRIVER_IRQL_NOT_LESS_OR_EQUAL}
+
+//
+// MessageId: BUGCODE_ID_DRIVER
+//
+// MessageText:
+//
+//  This driver may be at fault :
+//
+
+  BUGCODE_ID_DRIVER = ULONG($000000D2);
+  {$EXTERNALSYM BUGCODE_ID_DRIVER}
+
+//
+// MessageId: DRIVER_PORTION_MUST_BE_NONPAGED
+//
+// MessageText:
+//
+//  The driver mistakenly marked a part of it's image pagable instead of nonpagable.
+//
+
+  DRIVER_PORTION_MUST_BE_NONPAGED = ULONG($000000D3);
+  {$EXTERNALSYM DRIVER_PORTION_MUST_BE_NONPAGED}
+
+//
+// MessageId: SYSTEM_SCAN_AT_RAISED_IRQL_CAUGHT_IMPROPER_DRIVER_UNLOAD
+//
+// MessageText:
+//
+//  The driver unloaded without cancelling pending operations.
+//
+
+  SYSTEM_SCAN_AT_RAISED_IRQL_CAUGHT_IMPROPER_DRIVER_UNLOAD = ULONG($000000D4);
+  {$EXTERNALSYM SYSTEM_SCAN_AT_RAISED_IRQL_CAUGHT_IMPROPER_DRIVER_UNLOAD}
+
+//
+// MessageId: DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL
+//
+// MessageText:
+//
+//  
+//  The driver is attempting to access memory after it has been freed.
+//
+
+  DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL = ULONG($000000D5);
+  {$EXTERNALSYM DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL}
+
+//
+// MessageId: DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+//
+// MessageText:
+//
+//  
+//  The driver is attempting to access memory beyond the end of the allocation.
+//
+
+  DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION = ULONG($000000D6);
+  {$EXTERNALSYM DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION}
+
+//
+// MessageId: DRIVER_UNMAPPING_INVALID_VIEW
+//
+// MessageText:
+//
+//  
+//  The driver is attempting to unmap an invalid memory address.
+//
+
+  DRIVER_UNMAPPING_INVALID_VIEW = ULONG($000000D7);
+  {$EXTERNALSYM DRIVER_UNMAPPING_INVALID_VIEW}
+
+//
+// MessageId: DRIVER_USED_EXCESSIVE_PTES
+//
+// MessageText:
+//
+//  
+//  The driver has used an excessive number of system PTEs.
+//
+
+  DRIVER_USED_EXCESSIVE_PTES = ULONG($000000D8);
+  {$EXTERNALSYM DRIVER_USED_EXCESSIVE_PTES}
+
+//
+// MessageId: LOCKED_PAGES_TRACKER_CORRUPTION
+//
+// MessageText:
+//
+//  
+//  The driver is corrupting the locked pages tracking structures.
+//
+
+  LOCKED_PAGES_TRACKER_CORRUPTION = ULONG($000000D9);
+  {$EXTERNALSYM LOCKED_PAGES_TRACKER_CORRUPTION}
+
+//
+// MessageId: SYSTEM_PTE_MISUSE
+//
+// MessageText:
+//
+//  
+//  The driver is mismanaging system PTEs.
+//
+
+  SYSTEM_PTE_MISUSE = ULONG($000000DA);
+  {$EXTERNALSYM SYSTEM_PTE_MISUSE}
+
+//
+// MessageId: DRIVER_CORRUPTED_SYSPTES
+//
+// MessageText:
+//
+//  
+//  A driver has corrupted the memory management system PTEs.
+//
+
+  DRIVER_CORRUPTED_SYSPTES = ULONG($000000DB);
+  {$EXTERNALSYM DRIVER_CORRUPTED_SYSPTES}
+
+//
+// MessageId: DRIVER_INVALID_STACK_ACCESS
+//
+// MessageText:
+//
+//  
+//  A driver accessed a stack address that lies below the current stack pointer
+//  of the stack's thread.
+//
+
+  DRIVER_INVALID_STACK_ACCESS = ULONG($000000DC);
+  {$EXTERNALSYM DRIVER_INVALID_STACK_ACCESS}
+
+//
+// MessageId: BUGCODE_PSS_MESSAGE_A5
+//
+// MessageText:
+//
+//  
+//  The BIOS in this system is not fully ACPI compliant.  Please contact your
+//  system vendor or visit http://www.hardware-update.com for an updated BIOS.  
+//  If you are unable to obtain an updated BIOS or the latest BIOS supplied by 
+//  your vendor is not ACPI compliant, you can turn off ACPI mode during text 
+//  mode setup.  To do this, simply press the F7 key when you are prompted to 
+//  install storage drivers.  The system will not notify you that the F7 key 
+//  was pressed - it will silently disable ACPI and allow you to continue 
+//  your installation.
+//
+
+  BUGCODE_PSS_MESSAGE_A5 = ULONG($000000DD);
+  {$EXTERNALSYM BUGCODE_PSS_MESSAGE_A5}
+
+//
+// MessageId: POOL_CORRUPTION_IN_FILE_AREA
+//
+// MessageText:
+//
+//  
+//  A driver corrupted pool memory used for holding pages destined for disk.
+//
+
+  POOL_CORRUPTION_IN_FILE_AREA = ULONG($000000DE);
+  {$EXTERNALSYM POOL_CORRUPTION_IN_FILE_AREA}
+
+//
+// MessageId: HARDWARE_PROFILE_UNDOCKED_STRING
+//
+// MessageText:
+//
+//  Undocked Profile
+//
+
+  HARDWARE_PROFILE_UNDOCKED_STRING = ULONG($40010001);
+  {$EXTERNALSYM HARDWARE_PROFILE_UNDOCKED_STRING}
+
+//
+// MessageId: HARDWARE_PROFILE_DOCKED_STRING
+//
+// MessageText:
+//
+//  Docked Profile
+//
+
+  HARDWARE_PROFILE_DOCKED_STRING = ULONG($40010002);
+  {$EXTERNALSYM HARDWARE_PROFILE_DOCKED_STRING}
+
+//
+// MessageId: HARDWARE_PROFILE_UNKNOWN_STRING
+//
+// MessageText:
+//
+//  Profile
+//
+
+  HARDWARE_PROFILE_UNKNOWN_STRING = ULONG($40010003);
+  {$EXTERNALSYM HARDWARE_PROFILE_UNKNOWN_STRING}
+
+//
+// MessageId: IMPERSONATING_WORKER_THREAD
+//
+// MessageText:
+//
+//  
+//  A worker thread is impersonating another process. The work item forgot to
+//  disable impersonation before it returned.
+//
+
+  IMPERSONATING_WORKER_THREAD = ULONG($000000DF);
+  {$EXTERNALSYM IMPERSONATING_WORKER_THREAD}
+
+//
+// MessageId: ACPI_BIOS_FATAL_ERROR
+//
+// MessageText:
+//
+//  
+//  Your computer (BIOS) has reported that a component in your system is faulty and
+//  has prevented Windows from operating.  You can determine which component is
+//  faulty by running the diagnostic disk or tool that came with your computer.
+//  
+//  If you do not have this tool, you must contact your system vendor and report
+//  this error message to them.  They will be able to assist you in correcting this
+//  hardware problem thereby allowing Windows to operate.
+//
+
+  ACPI_BIOS_FATAL_ERROR = ULONG($000000E0);
+  {$EXTERNALSYM ACPI_BIOS_FATAL_ERROR}
+
+//
+// MessageId: WORKER_THREAD_RETURNED_AT_BAD_IRQL
+//
+// MessageText:
+//
+//  WORKER_THREAD_RETURNED_AT_BAD_IRQL
+//
+
+  WORKER_THREAD_RETURNED_AT_BAD_IRQL = ULONG($000000E1);
+  {$EXTERNALSYM WORKER_THREAD_RETURNED_AT_BAD_IRQL}
+
+//
+// MessageId: MANUALLY_INITIATED_CRASH
+//
+// MessageText:
+//
+//  
+//  The end-user manually generated the crashdump.
+//
+
+  MANUALLY_INITIATED_CRASH = ULONG($000000E2);
+  {$EXTERNALSYM MANUALLY_INITIATED_CRASH}
+
+//
+// MessageId: RESOURCE_NOT_OWNED
+//
+// MessageText:
+//
+//  
+//  A thread tried to release a resource it did not own.
+//
+
+  RESOURCE_NOT_OWNED = ULONG($000000E3);
+  {$EXTERNALSYM RESOURCE_NOT_OWNED}
+
+//
+// MessageId: WORKER_INVALID
+//
+// MessageText:
+//
+//  
+//  A executive worker item was found in memory which must not contain such
+//  items.  Usually this is memory being freed.  This is usually caused by
+//  a device driver that has not cleaned up properly before freeing memory.
+//
+
+  WORKER_INVALID = ULONG($000000E4);
+  {$EXTERNALSYM WORKER_INVALID}
+
+implementation
+
+end.

+ 141 - 0
packages/extra/winunits/jwacderr.pas

@@ -0,0 +1,141 @@
+{******************************************************************************}
+{                                                                              }
+{ Common dialog error return codes API interface Unit for Object Pascal        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: cderr.h, released June 2000. The original Pascal       }
+{ code is: CdErr.pas, released December 2000. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaCdErr;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "cderr.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+const
+  CDERR_DIALOGFAILURE = $FFFF;
+  {$EXTERNALSYM CDERR_DIALOGFAILURE}
+
+  CDERR_GENERALCODES    = $0000;
+  {$EXTERNALSYM CDERR_GENERALCODES}
+  CDERR_STRUCTSIZE      = $0001;
+  {$EXTERNALSYM CDERR_STRUCTSIZE}
+  CDERR_INITIALIZATION  = $0002;
+  {$EXTERNALSYM CDERR_INITIALIZATION}
+  CDERR_NOTEMPLATE      = $0003;
+  {$EXTERNALSYM CDERR_NOTEMPLATE}
+  CDERR_NOHINSTANCE     = $0004;
+  {$EXTERNALSYM CDERR_NOHINSTANCE}
+  CDERR_LOADSTRFAILURE  = $0005;
+  {$EXTERNALSYM CDERR_LOADSTRFAILURE}
+  CDERR_FINDRESFAILURE  = $0006;
+  {$EXTERNALSYM CDERR_FINDRESFAILURE}
+  CDERR_LOADRESFAILURE  = $0007;
+  {$EXTERNALSYM CDERR_LOADRESFAILURE}
+  CDERR_LOCKRESFAILURE  = $0008;
+  {$EXTERNALSYM CDERR_LOCKRESFAILURE}
+  CDERR_MEMALLOCFAILURE = $0009;
+  {$EXTERNALSYM CDERR_MEMALLOCFAILURE}
+  CDERR_MEMLOCKFAILURE  = $000A;
+  {$EXTERNALSYM CDERR_MEMLOCKFAILURE}
+  CDERR_NOHOOK          = $000B;
+  {$EXTERNALSYM CDERR_NOHOOK}
+  CDERR_REGISTERMSGFAIL = $000C;
+  {$EXTERNALSYM CDERR_REGISTERMSGFAIL}
+
+  PDERR_PRINTERCODES     = $1000;
+  {$EXTERNALSYM PDERR_PRINTERCODES}
+  PDERR_SETUPFAILURE     = $1001;
+  {$EXTERNALSYM PDERR_SETUPFAILURE}
+  PDERR_PARSEFAILURE     = $1002;
+  {$EXTERNALSYM PDERR_PARSEFAILURE}
+  PDERR_RETDEFFAILURE    = $1003;
+  {$EXTERNALSYM PDERR_RETDEFFAILURE}
+  PDERR_LOADDRVFAILURE   = $1004;
+  {$EXTERNALSYM PDERR_LOADDRVFAILURE}
+  PDERR_GETDEVMODEFAIL   = $1005;
+  {$EXTERNALSYM PDERR_GETDEVMODEFAIL}
+  PDERR_INITFAILURE      = $1006;
+  {$EXTERNALSYM PDERR_INITFAILURE}
+  PDERR_NODEVICES        = $1007;
+  {$EXTERNALSYM PDERR_NODEVICES}
+  PDERR_NODEFAULTPRN     = $1008;
+  {$EXTERNALSYM PDERR_NODEFAULTPRN}
+  PDERR_DNDMMISMATCH     = $1009;
+  {$EXTERNALSYM PDERR_DNDMMISMATCH}
+  PDERR_CREATEICFAILURE  = $100A;
+  {$EXTERNALSYM PDERR_CREATEICFAILURE}
+  PDERR_PRINTERNOTFOUND  = $100B;
+  {$EXTERNALSYM PDERR_PRINTERNOTFOUND}
+  PDERR_DEFAULTDIFFERENT = $100C;
+  {$EXTERNALSYM PDERR_DEFAULTDIFFERENT}
+
+  CFERR_CHOOSEFONTCODES = $2000;
+  {$EXTERNALSYM CFERR_CHOOSEFONTCODES}
+  CFERR_NOFONTS         = $2001;
+  {$EXTERNALSYM CFERR_NOFONTS}
+  CFERR_MAXLESSTHANMIN  = $2002;
+  {$EXTERNALSYM CFERR_MAXLESSTHANMIN}
+
+  FNERR_FILENAMECODES   = $3000;
+  {$EXTERNALSYM FNERR_FILENAMECODES}
+  FNERR_SUBCLASSFAILURE = $3001;
+  {$EXTERNALSYM FNERR_SUBCLASSFAILURE}
+  FNERR_INVALIDFILENAME = $3002;
+  {$EXTERNALSYM FNERR_INVALIDFILENAME}
+  FNERR_BUFFERTOOSMALL  = $3003;
+  {$EXTERNALSYM FNERR_BUFFERTOOSMALL}
+
+  FRERR_FINDREPLACECODES = $4000;
+  {$EXTERNALSYM FRERR_FINDREPLACECODES}
+  FRERR_BUFFERLENGTHZERO = $4001;
+  {$EXTERNALSYM FRERR_BUFFERLENGTHZERO}
+
+  CCERR_CHOOSECOLORCODES = $5000;
+  {$EXTERNALSYM CCERR_CHOOSECOLORCODES}
+
+implementation
+
+end.

+ 281 - 0
packages/extra/winunits/jwacmnquery.pas

@@ -0,0 +1,281 @@
+{******************************************************************************}
+{                                                                              }
+{ ICommonQuery API interface Unit for Object Pascal                            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: cmnquery.h, released November 2001. The original Pascal}
+{ code is: CmnQuery.pas, released March 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaCmnQuery;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "cmnquery.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX, // IPersist todo objidl, ocidl
+  JwaWinUser, JwaWinType;
+
+const
+  IID_IQueryForm: TGUID = (D1:$8cfcee30; D2:$39bd; D3:$11d0; D4:($b8, $d1, $0, $a0, $24, $ab, $2d, $bb));
+  {$EXTERNALSYM IID_IQueryForm}
+  IID_IPersistQuery: TGUID = (D1:$1a3114b8; D2:$a62e; D3:$11d0; D4:($a6, $c5, $0, $a0, $c9, $06, $af, $45));
+  {$EXTERNALSYM IID_IPersistQuery}
+
+  CLSID_CommonQuery: TGUID = (D1:$83bc5ec0; D2:$6f2a; D3:$11d0; D4:($a1, $c4, $0, $aa, $00, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_CommonQuery}
+  IID_ICommonQuery: TGUID = (D1:$ab50dec0; D2:$6f1d; D3:$11d0; D4:($a1, $c4, $0, $aa, $00, $c1, $6e, $65));
+  {$EXTERNALSYM IID_ICommonQuery}
+
+//-----------------------------------------------------------------------------
+// IQueryForm
+//-----------------------------------------------------------------------------
+
+//
+// A query form object is registered under the query handlers CLSID,
+// a list is stored in the registry:
+//
+//  HKCR\CLSID\{CLSID query handler}\Forms
+//
+// For each form object there are server values which can be defined:
+//
+//  Flags           = flags for the form object:
+//                      QUERYFORM_CHANGESFORMLIST
+//                      QUERYFORM_CHANGESOPTFORMLIST
+//
+//  CLSID           = string containing the CLSID of the InProc server to invoke
+//                    to get the IQueryFormObject.
+//
+//  Forms           = a sub key containing the CLSIDs for the forms registered
+//                    by IQueryForm::AddForms (or modified by ::AddPages), if
+//                    the flags are 0, then we scan this list looking for a match
+//                    for the default form specified.
+//
+
+  QUERYFORM_CHANGESFORMLIST    = $000000001;
+  {$EXTERNALSYM QUERYFORM_CHANGESFORMLIST}
+  QUERYFORM_CHANGESOPTFORMLIST = $000000002;
+  {$EXTERNALSYM QUERYFORM_CHANGESOPTFORMLIST}
+
+//
+// Query Forms
+// ===========
+//  Query forms are registered and have query pages added to them, a form without
+//  pages is not displayed.  Each form has a unique CLSID to allow it to be
+//  selected by invoking the query dialog.
+//
+
+  CQFF_NOGLOBALPAGES = $0000001; // = 1 => doesn't have global pages added
+  {$EXTERNALSYM CQFF_NOGLOBALPAGES}
+  CQFF_ISOPTIONAL    = $0000002; // = 1 => form is hidden, unless optional forms requested
+  {$EXTERNALSYM CQFF_ISOPTIONAL}
+
+type
+  CQFORM = record
+    cbStruct: DWORD;
+    dwFlags: DWORD;
+    clsid: CLSID;
+    hIcon: HICON;
+    pszTitle: LPCWSTR;
+  end;
+  {$EXTERNALSYM CQFORM}
+  LPCQFORM = ^CQFORM;
+  {$EXTERNALSYM LPCQFORM}
+  TCQForm = CQFORM;
+  PCQForm = LPCQFORM;
+
+  LPCQADDFORMSPROC = function(lParam: LPARAM; pForm: LPCQFORM): HRESULT; stdcall;
+  {$EXTERNALSYM LPCQADDFORMSPROC}
+
+//
+// Query Form Pages
+// ================
+//  When a query form has been registered the caller can then add pages to it,
+//  any form can have pages appended.
+//
+
+  _cqpage = record
+    cbStruct: DWORD;
+    dwFlags: DWORD;
+    pPageProc: Pointer{LPCQPAGEPROC};
+    hInstance: HINSTANCE;
+    idPageName: Integer;
+    idPageTemplate: Integer;
+    pDlgProc: DLGPROC;
+    lParam: LPARAM;
+  end;
+  {$EXTERNALSYM _cqpage}
+  CQPAGE = _cqpage;
+  {$EXTERNALSYM CQPAGE}
+  LPCQPAGE = ^CQPAGE;
+  {$EXTERNALSYM LPCQPAGE}
+  TCQPage = CQPAGE;
+  PCQPage = LPCQPAGE;
+
+  LPCQADDPAGESPROC = function(lParam: LPARAM; const clsidForm: CLSID; pPage: LPCQPAGE): HRESULT; stdcall;
+  {$EXTERNALSYM LPCQADDPAGESPROC}
+  LPCQPAGEPROC = function(pPage: LPCQPAGE; hwnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): HRESULT; stdcall;
+  {$EXTERNALSYM LPCQPAGEPROC}
+
+//
+// IQueryForm interfaces
+//
+
+  IQueryForm = interface(IUnknown)
+  ['{8cfcee30-39bd-11d0-b8d1-00a024ab2dbb}']
+    function Initialize(hkForm: HKEY): HRESULT; stdcall;
+    function AddForms(pAddFormsProc: LPCQADDPAGESPROC; lParam: LPARAM): HRESULT; stdcall;
+    function AddPages(pAddPagesProc: LPCQADDPAGESPROC; lParam: LPARAM): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IQueryForm}
+
+//
+// Messages for pages
+//
+
+const
+  CQPM_INITIALIZE           = $00000001;
+  {$EXTERNALSYM CQPM_INITIALIZE}
+  CQPM_RELEASE              = $00000002;
+  {$EXTERNALSYM CQPM_RELEASE}
+  CQPM_ENABLE               = $00000003; // wParam = TRUE/FALSE (enable, disable), lParam = 0
+  {$EXTERNALSYM CQPM_ENABLE}
+  CQPM_GETPARAMETERS        = $00000005; // wParam = 0, lParam = -> receives the LocalAlloc
+  {$EXTERNALSYM CQPM_GETPARAMETERS}
+  CQPM_CLEARFORM            = $00000006; // wParam, lParam = 0
+  {$EXTERNALSYM CQPM_CLEARFORM}
+  CQPM_PERSIST              = $00000007; // wParam = fRead, lParam -> IPersistQuery
+  {$EXTERNALSYM CQPM_PERSIST}
+  CQPM_HELP                 = $00000008; // wParam = 0, lParam -> LPHELPINFO
+  {$EXTERNALSYM CQPM_HELP}
+  CQPM_SETDEFAULTPARAMETERS = $00000009; // wParam = 0, lParam -> OPENQUERYWINDOW
+  {$EXTERNALSYM CQPM_SETDEFAULTPARAMETERS}
+
+  CQPM_HANDLERSPECIFIC      = $10000000;
+  {$EXTERNALSYM CQPM_HANDLERSPECIFIC}
+
+//-----------------------------------------------------------------------------
+// IPersistQuery
+//-----------------------------------------------------------------------------
+
+// IPersistQuery interface
+
+type
+  IPersistQuery = interface(IPersist)
+  ['{1a3114b8-a62e-11d0-a6c5-00a0c906af45}']
+    function WriteString(pSection, pValueName, pValue: LPCWSTR): HRESULT; stdcall;
+    function ReadString(pSection, pValueName, pBuffer: LPWSTR; cchBuffer: Integer): HRESULT; stdcall;
+    function WriteInt(pSection, pValueName: LPCWSTR; value: Integer): HRESULT; stdcall;
+    function ReadInt(pSection, pValueName: LPCWSTR; pValue: LPINT): HRESULT; stdcall;
+    function WriteStruct(pSection, pValueName: LPCWSTR; pStruct: LPVOID; cbStruct: DWORD): HRESULT; stdcall;
+    function ReadStruct(pSection, pValueName: LPCWSTR; pStruct: LPVOID; cbStruct: DWORD): HRESULT; stdcall;
+    function Clear: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IPersistQuery}
+
+//-----------------------------------------------------------------------------
+// ICommonQuery
+//-----------------------------------------------------------------------------
+
+const
+  OQWF_OKCANCEL           = $00000001; // = 1 => Provide OK/Cancel buttons
+  {$EXTERNALSYM OQWF_OKCANCEL}
+  OQWF_DEFAULTFORM        = $00000002; // = 1 => clsidDefaultQueryForm is valid
+  {$EXTERNALSYM OQWF_DEFAULTFORM}
+  OQWF_SINGLESELECT       = $00000004; // = 1 => view to have single selection (depends on viewer)
+  {$EXTERNALSYM OQWF_SINGLESELECT}
+  OQWF_LOADQUERY          = $00000008; // = 1 => use the IPersistQuery to load the given query
+  {$EXTERNALSYM OQWF_LOADQUERY}
+  OQWF_REMOVESCOPES       = $00000010; // = 1 => remove scope picker from dialog
+  {$EXTERNALSYM OQWF_REMOVESCOPES}
+  OQWF_REMOVEFORMS        = $00000020; // = 1 => remove form picker from dialog
+  {$EXTERNALSYM OQWF_REMOVEFORMS}
+  OQWF_ISSUEONOPEN        = $00000040; // = 1 => issue query on opening the dialog
+  {$EXTERNALSYM OQWF_ISSUEONOPEN}
+  OQWF_SHOWOPTIONAL       = $00000080; // = 1 => list optional forms by default
+  {$EXTERNALSYM OQWF_SHOWOPTIONAL}
+  OQWF_SAVEQUERYONOK      = $00000200; // = 1 => use the IPersistQuery to write the query on close
+  {$EXTERNALSYM OQWF_SAVEQUERYONOK}
+  OQWF_HIDEMENUS          = $00000400; // = 1 => no menu bar displayed
+  {$EXTERNALSYM OQWF_HIDEMENUS}
+  OQWF_HIDESEARCHUI       = $00000800; // = 1 => dialog is filter, therefore start, stop, new search etc
+  {$EXTERNALSYM OQWF_HIDESEARCHUI}
+
+  OQWF_PARAMISPROPERTYBAG = DWORD($80000000); // = 1 => the form parameters ptr is an IPropertyBag (ppbFormParameters)
+  {$EXTERNALSYM OQWF_PARAMISPROPERTYBAG}
+
+type
+  OPENQUERYWINDOW = record
+    cbStruct: DWORD;                   // structure size
+    dwFlags: DWORD;                    // flags (OQFW_*)
+    clsidHandler: CLSID;               // clsid of handler we are using
+    pHandlerParameters: LPVOID;        // handler specific structure for initialization
+    clsidDefaultForm: CLSID;           // default form to be selected (if OQF_DEFAULTFORM == 1 )
+    pPersistQuery: IPersistQuery;      // IPersistQuery used for loading queries
+    //mvb IPropertyBag is an interface which needs finalization and therefor can't be present in a variant record
+    //case Integer of
+    //  0: (pFormParameters: Pointer);
+    //  1: (ppbFormParameters: IPropertyBag);
+    case Integer of
+      0: (pFormParameters: Pointer);
+      1: (ppbFormParameters: Pointer);
+  end;
+  {$EXTERNALSYM OPENQUERYWINDOW}
+  LPOPENQUERYWINDOW = ^OPENQUERYWINDOW;
+  {$EXTERNALSYM LPOPENQUERYWINDOW}
+  TOpenQueryWindow = OPENQUERYWINDOW;
+  POpenQueryWindow = LPOPENQUERYWINDOW;
+
+// ICommonQuery
+
+  ICommonQuery = interface(IUnknown)
+  ['{ab50dec0-6f1d-11d0-a1c4-00aa00c16e65}']
+    function OpenQueryWindow(hwndParent: HWND; pQueryWnd: LPOPENQUERYWINDOW; out ppDataObject: IDataObject): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM ICommonQuery}
+
+implementation
+
+end.

+ 135 - 0
packages/extra/winunits/jwacolordlg.pas

@@ -0,0 +1,135 @@
+{******************************************************************************}
+{                                                                              }
+{ Win32 color dialog API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: colordlg.h, released June 2000. The original Pascal    }
+{ code is: ColorDlg.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaColorDlg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "colordlg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//
+//  Constant Declarations.
+//
+
+const
+  DLG_COLOR = 10;
+  {$EXTERNALSYM DLG_COLOR}
+
+  COLOR_HUESCROLL = 700; // color dialog
+  {$EXTERNALSYM COLOR_HUESCROLL}
+  COLOR_SATSCROLL = 701;
+  {$EXTERNALSYM COLOR_SATSCROLL}
+  COLOR_LUMSCROLL = 702;
+  {$EXTERNALSYM COLOR_LUMSCROLL}
+  COLOR_HUE       = 703;
+  {$EXTERNALSYM COLOR_HUE}
+  COLOR_SAT       = 704;
+  {$EXTERNALSYM COLOR_SAT}
+  COLOR_LUM       = 705;
+  {$EXTERNALSYM COLOR_LUM}
+  COLOR_RED       = 706;
+  {$EXTERNALSYM COLOR_RED}
+  COLOR_GREEN     = 707;
+  {$EXTERNALSYM COLOR_GREEN}
+  COLOR_BLUE      = 708;
+  {$EXTERNALSYM COLOR_BLUE}
+  COLOR_CURRENT   = 709;
+  {$EXTERNALSYM COLOR_CURRENT}
+  COLOR_RAINBOW   = 710;
+  {$EXTERNALSYM COLOR_RAINBOW}
+  COLOR_SAVE      = 711;
+  {$EXTERNALSYM COLOR_SAVE}
+  COLOR_ADD       = 712;
+  {$EXTERNALSYM COLOR_ADD}
+  COLOR_SOLID     = 713;
+  {$EXTERNALSYM COLOR_SOLID}
+  COLOR_TUNE      = 714;
+  {$EXTERNALSYM COLOR_TUNE}
+  COLOR_SCHEMES   = 715;
+  {$EXTERNALSYM COLOR_SCHEMES}
+  COLOR_ELEMENT   = 716;
+  {$EXTERNALSYM COLOR_ELEMENT}
+  COLOR_SAMPLES   = 717;
+  {$EXTERNALSYM COLOR_SAMPLES}
+  COLOR_PALETTE   = 718;
+  {$EXTERNALSYM COLOR_PALETTE}
+  COLOR_MIX       = 719;
+  {$EXTERNALSYM COLOR_MIX}
+  COLOR_BOX1      = 720;
+  {$EXTERNALSYM COLOR_BOX1}
+  COLOR_CUSTOM1   = 721;
+  {$EXTERNALSYM COLOR_CUSTOM1}
+
+  COLOR_HUEACCEL   = 723;
+  {$EXTERNALSYM COLOR_HUEACCEL}
+  COLOR_SATACCEL   = 724;
+  {$EXTERNALSYM COLOR_SATACCEL}
+  COLOR_LUMACCEL   = 725;
+  {$EXTERNALSYM COLOR_LUMACCEL}
+  COLOR_REDACCEL   = 726;
+  {$EXTERNALSYM COLOR_REDACCEL}
+  COLOR_GREENACCEL = 727;
+  {$EXTERNALSYM COLOR_GREENACCEL}
+  COLOR_BLUEACCEL  = 728;
+  {$EXTERNALSYM COLOR_BLUEACCEL}
+
+  COLOR_SOLID_LEFT  = 730;
+  {$EXTERNALSYM COLOR_SOLID_LEFT}
+  COLOR_SOLID_RIGHT = 731;
+  {$EXTERNALSYM COLOR_SOLID_RIGHT}
+
+  NUM_BASIC_COLORS  = 48;
+  {$EXTERNALSYM NUM_BASIC_COLORS}
+  NUM_CUSTOM_COLORS = 16;
+  {$EXTERNALSYM NUM_CUSTOM_COLORS}
+
+implementation
+
+end.

+ 297 - 0
packages/extra/winunits/jwacpl.pas

@@ -0,0 +1,297 @@
+{******************************************************************************}
+{                                                                              }
+{ Control Panel Applets Interface Unit for Object Pascal                       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: cpl.h, released June 2000. The original Pascal         }
+{ code is: Cpl.pas, released December 2000. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaCpl;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "cpl.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinUser, JwaWinType;
+
+//
+// General rules for being installed in the Control Panel:
+//
+//     1) The DLL must export a function named CPlApplet which will handle
+//        the messages discussed below.
+//     2) If the applet needs to save information in CONTROL.INI minimize
+//        clutter by using the application name [MMCPL.appletname].
+//     2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
+//        the following form:
+//             ...
+//             [MMCPL]
+//             uniqueName=c:\mydir\myapplet.dll
+//             ...
+//
+//
+// The order applet DLL's are loaded by CONTROL.EXE is not guaranteed.
+// Control panels may be sorted for display, etc.
+//
+//
+
+// #include <pshpack1.h>   // Assume byte packing throughout
+
+//
+// CONTROL.EXE will answer this message and launch an applet
+//
+// WM_CPL_LAUNCH
+//
+//      wParam      - window handle of calling app
+//      lParam      - LPTSTR of name of applet to launch
+//
+// WM_CPL_LAUNCHED
+//
+//      wParam      - TRUE/FALSE if applet was launched
+//      lParam      - NULL
+//
+// CONTROL.EXE will post this message to the caller when the applet returns
+// (ie., when wParam is a valid window handle)
+//
+//
+
+const
+  WM_CPL_LAUNCH   = WM_USER + 1000;
+  {$EXTERNALSYM WM_CPL_LAUNCH}
+  WM_CPL_LAUNCHED = WM_USER + 1001;
+  {$EXTERNALSYM WM_CPL_LAUNCHED}
+
+// A function prototype for CPlApplet()
+
+type
+  APPLET_PROC = function(hwndCpl: HWND; msg: UINT;
+    lParam1, lParam2: LPARAM): LONG; stdcall;
+  {$EXTERNALSYM APPLET_PROC}
+  TCPLApplet = APPLET_PROC;
+
+// The data structure CPlApplet() must fill in.
+
+  LPCPLINFO = ^CPLINFO;
+  {$EXTERNALSYM LPCPLINFO}
+  tagCPLINFO = packed record
+    idIcon: Integer; // icon resource id, provided by CPlApplet()
+    idName: Integer; // name string res. id, provided by CPlApplet()
+    idInfo: Integer; // info string res. id, provided by CPlApplet()
+    lData: LONG_PTR; // user defined data
+  end;
+  {$EXTERNALSYM tagCPLINFO}
+  CPLINFO = tagCPLINFO;
+  {$EXTERNALSYM CPLINFO}
+  TCplInfo = CPLINFO;
+  PCplInfo = LPCPLINFO;
+
+  LPNEWCPLINFOA = ^NEWCPLINFOA;
+  {$EXTERNALSYM LPNEWCPLINFOA}
+  tagNEWCPLINFOA = packed record
+    dwSize: DWORD;                       // similar to the commdlg
+    dwFlags: DWORD;
+    dwHelpContext: DWORD;                // help context to use
+    lData: LONG_PTR;                     // user defined data
+    hIcon: HICON; // icon to use, this is owned by CONTROL.EXE (may be deleted)
+    szName: array [0..31] of CHAR;       // short name
+    szInfo: array [0..63] of CHAR;       // long name (status line)
+    szHelpFile: array [0..127] of CHAR;  // path to help file to use
+  end;
+  {$EXTERNALSYM tagNEWCPLINFOA}
+  NEWCPLINFOA = tagNEWCPLINFOA;
+  {$EXTERNALSYM NEWCPLINFOA}
+  TNewCplInfoA = NEWCPLINFOA;
+  PNewCplInfoA = LPNEWCPLINFOA;
+
+  LPNEWCPLINFOW = ^NEWCPLINFOW;
+  {$EXTERNALSYM LPNEWCPLINFOW}
+  tagNEWCPLINFOW = packed record
+    dwSize: DWORD;                       // similar to the commdlg
+    dwFlags: DWORD;
+    dwHelpContext: DWORD;                // help context to use
+    lData: LONG_PTR;                     // user defined data
+    hIcon: HICON; // icon to use, this is owned by CONTROL.EXE (may be deleted)
+    szName: array [0..31] of WCHAR;      // short name
+    szInfo: array [0..63] of WCHAR;      // long name (status line)
+    szHelpFile: array [0..127] of WCHAR; // path to help file to use
+  end;
+  {$EXTERNALSYM tagNEWCPLINFOW}
+  NEWCPLINFOW = tagNEWCPLINFOW;
+  {$EXTERNALSYM NEWCPLINFOW}
+  TNewCplInfoW = NEWCPLINFOW;
+  PNewCplInfoW = LPNEWCPLINFOW;
+
+  {$IFDEF UNICODE}
+  NEWCPLINFO = NEWCPLINFOW;
+  {$EXTERNALSYM NEWCPLINFO}
+  LPNEWCPLINFO = LPNEWCPLINFOW;
+  {$EXTERNALSYM LPNEWCPLINFO}
+  TNewCplInfo = TNewCplInfoW;
+  PNewCplInfo = PNewCplInfoW;
+  {$ELSE}
+  NEWCPLINFO = NEWCPLINFOA;
+  {$EXTERNALSYM NEWCPLINFO}
+  LPNEWCPLINFO = LPNEWCPLINFOA;
+  {$EXTERNALSYM LPNEWCPLINFO}
+  TNewCplInfo = TNewCplInfoA;
+  PNewCplInfo = PNewCplInfoA;
+  {$ENDIF UNICODE}
+
+const
+  CPL_DYNAMIC_RES = 0;
+  {$EXTERNALSYM CPL_DYNAMIC_RES}
+
+// This constant may be used in place of real resource IDs for the idIcon,
+// idName or idInfo members of the CPLINFO structure.  Normally, the system
+// uses these values to extract copies of the resources and store them in a
+// cache.  Once the resource information is in the cache, the system does not
+// need to load a CPL unless the user actually tries to use it.
+// CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
+// load the CPL every time it needs to display information about an item.  This
+// allows a CPL to dynamically decide what information will be displayed, but
+// is SIGNIFICANTLY SLOWER than displaying information from a cache.
+// Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
+// runtime status of some device in order to provide text or icons to display.
+
+// The messages CPlApplet() must handle:
+
+  CPL_INIT = 1;
+  {$EXTERNALSYM CPL_INIT}
+
+//  This message is sent to indicate CPlApplet() was found.
+//  lParam1 and lParam2 are not defined.
+//  Return TRUE or FALSE indicating whether the control panel should proceed.
+
+  CPL_GETCOUNT = 2;
+  {$EXTERNALSYM CPL_GETCOUNT}
+
+//  This message is sent to determine the number of applets to be displayed.
+//  lParam1 and lParam2 are not defined.
+//  Return the number of applets you wish to display in the control
+//  panel window.
+
+  CPL_INQUIRE = 3;
+  {$EXTERNALSYM CPL_INQUIRE}
+
+//  This message is sent for information about each applet.
+
+//  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES.
+//  The developer must not make any assumptions about the order or dependance
+//  of CPL inquiries.
+
+//  lParam1 is the applet number to register, a value from 0 to
+//  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure.
+//  Fill in CPLINFO's idIcon, idName, idInfo and lData fields with
+//  the resource id for an icon to display, name and description string ids,
+//  and a long data item associated with applet #lParam1.  This information
+//  may be cached by the caller at runtime and/or across sessions.
+//  To prevent caching, see CPL_DYNAMIC_RES, above.
+
+  CPL_SELECT = 4;
+  {$EXTERNALSYM CPL_SELECT}
+
+//  The CPL_SELECT message has been deleted.
+
+  CPL_DBLCLK = 5;
+  {$EXTERNALSYM CPL_DBLCLK}
+
+//  This message is sent when the applet's icon has been double-clicked
+//  upon.  lParam1 is the applet number which was selected.  lParam2 is the
+//  applet's lData value.
+//  This message should initiate the applet's dialog box.
+
+  CPL_STOP = 6;
+  {$EXTERNALSYM CPL_STOP}
+
+//  This message is sent for each applet when the control panel is exiting.
+//  lParam1 is the applet number.  lParam2 is the applet's lData  value.
+//  Do applet specific cleaning up here.
+
+  CPL_EXIT = 7;
+  {$EXTERNALSYM CPL_EXIT}
+
+//  This message is sent just before the control panel calls FreeLibrary.
+//  lParam1 and lParam2 are not defined.
+//  Do non-applet specific cleaning up here.
+
+  CPL_NEWINQUIRE = 8;
+  {$EXTERNALSYM CPL_NEWINQUIRE}
+
+// Same as CPL_INQUIRE execpt lParam2 is a pointer to a NEWCPLINFO struct.
+
+//  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES.
+//  The developer must not make any assumptions about the order or dependance
+//  of CPL inquiries.
+
+  CPL_STARTWPARMSA = 9;
+  {$EXTERNALSYM CPL_STARTWPARMSA}
+  CPL_STARTWPARMSW = 10;
+  {$EXTERNALSYM CPL_STARTWPARMSW}
+
+  {$IFDEF UNICODE}
+  CPL_STARTWPARMS = CPL_STARTWPARMSW;
+  {$EXTERNALSYM CPL_STARTWPARMS}
+  {$ELSE}
+  CPL_STARTWPARMS = CPL_STARTWPARMSA;
+  {$EXTERNALSYM CPL_STARTWPARMS}
+  {$ENDIF UNICODE}
+
+// this message parallels CPL_DBLCLK in that the applet should initiate
+// its dialog box.  where it differs is that this invocation is coming
+// out of RUNDLL, and there may be some extra directions for execution.
+// lParam1: the applet number.
+// lParam2: an LPSTR to any extra directions that might exist.
+// returns: TRUE if the message was handled; FALSE if not.
+
+// This message is internal to the Control Panel and MAIN applets.
+// It is only sent when an applet is invoked from the Command line
+// during system installation.
+
+  CPL_SETUP = 200;
+  {$EXTERNALSYM CPL_SETUP}
+
+implementation
+
+end.

+ 107 - 0
packages/extra/winunits/jwacplext.pas

@@ -0,0 +1,107 @@
+{******************************************************************************}
+{                                                                              }
+{ Control Panel Applet Extensions interface Unit for Object Pascal             }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: cplext.h, released June 2000. The original Pascal      }
+{ code is: CplExt.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaCplext;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "Cplext.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+///////////////////////////////////////////////////////////////////////////////
+//  Below are constants for pages which can be replaced in the standard control
+// panel applets.  To extend an applet, you must define an object which
+// supports the IShellPropSheetExt interface and register it's in-process
+// server in a subkey under the applet's registry key.  Registry paths for the
+// applets are defined in the header file REGSTR.H
+//  Generally, when an IShellPropSheetExt is loaded, it's AddPages method
+// will be called once, while it's ReplacePage method may be called zero or
+// more times.  ReplacePage is only called in context.
+///////////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------------------------------
+// Mouse Control Panel Extensions
+// The following constants MAY be passed in IShellPropSheetExt::ReplacePage's
+// uPageID parameter for servers registered under
+//                                  ( REGSTR_PATH_CONTROLSFOLDER "\\Mouse" )
+//-----------------------------------------------------------------------------
+
+const
+  CPLPAGE_MOUSE_BUTTONS      = 1;
+  {$EXTERNALSYM CPLPAGE_MOUSE_BUTTONS}
+  CPLPAGE_MOUSE_PTRMOTION    = 2;
+  {$EXTERNALSYM CPLPAGE_MOUSE_PTRMOTION}
+  CPLPAGE_MOUSE_WHEEL        = 3;
+  {$EXTERNALSYM CPLPAGE_MOUSE_WHEEL}
+
+//-----------------------------------------------------------------------------
+// Keyboard Control Panel Extensions
+// The following constants MAY be passed in IShellPropSheetExt::ReplacePage's
+// uPageID parameter for servers registered under
+//                                  ( REGSTR_PATH_CONTROLSFOLDER "\\Keyboard" )
+//-----------------------------------------------------------------------------
+
+  CPLPAGE_KEYBOARD_SPEED     = 1;
+  {$EXTERNALSYM CPLPAGE_KEYBOARD_SPEED}
+
+//-----------------------------------------------------------------------------
+// Display Control Panel Extensions
+// The following constants MAY be passed in IShellPropSheetExt::ReplacePage's
+// uPageID parameter for servers registered under
+//                                  ( REGSTR_PATH_CONTROLSFOLDER "\\Display" )
+//-----------------------------------------------------------------------------
+
+  CPLPAGE_DISPLAY_BACKGROUND = 1;
+  {$EXTERNALSYM CPLPAGE_DISPLAY_BACKGROUND}
+
+///////////////////////////////////////////////////////////////////////////////
+
+implementation
+
+end.

+ 157 - 0
packages/extra/winunits/jwacryptuiapi.pas

@@ -0,0 +1,157 @@
+{******************************************************************************}
+{                                                                              }
+{ Cryptographic UI API interface Unit for Object Pascal                        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: cryptuiapi.h, released August 2001. The original Pascal}
+{ code is: CryptUIApi.pas, released December 2001. The initial developer of the}
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaCryptUIApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "cryptuiapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinCrypt, JwaWinType;
+
+// #include <pshpack8.h>
+
+//+-------------------------------------------------------------------------
+//  Dialog viewer of a certificate, CTL or CRL context.
+//
+//  dwContextType and associated pvContext's
+//      CERT_STORE_CERTIFICATE_CONTEXT  PCCERT_CONTEXT
+//      CERT_STORE_CRL_CONTEXT          PCCRL_CONTEXT
+//      CERT_STORE_CTL_CONTEXT          PCCTL_CONTEXT
+//
+//  dwFlags currently isn't used and should be set to 0.
+//--------------------------------------------------------------------------
+
+function CryptUIDlgViewContext(dwContextType: DWORD; pvContext: LPVOID; hwnd: HWND; pwszTitle: LPCWSTR;
+  dwFlags: DWORD; pvReserved: LPVOID): BOOL; stdcall;
+{$EXTERNALSYM CryptUIDlgViewContext}
+
+//+-------------------------------------------------------------------------
+//  Dialog to select a certificate from the specified store.
+//
+//  Returns the selected certificate context. If no certificate was
+//  selected, NULL is returned.
+//
+//  pwszTitle is either NULL or the title to be used for the dialog.
+//  If NULL, the default title is used.  The default title is
+//  "Select Certificate".
+//
+//  pwszDisplayString is either NULL or the text statement in the selection
+//  dialog.  If NULL, the default phrase
+//  "Select a certificate you wish to use" is used in the dialog.
+//
+//  dwDontUseColumn can be set to exclude columns from the selection
+//  dialog. See the CRYPTDLG_SELECTCERT_*_COLUMN definitions below.
+//
+//  dwFlags currently isn't used and should be set to 0.
+//--------------------------------------------------------------------------
+
+function CryptUIDlgSelectCertificateFromStore(hCertStore: HCERTSTORE; hwnd: HWND; pwszTitle, pwszDisplayString: LPCWSTR;
+  dwDontUseColumn, dwFlags: DWORD; pvReserved: LPVOID): PCCERT_CONTEXT; stdcall;
+{$EXTERNALSYM CryptUIDlgSelectCertificateFromStore}
+
+// flags for dwDontUseColumn
+
+const
+  CRYPTUI_SELECT_ISSUEDTO_COLUMN       = $000000001;
+  {$EXTERNALSYM CRYPTUI_SELECT_ISSUEDTO_COLUMN}
+  CRYPTUI_SELECT_ISSUEDBY_COLUMN       = $000000002;
+  {$EXTERNALSYM CRYPTUI_SELECT_ISSUEDBY_COLUMN}
+  CRYPTUI_SELECT_INTENDEDUSE_COLUMN    = $000000004;
+  {$EXTERNALSYM CRYPTUI_SELECT_INTENDEDUSE_COLUMN}
+  CRYPTUI_SELECT_FRIENDLYNAME_COLUMN   = $000000008;
+  {$EXTERNALSYM CRYPTUI_SELECT_FRIENDLYNAME_COLUMN}
+  CRYPTUI_SELECT_LOCATION_COLUMN       = $000000010;
+  {$EXTERNALSYM CRYPTUI_SELECT_LOCATION_COLUMN}
+  CRYPTUI_SELECT_EXPIRATION_COLUMN     = $000000020;
+  {$EXTERNALSYM CRYPTUI_SELECT_EXPIRATION_COLUMN}
+
+implementation
+
+const
+  cryptuiapi = 'cryptui.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _CryptUIDlgViewContext: Pointer;
+
+function CryptUIDlgViewContext;
+begin
+  GetProcedureAddress(_CryptUIDlgViewContext, cryptuiapi, 'CryptUIDlgViewContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CryptUIDlgViewContext]
+  end;
+end;
+
+var
+  _CryptUIDlgSelCertFromStore: Pointer;
+
+function CryptUIDlgSelectCertificateFromStore;
+begin
+  GetProcedureAddress(_CryptUIDlgSelCertFromStore, cryptuiapi, 'CryptUIDlgSelectCertificateFromStore');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CryptUIDlgSelCertFromStore]
+  end;
+end;
+
+{$ELSE}
+
+function CryptUIDlgViewContext; external cryptuiapi name 'CryptUIDlgViewContext';
+function CryptUIDlgSelectCertificateFromStore; external cryptuiapi name 'CryptUIDlgSelectCertificateFromStore';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 673 - 0
packages/extra/winunits/jwadbt.pas

@@ -0,0 +1,673 @@
+{******************************************************************************}
+{                                                                              }
+{ Equates for WM_DEVICECHANGE and BroadcastSystemMessage for Object Pascal     }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dbt.h, released June 2000. The original Pascal         }
+{ code is: Dbt.pas, released December 2000. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDbt;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dbt.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaWinUser;
+
+//
+// BroadcastSpecialMessage constants.
+//
+
+const
+  WM_DEVICECHANGE = $0219;
+  {$EXTERNALSYM WM_DEVICECHANGE}
+
+(*
+ * Broadcast message and receipient flags.
+ *
+ * Note that there is a third "flag". If the wParam has:
+ *
+ * bit 15 on:   lparam is a pointer and bit 14 is meaningfull.
+ * bit 15 off:  lparam is just a UNLONG data type.
+ *
+ * bit 14 on:   lparam is a pointer to an ASCIIZ string.
+ * bit 14 off:  lparam is a pointer to a binary struture starting with
+ *              a dword describing the length of the structure.
+ *)
+
+  BSF_QUERY              = $00000001;
+  {$EXTERNALSYM BSF_QUERY}
+  BSF_IGNORECURRENTTASK  = $00000002;     // Meaningless for VxDs
+  {$EXTERNALSYM BSF_IGNORECURRENTTASK}
+  BSF_FLUSHDISK          = $00000004;     // Shouldn't be used by VxDs
+  {$EXTERNALSYM BSF_FLUSHDISK}
+  BSF_NOHANG             = $00000008;
+  {$EXTERNALSYM BSF_NOHANG}
+  BSF_POSTMESSAGE        = $00000010;
+  {$EXTERNALSYM BSF_POSTMESSAGE}
+  BSF_FORCEIFHUNG        = $00000020;
+  {$EXTERNALSYM BSF_FORCEIFHUNG}
+  BSF_NOTIMEOUTIFNOTHUNG = $00000040;
+  {$EXTERNALSYM BSF_NOTIMEOUTIFNOTHUNG}
+  BSF_MSGSRV32ISOK       = $80000000;     // Called synchronously from PM API
+  {$EXTERNALSYM BSF_MSGSRV32ISOK}
+  BSF_MSGSRV32ISOK_BIT   = 31;            // Called synchronously from PM API
+  {$EXTERNALSYM BSF_MSGSRV32ISOK_BIT}
+
+  BSM_ALLCOMPONENTS      = $00000000;
+  {$EXTERNALSYM BSM_ALLCOMPONENTS}
+  BSM_VXDS               = $00000001;
+  {$EXTERNALSYM BSM_VXDS}
+  BSM_NETDRIVER          = $00000002;
+  {$EXTERNALSYM BSM_NETDRIVER}
+  BSM_INSTALLABLEDRIVERS = $00000004;
+  {$EXTERNALSYM BSM_INSTALLABLEDRIVERS}
+  BSM_APPLICATIONS       = $00000008;
+  {$EXTERNALSYM BSM_APPLICATIONS}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_APPYBEGIN
+ * lParam  = (not used)
+ *
+ *      'Appy-time is now available.  This message is itself sent
+ *      at 'Appy-time.
+ *
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_APPYEND
+ * lParam  = (not used)
+ *
+ *      'Appy-time is no longer available.  This message is *NOT* sent
+ *      at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
+ *
+ * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
+ * multiple times during a single Windows session.  Each appearance of
+ * 'Appy-time is bracketed by these two messages, but 'Appy-time may
+ * momentarily become unavailable during otherwise normal Windows
+ * processing.  The current status of 'Appy-time availability can always
+ * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
+ *)
+
+  DBT_APPYBEGIN = $0000;
+  {$EXTERNALSYM DBT_APPYBEGIN}
+  DBT_APPYEND   = $0001;
+  {$EXTERNALSYM DBT_APPYEND}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_DEVNODES_CHANGED
+ * lParam  = 0
+ *
+ *      send when configmg finished a process tree batch. Some devnodes
+ *      may have been added or removed. This is used by ring3 people which
+ *      need to be refreshed whenever any devnode changed occur (like
+ *      device manager). People specific to certain devices should use
+ *      DBT_DEVICE* instead.
+ *)
+
+  DBT_DEVNODES_CHANGED = $0007;
+  {$EXTERNALSYM DBT_DEVNODES_CHANGED}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_QUERYCHANGECONFIG
+ * lParam  = 0
+ *
+ *      sent to ask if a config change is allowed
+ *)
+
+  DBT_QUERYCHANGECONFIG = $0017;
+  {$EXTERNALSYM DBT_QUERYCHANGECONFIG}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_CONFIGCHANGED
+ * lParam  = 0
+ *
+ *      sent when a config has changed
+ *)
+
+  DBT_CONFIGCHANGED = $0018;
+  {$EXTERNALSYM DBT_CONFIGCHANGED}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_CONFIGCHANGECANCELED
+ * lParam  = 0
+ *
+ *      someone cancelled the config change
+ *)
+
+  DBT_CONFIGCHANGECANCELED = $0019;
+  {$EXTERNALSYM DBT_CONFIGCHANGECANCELED}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_MONITORCHANGE
+ * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
+ *           if 0, use the default res for current config
+ *
+ *      this message is sent when the display monitor has changed
+ *      and the system should change the display mode to match it.
+ *)
+
+  DBT_MONITORCHANGE = $001B;
+  {$EXTERNALSYM DBT_MONITORCHANGE}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_SHELLLOGGEDON
+ * lParam  = 0
+ *
+ *      The shell has finished login on: VxD can now do Shell_EXEC.
+ *)
+
+  DBT_SHELLLOGGEDON = $0020;
+  {$EXTERNALSYM DBT_SHELLLOGGEDON}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_CONFIGMGAPI
+ * lParam  = CONFIGMG API Packet
+ *
+ *      CONFIGMG ring 3 call.
+ *)
+
+  DBT_CONFIGMGAPI32 = $0022;
+  {$EXTERNALSYM DBT_CONFIGMGAPI32}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_VXDINITCOMPLETE
+ * lParam  = 0
+ *
+ *      CONFIGMG ring 3 call.
+ *)
+
+  DBT_VXDINITCOMPLETE = $0023;
+  {$EXTERNALSYM DBT_VXDINITCOMPLETE}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_VOLLOCK*
+ * lParam  = pointer to VolLockBroadcast structure described below
+ *
+ *      Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
+ *      All these messages pass a pointer to a struct which has no pointers.
+ *)
+
+  DBT_VOLLOCKQUERYLOCK    = $8041;
+  {$EXTERNALSYM DBT_VOLLOCKQUERYLOCK}
+  DBT_VOLLOCKLOCKTAKEN    = $8042;
+  {$EXTERNALSYM DBT_VOLLOCKLOCKTAKEN}
+  DBT_VOLLOCKLOCKFAILED   = $8043;
+  {$EXTERNALSYM DBT_VOLLOCKLOCKFAILED}
+  DBT_VOLLOCKQUERYUNLOCK  = $8044;
+  {$EXTERNALSYM DBT_VOLLOCKQUERYUNLOCK}
+  DBT_VOLLOCKLOCKRELEASED = $8045;
+  {$EXTERNALSYM DBT_VOLLOCKLOCKRELEASED}
+  DBT_VOLLOCKUNLOCKFAILED = $8046;
+  {$EXTERNALSYM DBT_VOLLOCKUNLOCKFAILED}
+
+(*
+ * Device broadcast header
+ *)
+
+type
+  _DEV_BROADCAST_HDR = record
+    dbch_size: DWORD;
+    dbch_devicetype: DWORD;
+    dbch_reserved: DWORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_HDR}
+  DEV_BROADCAST_HDR = _DEV_BROADCAST_HDR;
+  {$EXTERNALSYM DEV_BROADCAST_HDR}
+  PDEV_BROADCAST_HDR = ^DEV_BROADCAST_HDR;
+  {$EXTERNALSYM PDEV_BROADCAST_HDR}
+  TDevBroadcastHdr = DEV_BROADCAST_HDR;
+  PDevBroadcastHdr = PDEV_BROADCAST_HDR;
+
+(*
+ * Structure for volume lock broadcast
+ *)
+
+  VolLockBroadcast = record
+    vlb_dbh: DEV_BROADCAST_HDR;
+    vlb_owner: DWORD;   // thread on which lock request is being issued
+    vlb_perms: BYTE;    // lock permission flags defined below
+    vlb_lockType: BYTE; // type of lock
+    vlb_drive: BYTE;    // drive on which lock is issued
+    vlb_flags: BYTE;    // miscellaneous flags
+  end;
+  {$EXTERNALSYM VolLockBroadcast}
+  TVollockbroadcast = VolLockBroadcast;
+  PVollockbroadcast = ^VolLockBroadcast;
+
+(*
+ * Values for vlb_perms
+ *)
+
+const
+  LOCKP_ALLOW_WRITES      = $01; // Bit 0 set - allow writes
+  {$EXTERNALSYM LOCKP_ALLOW_WRITES}
+  LOCKP_FAIL_WRITES       = $00; // Bit 0 clear - fail writes
+  {$EXTERNALSYM LOCKP_FAIL_WRITES}
+  LOCKP_FAIL_MEM_MAPPING  = $02; // Bit 1 set - fail memory mappings
+  {$EXTERNALSYM LOCKP_FAIL_MEM_MAPPING}
+  LOCKP_ALLOW_MEM_MAPPING = $00; // Bit 1 clear - allow memory mappings
+  {$EXTERNALSYM LOCKP_ALLOW_MEM_MAPPING}
+  LOCKP_USER_MASK         = $03; // Mask for user lock flags
+  {$EXTERNALSYM LOCKP_USER_MASK}
+  LOCKP_LOCK_FOR_FORMAT   = $04; // Level 0 lock for format
+  {$EXTERNALSYM LOCKP_LOCK_FOR_FORMAT}
+
+(*
+ * Values for vlb_flags
+ *)
+
+  LOCKF_LOGICAL_LOCK  = $00; // Bit 0 clear - logical lock
+  {$EXTERNALSYM LOCKF_LOGICAL_LOCK}
+  LOCKF_PHYSICAL_LOCK = $01; // Bit 0 set - physical lock
+  {$EXTERNALSYM LOCKF_PHYSICAL_LOCK}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_NODISKSPACE
+ * lParam  = drive number of drive that is out of disk space (1-based)
+ *
+ * Message issued by IFS manager when it detects that a drive is run out of
+ * free space.
+ *)
+
+  DBT_NO_DISK_SPACE = $0047;
+  {$EXTERNALSYM DBT_NO_DISK_SPACE}
+
+(*
+ * Message = WM_DEVICECHANGE
+ * wParam  = DBT_LOW_DISK_SPACE
+ * lParam  = drive number of drive that is low on disk space (1-based)
+ *
+ * Message issued by VFAT when it detects that a drive it has mounted
+ * has the remaning free space below a threshold specified by the
+ * registry or by a disk space management application.
+ * The broadcast is issued by VFAT ONLY when space is either allocated
+ * or freed by VFAT.
+ *)
+
+  DBT_LOW_DISK_SPACE = $0048;
+  {$EXTERNALSYM DBT_LOW_DISK_SPACE}
+
+  DBT_CONFIGMGPRIVATE = $7FFF;
+  {$EXTERNALSYM DBT_CONFIGMGPRIVATE}
+
+(*
+ * The following messages are for WM_DEVICECHANGE. The immediate list
+ * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
+ * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
+ *
+ *)
+
+  DBT_DEVICEARRIVAL           = $8000; // system detected a new device
+  {$EXTERNALSYM DBT_DEVICEARRIVAL}
+  DBT_DEVICEQUERYREMOVE       = $8001; // wants to remove, may fail
+  {$EXTERNALSYM DBT_DEVICEQUERYREMOVE}
+  DBT_DEVICEQUERYREMOVEFAILED = $8002; // removal aborted
+  {$EXTERNALSYM DBT_DEVICEQUERYREMOVEFAILED}
+  DBT_DEVICEREMOVEPENDING     = $8003; // about to remove, still avail.
+  {$EXTERNALSYM DBT_DEVICEREMOVEPENDING}
+  DBT_DEVICEREMOVECOMPLETE    = $8004; // device is gone
+  {$EXTERNALSYM DBT_DEVICEREMOVECOMPLETE}
+  DBT_DEVICETYPESPECIFIC      = $8005; // type specific event
+  {$EXTERNALSYM DBT_DEVICETYPESPECIFIC}
+  DBT_CUSTOMEVENT             = $8006; // user-defined event
+  {$EXTERNALSYM DBT_CUSTOMEVENT}
+
+  DBT_DEVTYP_OEM     = $00000000; // oem-defined device type
+  {$EXTERNALSYM DBT_DEVTYP_OEM}
+  DBT_DEVTYP_DEVNODE = $00000001; // devnode number
+  {$EXTERNALSYM DBT_DEVTYP_DEVNODE}
+  DBT_DEVTYP_VOLUME  = $00000002; // logical volume
+  {$EXTERNALSYM DBT_DEVTYP_VOLUME}
+  DBT_DEVTYP_PORT    = $00000003; // serial, parallel
+  {$EXTERNALSYM DBT_DEVTYP_PORT}
+  DBT_DEVTYP_NET     = $00000004; // network resource
+  {$EXTERNALSYM DBT_DEVTYP_NET}
+
+  DBT_DEVTYP_DEVICEINTERFACE = $00000005; // device interface class
+  {$EXTERNALSYM DBT_DEVTYP_DEVICEINTERFACE}
+  DBT_DEVTYP_HANDLE          = $00000006; // file system handle
+  {$EXTERNALSYM DBT_DEVTYP_HANDLE}
+
+type
+  _DEV_BROADCAST_HEADER = record
+    dbcd_size: DWORD;
+    dbcd_devicetype: DWORD;
+    dbcd_reserved: DWORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_HEADER}
+  TDevBroadcastHeader = _DEV_BROADCAST_HEADER;
+  PDevBroadcastHeader = ^_DEV_BROADCAST_HEADER;
+
+  PDEV_BROADCAST_OEM = ^DEV_BROADCAST_OEM;
+  {$EXTERNALSYM PDEV_BROADCAST_OEM}
+  _DEV_BROADCAST_OEM = record
+    dbco_size: DWORD;
+    dbco_devicetype: DWORD;
+    dbco_reserved: DWORD;
+    dbco_identifier: DWORD;
+    dbco_suppfunc: DWORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_OEM}
+  DEV_BROADCAST_OEM = _DEV_BROADCAST_OEM;
+  {$EXTERNALSYM DEV_BROADCAST_OEM}
+  TDevBroadcastOem = DEV_BROADCAST_OEM;
+  PDevBroadcastOem = PDEV_BROADCAST_OEM;
+
+  PDEV_BROADCAST_DEVNODE = ^DEV_BROADCAST_DEVNODE;
+  {$EXTERNALSYM PDEV_BROADCAST_DEVNODE}
+  _DEV_BROADCAST_DEVNODE = record
+    dbcd_size: DWORD;
+    dbcd_devicetype: DWORD;
+    dbcd_reserved: DWORD;
+    dbcd_devnode: DWORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_DEVNODE}
+  DEV_BROADCAST_DEVNODE = _DEV_BROADCAST_DEVNODE;
+  {$EXTERNALSYM DEV_BROADCAST_DEVNODE}
+  TDevBroadcastDevNode = DEV_BROADCAST_DEVNODE;
+  PDevBroadcastDevNode = PDEV_BROADCAST_DEVNODE;
+
+  PDEV_BROADCAST_VOLUME = ^DEV_BROADCAST_VOLUME;
+  {$EXTERNALSYM PDEV_BROADCAST_VOLUME}
+  _DEV_BROADCAST_VOLUME = record
+    dbcv_size: DWORD;
+    dbcv_devicetype: DWORD;
+    dbcv_reserved: DWORD;
+    dbcv_unitmask: DWORD;
+    dbcv_flags: WORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_VOLUME}
+  DEV_BROADCAST_VOLUME = _DEV_BROADCAST_VOLUME;
+  {$EXTERNALSYM DEV_BROADCAST_VOLUME}
+  TDevBroadcastVolume = DEV_BROADCAST_VOLUME;
+  PDevBroadcastVolume = PDEV_BROADCAST_VOLUME;
+
+const
+  DBTF_MEDIA = $0001; // media comings and goings
+  {$EXTERNALSYM DBTF_MEDIA}
+  DBTF_NET   = $0002; // network volume
+  {$EXTERNALSYM DBTF_NET}
+
+type
+  PDEV_BROADCAST_PORT_A = ^DEV_BROADCAST_PORT_A;
+  {$EXTERNALSYM PDEV_BROADCAST_PORT_A}
+  _DEV_BROADCAST_PORT_A = record
+    dbcp_size: DWORD;
+    dbcp_devicetype: DWORD;
+    dbcp_reserved: DWORD;
+    dbcp_name: array [0..0] of Char;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_PORT_A}
+  DEV_BROADCAST_PORT_A = _DEV_BROADCAST_PORT_A;
+  {$EXTERNALSYM DEV_BROADCAST_PORT_A}
+  TDevBroadcastPortA = DEV_BROADCAST_PORT_A;
+  PDevBroadcastPortA = PDEV_BROADCAST_PORT_A;
+
+  PDEV_BROADCAST_PORT_W = ^DEV_BROADCAST_PORT_W;
+  {$EXTERNALSYM PDEV_BROADCAST_PORT_W}
+  _DEV_BROADCAST_PORT_W = record
+    dbcp_size: DWORD;
+    dbcp_devicetype: DWORD;
+    dbcp_reserved: DWORD;
+    dbcp_name: array [0..0] of WideChar;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_PORT_W}
+  DEV_BROADCAST_PORT_W = _DEV_BROADCAST_PORT_W;
+  {$EXTERNALSYM DEV_BROADCAST_PORT_W}
+  TDevBroadcastPortW = DEV_BROADCAST_PORT_W;
+  PDevBroadcastPortW = PDEV_BROADCAST_PORT_W;
+
+  {$IFDEF UNICODE}
+  DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_W;
+  {$EXTERNALSYM DEV_BROADCAST_PORT}
+  PDEV_BROADCAST_PORT = PDEV_BROADCAST_PORT_W;
+  {$EXTERNALSYM PDEV_BROADCAST_PORT}
+  TDevBroadcastPort = TDevBroadcastPortW;
+  PDevBroadcastPort = PDevBroadcastPortW;
+  {$ELSE}
+  DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_A;
+  {$EXTERNALSYM DEV_BROADCAST_PORT}
+  PDEV_BROADCAST_PORT = PDEV_BROADCAST_PORT_A;
+  {$EXTERNALSYM PDEV_BROADCAST_PORT}
+  TDevBroadcastPort = TDevBroadcastPortA;
+  PDevBroadcastPort = PDevBroadcastPortA;
+  {$ENDIF UNICODE}
+
+  PDEV_BROADCAST_NET = ^DEV_BROADCAST_NET;
+  {$EXTERNALSYM PDEV_BROADCAST_NET}
+  _DEV_BROADCAST_NET = record
+    dbcn_size: DWORD;
+    dbcn_devicetype: DWORD;
+    dbcn_reserved: DWORD;
+    dbcn_resource: DWORD;
+    dbcn_flags: DWORD;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_NET}
+  DEV_BROADCAST_NET = _DEV_BROADCAST_NET;
+  {$EXTERNALSYM DEV_BROADCAST_NET}
+  TDevBroadcastNet = DEV_BROADCAST_NET;
+  PDevBroadcastNet = PDEV_BROADCAST_NET;
+
+  PDEV_BROADCAST_DEVICEINTERFACE_A = ^DEV_BROADCAST_DEVICEINTERFACE_A;
+  {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE_A}
+  _DEV_BROADCAST_DEVICEINTERFACE_A = record
+    dbcc_size: DWORD;
+    dbcc_devicetype: DWORD;
+    dbcc_reserved: DWORD;
+    dbcc_classguid: GUID;
+    dbcc_name: array [0..0] of char;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_DEVICEINTERFACE_A}
+  DEV_BROADCAST_DEVICEINTERFACE_A = _DEV_BROADCAST_DEVICEINTERFACE_A;
+  {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE_A}
+  TDevBroadcastDeviceInterfaceA = DEV_BROADCAST_DEVICEINTERFACE_A;
+  PDevBroadcastDeviceInterfaceA = PDEV_BROADCAST_DEVICEINTERFACE_A;
+
+  PDEV_BROADCAST_DEVICEINTERFACE_W = ^DEV_BROADCAST_DEVICEINTERFACE_W;
+  {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE_W}
+  _DEV_BROADCAST_DEVICEINTERFACE_W = record
+    dbcc_size: DWORD;
+    dbcc_devicetype: DWORD;
+    dbcc_reserved: DWORD;
+    dbcc_classguid: GUID;
+    dbcc_name: array [0..0] of wchar_t;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_DEVICEINTERFACE_W}
+  DEV_BROADCAST_DEVICEINTERFACE_W = _DEV_BROADCAST_DEVICEINTERFACE_W;
+  {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE_W}
+  TDevBroadcastDeviceInterfaceW = DEV_BROADCAST_DEVICEINTERFACE_W;
+  PDevBroadcastDeviceInterfaceW = PDEV_BROADCAST_DEVICEINTERFACE_W;
+
+  {$IFDEF UNICODE}
+  DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_W;
+  {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE}
+  PDEV_BROADCAST_DEVICEINTERFACE = PDEV_BROADCAST_DEVICEINTERFACE_W;
+  {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE}
+  TDevBroadcastDeviceInterface = TDevBroadcastDeviceInterfaceW;
+  PDevBroadcastDeviceInterface = PDevBroadcastDeviceInterfaceW;
+  {$ELSE}
+  DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_A;
+  {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE}
+  PDEV_BROADCAST_DEVICEINTERFACE = PDEV_BROADCAST_DEVICEINTERFACE_A;
+  {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE}
+  TDevBroadcastDeviceInterface = TDevBroadcastDeviceInterfaceA;
+  PDevBroadcastDeviceInterface = PDevBroadcastDeviceInterfaceA;
+  {$ENDIF UNICODE}
+
+  PDEV_BROADCAST_HANDLE = ^DEV_BROADCAST_HANDLE;
+  {$EXTERNALSYM PDEV_BROADCAST_HANDLE}
+  _DEV_BROADCAST_HANDLE = record
+    dbch_size: DWORD;
+    dbch_devicetype: DWORD;
+    dbch_reserved: DWORD;
+    dbch_handle: HANDLE;         // file handle used in call to RegisterDeviceNotification
+    dbch_hdevnotify: HDEVNOTIFY; // returned from RegisterDeviceNotification
+    //
+    // The following 3 fields are only valid if wParam is DBT_CUSTOMEVENT.
+    //
+    dbch_eventguid: GUID;
+    dbch_nameoffset: LONG;           // offset (bytes) of variable-length string buffer (-1 if none)
+    dbch_data: array [0..0] of BYTE; // variable-sized buffer, potentially containing binary and/or text data
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_HANDLE}
+  DEV_BROADCAST_HANDLE = _DEV_BROADCAST_HANDLE;
+  {$EXTERNALSYM DEV_BROADCAST_HANDLE}
+  TDevBroadcastHandle = DEV_BROADCAST_HANDLE;
+  PDevBroadcastHandle = PDEV_BROADCAST_HANDLE;
+
+//
+// Define 32-bit and 64-bit versions of the DEV_BROADCAST_HANDLE structure
+// for WOW64.  These must be kept in sync with the above structure.
+//
+
+  PDEV_BROADCAST_HANDLE32 = ^DEV_BROADCAST_HANDLE32;
+  {$EXTERNALSYM PDEV_BROADCAST_HANDLE32}
+  _DEV_BROADCAST_HANDLE32 = record
+    dbch_size: DWORD;
+    dbch_devicetype: DWORD;
+    dbch_reserved: DWORD;
+    dbch_handle: ULONG32;
+    dbch_hdevnotify: ULONG32;
+    dbch_eventguid: GUID;
+    dbch_nameoffset: LONG;
+    dbch_data: array [0..0] of BYTE;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_HANDLE32}
+  DEV_BROADCAST_HANDLE32 = _DEV_BROADCAST_HANDLE32;
+  {$EXTERNALSYM DEV_BROADCAST_HANDLE32}
+  TDevBroadcastHandle32 = DEV_BROADCAST_HANDLE32;
+  PDevBroadcastHandle32 = PDEV_BROADCAST_HANDLE32;
+
+  PDEV_BROADCAST_HANDLE64 = ^DEV_BROADCAST_HANDLE64;
+  {$EXTERNALSYM PDEV_BROADCAST_HANDLE64}
+  _DEV_BROADCAST_HANDLE64 = record
+    dbch_size: DWORD;
+    dbch_devicetype: DWORD;
+    dbch_reserved: DWORD;
+    dbch_handle: ULONG64;
+    dbch_hdevnotify: ULONG64;
+    dbch_eventguid: GUID;
+    dbch_nameoffset: LONG;
+    dbch_data: array [0..0] of BYTE;
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_HANDLE64}
+  DEV_BROADCAST_HANDLE64 = _DEV_BROADCAST_HANDLE64;
+  {$EXTERNALSYM DEV_BROADCAST_HANDLE64}
+  TDevBroadcastHandle64 = DEV_BROADCAST_HANDLE64;
+  PDevBroadcastHandle64 = PDEV_BROADCAST_HANDLE64;
+
+const
+  DBTF_RESOURCE = $00000001; // network resource
+  {$EXTERNALSYM DBTF_RESOURCE}
+  DBTF_XPORT    = $00000002; // new transport coming or going
+  {$EXTERNALSYM DBTF_XPORT}
+  DBTF_SLOWNET  = $00000004; // new incoming transport is slow
+  {$EXTERNALSYM DBTF_SLOWNET}
+                             // (dbcn_resource undefined for now)
+
+  DBT_VPOWERDAPI = $8100; // VPOWERD API for Win95
+  {$EXTERNALSYM DBT_VPOWERDAPI}
+
+(*
+ *  User-defined message types all use wParam = 0xFFFF with the
+ *  lParam a pointer to the structure below.
+ *
+ *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
+ *
+ *  dbud_szName contains a case-sensitive ASCIIZ name which names the
+ *  message.  The message name consists of the vendor name, a backslash,
+ *  then arbitrary user-defined ASCIIZ text.  For example:
+ *
+ *      "WidgetWare\QueryScannerShutdown"
+ *      "WidgetWare\Video Q39S\AdapterReady"
+ *
+ *  After the ASCIIZ name, arbitrary information may be provided.
+ *  Make sure that dbud_dbh.dbch_size is big enough to encompass
+ *  all the data.  And remember that nothing in the structure may
+ *  contain pointers.
+ *)
+
+  DBT_USERDEFINED = $FFFF;
+  {$EXTERNALSYM DBT_USERDEFINED}
+
+type
+  PDEV_BROADCAST_USERDEFINED = ^DEV_BROADCAST_USERDEFINED;
+  {$EXTERNALSYM PDEV_BROADCAST_USERDEFINED}
+  _DEV_BROADCAST_USERDEFINED = record
+    dbud_dbh: DEV_BROADCAST_HDR;
+    dbud_szName: array [0..0] of Char;
+    //  BYTE        dbud_rgbUserDefined[];*/ /* User-defined contents */
+  end;
+  {$EXTERNALSYM _DEV_BROADCAST_USERDEFINED}
+  DEV_BROADCAST_USERDEFINED = _DEV_BROADCAST_USERDEFINED;
+  {$EXTERNALSYM DEV_BROADCAST_USERDEFINED}
+  TDevBroadcastUserDefined = DEV_BROADCAST_USERDEFINED;
+  PDevBroadcastUserDefined = PDEV_BROADCAST_USERDEFINED;
+
+// (rom) added own message type for WM_DEVICECHANGE
+// see Messages.pas TWMNoParams ff. 
+
+type
+  TWMDeviceChange = record
+   Msg: Cardinal;
+   Event: UINT;
+   dwData: Pointer;
+   Result: Longint;
+  end;
+
+implementation
+
+end.

+ 330 - 0
packages/extra/winunits/jwadde.pas

@@ -0,0 +1,330 @@
+{******************************************************************************}
+{                                                                              }
+{ Dynamic Data Exchange API interface Unit for Object Pascal                   }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dde.h, released June 2000. The original Pascal         }
+{ code is: Dde.pas, released December 2000. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDde;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "Dde.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType;
+
+// DDE window messages
+
+const
+  WM_DDE_FIRST = $03E0;
+  {$EXTERNALSYM WM_DDE_FIRST}
+  WM_DDE_INITIATE = WM_DDE_FIRST;
+  {$EXTERNALSYM WM_DDE_INITIATE}
+  WM_DDE_TERMINATE = WM_DDE_FIRST + 1;
+  {$EXTERNALSYM WM_DDE_TERMINATE}
+  WM_DDE_ADVISE = WM_DDE_FIRST + 2;
+  {$EXTERNALSYM WM_DDE_ADVISE}
+  WM_DDE_UNADVISE = WM_DDE_FIRST + 3;
+  {$EXTERNALSYM WM_DDE_UNADVISE}
+  WM_DDE_ACK = WM_DDE_FIRST + 4;
+  {$EXTERNALSYM WM_DDE_ACK}
+  WM_DDE_DATA = WM_DDE_FIRST + 5;
+  {$EXTERNALSYM WM_DDE_DATA}
+  WM_DDE_REQUEST = WM_DDE_FIRST + 6;
+  {$EXTERNALSYM WM_DDE_REQUEST}
+  WM_DDE_POKE = WM_DDE_FIRST + 7;
+  {$EXTERNALSYM WM_DDE_POKE}
+  WM_DDE_EXECUTE = WM_DDE_FIRST + 8;
+  {$EXTERNALSYM WM_DDE_EXECUTE}
+  WM_DDE_LAST = WM_DDE_FIRST + 8;
+  {$EXTERNALSYM WM_DDE_LAST}
+
+{*----------------------------------------------------------------------------
+|       DDEACK structure
+|
+|       Structure of wStatus (LOWORD(lParam)) in WM_DDE_ACK message
+|       sent in response to a WM_DDE_DATA, WM_DDE_REQUEST, WM_DDE_POKE,
+|       WM_DDE_ADVISE, or WM_DDE_UNADVISE message.
+|
+----------------------------------------------------------------------------*}
+
+type
+  DDEACK = record
+    Flags: Word;
+    // bAppReturnCode:8,
+    // reserved:6,
+    // fBusy:1,
+    // fAck:1;
+  end;
+  {$EXTERNALSYM DDEACK}
+  TDdeAck = DDEACK;
+  PDdeAck = ^DDEACK;
+
+{*----------------------------------------------------------------------------
+|       DDEADVISE structure
+|
+|       WM_DDE_ADVISE parameter structure for hOptions (LOWORD(lParam))
+|
+----------------------------------------------------------------------------*}
+
+type
+  DDEADVICE = record
+    Flags: Word;
+    // reserved:14,
+    // fDeferUpd:1,
+    // fAckReq:1;
+    cfFormat: Smallint;
+  end;
+  {$EXTERNALSYM DDEADVICE}
+  TDdeAdvice = DDEADVICE;
+  PDdeAdvice = ^DDEADVICE;
+
+{*----------------------------------------------------------------------------
+|       DDEDATA structure
+|
+|       WM_DDE_DATA parameter structure for hData (LOWORD(lParam)).
+|       The actual size of this structure depends on the size of
+|       the Value array.
+|
+----------------------------------------------------------------------------*}
+
+type
+  DDEDATA = record
+    usFlags: Word;
+    // unused:12,
+    // fResponse:1,
+    // fRelease:1,
+    // reserved:1,
+    // fAckReq:1;
+    cfFormat: Smallint;
+    Value: array [0..0] of Byte;
+  end;
+  {$EXTERNALSYM DDEDATA}
+  TDdeData = DDEDATA;
+  PDdeData = ^DDEDATA;
+
+{*----------------------------------------------------------------------------
+|       DDEPOKE structure
+|
+|       WM_DDE_POKE parameter structure for hData (LOWORD(lParam)).
+|       The actual size of this structure depends on the size of
+|       the Value array.
+|
+----------------------------------------------------------------------------*}
+
+type
+  DDEPOKE = record
+    usFlags: Word;
+    //unused:13,  // Earlier versions of DDE.H incorrectly 12 unused bits.
+    //fRelease:1,
+    //fReserved:2;
+    cfFormat: Smallint;
+    Value: array [0..0] of Byte;  // This member was named rgb[1] in previous
+                                  // versions of DDE.H
+  end;
+  {$EXTERNALSYM DDEPOKE}
+  TDdePoke = DDEPOKE;
+  PDdePoke = ^DDEPOKE;
+
+{*----------------------------------------------------------------------------
+The following typedef's were used in previous versions of the Windows SDK.
+They are still valid.  The above typedef's define exactly the same structures
+as those below.  The above typedef names are recommended, however, as they
+are more meaningful.
+
+Note that the DDEPOKE structure typedef'ed in earlier versions of DDE.H did
+not correctly define the bit positions.
+----------------------------------------------------------------------------*}
+
+type
+  DDELN = record
+    usFlags: Word;
+    // unused:13,
+    // fRelease:1,
+    // fDeferUpd:1,
+    // fAckReq:1;
+    cfFormat: Smallint;
+  end;
+  {$EXTERNALSYM DDELN}
+  TDdeLn = DDELN;
+  PDdeLn = ^DDELN;
+
+  DDEUP = record
+    usFlags: Word;
+    // unused:12,
+    // fAck:1,
+    // fRelease:1,
+    // fReserved:1,
+    // fAckReq:1;
+    cfFormat: Smallint;
+    rgb: array [0..0] of Byte;
+  end;
+  {$EXTERNALSYM DDEUP}
+  TDdeUp = DDEUP;
+  PDdeUp = ^DDEUP;
+
+//
+// DDE SECURITY
+//
+
+function DdeSetQualityOfService(hwndClient: HWND; const pqosNew: SECURITY_QUALITY_OF_SERVICE;
+  pqosPrev: PSECURITY_QUALITY_OF_SERVICE): BOOL; stdcall;
+{$EXTERNALSYM DdeSetQualityOfService}
+
+function ImpersonateDdeClientWindow(hWndClient, hWndServer: HWND): BOOL; stdcall;
+{$EXTERNALSYM ImpersonateDdeClientWindow}
+
+//
+// DDE message packing APIs
+//
+
+function PackDDElParam(msg: UINT; uiLo, uiHi: UINT_PTR): LPARAM; stdcall;
+{$EXTERNALSYM PackDDElParam}
+function UnpackDDElParam(msg: UINT; lParam: LPARAM; puiLo, puiHi: PUINT_PTR): BOOL; stdcall;
+{$EXTERNALSYM UnpackDDElParam}
+function FreeDDElParam(msg: UINT; lParam: LPARAM): BOOL; stdcall;
+{$EXTERNALSYM FreeDDElParam}
+function ReuseDDElParam(lParam: LPARAM; msgIn, msgOut: UINT; uiLo, uiHi: UINT_PTR): LPARAM; stdcall;
+{$EXTERNALSYM ReuseDDElParam}
+
+implementation
+
+const
+  user32 = 'user32.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DdeSetQualityOfService: Pointer;
+
+function DdeSetQualityOfService;
+begin
+  GetProcedureAddress(_DdeSetQualityOfService, user32, 'DdeSetQualityOfService');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DdeSetQualityOfService]
+  end;
+end;
+
+var
+  _ImpersonateDdeClientWindow: Pointer;
+
+function ImpersonateDdeClientWindow;
+begin
+  GetProcedureAddress(_ImpersonateDdeClientWindow, user32, 'ImpersonateDdeClientWindow');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImpersonateDdeClientWindow]
+  end;
+end;
+
+var
+  _PackDDElParam: Pointer;
+
+function PackDDElParam;
+begin
+  GetProcedureAddress(_PackDDElParam, user32, 'PackDDElParam');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_PackDDElParam]
+  end;
+end;
+
+var
+  _UnpackDDElParam: Pointer;
+
+function UnpackDDElParam;
+begin
+  GetProcedureAddress(_UnpackDDElParam, user32, 'UnpackDDElParam');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnpackDDElParam]
+  end;
+end;
+
+var
+  _FreeDDElParam: Pointer;
+
+function FreeDDElParam;
+begin
+  GetProcedureAddress(_FreeDDElParam, user32, 'FreeDDElParam');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FreeDDElParam]
+  end;
+end;
+
+var
+  _ReuseDDElParam: Pointer;
+
+function ReuseDDElParam;
+begin
+  GetProcedureAddress(_ReuseDDElParam, user32, 'ReuseDDElParam');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReuseDDElParam]
+  end;
+end;
+
+{$ELSE}
+
+function DdeSetQualityOfService; external user32 name 'DdeSetQualityOfService';
+function ImpersonateDdeClientWindow; external user32 name 'ImpersonateDdeClientWindow';
+function PackDDElParam; external user32 name 'PackDDElParam';
+function UnpackDDElParam; external user32 name 'UnpackDDElParam';
+function FreeDDElParam; external user32 name 'FreeDDElParam';
+function ReuseDDElParam; external user32 name 'ReuseDDElParam';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 449 - 0
packages/extra/winunits/jwadhcpcsdk.pas

@@ -0,0 +1,449 @@
+{******************************************************************************}
+{                                                                              }
+{ DHCP Client API interface unit for Object Pascal                             }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dhcpcsdk.h, released June 2000. The original Pascal    }
+{ code is: DhcpCSdk.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDhcpCSdk;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dhcpcsdk.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+// DHCP Standard Options.
+//
+
+const
+  OPTION_PAD                 = 0;
+  {$EXTERNALSYM OPTION_PAD}
+  OPTION_SUBNET_MASK         = 1;
+  {$EXTERNALSYM OPTION_SUBNET_MASK}
+  OPTION_TIME_OFFSET         = 2;
+  {$EXTERNALSYM OPTION_TIME_OFFSET}
+  OPTION_ROUTER_ADDRESS      = 3;
+  {$EXTERNALSYM OPTION_ROUTER_ADDRESS}
+  OPTION_TIME_SERVERS        = 4;
+  {$EXTERNALSYM OPTION_TIME_SERVERS}
+  OPTION_IEN116_NAME_SERVERS = 5;
+  {$EXTERNALSYM OPTION_IEN116_NAME_SERVERS}
+  OPTION_DOMAIN_NAME_SERVERS = 6;
+  {$EXTERNALSYM OPTION_DOMAIN_NAME_SERVERS}
+  OPTION_LOG_SERVERS         = 7;
+  {$EXTERNALSYM OPTION_LOG_SERVERS}
+  OPTION_COOKIE_SERVERS      = 8;
+  {$EXTERNALSYM OPTION_COOKIE_SERVERS}
+  OPTION_LPR_SERVERS         = 9;
+  {$EXTERNALSYM OPTION_LPR_SERVERS}
+  OPTION_IMPRESS_SERVERS     = 10;
+  {$EXTERNALSYM OPTION_IMPRESS_SERVERS}
+  OPTION_RLP_SERVERS         = 11;
+  {$EXTERNALSYM OPTION_RLP_SERVERS}
+  OPTION_HOST_NAME           = 12;
+  {$EXTERNALSYM OPTION_HOST_NAME}
+  OPTION_BOOT_FILE_SIZE      = 13;
+  {$EXTERNALSYM OPTION_BOOT_FILE_SIZE}
+  OPTION_MERIT_DUMP_FILE     = 14;
+  {$EXTERNALSYM OPTION_MERIT_DUMP_FILE}
+  OPTION_DOMAIN_NAME         = 15;
+  {$EXTERNALSYM OPTION_DOMAIN_NAME}
+  OPTION_SWAP_SERVER         = 16;
+  {$EXTERNALSYM OPTION_SWAP_SERVER}
+  OPTION_ROOT_DISK           = 17;
+  {$EXTERNALSYM OPTION_ROOT_DISK}
+  OPTION_EXTENSIONS_PATH     = 18;
+  {$EXTERNALSYM OPTION_EXTENSIONS_PATH}
+
+//
+// IP layer parameters - per host
+//
+
+  OPTION_BE_A_ROUTER              = 19;
+  {$EXTERNALSYM OPTION_BE_A_ROUTER}
+  OPTION_NON_LOCAL_SOURCE_ROUTING = 20;
+  {$EXTERNALSYM OPTION_NON_LOCAL_SOURCE_ROUTING}
+  OPTION_POLICY_FILTER_FOR_NLSR   = 21;
+  {$EXTERNALSYM OPTION_POLICY_FILTER_FOR_NLSR}
+  OPTION_MAX_REASSEMBLY_SIZE      = 22;
+  {$EXTERNALSYM OPTION_MAX_REASSEMBLY_SIZE}
+  OPTION_DEFAULT_TTL              = 23;
+  {$EXTERNALSYM OPTION_DEFAULT_TTL}
+  OPTION_PMTU_AGING_TIMEOUT       = 24;
+  {$EXTERNALSYM OPTION_PMTU_AGING_TIMEOUT}
+  OPTION_PMTU_PLATEAU_TABLE       = 25;
+  {$EXTERNALSYM OPTION_PMTU_PLATEAU_TABLE}
+
+//
+// Link layer parameters - per interface.
+//
+
+  OPTION_MTU                      = 26;
+  {$EXTERNALSYM OPTION_MTU}
+  OPTION_ALL_SUBNETS_MTU          = 27;
+  {$EXTERNALSYM OPTION_ALL_SUBNETS_MTU}
+  OPTION_BROADCAST_ADDRESS        = 28;
+  {$EXTERNALSYM OPTION_BROADCAST_ADDRESS}
+  OPTION_PERFORM_MASK_DISCOVERY   = 29;
+  {$EXTERNALSYM OPTION_PERFORM_MASK_DISCOVERY}
+  OPTION_BE_A_MASK_SUPPLIER       = 30;
+  {$EXTERNALSYM OPTION_BE_A_MASK_SUPPLIER}
+  OPTION_PERFORM_ROUTER_DISCOVERY = 31;
+  {$EXTERNALSYM OPTION_PERFORM_ROUTER_DISCOVERY}
+  OPTION_ROUTER_SOLICITATION_ADDR = 32;
+  {$EXTERNALSYM OPTION_ROUTER_SOLICITATION_ADDR}
+  OPTION_STATIC_ROUTES            = 33;
+  {$EXTERNALSYM OPTION_STATIC_ROUTES}
+  OPTION_TRAILERS                 = 34;
+  {$EXTERNALSYM OPTION_TRAILERS}
+  OPTION_ARP_CACHE_TIMEOUT        = 35;
+  {$EXTERNALSYM OPTION_ARP_CACHE_TIMEOUT}
+  OPTION_ETHERNET_ENCAPSULATION   = 36;
+  {$EXTERNALSYM OPTION_ETHERNET_ENCAPSULATION}
+
+//
+// TCP Paramters - per host
+//
+
+  OPTION_TTL                  = 37;
+  {$EXTERNALSYM OPTION_TTL}
+  OPTION_KEEP_ALIVE_INTERVAL  = 38;
+  {$EXTERNALSYM OPTION_KEEP_ALIVE_INTERVAL}
+  OPTION_KEEP_ALIVE_DATA_SIZE = 39;
+  {$EXTERNALSYM OPTION_KEEP_ALIVE_DATA_SIZE}
+
+//
+// Application Layer Parameters
+//
+
+  OPTION_NETWORK_INFO_SERVICE_DOM = 40;
+  {$EXTERNALSYM OPTION_NETWORK_INFO_SERVICE_DOM}
+  OPTION_NETWORK_INFO_SERVERS     = 41;
+  {$EXTERNALSYM OPTION_NETWORK_INFO_SERVERS}
+  OPTION_NETWORK_TIME_SERVERS     = 42;
+  {$EXTERNALSYM OPTION_NETWORK_TIME_SERVERS}
+
+//
+// Vender specific information option
+//
+
+  OPTION_VENDOR_SPEC_INFO = 43;
+  {$EXTERNALSYM OPTION_VENDOR_SPEC_INFO}
+
+//
+// NetBIOS over TCP/IP Name server option
+//
+
+  OPTION_NETBIOS_NAME_SERVER     = 44;
+  {$EXTERNALSYM OPTION_NETBIOS_NAME_SERVER}
+  OPTION_NETBIOS_DATAGRAM_SERVER = 45;
+  {$EXTERNALSYM OPTION_NETBIOS_DATAGRAM_SERVER}
+  OPTION_NETBIOS_NODE_TYPE       = 46;
+  {$EXTERNALSYM OPTION_NETBIOS_NODE_TYPE}
+  OPTION_NETBIOS_SCOPE_OPTION    = 47;
+  {$EXTERNALSYM OPTION_NETBIOS_SCOPE_OPTION}
+
+//
+// X Window System Options.
+//
+
+  OPTION_XWINDOW_FONT_SERVER     = 48;
+  {$EXTERNALSYM OPTION_XWINDOW_FONT_SERVER}
+  OPTION_XWINDOW_DISPLAY_MANAGER = 49;
+  {$EXTERNALSYM OPTION_XWINDOW_DISPLAY_MANAGER}
+
+//
+// Other extensions
+//
+
+  OPTION_REQUESTED_ADDRESS      = 50;
+  {$EXTERNALSYM OPTION_REQUESTED_ADDRESS}
+  OPTION_LEASE_TIME             = 51;
+  {$EXTERNALSYM OPTION_LEASE_TIME}
+  OPTION_OK_TO_OVERLAY          = 52;
+  {$EXTERNALSYM OPTION_OK_TO_OVERLAY}
+  OPTION_MESSAGE_TYPE           = 53;
+  {$EXTERNALSYM OPTION_MESSAGE_TYPE}
+  OPTION_SERVER_IDENTIFIER      = 54;
+  {$EXTERNALSYM OPTION_SERVER_IDENTIFIER}
+  OPTION_PARAMETER_REQUEST_LIST = 55;
+  {$EXTERNALSYM OPTION_PARAMETER_REQUEST_LIST}
+  OPTION_MESSAGE                = 56;
+  {$EXTERNALSYM OPTION_MESSAGE}
+  OPTION_MESSAGE_LENGTH         = 57;
+  {$EXTERNALSYM OPTION_MESSAGE_LENGTH}
+  OPTION_RENEWAL_TIME           = 58; // T1
+  {$EXTERNALSYM OPTION_RENEWAL_TIME}
+  OPTION_REBIND_TIME            = 59; // T2
+  {$EXTERNALSYM OPTION_REBIND_TIME}
+  OPTION_CLIENT_CLASS_INFO      = 60;
+  {$EXTERNALSYM OPTION_CLIENT_CLASS_INFO}
+  OPTION_CLIENT_ID              = 61;
+  {$EXTERNALSYM OPTION_CLIENT_ID}
+
+  OPTION_TFTP_SERVER_NAME = 66;
+  {$EXTERNALSYM OPTION_TFTP_SERVER_NAME}
+  OPTION_BOOTFILE_NAME    = 67;
+  {$EXTERNALSYM OPTION_BOOTFILE_NAME}
+
+  OPTION_END = 255;
+  {$EXTERNALSYM OPTION_END}
+
+type
+  _DHCPAPI_PARAMS = record
+    Flags: ULONG;      // for future use
+    OptionId: ULONG;   // what option is this?
+    IsVendor: BOOL;    // is this vendor specific?
+    Data: LPBYTE;      // the actual data
+    nBytesData: DWORD; // how many bytes of data are there in Data?
+  end;
+  {$EXTERNALSYM _DHCPAPI_PARAMS}
+  DHCPAPI_PARAMS = _DHCPAPI_PARAMS;
+  {$EXTERNALSYM DHCPAPI_PARAMS}
+  LPDHCPAPI_PARAMS = ^DHCPAPI_PARAMS;
+  {$EXTERNALSYM LPDHCPAPI_PARAMS}
+  PDHCPAPI_PARAMS = ^DHCPAPI_PARAMS;
+  {$EXTERNALSYM PDHCPAPI_PARAMS}
+  TDhcpApiParams = DHCPAPI_PARAMS;
+  PDhcpApiParams = PDHCPAPI_PARAMS;
+
+  DHCPCAPI_PARAMS = DHCPAPI_PARAMS;
+  {$EXTERNALSYM DHCPCAPI_PARAMS}
+  PDHCPCAPI_PARAMS = ^DHCPCAPI_PARAMS;
+  {$EXTERNALSYM PDHCPCAPI_PARAMS}
+  LPDHCPCAPI_PARAMS = ^DHCPCAPI_PARAMS;
+  {$EXTERNALSYM LPDHCPCAPI_PARAMS}
+  TDhcpCApiParams = DHCPCAPI_PARAMS;
+  PDhcpCApiParams = PDHCPCAPI_PARAMS;
+
+  _DHCPCAPI_PARAMS_ARRAY = record
+    nParams: ULONG;            // size of array
+    Params: PDHCPCAPI_PARAMS;  // actual array
+  end;
+  {$EXTERNALSYM _DHCPCAPI_PARAMS_ARRAY}
+  DHCPCAPI_PARAMS_ARRAY = _DHCPCAPI_PARAMS_ARRAY;
+  {$EXTERNALSYM DHCPCAPI_PARAMS_ARRAY}
+  LPDHCPCAPI_PARAMS_ARRAY = ^DHCPCAPI_PARAMS_ARRAY;
+  {$EXTERNALSYM LPDHCPCAPI_PARAMS_ARRAY}
+  PDHCPCAPI_PARAMS_ARRAY = ^DHCPCAPI_PARAMS_ARRAY;
+  {$EXTERNALSYM PDHCPCAPI_PARAMS_ARRAY}
+  TDhcpcApiParamsArray = DHCPCAPI_PARAMS_ARRAY;
+  PDhcpcApiParamsArray = PDHCPCAPI_PARAMS_ARRAY;
+
+  _DHCPCAPI_CLASSID = record
+    Flags: ULONG;      // must be zero currently.
+    Data: LPBYTE;      // classid binary data.
+    nBytesData: ULONG; // how many bytes of data are there?
+  end;
+  {$EXTERNALSYM _DHCPCAPI_CLASSID}
+  DHCPCAPI_CLASSID = _DHCPCAPI_CLASSID;
+  {$EXTERNALSYM DHCPCAPI_CLASSID}
+  LPDHCPCAPI_CLASSID = ^DHCPCAPI_CLASSID;
+  {$EXTERNALSYM LPDHCPCAPI_CLASSID}
+  PDHCPCAPI_CLASSID = ^DHCPCAPI_CLASSID;
+  {$EXTERNALSYM PDHCPCAPI_CLASSID}
+  TDhcpcApiClassId = DHCPCAPI_CLASSID;
+  PDhcpcApiClassId = PDHCPCAPI_CLASSID;
+
+const
+  DHCPCAPI_REQUEST_PERSISTENT   = $01; // request this options "permanently"
+  {$EXTERNALSYM DHCPCAPI_REQUEST_PERSISTENT}
+  DHCPCAPI_REQUEST_SYNCHRONOUS  = $02; // request and block on it
+  {$EXTERNALSYM DHCPCAPI_REQUEST_SYNCHRONOUS}
+  DHCPCAPI_REQUEST_ASYNCHRONOUS = $04; // request and return, set event on completion
+  {$EXTERNALSYM DHCPCAPI_REQUEST_ASYNCHRONOUS}
+  DHCPCAPI_REQUEST_CANCEL       = $08; // cancel request
+  {$EXTERNALSYM DHCPCAPI_REQUEST_CANCEL}
+  DHCPCAPI_REQUEST_MASK         = $0F; // allowed flags..
+  {$EXTERNALSYM DHCPCAPI_REQUEST_MASK}
+
+function DhcpCApiInitialize(var Version: DWORD): DWORD; stdcall;
+{$EXTERNALSYM DhcpCApiInitialize}
+
+procedure DhcpCApiCleanup; stdcall;
+{$EXTERNALSYM DhcpCApiCleanup}
+
+function DhcpRequestParams(Flags: DWORD; Reserved: LPVOID; AdapterName: LPWSTR;
+  ClassId: PDHCPCAPI_CLASSID; SendParams, RecdParams: DHCPCAPI_PARAMS_ARRAY;
+  Buffer: LPBYTE; pSize: LPDWORD; RequestIdStr: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM DhcpRequestParams}
+
+function DhcpUndoRequestParams(Flags: DWORD; Reserved: LPVOID; AdapterName: LPWSTR;
+  RequestIdStr: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM DhcpUndoRequestParams}
+
+const
+  DHCPCAPI_REGISTER_HANDLE_EVENT = $01; // handle returned is to an event
+  {$EXTERNALSYM DHCPCAPI_REGISTER_HANDLE_EVENT}
+
+function DhcpRegisterParamChange(Flags: DWORD; Reserved: LPVOID; AdapterName: LPWSTR;
+  ClassId: PDHCPCAPI_CLASSID; Params: DHCPCAPI_PARAMS_ARRAY; Handle: LPVOID): DWORD; stdcall;
+{$EXTERNALSYM DhcpRegisterParamChange}
+
+const
+  DHCPCAPI_DEREGISTER_HANDLE_EVENT = $01; // de-register handle that is an event
+  {$EXTERNALSYM DHCPCAPI_DEREGISTER_HANDLE_EVENT}
+
+function DhcpDeRegisterParamChange(Flags: DWORD; Reserved, Event: LPVOID): DWORD; stdcall;
+{$EXTERNALSYM DhcpDeRegisterParamChange}
+
+function DhcpRemoveDNSRegistrations: DWORD; stdcall;
+{$EXTERNALSYM DhcpRemoveDNSRegistrations}
+
+implementation
+
+const
+  dhcpapi = 'dhcpcsvc.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DhcpCApiInitialize: Pointer;
+
+function DhcpCApiInitialize;
+begin
+  GetProcedureAddress(_DhcpCApiInitialize, dhcpapi, 'DhcpCApiInitialize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpCApiInitialize]
+  end;
+end;
+
+var
+  _DhcpCApiCleanup: Pointer;
+
+procedure DhcpCApiCleanup;
+begin
+  GetProcedureAddress(_DhcpCApiCleanup, dhcpapi, 'DhcpCApiCleanup');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpCApiCleanup]
+  end;
+end;
+
+var
+  _DhcpRequestParams: Pointer;
+
+function DhcpRequestParams;
+begin
+  GetProcedureAddress(_DhcpRequestParams, dhcpapi, 'DhcpRequestParams');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpRequestParams]
+  end;
+end;
+
+var
+  _DhcpUndoRequestParams: Pointer;
+
+function DhcpUndoRequestParams;
+begin
+  GetProcedureAddress(_DhcpUndoRequestParams, dhcpapi, 'DhcpUndoRequestParams');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpUndoRequestParams]
+  end;
+end;
+
+var
+  _DhcpRegisterParamChange: Pointer;
+
+function DhcpRegisterParamChange;
+begin
+  GetProcedureAddress(_DhcpRegisterParamChange, dhcpapi, 'DhcpRegisterParamChange');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpRegisterParamChange]
+  end;
+end;
+
+var
+  _DhcpDeRegisterParamChange: Pointer;
+
+function DhcpDeRegisterParamChange;
+begin
+  GetProcedureAddress(_DhcpDeRegisterParamChange, dhcpapi, 'DhcpDeRegisterParamChange');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpDeRegisterParamChange]
+  end;
+end;
+
+var
+  _DhcpRemoveDNSRegistrations: Pointer;
+
+function DhcpRemoveDNSRegistrations;
+begin
+  GetProcedureAddress(_DhcpRemoveDNSRegistrations, dhcpapi, 'DhcpRemoveDNSRegistrations');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpRemoveDNSRegistrations]
+  end;
+end;
+
+{$ELSE}
+
+function DhcpCApiInitialize; external dhcpapi name 'DhcpCApiInitialize';
+procedure DhcpCApiCleanup; external dhcpapi name 'DhcpCApiCleanup';
+function DhcpRequestParams; external dhcpapi name 'DhcpRequestParams';
+function DhcpUndoRequestParams; external dhcpapi name 'DhcpUndoRequestParams';
+function DhcpRegisterParamChange; external dhcpapi name 'DhcpRegisterParamChange';
+function DhcpDeRegisterParamChange; external dhcpapi name 'DhcpDeRegisterParamChange';
+function DhcpRemoveDNSRegistrations; external dhcpapi name 'DhcpRemoveDNSRegistrations';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 623 - 0
packages/extra/winunits/jwadhcpsapi.pas

@@ -0,0 +1,623 @@
+{******************************************************************************}
+{                                                                              }
+{ DHCP Server Management API interface Unit for Object Pascal                  }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dhcpsapi.h, released Feb 2003. The original Pascal     }
+{ code is: DhcpsApi.pas, released December 2003. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDhcpsApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dhcpsapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+type
+  DHCP_IP_ADDRESS = DWORD;
+  {$EXTERNALSYM DHCP_IP_ADDRESS}
+  PDHCP_IP_ADDRESS = ^DHCP_IP_ADDRESS;
+  {$EXTERNALSYM PDHCP_IP_ADDRESS}
+  LPDHCP_IP_ADDRESS = ^DHCP_IP_ADDRESS;
+  {$EXTERNALSYM LPDHCP_IP_ADDRESS}
+  TDhcpIpAddress = DHCP_IP_ADDRESS;
+  PDhcpIpAddress = ^DHCP_IP_ADDRESS;
+
+  DHCP_IP_MASK = DWORD;
+  {$EXTERNALSYM DHCP_IP_MASK}
+  TDhcpIpMask = DHCP_IP_MASK;
+  DHCP_RESUME_HANDLE = DWORD;
+  {$EXTERNALSYM DHCP_RESUME_HANDLE}
+  TDhcpResumeHandle = DHCP_RESUME_HANDLE;
+
+  DHCP_OPTION_ID = DWORD;
+  {$EXTERNALSYM DHCP_OPTION_ID}
+  TDhcpOptionID = DHCP_OPTION_ID;
+
+  _DATE_TIME = record
+    dwLowDateTime: DWORD;
+    dwHighDateTime: DWORD;
+  end;
+  {$EXTERNALSYM _DATE_TIME}
+  DATE_TIME = _DATE_TIME;
+  {$EXTERNALSYM DATE_TIME}
+  LPDATE_TIME = ^DATE_TIME;
+  {$EXTERNALSYM LPDATE_TIME}
+  TDateTime = DATE_TIME;
+  PDateTime = ^DATE_TIME;
+
+  _DWORD_DWORD = record
+    DWord1: DWORD;
+    DWord2: DWORD;
+  end;
+  {$EXTERNALSYM _DWORD_DWORD}
+  DWORD_DWORD = _DWORD_DWORD;
+  {$EXTERNALSYM DWORD_DWORD}
+  LPDWORD_DWORD = ^DWORD_DWORD;
+  {$EXTERNALSYM LPDWORD_DWORD}
+  TDwordDword = DWORD_DWORD;
+  PDwordDword = ^DWORD_DWORD;
+
+  _DHCP_BINARY_DATA = record
+    DataLength: DWORD;
+    Data: LPBYTE;
+  end;
+  {$EXTERNALSYM _DHCP_BINARY_DATA}
+  DHCP_BINARY_DATA = _DHCP_BINARY_DATA;
+  {$EXTERNALSYM DHCP_BINARY_DATA}
+  LPDHCP_BINARY_DATA = ^DHCP_BINARY_DATA;
+  {$EXTERNALSYM LPDHCP_BINARY_DATA}
+  TDhcpBinaryData = DHCP_BINARY_DATA;
+  PDhcpBinaryData = ^DHCP_BINARY_DATA;
+
+  DHCP_CLIENT_UID = DHCP_BINARY_DATA;
+  {$EXTERNALSYM DHCP_CLIENT_UID}
+  TDhcpClientUid = DHCP_CLIENT_UID;
+
+const
+  DHCP_ENDPOINT_FLAG_CANT_MODIFY = $01;
+  {$EXTERNALSYM DHCP_ENDPOINT_FLAG_CANT_MODIFY}
+
+type
+  _DHCP_BIND_ELEMENT = record
+    Flags: ULONG;
+    fBoundToDHCPServer: BOOL;
+    AdapterPrimaryAddress: DHCP_IP_ADDRESS;
+    AdapterSubnetAddress: DHCP_IP_ADDRESS;
+    IfDescription: LPWSTR;
+    IfIdSize: ULONG;
+    IfId: LPBYTE;
+  end;
+  {$EXTERNALSYM _DHCP_BIND_ELEMENT}
+  DHCP_BIND_ELEMENT = _DHCP_BIND_ELEMENT;
+  {$EXTERNALSYM DHCP_BIND_ELEMENT}
+  LPDHCP_BIND_ELEMENT = ^DHCP_BIND_ELEMENT;
+  {$EXTERNALSYM LPDHCP_BIND_ELEMENT}
+  TDhcpBindElement = DHCP_BIND_ELEMENT;
+  PDhcpBindElement = ^DHCP_BIND_ELEMENT;
+
+  _DHCP_BIND_ELEMENT_ARRAY = record
+    NumElements: DWORD;
+    Elements: LPDHCP_BIND_ELEMENT; //array
+  end;
+  {$EXTERNALSYM _DHCP_BIND_ELEMENT_ARRAY}
+  DHCP_BIND_ELEMENT_ARRAY = _DHCP_BIND_ELEMENT_ARRAY;
+  {$EXTERNALSYM DHCP_BIND_ELEMENT_ARRAY}
+  LPDHCP_BIND_ELEMENT_ARRAY = ^DHCP_BIND_ELEMENT_ARRAY;
+  {$EXTERNALSYM LPDHCP_BIND_ELEMENT_ARRAY}
+  TDhcpBindElementArray = DHCP_BIND_ELEMENT_ARRAY;
+  PDhcpBindElementArray = ^DHCP_BIND_ELEMENT_ARRAY;
+
+  _DHCP_CLIENT_SEARCH_TYPE = (
+    DhcpClientIpAddress,
+    DhcpClientHardwareAddress,
+    DhcpClientName);
+  {$EXTERNALSYM _DHCP_CLIENT_SEARCH_TYPE}
+  DHCP_SEARCH_INFO_TYPE = _DHCP_CLIENT_SEARCH_TYPE;
+  {$EXTERNALSYM DHCP_SEARCH_INFO_TYPE}
+  LPDHCP_SEARCH_INFO_TYPE = ^DHCP_SEARCH_INFO_TYPE;
+  {$EXTERNALSYM LPDHCP_SEARCH_INFO_TYPE}
+  TDhcpSearchInfoType = DHCP_SEARCH_INFO_TYPE;
+  PDhcpSearchInfoType = ^DHCP_SEARCH_INFO_TYPE;
+
+  _DHCP_CLIENT_SEARCH_UNION = record
+    case Integer of
+      0: (ClientIpAddress: DHCP_IP_ADDRESS);
+      1: (ClientHardwareAddress: DHCP_CLIENT_UID);
+      2: (ClientName: LPWSTR);
+  end;
+  {$EXTERNALSYM _DHCP_CLIENT_SEARCH_UNION}
+
+  _DHCP_CLIENT_SEARCH_INFO = record
+    SearchType: DHCP_SEARCH_INFO_TYPE;
+    SearchInfo: _DHCP_CLIENT_SEARCH_UNION;
+  end;
+  {$EXTERNALSYM _DHCP_CLIENT_SEARCH_INFO}
+  DHCP_SEARCH_INFO = _DHCP_CLIENT_SEARCH_INFO;
+  {$EXTERNALSYM DHCP_SEARCH_INFO}
+  LPDHCP_SEARCH_INFO = ^DHCP_SEARCH_INFO;
+  {$EXTERNALSYM LPDHCP_SEARCH_INFO}
+  TDhcpSearchInfo = DHCP_SEARCH_INFO;
+  PDhcpSearchInfo = ^DHCP_SEARCH_INFO;
+
+  _DHCP_OPTION_SCOPE_TYPE = (
+    DhcpDefaultOptions,
+    DhcpGlobalOptions,
+    DhcpSubnetOptions,
+    DhcpReservedOptions,
+    DhcpMScopeOptions);
+  {$EXTERNALSYM _DHCP_OPTION_SCOPE_TYPE}
+  DHCP_OPTION_SCOPE_TYPE = _DHCP_OPTION_SCOPE_TYPE;
+  {$EXTERNALSYM DHCP_OPTION_SCOPE_TYPE}
+  LPDHCP_OPTION_SCOPE_TYPE = ^DHCP_OPTION_SCOPE_TYPE;
+  {$EXTERNALSYM LPDHCP_OPTION_SCOPE_TYPE}
+  TDhcpOptionScopeType = DHCP_OPTION_SCOPE_TYPE;
+  PDhcpOptionScopeType = ^DHCP_OPTION_SCOPE_TYPE;
+
+  _DHCP_RESERVED_SCOPE = record
+    ReservedIpAddress: DHCP_IP_ADDRESS;
+    ReservedIpSubnetAddress: DHCP_IP_ADDRESS;
+  end;
+  {$EXTERNALSYM _DHCP_RESERVED_SCOPE}
+  DHCP_RESERVED_SCOPE = _DHCP_RESERVED_SCOPE;
+  {$EXTERNALSYM DHCP_RESERVED_SCOPE}
+  LPDHCP_RESERVED_SCOPE = ^DHCP_RESERVED_SCOPE;
+  {$EXTERNALSYM LPDHCP_RESERVED_SCOPE}
+  TDhcpReservedScope = DHCP_RESERVED_SCOPE;
+  PDhcpReservedScope = ^DHCP_RESERVED_SCOPE;
+
+  _DHCP_OPTION_SCOPE_UNION = record
+    case Integer of
+      0: (DefaultScopeInfo: PVOID); // must be NULL
+      1: (GlobalScopeInfo: PVOID);  // must be NULL
+      2: (SubnetScopeInfo: DHCP_IP_ADDRESS);
+      3: (ReservedScopeInfo: DHCP_RESERVED_SCOPE);
+      4: (MScopeInfo: LPWSTR);
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_SCOPE_UNION}
+
+  _DHCP_OPTION_SCOPE_INFO = record
+    ScopeType: DHCP_OPTION_SCOPE_TYPE;
+    ScopeInfo: _DHCP_OPTION_SCOPE_UNION;
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_SCOPE_INFO}
+  DHCP_OPTION_SCOPE_INFO = _DHCP_OPTION_SCOPE_INFO;
+  {$EXTERNALSYM DHCP_OPTION_SCOPE_INFO}
+  LPDHCP_OPTION_SCOPE_INFO = ^DHCP_OPTION_SCOPE_INFO;
+  {$EXTERNALSYM LPDHCP_OPTION_SCOPE_INFO}
+  TDhcpOptionScopeInfo = DHCP_OPTION_SCOPE_INFO;
+  PDhcpOptionScopeInfo = ^DHCP_OPTION_SCOPE_INFO;
+
+  _DHCP_HOST_INFO = record
+    IpAddress: DHCP_IP_ADDRESS;      // minimum information always available
+    NetBiosName: LPWSTR;             // optional information
+    HostName: LPWSTR;                // optional information
+  end;
+  {$EXTERNALSYM _DHCP_HOST_INFO}
+  DHCP_HOST_INFO = _DHCP_HOST_INFO;
+  {$EXTERNALSYM DHCP_HOST_INFO}
+  LPDHCP_HOST_INFO = ^DHCP_HOST_INFO;
+  {$EXTERNALSYM LPDHCP_HOST_INFO}
+  TDhcpHostInfo = DHCP_HOST_INFO;
+  PDhcpHostInfo = ^DHCP_HOST_INFO;
+
+  _DHCP_CLIENT_INFO = record
+    ClientIpAddress: DHCP_IP_ADDRESS;    // currently assigned IP address.
+    SubnetMask: DHCP_IP_MASK;
+    ClientHardwareAddress: DHCP_CLIENT_UID;
+    ClientName: LPWSTR;                  // optional.
+    ClientComment: LPWSTR;
+    ClientLeaseExpires: DATE_TIME;       // UTC time in FILE_TIME format.
+    OwnerHost: DHCP_HOST_INFO;           // host that distributed this IP address.
+  end;
+  {$EXTERNALSYM _DHCP_CLIENT_INFO}
+  DHCP_CLIENT_INFO = _DHCP_CLIENT_INFO;
+  {$EXTERNALSYM DHCP_CLIENT_INFO}
+  LPDHCP_CLIENT_INFO = ^DHCP_CLIENT_INFO;
+  {$EXTERNALSYM LPDHCP_CLIENT_INFO}
+  TDhcpClientInfo = DHCP_CLIENT_INFO;
+  PDhcpClientInfo = ^DHCP_CLIENT_INFO;
+
+  _DHCP_CLIENT_INFO_ARRAY = record
+    NumElements: DWORD;
+    Clients: ^LPDHCP_CLIENT_INFO; // array of pointers\
+  end;
+  {$EXTERNALSYM _DHCP_CLIENT_INFO_ARRAY}
+  DHCP_CLIENT_INFO_ARRAY = _DHCP_CLIENT_INFO_ARRAY;
+  {$EXTERNALSYM DHCP_CLIENT_INFO_ARRAY}
+  LPDHCP_CLIENT_INFO_ARRAY = ^DHCP_CLIENT_INFO_ARRAY;
+  {$EXTERNALSYM LPDHCP_CLIENT_INFO_ARRAY}
+  TDhcpClientInfoArray = DHCP_CLIENT_INFO_ARRAY;
+  PDhcpClientInfoArray = ^DHCP_CLIENT_INFO_ARRAY;
+
+  _DHCP_IP_ARRAY = record
+    NumElements: DWORD;
+    Elements: LPDHCP_IP_ADDRESS; //array
+  end;
+  {$EXTERNALSYM _DHCP_IP_ARRAY}
+  DHCP_IP_ARRAY = _DHCP_IP_ARRAY;
+  {$EXTERNALSYM DHCP_IP_ARRAY}
+  LPDHCP_IP_ARRAY = ^DHCP_IP_ARRAY;
+  {$EXTERNALSYM LPDHCP_IP_ARRAY}
+  TDhcpIpArray = DHCP_IP_ARRAY;
+  PDhcpIpArray = ^DHCP_IP_ARRAY;
+
+//
+// Subnet State.
+//
+// Currently a Subnet scope can be Enabled or Disabled.
+//
+// If the state is Enabled State,
+//  The server distributes address to the client, extends leases and
+//  accepts releases.
+//
+// If the state is Disabled State,
+//  The server does not distribute address to any new client, and does
+//  extent (and sends NACK) old leases, but the servers accepts lease
+//  releases.
+//
+// The idea behind this subnet state is, when the admin wants to stop
+//  serving a subnet, he moves the state from Enbaled to Disabled so
+//  that the clients from the subnets smoothly move to another servers
+//  serving that subnet. When all or most of the clients move to
+//  another server, the admin can delete the subnet without any force
+//  if no client left in that subnet, otherwise the admin should use
+//  full force to delete the subnet.
+//
+
+type
+  _DHCP_SUBNET_STATE = (
+    DhcpSubnetEnabled = 0,
+    DhcpSubnetDisabled,
+    DhcpSubnetEnabledSwitched,
+    DhcpSubnetDisabledSwitched,
+    DhcpSubnetInvalidState);
+  {$EXTERNALSYM _DHCP_SUBNET_STATE}
+  DHCP_SUBNET_STATE = _DHCP_SUBNET_STATE;
+  {$EXTERNALSYM DHCP_SUBNET_STATE}
+  LPDHCP_SUBNET_STATE = ^DHCP_SUBNET_STATE;
+  {$EXTERNALSYM LPDHCP_SUBNET_STATE}
+  TDhcpSubnetState = DHCP_SUBNET_STATE;
+  PDhcpSubnetState = ^DHCP_SUBNET_STATE;
+
+//
+// Subnet related data structures.
+//
+
+  _DHCP_SUBNET_INFO = record
+    SubnetAddress: DHCP_IP_ADDRESS;
+    SubnetMask: DHCP_IP_MASK;
+    SubnetName: LPWSTR;
+    SubnetComment: LPWSTR;
+    PrimaryHost: DHCP_HOST_INFO;
+    SubnetState: DHCP_SUBNET_STATE;
+  end;
+  {$EXTERNALSYM _DHCP_SUBNET_INFO}
+  DHCP_SUBNET_INFO = _DHCP_SUBNET_INFO;
+  {$EXTERNALSYM DHCP_SUBNET_INFO}
+  LPDHCP_SUBNET_INFO = ^DHCP_SUBNET_INFO;
+  {$EXTERNALSYM LPDHCP_SUBNET_INFO}
+  TDhcpSubnetInfo = DHCP_SUBNET_INFO;
+  PDhcpSubnetInfo = ^DHCP_SUBNET_INFO;
+
+//
+// DHCP Options related data structures.
+//
+
+  _DHCP_OPTION_DATA_TYPE = (
+    DhcpByteOption,
+    DhcpWordOption,
+    DhcpDWordOption,
+    DhcpDWordDWordOption,
+    DhcpIpAddressOption,
+    DhcpStringDataOption,
+    DhcpBinaryDataOption,
+    DhcpEncapsulatedDataOption);
+  {$EXTERNALSYM _DHCP_OPTION_DATA_TYPE}
+  DHCP_OPTION_DATA_TYPE = _DHCP_OPTION_DATA_TYPE;
+  {$EXTERNALSYM DHCP_OPTION_DATA_TYPE}
+  LPDHCP_OPTION_DATA_TYPE = ^DHCP_OPTION_DATA_TYPE;
+  {$EXTERNALSYM LPDHCP_OPTION_DATA_TYPE}
+  TDhcpOptionDataType = DHCP_OPTION_DATA_TYPE;
+  PDhcpOptionDataType = ^DHCP_OPTION_DATA_TYPE;
+
+  _DHCP_OPTION_ELEMENT_UNION = record
+    case Integer of
+      0: (ByteOption: BYTE);
+      1: (WordOption: WORD);
+      2: (DWordOption: DWORD);
+      3: (DWordDWordOption: DWORD_DWORD);
+      4: (IpAddressOption: DHCP_IP_ADDRESS);
+      5: (StringDataOption: LPWSTR);
+      6: (BinaryDataOption: DHCP_BINARY_DATA);
+      7: (EncapsulatedDataOption: DHCP_BINARY_DATA);
+      // for vendor specific information option.
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_ELEMENT_UNION}
+
+  _DHCP_OPTION_DATA_ELEMENT = record
+    OptionType: DHCP_OPTION_DATA_TYPE;
+    Element: _DHCP_OPTION_ELEMENT_UNION;
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_DATA_ELEMENT}
+  DHCP_OPTION_DATA_ELEMENT = _DHCP_OPTION_DATA_ELEMENT;
+  {$EXTERNALSYM DHCP_OPTION_DATA_ELEMENT}
+  LPDHCP_OPTION_DATA_ELEMENT = ^DHCP_OPTION_DATA_ELEMENT;
+  {$EXTERNALSYM LPDHCP_OPTION_DATA_ELEMENT}
+  TDhcpOptionDataElement = DHCP_OPTION_DATA_ELEMENT;
+  PDhcpOptionDataElement = ^DHCP_OPTION_DATA_ELEMENT;
+
+  _DHCP_OPTION_DATA = record
+    NumElements: DWORD; // number of option elements in the pointed array
+    Elements: LPDHCP_OPTION_DATA_ELEMENT; //array
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_DATA}
+  DHCP_OPTION_DATA = _DHCP_OPTION_DATA;
+  {$EXTERNALSYM DHCP_OPTION_DATA}
+  LPDHCP_OPTION_DATA = ^DHCP_OPTION_DATA;
+  {$EXTERNALSYM LPDHCP_OPTION_DATA}
+  TDhcpOptionData = DHCP_OPTION_DATA;
+  PDhcpOptionData = ^DHCP_OPTION_DATA;
+
+  _DHCP_OPTION_VALUE = record
+    OptionID: DHCP_OPTION_ID;
+    Value: DHCP_OPTION_DATA;
+  end;
+  {$EXTERNALSYM _DHCP_OPTION_VALUE}
+  DHCP_OPTION_VALUE = _DHCP_OPTION_VALUE;
+  {$EXTERNALSYM DHCP_OPTION_VALUE}
+  LPDHCP_OPTION_VALUE = ^DHCP_OPTION_VALUE;
+  {$EXTERNALSYM LPDHCP_OPTION_VALUE}
+  TDhcpOptionValue = DHCP_OPTION_VALUE;
+  PDhcpOptionValue = ^DHCP_OPTION_VALUE;  
+
+function DhcpGetVersion(ServerIpAddress: LPWSTR; MajorVersion, MinorVersion: LPDWORD): DWORD; stdcall;
+{$EXTERNALSYM DhcpGetVersion}
+function DhcpSetServerBindingInfo(ServerIpAddress: PWideChar; Flags: ULONG; BindElementInfo: LPDHCP_BIND_ELEMENT_ARRAY): DWORD; stdcall;
+{$EXTERNALSYM DhcpSetServerBindingInfo}
+function DhcpGetServerBindingInfo(ServerIpAddress: PWideChar; Flags: ULONG; out BindElementsInfo: LPDHCP_BIND_ELEMENT_ARRAY): DWORD; stdcall;
+{$EXTERNALSYM DhcpGetServerBindingInfo}
+function DhcpCreateClientInfo(ServerIpAddress: PWideChar; ClientInfo: LPDHCP_CLIENT_INFO): DWORD; stdcall;
+{$EXTERNALSYM DhcpCreateClientInfo}
+function DhcpSetClientInfo(ServerIpAddress: PWideChar; ClientInfo: LPDHCP_CLIENT_INFO): DWORD; stdcall;
+{$EXTERNALSYM DhcpSetClientInfo}
+function DhcpGetClientInfo(ServerIpAddress: PWideChar; SearchInfo: LPDHCP_SEARCH_INFO; ClientInfo: LPDHCP_CLIENT_INFO): DWORD; stdcall;
+{$EXTERNALSYM DhcpGetClientInfo}
+function DhcpDeleteClientInfo(ServerIpAddress: PWideChar; ClientInfo: LPDHCP_SEARCH_INFO): DWORD; stdcall;
+{$EXTERNALSYM DhcpDeleteClientInfo}
+function DhcpEnumSubnetClients(ServerIpAddress: PWideChar; SubnetAddress: DHCP_IP_ADDRESS; var ResumeHandle: DHCP_RESUME_HANDLE; PreferredMaximum: DWORD; out ClientInfo: LPDHCP_CLIENT_INFO_ARRAY; out ClientsRead, ClientsTotal: DWORD): DWORD; stdcall;
+{$EXTERNALSYM DhcpEnumSubnetClients}
+function DhcpEnumSubnets(ServerIpAddress: PWideChar; var ResumeHandle: DHCP_RESUME_HANDLE; PreferredMaximum: DWORD; EnumInfo: LPDHCP_IP_ARRAY; out ElementsRead, ElementsTotal: DWORD): DWORD; stdcall;
+{$EXTERNALSYM DhcpEnumSubnets}
+function DhcpGetSubnetInfo(ServerIpAddress: PWideChar; SubnetAddress: DHCP_IP_ADDRESS; out SubnetInfo: LPDHCP_SUBNET_INFO): DWORD; stdcall;
+{$EXTERNALSYM DhcpGetSubnetInfo}
+function DhcpGetOptionValue(ServerIpAddress: PWideChar; OptionID: DHCP_OPTION_ID; const ScopeInfo: DHCP_OPTION_SCOPE_INFO; out OptionValue: LPDHCP_OPTION_VALUE): DWORD; stdcall;
+{$EXTERNALSYM DhcpGetOptionValue}
+procedure DhcpRpcFreeMemory(BufferPointer: PVOID); stdcall;
+{$EXTERNALSYM DhcpRpcFreeMemory}
+
+implementation
+
+const
+  dhcplib = 'dhcpsapi.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DhcpGetVersion: Pointer;
+
+function DhcpGetVersion;
+begin
+  GetProcedureAddress(_DhcpGetVersion, dhcplib, 'DhcpGetVersion');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpGetVersion]
+  end;
+end;
+
+var
+  _DhcpSetServerBindingInfo: Pointer;
+
+function DhcpSetServerBindingInfo;
+begin
+  GetProcedureAddress(_DhcpSetServerBindingInfo, dhcplib, 'DhcpSetServerBindingInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpSetServerBindingInfo]
+  end;
+end;
+
+var
+  _DhcpGetServerBindingInfo: Pointer;
+
+function DhcpGetServerBindingInfo;
+begin
+  GetProcedureAddress(_DhcpGetServerBindingInfo, dhcplib, 'DhcpGetServerBindingInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpGetServerBindingInfo]
+  end;
+end;
+
+var
+  _DhcpCreateClientInfo: Pointer;
+
+function DhcpCreateClientInfo;
+begin
+  GetProcedureAddress(_DhcpCreateClientInfo, dhcplib, 'DhcpCreateClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpCreateClientInfo]
+  end;
+end;
+
+var
+  _DhcpSetClientInfo: Pointer;
+
+function DhcpSetClientInfo;
+begin
+  GetProcedureAddress(_DhcpSetClientInfo, dhcplib, 'DhcpSetClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpSetClientInfo]
+  end;
+end;
+
+var
+  _DhcpGetClientInfo: Pointer;
+
+function DhcpGetClientInfo;
+begin
+  GetProcedureAddress(_DhcpGetClientInfo, dhcplib, 'DhcpGetClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpGetClientInfo]
+  end;
+end;
+
+var
+  _DhcpDeleteClientInfo: Pointer;
+
+function DhcpDeleteClientInfo;
+begin
+  GetProcedureAddress(_DhcpDeleteClientInfo, dhcplib, 'DhcpDeleteClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpDeleteClientInfo]
+  end;
+end;
+
+var
+  _DhcpEnumSubnetClients: Pointer;
+
+function DhcpEnumSubnetClients;
+begin
+  GetProcedureAddress(_DhcpEnumSubnetClients, dhcplib, 'DhcpEnumSubnetClients');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpEnumSubnetClients]
+  end;
+end;
+
+var
+  _DhcpEnumSubnets: Pointer;
+
+function DhcpEnumSubnets;
+begin
+  GetProcedureAddress(_DhcpEnumSubnets, dhcplib, 'DhcpEnumSubnets');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpEnumSubnets]
+  end;
+end;
+
+var
+  _DhcpGetSubnetInfo: Pointer;
+
+function DhcpGetSubnetInfo;
+begin
+  GetProcedureAddress(_DhcpGetSubnetInfo, dhcplib, 'DhcpGetSubnetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpGetSubnetInfo]
+  end;
+end;
+
+var
+  _DhcpGetOptionValue: Pointer;
+
+function DhcpGetOptionValue;
+begin
+  GetProcedureAddress(_DhcpGetOptionValue, dhcplib, 'DhcpGetOptionValue');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpGetOptionValue]
+  end;
+end;
+
+var
+  _DhcpRpcFreeMemory: Pointer;
+
+procedure DhcpRpcFreeMemory;
+begin
+  GetProcedureAddress(_DhcpRpcFreeMemory, dhcplib, 'DhcpRpcFreeMemory');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DhcpRpcFreeMemory]
+  end;
+end;
+                                   
+{$ELSE}
+
+function DhcpGetVersion; external dhcplib name 'DhcpGetVersion';
+function DhcpSetServerBindingInfo; external dhcplib name 'DhcpSetServerBindingInfo';
+function DhcpGetServerBindingInfo; external dhcplib name 'DhcpGetServerBindingInfo';
+function DhcpCreateClientInfo; external dhcplib name 'DhcpCreateClientInfo';
+function DhcpSetClientInfo; external dhcplib name 'DhcpSetClientInfo';
+function DhcpGetClientInfo; external dhcplib name 'DhcpGetClientInfo';
+function DhcpDeleteClientInfo; external dhcplib name 'DhcpDeleteClientInfo';
+function DhcpEnumSubnetClients; external dhcplib name 'DhcpEnumSubnetClients';
+function DhcpEnumSubnets; external dhcplib name 'DhcpEnumSubnets';
+function DhcpGetSubnetInfo; external dhcplib name 'DhcpGetSubnetInfo';
+function DhcpGetOptionValue; external dhcplib name 'DhcpGetOptionValue';
+procedure DhcpRpcFreeMemory; external dhcplib name 'DhcpRpcFreeMemory';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 521 - 0
packages/extra/winunits/jwadhcpssdk.pas

@@ -0,0 +1,521 @@
+{******************************************************************************}
+{                                                                              }
+{ DHCP Callout DLL API interface unit for Object Pascal                        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dhcpssdk.h, released June 2000. The original Pascal    }
+{ code is: DhcpSSdk.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDhcpSSdk;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dhcpssdk.h"'}
+{$HPPEMIT ''}
+{$HPPEMIT 'typedef DHCP_IP_ADDRESS *LPDHCP_IP_ADDRESS;'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType;
+
+//  This structure could change any day.  This will be accurate only for version 0 -- which
+//  has to be checked for by any CalloutDLL that is hooking onto the DhcpHandleOptionsHook.
+
+type
+  DHCP_IP_ADDRESS = DWORD;
+  {$EXTERNALSYM DHCP_IP_ADDRESS}
+  LPDHCP_IP_ADDRESS = ^DHCP_IP_ADDRESS;
+  {$NODEFINE LPDHCP_IP_ADDRESS}
+  TDhcpIpAddress = DHCP_IP_ADDRESS;
+
+  _DHCP_SERVER_OPTIONS = record
+    MessageType: LPBYTE;
+    SubnetMask: LPDHCP_IP_ADDRESS;
+    RequestedAddress: LPDHCP_IP_ADDRESS;
+    RequestLeaseTime: LPDWORD;
+    OverlayFields: LPBYTE;
+    RouterAddress: LPDHCP_IP_ADDRESS;
+    Server: LPDHCP_IP_ADDRESS;
+    ParameterRequestList: LPBYTE;
+    ParameterRequestListLength: DWORD;
+    MachineName: PCHAR;
+    MachineNameLength: DWORD;
+    ClientHardwareAddressType: BYTE;
+    ClientHardwareAddressLength: BYTE;
+    ClientHardwareAddress: LPBYTE;
+    ClassIdentifier: PCHAR;
+    ClassIdentifierLength: DWORD;
+    VendorClass: LPBYTE;
+    VendorClassLength: DWORD;
+    DNSFlags: DWORD;
+    DNSNameLength: DWORD;
+    DNSName: LPBYTE;
+    DSDomainNameRequested: LongBool;
+    DSDomainName: PCHAR;
+    DSDomainNameLen: DWORD;
+    ScopeId: LPDWORD;
+  end;
+  {$EXTERNALSYM _DHCP_SERVER_OPTIONS}
+  DHCP_SERVER_OPTIONS = _DHCP_SERVER_OPTIONS;
+  {$EXTERNALSYM DHCP_SERVER_OPTIONS}
+  LPDHCP_SERVER_OPTIONS = ^DHCP_SERVER_OPTIONS;
+  {$EXTERNALSYM LPDHCP_SERVER_OPTIONS}
+  TDhcpServerOptions = DHCP_SERVER_OPTIONS;
+  PDhcpServerOptions = LPDHCP_SERVER_OPTIONS;
+
+//
+// The location in registry where the REG_MULTI_SZ list of callout DLLs
+// that the DHCP Server will try to load.
+//
+
+const
+  DHCP_CALLOUT_LIST_KEY    = WideString('System\CurrentControlSet\Services\DHCPServer\Parameters');
+  {$EXTERNALSYM DHCP_CALLOUT_LIST_KEY}
+  DHCP_CALLOUT_LIST_VALUE  = WideString('CalloutDlls');
+  {$EXTERNALSYM DHCP_CALLOUT_LIST_VALUE}
+  DHCP_CALLOUT_LIST_TYPE   = REG_MULTI_SZ;
+  {$EXTERNALSYM DHCP_CALLOUT_LIST_TYPE}
+  DHCP_CALLOUT_ENTRY_POINT = 'DhcpServerCalloutEntry';
+  {$EXTERNALSYM DHCP_CALLOUT_ENTRY_POINT}
+
+//
+// Control CODES used by DHCP Server to notify server state change.
+//
+
+  DHCP_CONTROL_START    = $00000001;
+  {$EXTERNALSYM DHCP_CONTROL_START}
+  DHCP_CONTROL_STOP     = $00000002;
+  {$EXTERNALSYM DHCP_CONTROL_STOP}
+  DHCP_CONTROL_PAUSE    = $00000003;
+  {$EXTERNALSYM DHCP_CONTROL_PAUSE}
+  DHCP_CONTROL_CONTINUE = $00000004;
+  {$EXTERNALSYM DHCP_CONTROL_CONTINUE}
+
+//
+// Other ControlCodes used by various Callout HOOKS.
+//
+
+  DHCP_DROP_DUPLICATE      = $00000001; // duplicate of pkt being processed
+  {$EXTERNALSYM DHCP_DROP_DUPLICATE}
+  DHCP_DROP_NOMEM          = $00000002; // not enough server mem in queues
+  {$EXTERNALSYM DHCP_DROP_NOMEM}
+  DHCP_DROP_INTERNAL_ERROR = $00000003; // ooops?
+  {$EXTERNALSYM DHCP_DROP_INTERNAL_ERROR}
+  DHCP_DROP_TIMEOUT        = $00000004; // too late, pkt is too old
+  {$EXTERNALSYM DHCP_DROP_TIMEOUT}
+  DHCP_DROP_UNAUTH         = $00000005; // server is not authorized to run
+  {$EXTERNALSYM DHCP_DROP_UNAUTH}
+  DHCP_DROP_PAUSED         = $00000006; // service is paused
+  {$EXTERNALSYM DHCP_DROP_PAUSED}
+  DHCP_DROP_NO_SUBNETS     = $00000007; // no subnets configured on server
+  {$EXTERNALSYM DHCP_DROP_NO_SUBNETS}
+  DHCP_DROP_INVALID        = $00000008; // invalid packet or client
+  {$EXTERNALSYM DHCP_DROP_INVALID}
+  DHCP_DROP_WRONG_SERVER   = $00000009; // client in different DS enterprise
+  {$EXTERNALSYM DHCP_DROP_WRONG_SERVER}
+  DHCP_DROP_NOADDRESS      = $0000000A; // no address available to offer
+  {$EXTERNALSYM DHCP_DROP_NOADDRESS}
+  DHCP_DROP_PROCESSED      = $0000000B; // packet has been processed
+  {$EXTERNALSYM DHCP_DROP_PROCESSED}
+  DHCP_DROP_GEN_FAILURE    = $00000100; // catch-all error
+  {$EXTERNALSYM DHCP_DROP_GEN_FAILURE}
+  DHCP_SEND_PACKET         = $10000000; // send the packet on wire
+  {$EXTERNALSYM DHCP_SEND_PACKET}
+  DHCP_PROB_CONFLICT       = $20000001; // address conflicted..
+  {$EXTERNALSYM DHCP_PROB_CONFLICT}
+  DHCP_PROB_DECLINE        = $20000002; // an addr got declined
+  {$EXTERNALSYM DHCP_PROB_DECLINE}
+  DHCP_PROB_RELEASE        = $20000003; // an addr got released
+  {$EXTERNALSYM DHCP_PROB_RELEASE}
+  DHCP_PROB_NACKED         = $20000004; // a client is being nacked.
+  {$EXTERNALSYM DHCP_PROB_NACKED}
+  DHCP_GIVE_ADDRESS_NEW    = $30000001; // give client a "new" address
+  {$EXTERNALSYM DHCP_GIVE_ADDRESS_NEW}
+  DHCP_GIVE_ADDRESS_OLD    = $30000002; // renew client's "old" address
+  {$EXTERNALSYM DHCP_GIVE_ADDRESS_OLD}
+  DHCP_CLIENT_BOOTP        = $30000003; // client is a BOOTP client
+  {$EXTERNALSYM DHCP_CLIENT_BOOTP}
+  DHCP_CLIENT_DHCP         = $30000004; // client is a DHCP client
+  {$EXTERNALSYM DHCP_CLIENT_DHCP}
+
+type
+  LPDHCP_CONTROL = function(dwControlCode: DWORD; lpReserved: LPVOID): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_CONTROL}
+  PDhcpControl = LPDHCP_CONTROL;
+
+{
+Routine Description:
+
+    This routine is called whenever the DHCP Server service is
+    started, stopped, paused or continued as defined by the values of
+    the dwControlCode parameter.  The lpReserved parameter is reserved
+    for future use and it should not be interpreted in any way.   This
+    routine should not block.
+
+Arguments:
+
+    dwControlCode - one of the DHCP_CONTROL_* values
+    lpReserved - reserved for future use.
+
+}
+
+type
+  LPDHCP_NEWPKT = function(var Packet: LPBYTE; var PacketSize: DWORD; IpAddress: DWORD;
+    Reserved: LPVOID; var PktContext: LPVOID; ProcessIt: LPBOOL): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_NEWPKT}
+  PDhcpNewPkt = LPDHCP_NEWPKT;
+
+{
+Routine Description:
+
+    This routine is called soon after the DHCP Server receives a
+    packet that it attempts to process.  This routine is in the
+    critical path of server execution and should return very fast, as
+    otherwise server performance will be impacted.  The Callout DLL
+    can modify the buffer or return a new buffer via the Packet,
+    PacketSize arguments.  Also, if the callout DLL has internal
+    structures to keep track of the packet and its progress, it can
+    then return a context to this packet in the PktContext parameter.
+    This context will be passed to almost all other hooks to indicate
+    the packet being referred to.  Also, if the Callout DLL is
+    planning on processing the packet or for some other reason the
+    DHCP server is not expected to process this packet, then it can
+    set the ProcessIt flag to FALSE to indicate that the packet is to
+    be dropped.
+
+Arguments:
+
+    Packet - This parameter points to a character buffer that holds
+    the actual packet received by the DHCP Server.
+
+    PacketSize - This parameter points to a variable that holds the
+    size of the above buffer.
+
+    IpAddress - This parameter points to an IPV4 host order IP address
+    of the socket that this packet was received on.
+
+    Reserved -Reserved for future use.
+
+    PktContect - This is an opaque pointer used by the DHCP Server for
+    future references to this packet.  It is expected that the callout
+    DLL will provide this pointer if it is interested in keeping track
+    of the packet.  (See the descriptions for the hooks below for
+    other usage of this Context).
+
+    ProcessIt - This is a BOOL flag that the CalloutDll can set to
+    TRUE or reset to indicate if the DHCP Server should continue
+    processing this packet or not, respectively.
+}
+
+type
+  LPDHCP_DROP_SEND = function(var Packet: LPBYTE; var PacketSize: DWORD;
+    ControlCode, IpAddress: DWORD; Reserved, PktContext: LPVOID): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_DROP_SEND}
+  PDhcpDropSend = LPDHCP_DROP_SEND;
+
+{
+Routine Description:
+
+    This hook is called if a packet is (DropPktHook) dropped for some
+    reason or if the packet is completely processed.   (If a packet is
+    dropped, the hook is called twice as it is called once again to
+    note that the packet has been completely processed).  The callout
+    DLL should  be prepared to handle this hook multiple times for a
+    packet. This routine should not block. The ControlCode parameter
+    defines the reasons for the packet being dropped:
+
+    * DHCP_DROP_DUPLICATE - This packet is a duplicate of another
+      received by the server.
+    * DHCP_DROP_NOMEM - Not enough memory to process the packet.
+    * DHCP_DROP_INTERNAL_ERROR - Unexpected nternal error occurred.
+    * DHCP_DROP_TIMEOUT - The packet is too old to process.
+    * DHCP_DROP_UNAUTH - The server is not authorized.
+    * DHCP_DROP_PAUSED - The server is paused.
+    * DHCP_DROP_NO_SUBNETS - There are no subnets configured.
+    * DHCP_DROP_INVALID - The packet is invalid or it came on an
+      invalid socket ..
+    * DHCP_DROP_WRONG_SERVER - The packet was sent to the wrong DHCP Server.
+    * DHCP_DROP_NOADDRESS - There is no address to offer.
+    * DHCP_DROP_PROCESSED - The packet has been processed.
+    * DHCP_DROP_GEN_FAILURE - An unknown error occurred.
+
+    This routine is also called right before a response is sent down
+    the wire (SendPktHook) and in this case the ControlCode has a
+    value of DHCP_SEND_PACKET.
+
+Arguments:
+
+    Packet - This parameter points to a character buffer that holds
+    the packet being processed by the DHCP Server.
+
+    PacketSize - This parameter points to a variable that holds the
+    size of the above buffer.
+
+    ControlCode - See description for various control codes.
+
+    IpAddress - This parameter points to an IPV4 host order IP address
+    of the socket that this packet was received on.
+
+    Reserved - Reserved for future use.
+
+    PktContext - This parameter is the packet context that the Callout
+    DLL NewPkt Hook returned for this packet.  This can be used to
+    track a packet.
+}
+
+type
+  LPDHCP_PROB = function(Packet: LPBYTE; PacketSize, ControlCode, IpAddress,
+    AltAddress: DWORD; Reserved, PktContext: LPVOID): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_PROB}
+  PDhcpProb = LPDHCP_PROB;
+
+{
+Routine Description:
+
+    This routine is called whenever special events occur that cause
+    the packet to be dropped etc.  The possible ControlCodes and their
+    meanings are as follows:
+
+    * DHCP_PROB_CONFLICT - The address attempted to be offered
+      (AltAddress) is in use in the network already.
+    * DHCP_PROB_DECLINE - The packet was a DECLINE message for the
+      address specified in AltAddress.
+    * DHCP_PROB_RELEASE - The packet was a RELEASE message for the
+      address specified in AltAddress.
+    * DHCP_PROB_NACKED - The packet was a REQUEST message for address
+      specified in AltAddress and it was NACKed by the server.
+
+    This routine should not block.
+
+Arguments:
+
+    Packet - This parameter is the buffer of the packet being
+    processed.
+
+    PacketSize - This is the size of the above buffer.
+
+    ControlCode - Specifies the event. See description below for
+    control codes and meanings.
+
+    IpAddress - IpV4 address of socket this packet was received on.
+
+    AltAddress - Request IpV4 Address or Ip address that is in
+    conflict.
+
+    Reserved - Reserve for future use.
+
+    PktContext - This is the context returned by the NewPkt hook for
+    this packet.
+}
+
+type
+  LPDHCP_GIVE_ADDRESS = function(Packet: LPBYTE; PacketSize, ControlCode, IpAddress,
+    AltAddress, AddrType, LeaseTime: DWORD; Reserved, PktContext: LPVOID): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_GIVE_ADDRESS}
+  PDhcpGiveAddress = LPDHCP_GIVE_ADDRESS;
+
+{
+Routine Description:
+
+    This routine is called when the server is about to send an ACK to
+    a REQUEST message.  The ControlCode specifies if the address is a
+    totally new address or if it an renewal of an old address (with
+    values DHCP_GIVE_ADDRESS_NEW and DHCP_GIVE_ADDRESS_OLD
+    respectively). The address being offered is passed as the
+    AltAddress parameter and the AddrType parameter can be one of
+    DHCP_CLIENT_BOOTP or DHCP_CLIENT_DHCP indicating whether the
+    client is using BOOTP or DHCP respectively. This call should not
+    block.
+
+Arguments:
+
+    Packet - This parameter is the buffer of the packet being
+    processed.
+
+    PacketSize - This is the size of the above buffer.
+
+    ControlCode -  See description above for control codes and
+    meanings.
+
+    IpAddress - IpV4 address of socket this packet was received on.
+
+    AltAddress - IpV4 address being ACKed to the client.
+
+    AddrType - Is this a DHCP or BOOTP address?
+
+    LeaseTime - Lease duration being passed.
+
+    Reserved - Reserve for future use.
+
+    PktContext - This is the context returned by the NewPkt hook for
+    this packet.
+}
+
+type
+  LPDHCP_HANDLE_OPTIONS = function(Packet: LPBYTE; PacketSize: DWORD;
+    Reserved, PktContext: LPVOID; ServerOptions: DHCP_SERVER_OPTIONS): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_HANDLE_OPTIONS}
+  TDhcpHandleOptions = LPDHCP_HANDLE_OPTIONS;
+
+{
+Routine Description:
+
+    This routine can be utilized by the CalloutDLL to avoid parsing
+    the whole packet.  The packet is parsed by the server and some
+    commonly used options are returned in the parsed pointers
+    structure (see header for definition of DHCP_SERVER_OPTIONS).  The
+    hook is expected to make a copy of the structure pointed to by
+    ServerOptions if it needs it beyond this function call.  This
+    routine may be called several times for a single packet.  This
+    routine should not block.
+
+Arguments:
+
+    Packet - This parameter is the buffer of the packet being
+    processed.
+
+    PacketSize - This is the size of the above buffer.
+
+    Reserved - Reserve for future use.
+
+    PktContext - This is the context returned by the NewPkt hook for
+    this packet.
+
+    ServerOptions - This parameter is the structure that contains a
+    bunch of pointers that represent corresponding options.
+}
+
+type
+  LPDHCP_DELETE_CLIENT = function(IpAddress: DWORD; HwAddress: LPBYTE;
+    HwAddressLength: ULONG; Reserved, ClientType: DWORD): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_DELETE_CLIENT}
+  PDhcpDeleteClient = LPDHCP_DELETE_CLIENT;
+
+{
+Routine Description:
+
+    This routine is called before a client lease is deleted off the
+    active leases database.  The ClientType field is currently not
+    provided and this should not be used.  This routine should not
+    block.
+
+Arguments:
+
+    IpAddress - IpV4 address of the client lease being deleted.
+
+    HwAddress - Buffer holding the Hardware address of the client (MAC).
+
+    HwAddressLength - This specifies the length of the above buffer.
+
+    Reserved - Reserved for future use.
+
+    ClientType - Reserved for future use.
+}
+
+type
+  _DHCP_CALLOUT_TABLE = record
+    DhcpControlHook: LPDHCP_CONTROL;
+    DhcpNewPktHook: LPDHCP_NEWPKT;
+    DhcpPktDropHook: LPDHCP_DROP_SEND;
+    DhcpPktSendHook: LPDHCP_DROP_SEND;
+    DhcpAddressDelHook: LPDHCP_PROB;
+    DhcpAddressOfferHook: LPDHCP_GIVE_ADDRESS;
+    DhcpHandleOptionsHook: LPDHCP_HANDLE_OPTIONS;
+    DhcpDeleteClientHook: LPDHCP_DELETE_CLIENT;
+    DhcpExtensionHook: LPVOID;
+    DhcpReservedHook: LPVOID;
+  end;
+  {$EXTERNALSYM _DHCP_CALLOUT_TABLE}
+  DHCP_CALLOUT_TABLE = _DHCP_CALLOUT_TABLE;
+  {$EXTERNALSYM DHCP_CALLOUT_TABLE}
+  LPDHCP_CALLOUT_TABLE = ^DHCP_CALLOUT_TABLE;
+  {$EXTERNALSYM LPDHCP_CALLOUT_TABLE}
+  TDhcpCalloutTable = DHCP_CALLOUT_TABLE;
+  PDhcpCalloutTable = LPDHCP_CALLOUT_TABLE;
+
+type
+  LPDHCP_ENTRY_POINT_FUNC = function(ChainDlls: LPWSTR; CalloutVersion: DWORD;
+    var CalloutTbl: DHCP_CALLOUT_TABLE): DWORD; stdcall;
+  {$EXTERNALSYM LPDHCP_ENTRY_POINT_FUNC}
+  PDhcpEntryPointFunc = LPDHCP_ENTRY_POINT_FUNC;
+
+{
+Routine Description:
+
+    This is the routine that is called by the DHCP Server when it
+    successfully loads a DLL.    If the routine succeeds, then the
+    DHCP Server does not attempt to load any of the DLLs specified in
+    the ChainDlls list of DLLs.   If this function fails for some
+    reason, then the DHCP Server proceeds to the next DLL in the
+    ChainDlls structure.
+
+    Note that for version negotiation, the server may call this
+    routine several times until a compatible version is found.
+
+    It is expected that the entrypoint routine would walk through the
+    names of the dlls and attempt to load each of them and when it
+    succeeds in retrieving the entry point, it attempts to get the
+    cumulative set of hooks by repeating the above procedure(as done
+    by the DHCP Server).
+
+Arguments:
+
+    ChainDlls - This is a set of DLL names in REG_MULTI_SZ format (as
+    returned by Registry function calls).  This does not contain the
+    name of the current DLL itself, but only the names of all DLLs
+    that follow the current DLL.
+
+    CalloutVersion - This is the version that the Callout DLL is
+    expected to support.  The current version number is 0.
+
+    CalloutTbl - This is the cumulative set of Hooks that is needed by
+    the current DLLs as well as all the DLLs in ChainDlls.   It is the
+    responsibility of the current DLL to retrive the cumulative set of
+    Hooks and merge that with its own set of hooks and return that in
+    this table structure.  The table structure is defined above.
+}
+
+implementation
+
+end.

+ 497 - 0
packages/extra/winunits/jwadlgs.pas

@@ -0,0 +1,497 @@
+{******************************************************************************}
+{                                                                              }
+{ UI dialog header information API interface unit for Object Pascal            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dlgs.h, released June 2000. The original Pascal        }
+{ code is: Dlgs.pas, released December 2000. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDlgs;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dlgs.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//
+//  Constant Declarations.
+//
+
+const
+  ctlFirst = $0400;
+  {$EXTERNALSYM ctlFirst}
+  ctlLast  = $04ff;
+  {$EXTERNALSYM ctlLast}
+
+//
+//  Push buttons.
+//
+
+  psh1    = $0400;
+  {$EXTERNALSYM psh1}
+  psh2    = $0401;
+  {$EXTERNALSYM psh2}
+  psh3    = $0402;
+  {$EXTERNALSYM psh3}
+  psh4    = $0403;
+  {$EXTERNALSYM psh4}
+  psh5    = $0404;
+  {$EXTERNALSYM psh5}
+  psh6    = $0405;
+  {$EXTERNALSYM psh6}
+  psh7    = $0406;
+  {$EXTERNALSYM psh7}
+  psh8    = $0407;
+  {$EXTERNALSYM psh8}
+  psh9    = $0408;
+  {$EXTERNALSYM psh9}
+  psh10   = $0409;
+  {$EXTERNALSYM psh10}
+  psh11   = $040a;
+  {$EXTERNALSYM psh11}
+  psh12   = $040b;
+  {$EXTERNALSYM psh12}
+  psh13   = $040c;
+  {$EXTERNALSYM psh13}
+  psh14   = $040d;
+  {$EXTERNALSYM psh14}
+  psh15   = $040e;
+  {$EXTERNALSYM psh15}
+  pshHelp = psh15;
+  {$EXTERNALSYM pshHelp}
+  psh16   = $040f;
+  {$EXTERNALSYM psh16}
+
+//
+//  Checkboxes.
+//
+
+  chx1  = $0410;
+  {$EXTERNALSYM chx1}
+  chx2  = $0411;
+  {$EXTERNALSYM chx2}
+  chx3  = $0412;
+  {$EXTERNALSYM chx3}
+  chx4  = $0413;
+  {$EXTERNALSYM chx4}
+  chx5  = $0414;
+  {$EXTERNALSYM chx5}
+  chx6  = $0415;
+  {$EXTERNALSYM chx6}
+  chx7  = $0416;
+  {$EXTERNALSYM chx7}
+  chx8  = $0417;
+  {$EXTERNALSYM chx8}
+  chx9  = $0418;
+  {$EXTERNALSYM chx9}
+  chx10 = $0419;
+  {$EXTERNALSYM chx10}
+  chx11 = $041a;
+  {$EXTERNALSYM chx11}
+  chx12 = $041b;
+  {$EXTERNALSYM chx12}
+  chx13 = $041c;
+  {$EXTERNALSYM chx13}
+  chx14 = $041d;
+  {$EXTERNALSYM chx14}
+  chx15 = $041e;
+  {$EXTERNALSYM chx15}
+  chx16 = $041f;
+  {$EXTERNALSYM chx16}
+
+//
+//  Radio buttons.
+//
+
+  rad1  = $0420;
+  {$EXTERNALSYM rad1}
+  rad2  = $0421;
+  {$EXTERNALSYM rad2}
+  rad3  = $0422;
+  {$EXTERNALSYM rad3}
+  rad4  = $0423;
+  {$EXTERNALSYM rad4}
+  rad5  = $0424;
+  {$EXTERNALSYM rad5}
+  rad6  = $0425;
+  {$EXTERNALSYM rad6}
+  rad7  = $0426;
+  {$EXTERNALSYM rad7}
+  rad8  = $0427;
+  {$EXTERNALSYM rad8}
+  rad9  = $0428;
+  {$EXTERNALSYM rad9}
+  rad10 = $0429;
+  {$EXTERNALSYM rad10}
+  rad11 = $042a;
+  {$EXTERNALSYM rad11}
+  rad12 = $042b;
+  {$EXTERNALSYM rad12}
+  rad13 = $042c;
+  {$EXTERNALSYM rad13}
+  rad14 = $042d;
+  {$EXTERNALSYM rad14}
+  rad15 = $042e;
+  {$EXTERNALSYM rad15}
+  rad16 = $042f;
+  {$EXTERNALSYM rad16}
+
+//
+//  Groups, frames, rectangles, and icons.
+//
+
+  grp1 = $0430;
+  {$EXTERNALSYM grp1}
+  grp2 = $0431;
+  {$EXTERNALSYM grp2}
+  grp3 = $0432;
+  {$EXTERNALSYM grp3}
+  grp4 = $0433;
+  {$EXTERNALSYM grp4}
+  frm1 = $0434;
+  {$EXTERNALSYM frm1}
+  frm2 = $0435;
+  {$EXTERNALSYM frm2}
+  frm3 = $0436;
+  {$EXTERNALSYM frm3}
+  frm4 = $0437;
+  {$EXTERNALSYM frm4}
+  rct1 = $0438;
+  {$EXTERNALSYM rct1}
+  rct2 = $0439;
+  {$EXTERNALSYM rct2}
+  rct3 = $043a;
+  {$EXTERNALSYM rct3}
+  rct4 = $043b;
+  {$EXTERNALSYM rct4}
+  ico1 = $043c;
+  {$EXTERNALSYM ico1}
+  ico2 = $043d;
+  {$EXTERNALSYM ico2}
+  ico3 = $043e;
+  {$EXTERNALSYM ico3}
+  ico4 = $043f;
+  {$EXTERNALSYM ico4}
+
+//
+//  Static text.
+//
+
+  stc1  = $0440;
+  {$EXTERNALSYM stc1}
+  stc2  = $0441;
+  {$EXTERNALSYM stc2}
+  stc3  = $0442;
+  {$EXTERNALSYM stc3}
+  stc4  = $0443;
+  {$EXTERNALSYM stc4}
+  stc5  = $0444;
+  {$EXTERNALSYM stc5}
+  stc6  = $0445;
+  {$EXTERNALSYM stc6}
+  stc7  = $0446;
+  {$EXTERNALSYM stc7}
+  stc8  = $0447;
+  {$EXTERNALSYM stc8}
+  stc9  = $0448;
+  {$EXTERNALSYM stc9}
+  stc10 = $0449;
+  {$EXTERNALSYM stc10}
+  stc11 = $044a;
+  {$EXTERNALSYM stc11}
+  stc12 = $044b;
+  {$EXTERNALSYM stc12}
+  stc13 = $044c;
+  {$EXTERNALSYM stc13}
+  stc14 = $044d;
+  {$EXTERNALSYM stc14}
+  stc15 = $044e;
+  {$EXTERNALSYM stc15}
+  stc16 = $044f;
+  {$EXTERNALSYM stc16}
+  stc17 = $0450;
+  {$EXTERNALSYM stc17}
+  stc18 = $0451;
+  {$EXTERNALSYM stc18}
+  stc19 = $0452;
+  {$EXTERNALSYM stc19}
+  stc20 = $0453;
+  {$EXTERNALSYM stc20}
+  stc21 = $0454;
+  {$EXTERNALSYM stc21}
+  stc22 = $0455;
+  {$EXTERNALSYM stc22}
+  stc23 = $0456;
+  {$EXTERNALSYM stc23}
+  stc24 = $0457;
+  {$EXTERNALSYM stc24}
+  stc25 = $0458;
+  {$EXTERNALSYM stc25}
+  stc26 = $0459;
+  {$EXTERNALSYM stc26}
+  stc27 = $045a;
+  {$EXTERNALSYM stc27}
+  stc28 = $045b;
+  {$EXTERNALSYM stc28}
+  stc29 = $045c;
+  {$EXTERNALSYM stc29}
+  stc30 = $045d;
+  {$EXTERNALSYM stc30}
+  stc31 = $045e;
+  {$EXTERNALSYM stc31}
+  stc32 = $045f;
+  {$EXTERNALSYM stc32}
+
+//
+//  Listboxes.
+//
+
+  lst1  = $0460;
+  {$EXTERNALSYM lst1}
+  lst2  = $0461;
+  {$EXTERNALSYM lst2}
+  lst3  = $0462;
+  {$EXTERNALSYM lst3}
+  lst4  = $0463;
+  {$EXTERNALSYM lst4}
+  lst5  = $0464;
+  {$EXTERNALSYM lst5}
+  lst6  = $0465;
+  {$EXTERNALSYM lst6}
+  lst7  = $0466;
+  {$EXTERNALSYM lst7}
+  lst8  = $0467;
+  {$EXTERNALSYM lst8}
+  lst9  = $0468;
+  {$EXTERNALSYM lst9}
+  lst10 = $0469;
+  {$EXTERNALSYM lst10}
+  lst11 = $046a;
+  {$EXTERNALSYM lst11}
+  lst12 = $046b;
+  {$EXTERNALSYM lst12}
+  lst13 = $046c;
+  {$EXTERNALSYM lst13}
+  lst14 = $046d;
+  {$EXTERNALSYM lst14}
+  lst15 = $046e;
+  {$EXTERNALSYM lst15}
+  lst16 = $046f;
+  {$EXTERNALSYM lst16}
+
+//
+//  Combo boxes.
+//
+
+  cmb1  = $0470;
+  {$EXTERNALSYM cmb1}
+  cmb2  = $0471;
+  {$EXTERNALSYM cmb2}
+  cmb3  = $0472;
+  {$EXTERNALSYM cmb3}
+  cmb4  = $0473;
+  {$EXTERNALSYM cmb4}
+  cmb5  = $0474;
+  {$EXTERNALSYM cmb5}
+  cmb6  = $0475;
+  {$EXTERNALSYM cmb6}
+  cmb7  = $0476;
+  {$EXTERNALSYM cmb7}
+  cmb8  = $0477;
+  {$EXTERNALSYM cmb8}
+  cmb9  = $0478;
+  {$EXTERNALSYM cmb9}
+  cmb10 = $0479;
+  {$EXTERNALSYM cmb10}
+  cmb11 = $047a;
+  {$EXTERNALSYM cmb11}
+  cmb12 = $047b;
+  {$EXTERNALSYM cmb12}
+  cmb13 = $047c;
+  {$EXTERNALSYM cmb13}
+  cmb14 = $047d;
+  {$EXTERNALSYM cmb14}
+  cmb15 = $047e;
+  {$EXTERNALSYM cmb15}
+  cmb16 = $047f;
+  {$EXTERNALSYM cmb16}
+
+//
+//  Edit controls.
+//
+
+  edt1  = $0480;
+  {$EXTERNALSYM edt1}
+  edt2  = $0481;
+  {$EXTERNALSYM edt2}
+  edt3  = $0482;
+  {$EXTERNALSYM edt3}
+  edt4  = $0483;
+  {$EXTERNALSYM edt4}
+  edt5  = $0484;
+  {$EXTERNALSYM edt5}
+  edt6  = $0485;
+  {$EXTERNALSYM edt6}
+  edt7  = $0486;
+  {$EXTERNALSYM edt7}
+  edt8  = $0487;
+  {$EXTERNALSYM edt8}
+  edt9  = $0488;
+  {$EXTERNALSYM edt9}
+  edt10 = $0489;
+  {$EXTERNALSYM edt10}
+  edt11 = $048a;
+  {$EXTERNALSYM edt11}
+  edt12 = $048b;
+  {$EXTERNALSYM edt12}
+  edt13 = $048c;
+  {$EXTERNALSYM edt13}
+  edt14 = $048d;
+  {$EXTERNALSYM edt14}
+  edt15 = $048e;
+  {$EXTERNALSYM edt15}
+  edt16 = $048f;
+  {$EXTERNALSYM edt16}
+
+//
+//  Scroll bars.
+//
+
+  scr1 = $0490;
+  {$EXTERNALSYM scr1}
+  scr2 = $0491;
+  {$EXTERNALSYM scr2}
+  scr3 = $0492;
+  {$EXTERNALSYM scr3}
+  scr4 = $0493;
+  {$EXTERNALSYM scr4}
+  scr5 = $0494;
+  {$EXTERNALSYM scr5}
+  scr6 = $0495;
+  {$EXTERNALSYM scr6}
+  scr7 = $0496;
+  {$EXTERNALSYM scr7}
+  scr8 = $0497;
+  {$EXTERNALSYM scr8}
+
+//
+//  Controls
+//
+
+  ctl1 = $04A0;
+  {$EXTERNALSYM ctl1}
+
+//
+//  These dialog resource ordinals really start at 0x0600, but the
+//  RC Compiler can't handle hex for resource IDs, hence the decimal.
+//
+
+  {$IFDEF UNIX}
+
+  MW_BIG_FILEOPENORD      = 10000;
+  {$EXTERNALSYM MW_BIG_FILEOPENORD}
+  MW_BIG_MULTIFILEOPENORD = 10001;
+  {$EXTERNALSYM MW_BIG_MULTIFILEOPENORD}
+
+  FILEOPENORDMOTIF = 10003;
+  {$EXTERNALSYM FILEOPENORDMOTIF}
+  PRINTDLGORDMOTIF = 10004;
+  {$EXTERNALSYM PRINTDLGORDMOTIF}
+  FINDDLGORDMOTIF  = 10005;
+  {$EXTERNALSYM FINDDLGORDMOTIF}
+
+  {$ENDIF UNIX}
+
+  FILEOPENORD      = 1536;
+  {$EXTERNALSYM FILEOPENORD}
+  MULTIFILEOPENORD = 1537;
+  {$EXTERNALSYM MULTIFILEOPENORD}
+  PRINTDLGORD      = 1538;
+  {$EXTERNALSYM PRINTDLGORD}
+  PRNSETUPDLGORD   = 1539;
+  {$EXTERNALSYM PRNSETUPDLGORD}
+  FINDDLGORD       = 1540;
+  {$EXTERNALSYM FINDDLGORD}
+  REPLACEDLGORD    = 1541;
+  {$EXTERNALSYM REPLACEDLGORD}
+  FONTDLGORD       = 1542;
+  {$EXTERNALSYM FONTDLGORD}
+  FORMATDLGORD31   = 1543;
+  {$EXTERNALSYM FORMATDLGORD31}
+  FORMATDLGORD30   = 1544;
+  {$EXTERNALSYM FORMATDLGORD30}
+  RUNDLGORD        = 1545;
+  {$EXTERNALSYM RUNDLGORD}
+
+  PAGESETUPDLGORD      = 1546;
+  {$EXTERNALSYM PAGESETUPDLGORD}
+  NEWFILEOPENORD       = 1547;
+  {$EXTERNALSYM NEWFILEOPENORD}
+  PRINTDLGEXORD        = 1549;
+  {$EXTERNALSYM PRINTDLGEXORD}
+  PAGESETUPDLGORDMOTIF = 1550;
+  {$EXTERNALSYM PAGESETUPDLGORDMOTIF}
+  COLORMGMTDLGORD      = 1551;
+  {$EXTERNALSYM COLORMGMTDLGORD}
+  NEWFILEOPENV2ORD     = 1552;
+  {$EXTERNALSYM NEWFILEOPENV2ORD}
+
+//
+//  Typedef Declarations.
+//
+
+type
+  tagCRGB = record
+    bRed: BYTE;
+    bGreen: BYTE;
+    bBlue: BYTE;
+    bExtra: BYTE;
+  end;
+  {$EXTERNALSYM tagCRGB}
+  CRGB = tagCRGB;
+  {$EXTERNALSYM CRGB}
+
+implementation
+
+end.

+ 258 - 0
packages/extra/winunits/jwadsadmin.pas

@@ -0,0 +1,258 @@
+{******************************************************************************}
+{                                                                              }
+{ Directory Services Admin API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dsadmin.h, released June 2000. The original Pascal     }
+{ code is: dsadmin.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDSAdmin;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dsadmin.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaAdsTLB, JwaPrSht, JwaWinType;
+
+//
+// CoClass for the Object creation dialog object
+//
+// {E301A009-F901-11d2-82B9-00C04F68928B}
+
+const
+  CLSID_DsAdminCreateObj: TGUID = (
+    D1:$e301a009; D2:$f901; D3:$11d2; D4:($82, $b9, $0, $c0, $4f, $68, $92, $8b));
+  {$EXTERNALSYM CLSID_DsAdminCreateObj}
+
+//
+// Interface GUIDs
+//
+
+// {53554A38-F902-11d2-82B9-00C04F68928B}
+
+  IID_IDsAdminCreateObj: TGUID = (
+    D1:$53554a38; D2:$f902; D3:$11d2; D4:($82, $b9, $0, $c0, $4f, $68, $92, $8b));
+  {$EXTERNALSYM IID_IDsAdminCreateObj}
+
+// {F2573587-E6FC-11d2-82AF-00C04F68928B}
+
+  IID_IDsAdminNewObj: TGUID = (
+    D1:$f2573587; D2:$e6fc; D3:$11d2; D4:($82, $af, $0, $c0, $4f, $68, $92, $8b));
+  {$EXTERNALSYM IID_IDsAdminNewObj}
+
+// {BE2B487E-F904-11d2-82B9-00C04F68928B}
+
+  IID_IDsAdminNewObjPrimarySite: TGUID = (
+    D1:$be2b487e; D2:$f904; D3:$11d2; D4:($82, $b9, $0, $c0, $4f, $68, $92, $8b));
+  {$EXTERNALSYM IID_IDsAdminNewObjPrimarySite}
+
+// {6088EAE2-E7BF-11d2-82AF-00C04F68928B}
+
+  IID_IDsAdminNewObjExt: TGUID = (
+    D1:$6088eae2; D2:$e7bf; D3:$11d2; D4:($82, $af, $0, $c0, $4f, $68, $92, $8b));
+  {$EXTERNALSYM IID_IDsAdminNewObjExt}
+
+// {E4A2B8B3-5A18-11d2-97C1-00A0C9A06D2D}
+
+  IID_IDsAdminNotifyHandler: TGUID = (
+    D1:$e4a2b8b3; D2:$5a18; D3:$11d2; D4:($97, $c1, $0, $a0, $c9, $a0, $6d, $2d));
+  {$EXTERNALSYM IID_IDsAdminNotifyHandler}
+
+// ----------------------------------------------------------------------------
+// 
+// Interface: IDsAdminCreateObj
+//  
+// Implemented by the object (implemented by the system) CLSID_DsAdminCreateObj
+//
+// Used by: any client needing to invoke the creation UI
+//
+
+type
+  IDsAdminCreateObj = interface (IUnknown)
+  ['{53554A38-F902-11d2-82B9-00C04F68928B}']
+    function Initialize(pADsContainerObj: IADsContainer; pADsCopySource: IADS;
+      lpszClassName: LPCWSTR): HRESULT; stdcall;
+    function CreateModal(hwndParent: HWND; out ppADsObj: IADS): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsAdminCreateObj}
+
+//---------------------------------------------------------------------------
+//
+// Interface: IDsAdminNewObj
+// 
+// Implemented by: DS Admin
+//
+// Used by: creation extension in proc server (both primary and regular)
+//
+
+  IDsAdminNewObj = interface (IUnknown)
+  ['{F2573587-E6FC-11d2-82AF-00C04F68928B}']
+    function SetButtons(nCurrIndex: ULONG; bValid: BOOL): HRESULT; stdcall;
+    function GetPageCounts(var pnTotal, pnStartIndex: LONG): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsAdminNewObj}
+
+//---------------------------------------------------------------------------
+//
+// Interface: IDsAdminNewObjPrimarySite
+// 
+// Implemented by: DS Admin
+//
+// Used by: creation extension in proc server (primary only)
+//
+
+  IDsAdminNewObjPrimarySite = interface (IUnknown)
+  ['{BE2B487E-F904-11d2-82B9-00C04F68928B}']
+    function CreateNew(pszName: LPCWSTR): HRESULT; stdcall;
+    function Commit: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsAdminNewObjPrimarySite}
+
+//
+// struct passed to IDsAdminNewObjExt::Initialize()
+//
+// it contains information regarding UI look
+//
+
+  LPDSA_NEWOBJ_DISPINFO = ^DSA_NEWOBJ_DISPINFO;
+  {$EXTERNALSYM LPDSA_NEWOBJ_DISPINFO}
+  DSA_NEWOBJ_DISPINFO = record
+    dwSize: DWORD;               // size of struct, for versioning
+    hObjClassIcon: HICON;        // class icon for the object to be created
+    lpszWizTitle: LPWSTR;        // title of the wizard
+    lpszContDisplayName: LPWSTR; // container display name (canonical name)
+  end;
+  {$EXTERNALSYM DSA_NEWOBJ_DISPINFO}
+  TDsaNewObjDispInfo = DSA_NEWOBJ_DISPINFO;
+  PDsaNewObjDispInfo = LPDSA_NEWOBJ_DISPINFO;
+
+//
+// context flags passed to IDsAdminNewObjExt::OnError() and to IDsAdminNewObjExt::WriteData()
+//
+
+const
+  DSA_NEWOBJ_CTX_PRECOMMIT  = $00000001; // before SetInfo()
+  {$EXTERNALSYM DSA_NEWOBJ_CTX_PRECOMMIT}
+  DSA_NEWOBJ_CTX_COMMIT     = $00000002; // SetInfo(), commit phase
+  {$EXTERNALSYM DSA_NEWOBJ_CTX_COMMIT}
+  DSA_NEWOBJ_CTX_POSTCOMMIT = $00000003; // after SetInfo()
+  {$EXTERNALSYM DSA_NEWOBJ_CTX_POSTCOMMIT}
+  DSA_NEWOBJ_CTX_CLEANUP    = $00000004; // on post commit fail
+  {$EXTERNALSYM DSA_NEWOBJ_CTX_CLEANUP}
+
+//---------------------------------------------------------------------------
+//
+// Interface: IDsAdminNewObjExt
+//
+// Implemented by: creation extension in proc server (both primary and regular)
+//
+// Used by: DS Admin
+//
+
+type
+  IDsAdminNewObjExt = interface (IUnknown)
+  ['{6088EAE2-E7BF-11d2-82AF-00C04F68928B}']
+    function Initialize(pADsContainerObj: IADsContainer; pADsCopySource: IADs;
+      lpszClassName: LPCWSTR; pDsAdminNewObj: IDsAdminNewObj;
+      const pDispInfo: DSA_NEWOBJ_DISPINFO): HRESULT; stdcall;
+    function AddPages(lpfnAddPage: LPFNADDPROPSHEETPAGE; lParam: LPARAM): HRESULT; stdcall;
+    function SetObject(pADsObj: IADs): HRESULT; stdcall;
+    function WriteData(hWnd: HWND; uContext: ULONG): HRESULT; stdcall;
+    function OnError(hWnd: HWND; hr: HRESULT; uContext: ULONG): HRESULT; stdcall;
+    function GetSummaryInfo(out pBstrText: WideString): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsAdminNewObjExt}
+
+//
+// Notification opcodes for IDsAdminNotifyHandler
+//
+
+const
+  DSA_NOTIFY_DEL  = $00000001; // delete
+  {$EXTERNALSYM DSA_NOTIFY_DEL}
+  DSA_NOTIFY_REN  = $00000002; // rename
+  {$EXTERNALSYM DSA_NOTIFY_REN}
+  DSA_NOTIFY_MOV  = $00000004; // move
+  {$EXTERNALSYM DSA_NOTIFY_MOV}
+  DSA_NOTIFY_PROP = $00000008; // property change
+  {$EXTERNALSYM DSA_NOTIFY_PROP}
+
+  DSA_NOTIFY_ALL = (DSA_NOTIFY_DEL or DSA_NOTIFY_REN or DSA_NOTIFY_MOV or
+    DSA_NOTIFY_PROP);
+  {$EXTERNALSYM DSA_NOTIFY_ALL}
+
+//
+// flags to handle additional data
+//
+
+  DSA_NOTIFY_FLAG_ADDITIONAL_DATA       = $00000002; // process additional extension data?
+  {$EXTERNALSYM DSA_NOTIFY_FLAG_ADDITIONAL_DATA}
+  DSA_NOTIFY_FLAG_FORCE_ADDITIONAL_DATA = $00000001; // operation forced
+  {$EXTERNALSYM DSA_NOTIFY_FLAG_FORCE_ADDITIONAL_DATA}
+
+//---------------------------------------------------------------------------
+//
+// Interface: IDsAdminNotifyHandler
+// 
+// Implemented by: notification handler in proc server
+//
+// Used by: DS Admin
+//
+
+type
+  IDsAdminNotifyHandler = interface (IUnknown)
+  ['{E4A2B8B3-5A18-11d2-97C1-00A0C9A06D2D}']
+    function Initialize(pExtraInfo: IDataObject; puEventFlags: PULONG): HRESULT; stdcall;
+    function Begin_(uEvent: ULONG; pArg1, pArg2: IDataObject; puFlags: ULONG;
+      out pBstr: WideString): HRESULT; stdcall;
+    function Notify(nItem: ULONG; uFlags: ULONG): HRESULT; stdcall;
+    function End_: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsAdminNotifyHandler}
+
+implementation
+
+end.

+ 771 - 0
packages/extra/winunits/jwadsclient.pas

@@ -0,0 +1,771 @@
+{******************************************************************************}
+{                                                                              }
+{ Active Directory Display API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dsclient.h, released June 2000. The original Pascal    }
+{ code is: DsClient.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDSClient;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dsclient.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaAdsTLB, JwaWinType;
+
+//---------------------------------------------------------------------------//
+// CLSIDs exposed for the dsclient.
+//---------------------------------------------------------------------------//
+
+// this CLSID is used to signal that the DSOBJECTNAMEs structure originated
+// for the Microsoft DS.
+
+const
+  CLSID_MicrosoftDS: TGUID = (
+    D1:$fe1290f0; D2:$cfbd; D3:$11cf; D4:($a3, $30, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_MicrosoftDS}
+
+  //CLSID_DsFolder: = CLSID_MicrosoftDS;
+  CLSID_DsFolder: TGUID = (
+    D1:$fe1290f0; D2:$cfbd; D3:$11cf; D4:($a3, $30, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsFolder}
+
+// this is the CLSID used by clients to get the IShellExtInit, IPropSheetExt
+// and IContextMenus exposed from dsuiext.dll.
+
+  CLSID_DsPropertyPages: TGUID = (
+    D1:$d45d530; D2:$764b; D3:$11d0; D4:($a1, $ca, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsPropertyPages}
+
+  CLSID_DsDomainTreeBrowser: TGUID = (
+    D1:$1698790a; D2:$e2b4; D3:$11d0; D4:($b0, $b1, $00, $c0, $4f, $d8, $dc, $a6));
+  {$EXTERNALSYM CLSID_DsDomainTreeBrowser}
+  IID_IDsBrowseDomainTree: TGUID = (
+    D1:$7cabcf1e; D2:$78f5; D3:$11d2; D4:($96, $c, $0, $c0, $4f, $a3, $1a, $86));
+  {$EXTERNALSYM IID_IDsBrowseDomainTree}
+
+  CLSID_DsDisplaySpecifier: TGUID = (
+    D1:$1ab4a8c0; D2:$6a0b; D3:$11d2; D4:($ad, $49, $0, $c0, $4f, $a3, $1a, $86));
+  {$EXTERNALSYM CLSID_DsDisplaySpecifier}
+  //IID_IDsDisplaySpecifier = CLSID_DsDisplaySpecifier;
+  IID_IDsDisplaySpecifier: TGUID = (
+    D1:$1ab4a8c0; D2:$6a0b; D3:$11d2; D4:($ad, $49, $0, $c0, $4f, $a3, $1a, $86));
+  {$EXTERNALSYM IID_IDsDisplaySpecifier}
+
+  CLSID_DsFolderProperties: TGUID = (
+    D1:$9e51e0d0; D2:$6e0f; D3:$11d2; D4:($96, $1, $0, $c0, $4f, $a3, $1a, $86));
+  {$EXTERNALSYM CLSID_DsFolderProperties}
+  //IID_IDsFolderProperties = CLSID_DsFolderProperties;
+  IID_IDsFolderProperties: TGUID = (
+    D1:$9e51e0d0; D2:$6e0f; D3:$11d2; D4:($96, $1, $0, $c0, $4f, $a3, $1a, $86));
+  {$EXTERNALSYM IID_IDsFolderProperties}
+
+// #include "activeds.h"
+
+//---------------------------------------------------------------------------//
+// Clipboard formats used within DSUI
+//---------------------------------------------------------------------------//
+
+//
+// CF_DSOBJECTS
+// ------------
+//  This clipboard format defines the seleciton for an DS IShellFolder to the
+//  shell extensions.   All strings are stored as BSTR's, and an offset == 0 
+//  is used to indicate that the string is not present.
+// 
+
+const
+  DSOBJECT_ISCONTAINER   = $00000001; // = 1 => object is a container
+  {$EXTERNALSYM DSOBJECT_ISCONTAINER}
+  DSOBJECT_READONLYPAGES = DWORD($80000000); // = 1 => read only pages
+  {$EXTERNALSYM DSOBJECT_READONLYPAGES}
+
+  DSPROVIDER_UNUSED_0 = $00000001;
+  {$EXTERNALSYM DSPROVIDER_UNUSED_0}
+  DSPROVIDER_UNUSED_1 = $00000002;
+  {$EXTERNALSYM DSPROVIDER_UNUSED_1}
+  DSPROVIDER_UNUSED_2 = $00000004;
+  {$EXTERNALSYM DSPROVIDER_UNUSED_2}
+  DSPROVIDER_UNUSED_3 = $00000008;
+  {$EXTERNALSYM DSPROVIDER_UNUSED_3}
+  DSPROVIDER_ADVANCED = $00000010; // = 1 => advanced mode
+  {$EXTERNALSYM DSPROVIDER_ADVANCED}
+
+  CFSTR_DSOBJECTNAMES = 'DsObjectNames';
+  {$EXTERNALSYM CFSTR_DSOBJECTNAMES}
+
+type
+  LPDSOBJECT = ^DSOBJECT;
+  {$EXTERNALSYM LPDSOBJECT}
+  DSOBJECT = record
+    dwFlags: DWORD; // item flags
+    dwProviderFlags: DWORD; // flags for item provider
+    offsetName: DWORD; // offset to ADS path of the object
+    offsetClass: DWORD; // offset to object class name / == 0 not known
+  end;
+  {$EXTERNALSYM DSOBJECT}
+  TDsObject = DSOBJECT;
+  PDsObject = LPDSOBJECT;
+
+  LPDSOBJECTNAMES = ^DSOBJECTNAMES;
+  {$EXTERNALSYM LPDSOBJECTNAMES}
+  DSOBJECTNAMES = record
+    clsidNamespace: CLSID; // namespace identifier (indicates which namespace selection from)
+    cItems: UINT; // number of objects
+    aObjects: array [0..0] of DSOBJECT; // array of objects
+  end;
+  {$EXTERNALSYM DSOBJECTNAMES}
+  TDsObjectNames = DSOBJECTNAMES;
+  PDsObjectNames = LPDSOBJECTNAMES;
+
+//
+// CF_DSDISPLAYSPECOPTIONS
+// -----------------------
+//  When invoking an object referenced by a display specifier (context menu, property
+//  page, etc) we call the IShellExtInit interface passing a IDataObject.  This data
+//  object supports the CF_DSDISPLAYSPECOPTIONS format to give out configuration
+//  informaiton about admin/shell invocation.
+//
+//  When interacting with dsuiext.dll the interfaces uses this clipboard format
+//  to determine which display specifier attributes to address (admin/shell)
+//  and pick up the values accordingly.  If no format is suppoted then
+//  dsuiext.dll defaults to shell.
+//
+
+const
+  CFSTR_DS_DISPLAY_SPEC_OPTIONS = 'DsDisplaySpecOptions';
+  {$EXTERNALSYM CFSTR_DS_DISPLAY_SPEC_OPTIONS}
+  CFSTR_DSDISPLAYSPECOPTIONS = CFSTR_DS_DISPLAY_SPEC_OPTIONS;
+  {$EXTERNALSYM CFSTR_DSDISPLAYSPECOPTIONS}
+
+type
+  LPDSDISPLAYSPECOPTIONS = ^DSDISPLAYSPECOPTIONS;
+  {$EXTERNALSYM LPDSDISPLAYSPECOPTIONS}
+  _DSDISPLAYSPECOPTIONS = record
+    dwSize: DWORD; // size of struct, for versioning
+    dwFlags: DWORD; // invocation flags
+    offsetAttribPrefix: DWORD; // offset to attribute prefix string.
+    offsetUserName: DWORD; // offset to UNICODE user name
+    offsetPassword: DWORD; // offset to UNICODE password
+    offsetServer: DWORD;
+    offsetServerConfigPath: DWORD;
+  end;
+  {$EXTERNALSYM _DSDISPLAYSPECOPTIONS}
+  DSDISPLAYSPECOPTIONS = _DSDISPLAYSPECOPTIONS;
+  {$EXTERNALSYM DSDISPLAYSPECOPTIONS}
+  TDsDisplaySpecOptions = DSDISPLAYSPECOPTIONS;
+  PDsDisplaySpecOptions = LPDSDISPLAYSPECOPTIONS;
+
+const
+  DS_PROP_SHELL_PREFIX = 'shell';
+  {$EXTERNALSYM DS_PROP_SHELL_PREFIX}
+  DS_PROP_ADMIN_PREFIX = 'admin';
+  {$EXTERNALSYM DS_PROP_ADMIN_PREFIX}
+
+  DSDSOF_HASUSERANDSERVERINFO = $00000001; // = 1 => user name/password are valid
+  {$EXTERNALSYM DSDSOF_HASUSERANDSERVERINFO}
+  DSDSOF_SIMPLEAUTHENTICATE   = $00000002; // = 1 => don't use secure authentication to DS
+  {$EXTERNALSYM DSDSOF_SIMPLEAUTHENTICATE}
+  DSDSOF_DONTSIGNSEAL         = $00000004; // = 1 => don't sign+seal when opening DS objects
+  {$EXTERNALSYM DSDSOF_DONTSIGNSEAL}
+  DSDSOF_DSAVAILABLE          = $40000000; // = 1 => ignore DS available checks
+  {$EXTERNALSYM DSDSOF_DSAVAILABLE}
+
+//
+// CF_DSPROPERTYPAGEINFO
+// ---------------------
+//  When the property pages for an object are being displayed the parsed
+//  display specifier string is passed to the page object via the IDataObject
+//  in the following clipboard format.
+//
+//  Within the display specifier for a property page, the format for a
+//  Win32 extension is "n,{clsid}[,bla...]" we take the "bla" section and
+//  pass it down.
+// 
+
+  CFSTR_DSPROPERTYPAGEINFO = 'DsPropPageInfo';
+  {$EXTERNALSYM CFSTR_DSPROPERTYPAGEINFO}
+
+type
+  LPDSPROPERTYPAGEINFO = ^DSPROPERTYPAGEINFO;
+  {$EXTERNALSYM LPDSPROPERTYPAGEINFO}
+  DSPROPERTYPAGEINFO = record
+    offsetString: DWORD; // offset to UNICODE string
+  end;
+  {$EXTERNALSYM DSPROPERTYPAGEINFO}
+  TDsPropertyPageInfo = DSPROPERTYPAGEINFO;
+  PDsPropertyPageInfo = LPDSPROPERTYPAGEINFO;
+
+//
+// To sync property pages and the admin tools this message is broadcast
+//
+
+const
+  DSPROP_ATTRCHANGED_MSG = 'DsPropAttrChanged';
+  {$EXTERNALSYM DSPROP_ATTRCHANGED_MSG}
+
+//---------------------------------------------------------------------------//
+
+//---------------------------------------------------------------------------//
+//
+// IDsBrowseDomainTree
+// ===================
+//  This interface returns a list of the domains from a given computer name
+//  (or the current computer name if none is specified).
+//
+//  NOTES:
+//    1) The structure returned by ::GetDomains should be free'd using
+//       FreeDomains.
+//
+//    2) ::BrowseTo allocates a string on exit, this is allocated using
+//       CoTaskMemAlloc, and therefore should be free'd using CoTaskMemFree.
+//
+//---------------------------------------------------------------------------//
+
+  DBDTF_RETURNFQDN         = $00000001; // if not set, pszNCName will be blank
+  {$EXTERNALSYM DBDTF_RETURNFQDN}
+  DBDTF_RETURNMIXEDDOMAINS = $00000002; // set it if you want downlevel trust domains too
+  {$EXTERNALSYM DBDTF_RETURNMIXEDDOMAINS}
+  DBDTF_RETURNEXTERNAL     = $00000004; // set it if you want external trust domains too
+  {$EXTERNALSYM DBDTF_RETURNEXTERNAL}
+  DBDTF_RETURNINBOUND      = $00000008; // set it if you want trusting domains
+  {$EXTERNALSYM DBDTF_RETURNINBOUND}
+  DBDTF_RETURNINOUTBOUND   = $00000010; // set it if you want both trusted and trusting domains
+  {$EXTERNALSYM DBDTF_RETURNINOUTBOUND}
+
+type
+  PDOMAINDESC = ^DOMAINDESC;
+  {$EXTERNALSYM PDOMAINDESC}
+  _DOMAINDESC = record
+    pszName: LPWSTR; // domain name (if no dns, use netbios)
+    pszPath: LPWSTR; // set to blank
+    pszNCName: LPWSTR; // FQDN, e.g.,DC=mydomain,DC=microsoft,DC=com
+    pszTrustParent: LPWSTR; // parent domain name (if no dns, use netbios)
+    pszObjectClass: LPWSTR; // Object class of the domain object referenced
+    ulFlags: ULONG; // Flags, from DS_TRUSTED_DOMAINS.Flags
+    fDownLevel: BOOL; // == 1 if downlevel domain
+    pdChildList: PDOMAINDESC; // Children of this node
+    pdNextSibling: PDOMAINDESC; // Siblings of this node
+  end;
+  {$EXTERNALSYM _DOMAINDESC}
+  DOMAINDESC = _DOMAINDESC;
+  {$EXTERNALSYM DOMAINDESC}
+  TDomainDesc = DOMAINDESC;
+
+  PDOMAIN_TREE = ^DOMAIN_TREE;
+  {$EXTERNALSYM PDOMAIN_TREE}
+  DOMAIN_TREE = record
+    dsSize: DWORD;
+    dwCount: DWORD;
+    aDomains: array [0..1 - 1] of DOMAINDESC;
+  end;
+  {$EXTERNALSYM DOMAIN_TREE}
+  DOMAINTREE = DOMAIN_TREE;
+  {$EXTERNALSYM DOMAINTREE}
+  TDomainTree = DOMAIN_TREE;
+  PDomainTree = PDOMAIN_TREE;
+  
+  IDsBrowseDomainTree = interface (IUnknown)
+  ['{7cabcf1e-78f5-11d2-960c-00c04fa31a86}']
+    function BrowseTo(hwndParent: HWND; var ppszTargetPath: LPWSTR;
+      dwFlags: DWORD): HRESULT; stdcall;
+    function GetDomains(var ppDomainTree: PDOMAIN_TREE;
+      dwFlags: DWORD): HRESULT; stdcall;
+    function FreeDomains(var ppDomainTree: PDOMAIN_TREE): HRESULT; stdcall;
+    function FlushCachedDomains: HRESULT; stdcall;
+    function SetComputer(pszComputerName, pszUserName,
+      pszPassword: LPCWSTR): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDsBrowseDomainTree}
+
+//---------------------------------------------------------------------------//
+
+//---------------------------------------------------------------------------//
+//
+// IDsDisplaySpecifier
+// ===================
+//  This interface gives client UI access to the display specifiers for 
+//  specific attributes.
+//
+//---------------------------------------------------------------------------//
+
+//
+// IDsDisplaySpecifier::SetServer flags
+//
+
+const
+  DSSSF_SIMPLEAUTHENTICATE = $00000001; // = 1 => don't use secure authentication to DS
+  {$EXTERNALSYM DSSSF_SIMPLEAUTHENTICATE}
+  DSSSF_DONTSIGNSEAL       = $00000002; // = 1 => don't use sign+seal when opening objects in the DS
+  {$EXTERNALSYM DSSSF_DONTSIGNSEAL}
+  DSSSF_DSAVAILABLE        = DWORD($80000000); // = 1 => ignore DS available checks
+  {$EXTERNALSYM DSSSF_DSAVAILABLE}
+
+//
+// Flags for IDsDisplaySpecifier::GetIcon / GetIconLocation
+//
+
+  DSGIF_ISNORMAL           = $0000000; // = icon is in normal state (default)
+  {$EXTERNALSYM DSGIF_ISNORMAL}
+  DSGIF_ISOPEN             = $0000001; // = icon is in open state
+  {$EXTERNALSYM DSGIF_ISOPEN}
+  DSGIF_ISDISABLED         = $0000002; // = icon is in a disabled state
+  {$EXTERNALSYM DSGIF_ISDISABLED}
+  DSGIF_ISMASK             = $000000f;
+  {$EXTERNALSYM DSGIF_ISMASK}
+  DSGIF_GETDEFAULTICON     = $0000010; // = 1 => if no icon then get default (from shell32.dll)
+  {$EXTERNALSYM DSGIF_GETDEFAULTICON}
+  DSGIF_DEFAULTISCONTAINER = $0000020; // = 1 => if returning default icon, return it as a container
+  {$EXTERNALSYM DSGIF_DEFAULTISCONTAINER}
+
+//
+// Flags for IDsDisplaySpecifier::IsClassContainer
+//
+
+  DSICCF_IGNORETREATASLEAF = $00000001; // = 1 => igore the "treatAsLeaf" and use only schema information
+  {$EXTERNALSYM DSICCF_IGNORETREATASLEAF}
+
+//
+// Callback function used for IDsDisplaySpecifier::EnumClassAttributes
+//
+
+  DSECAF_NOTLISTED = $00000001; // = 1 => hide from the field drop down in the query UI
+  {$EXTERNALSYM DSECAF_NOTLISTED}
+
+type
+  LPDSENUMATTRIBUTES = function(lParam: LPARAM; pszAttributeName: LPCWSTR;
+    pszDisplayName: LPCWSTR; dwFlags: DWORD): HRESULT; stdcall;
+  {$EXTERNALSYM LPDSENUMATTRIBUTES}
+  TDsEnumAttributes = LPDSENUMATTRIBUTES;  
+
+//
+// IDsDisplaySpecifier::GetClassCreationInfo information
+//
+
+const
+  DSCCIF_HASWIZARDDIALOG      = $00000001; // = 1 => return the wizard dialog CLSID
+  {$EXTERNALSYM DSCCIF_HASWIZARDDIALOG}
+  DSCCIF_HASWIZARDPRIMARYPAGE = $00000002; // = 1 => returning a primary wizard dlg CLSID
+  {$EXTERNALSYM DSCCIF_HASWIZARDPRIMARYPAGE}
+
+type
+  LPDSCLASSCREATIONINFO = ^DSCLASSCREATIONINFO;
+  {$EXTERNALSYM LPDSCLASSCREATIONINFO}
+  DSCLASSCREATIONINFO = record
+    dwFlags: DWORD;
+    clsidWizardDialog: CLSID;
+    clsidWizardPrimaryPage: CLSID;
+    cWizardExtensions: DWORD; // how many extension CLSIDs?
+    aWizardExtensions: array [0..0] of CLSID;
+  end;
+  {$EXTERNALSYM DSCLASSCREATIONINFO}
+  TDsClassCreationInfo = DSCLASSCREATIONINFO;
+  PDsClassCreationInfo = LPDSCLASSCREATIONINFO;
+
+//
+// IDsDisplaySpecifier - a COM object for interacting with display specifiers
+//
+
+  IDsDisplaySpecifier = interface (IUnknown)
+  ['{1ab4a8c0-6a0b-11d2-ad49-00c04fa31a86}']
+    function SetServer(pszServer, pszUserName, pszPassword: LPCWSTR;
+      dwFlags: DWORD): HRESULT; stdcall;
+    function SetLanguageID(langid: LANGID): HRESULT; stdcall;
+    function GetDisplaySpecifier(pszObjectClass: LPCWSTR; riid: LPGUID;
+      var ppv: Pointer): HRESULT; stdcall;
+    function GetIconLocation(pszObjectClass: LPCWSTR; dwFlags: DWORD;
+      pszBuffer: LPWSTR; cchBuffer: Integer; var presid: Integer): HRESULT; stdcall;
+    function GetIcon(pszObjectClass: LPCWSTR; dwFlags: DWORD;
+      cxIcon, cyIcon: Integer): HICON; stdcall;
+    function GetFriendlyClassName(pszObjectClass: LPCWSTR; pszBuffer: LPWSTR;
+      cchBuffer: Integer): HRESULT; stdcall;
+    function GetFriendlyAttributeName(pszObjectClass, pszAttributeName,
+      pszBuffer: LPCWSTR; cchBuffer: UINT): HRESULT; stdcall;
+    function IsClassContainer(pszObjectClass, pszADsPath: LPCWSTR;
+      dwFlags: DWORD): BOOL; stdcall;
+    function GetClassCreationInfo(pszObjectClass: LPCWSTR;
+      var ppdscci: LPDSCLASSCREATIONINFO): HRESULT; stdcall;
+    function EnumClassAttributes(pszObjectClass: LPCWSTR;
+      pcbEnum: LPDSENUMATTRIBUTES; lParam: LPARAM): HRESULT; stdcall;
+    function GetAttributeADsType(pszAttributeName: LPCWSTR): ADSTYPEENUM; stdcall;
+  end;
+  {$EXTERNALSYM IDsDisplaySpecifier}
+
+//---------------------------------------------------------------------------//
+//
+// DsBrowseForContainer
+// --------------------
+//  Provides a container browser similar to the SHBrowseForFolder, except
+//  targetting the DS.
+//
+// In:
+//  pInfo -> DSBROWSEINFO structure
+//
+// Out:
+//  == IDOK/IDCANCEL depending on buttons, -1 if error
+//
+//---------------------------------------------------------------------------//
+
+type
+  BFFCALLBACK = function(hwnd: HWND; msg: UINT;
+    lpData, lParam: LPARAM): Integer; stdcall;
+  {$NODEFINE BFFCALLBACK}
+  TBffCallback = BFFCALLBACK;
+
+  PDSBROWSEINFOW = ^DSBROWSEINFOW;
+  DSBROWSEINFOW = record
+    cbStruct: DWORD; // size of structure in bytes
+    hwndOwner: HWND; // dialog owner
+    pszCaption: LPCWSTR; // dialog caption text (can be NULL)
+    pszTitle: LPCWSTR; // displayed above the tree view control (can be NULL)
+    pszRoot: LPCWSTR; // ADS path to root (NULL == root of DS namespace)
+    pszPath: LPWSTR; // [in/out] initial selection & returned path (required)
+    cchPath: ULONG; // size of pszPath buffer in characters
+    dwFlags: DWORD;
+    pfnCallback: BFFCALLBACK; // callback function(see SHBrowseForFolder)
+    lParam: LPARAM; // passed to pfnCallback as lpUserData
+    dwReturnFormat: DWORD; // ADS_FORMAT_* (default is ADS_FORMAT_X500_NO_SERVER)
+    pUserName: LPCWSTR; // Username and Password to authenticate against DS with
+    pPassword: LPCWSTR;
+    pszObjectClass: LPWSTR; // UNICODE string for the object class
+    cchObjectClass: ULONG;
+  end;
+  {$EXTERNALSYM DSBROWSEINFOW}
+  TDsBrowseInfoW = DSBROWSEINFOW;
+
+  PDSBROWSEINFOA = ^DSBROWSEINFOA;
+  DSBROWSEINFOA = record
+    cbStruct: DWORD;
+    hwndOwner: HWND;
+    pszCaption: LPCSTR;
+    pszTitle: LPCSTR;
+    pszRoot: LPCWSTR; // ADS paths are always UNICODE
+    pszPath: LPWSTR; // ditto
+    cchPath: ULONG;
+    dwFlags: DWORD;
+    pfnCallback: BFFCALLBACK;
+    lParam: LPARAM;
+    dwReturnFormat: DWORD;
+    pUserName: LPCWSTR; // Username and Password to authenticate against DS with
+    pPassword: LPCWSTR;
+    pszObjectClass: LPWSTR; // object class of the selected object
+    cchObjectClass: ULONG;
+  end;
+  {$EXTERNALSYM DSBROWSEINFOA}
+  TDsBrowseInfoA = DSBROWSEINFOA;
+
+  {$IFDEF UNICODE}
+  DSBROWSEINFO = DSBROWSEINFOW;
+  {$EXTERNALSYM DSBROWSEINFO}
+  PDSBROWSEINFO = PDSBROWSEINFOW;
+  {$EXTERNALSYM PDSBROWSEINFO}
+  TDsBrowseInfo = TDsBrowseInfoW;
+  {$ELSE}
+  DSBROWSEINFO = DSBROWSEINFOA;
+  {$EXTERNALSYM DSBROWSEINFO}
+  PDSBROWSEINFO = PDSBROWSEINFOA;
+  {$EXTERNALSYM PDSBROWSEINFO}
+  TDsBrowseInfo = TDsBrowseInfoA;
+  {$ENDIF UNICODE}
+
+// DSBROWSEINFO flags
+
+const
+  DSBI_NOBUTTONS          = $00000001; // NOT TVS_HASBUTTONS
+  {$EXTERNALSYM DSBI_NOBUTTONS}
+  DSBI_NOLINES            = $00000002; // NOT TVS_HASLINES
+  {$EXTERNALSYM DSBI_NOLINES}
+  DSBI_NOLINESATROOT      = $00000004; // NOT TVS_LINESATROOT
+  {$EXTERNALSYM DSBI_NOLINESATROOT}
+  DSBI_CHECKBOXES         = $00000100; // TVS_CHECKBOXES
+  {$EXTERNALSYM DSBI_CHECKBOXES}
+  DSBI_NOROOT             = $00010000; // don't include pszRoot in tree (its children become top level nodes)
+  {$EXTERNALSYM DSBI_NOROOT}
+  DSBI_INCLUDEHIDDEN      = $00020000; // display hidden objects
+  {$EXTERNALSYM DSBI_INCLUDEHIDDEN}
+  DSBI_EXPANDONOPEN       = $00040000; // expand to the path specified in pszPath when opening the dialog
+  {$EXTERNALSYM DSBI_EXPANDONOPEN}
+  DSBI_ENTIREDIRECTORY    = $00090000; // browse the entire directory (defaults to having DSBI_NOROOT set)
+  {$EXTERNALSYM DSBI_ENTIREDIRECTORY}
+  DSBI_RETURN_FORMAT      = $00100000; // dwReturnFormat field is valid
+  {$EXTERNALSYM DSBI_RETURN_FORMAT}
+  DSBI_HASCREDENTIALS     = $00200000; // pUserName & pPassword are valid
+  {$EXTERNALSYM DSBI_HASCREDENTIALS}
+  DSBI_IGNORETREATASLEAF  = $00400000; // ignore the treat as leaf flag when calling IsClassContainer
+  {$EXTERNALSYM DSBI_IGNORETREATASLEAF}
+  DSBI_SIMPLEAUTHENTICATE = $00800000; // don't use secure authentication to DS
+  {$EXTERNALSYM DSBI_SIMPLEAUTHENTICATE}
+  DSBI_RETURNOBJECTCLASS  = $01000000; // return object class of selected object
+  {$EXTERNALSYM DSBI_RETURNOBJECTCLASS}
+  DSBI_DONTSIGNSEAL       = $02000000; // don't sign+seal communication with DS
+  {$EXTERNALSYM DSBI_DONTSIGNSEAL}
+
+  DSB_MAX_DISPLAYNAME_CHARS = 64;
+  {$EXTERNALSYM DSB_MAX_DISPLAYNAME_CHARS}
+
+type
+  PDSBITEMW = ^DSBITEMW;
+  DSBITEMW = record
+    cbStruct: DWORD;
+    pszADsPath: LPCWSTR; // ADS paths are always Unicode
+    pszClass: LPCWSTR; // ADS properties are always Unicode
+    dwMask: DWORD;
+    dwState: DWORD;
+    dwStateMask: DWORD;
+    szDisplayName: array [0..DSB_MAX_DISPLAYNAME_CHARS - 1] of WCHAR;
+    szIconLocation: array [0..MAX_PATH - 1] of WCHAR;
+    iIconResID: Integer;
+  end;
+  {$EXTERNALSYM DSBITEMW}
+  TDsBItemW = DSBITEMW;
+
+  PDSBITEMA = ^DSBITEMA;
+  DSBITEMA = record
+    cbStruct: DWORD;
+    pszADsPath: LPCWSTR; // ADS paths are always Unicode
+    pszClass: LPCWSTR; // ADS properties are always Unicode
+    dwMask: DWORD;
+    dwState: DWORD;
+    dwStateMask: DWORD;
+    szDisplayName: array [0..DSB_MAX_DISPLAYNAME_CHARS - 1] of CHAR;
+    szIconLocation: array [0..MAX_PATH - 1] of CHAR;
+    iIconResID: Integer;
+  end;
+  {$EXTERNALSYM DSBITEMA}
+  TDsBItemA = DSBITEMA;
+
+  {$IFDEF UNICODE}
+  DSBITEM = DSBITEMW;
+  {$EXTERNALSYM DSBITEM}
+  PDSBITEM = PDSBITEMW;
+  {$EXTERNALSYM PDSBITEM}
+  TDsBItem = TDsBItemW;
+  {$ELSE}
+  DSBITEM = DSBITEMA;
+  {$EXTERNALSYM DSBITEM}
+  PDSBITEM = PDSBITEMA;
+  {$EXTERNALSYM PDSBITEM}
+  TDsBItem = TDsBItemA;
+  {$ENDIF UNICODE}
+
+// DSBITEM mask flags
+
+const
+  DSBF_STATE        = $00000001;
+  {$EXTERNALSYM DSBF_STATE}
+  DSBF_ICONLOCATION = $00000002;
+  {$EXTERNALSYM DSBF_ICONLOCATION}
+  DSBF_DISPLAYNAME  = $00000004;
+  {$EXTERNALSYM DSBF_DISPLAYNAME}
+
+// DSBITEM state flags
+
+  DSBS_CHECKED = $00000001;
+  {$EXTERNALSYM DSBS_CHECKED}
+  DSBS_HIDDEN  = $00000002;
+  {$EXTERNALSYM DSBS_HIDDEN}
+  DSBS_ROOT    = $00000004;
+  {$EXTERNALSYM DSBS_ROOT}
+
+//
+// this message is sent to the callback to see if it wants to insert or modify
+// the item that is about to be inserted into the view.
+//
+
+  DSBM_QUERYINSERTW = 100; // lParam = PDSBITEMW (state, icon & name may be modified). Return TRUE if handled.
+  {$EXTERNALSYM DSBM_QUERYINSERTW}
+  DSBM_QUERYINSERTA = 101; // lParam = PDSBITEMA (state, icon & name may be modified). Return TRUE if handled.
+  {$EXTERNALSYM DSBM_QUERYINSERTA}
+
+  {$IFDEF UNICODE}
+  DSBM_QUERYINSERT = DSBM_QUERYINSERTW;
+  {$EXTERNALSYM DSBM_QUERYINSERT}
+  {$ELSE}
+  DSBM_QUERYINSERT = DSBM_QUERYINSERTA;
+  {$EXTERNALSYM DSBM_QUERYINSERT}
+  {$ENDIF UNICODE}
+
+//
+// Called before we change the state of the icon (on tree collapse/expand)
+//
+
+  DSBM_CHANGEIMAGESTATE = 102; // lParam = adspath.  Return TRUE/FALSE top allow/disallow
+  {$EXTERNALSYM DSBM_CHANGEIMAGESTATE}
+
+//
+// The dialog receives a WM_HELP
+//
+
+  DSBM_HELP = 103; // lParam == LPHELPINFO structure
+  {$EXTERNALSYM DSBM_HELP}
+
+//
+// The dialog receives a WM_CONTEXTMENU, DSBID_xxx are the control ID's for this
+// dialog so that you can display suitable help.
+//
+
+  DSBM_CONTEXTMENU = 104; // lParam == window handle to retrieve help for
+  {$EXTERNALSYM DSBM_CONTEXTMENU}
+
+//
+// These are the control IDs for the controls in the dialog.   The callback can use
+// these to modify the contents of the dialog as required.
+//
+
+  DSBID_BANNER        = 256;
+  {$EXTERNALSYM DSBID_BANNER}
+  DSBID_CONTAINERLIST = 257;
+  {$EXTERNALSYM DSBID_CONTAINERLIST}
+
+//
+// API exported for browsing for containers.
+//
+
+function DsBrowseForContainerW(const pInfo: DSBROWSEINFOW): Integer; stdcall;
+{$EXTERNALSYM DsBrowseForContainerW}
+function DsBrowseForContainerA(const pInfo: DSBROWSEINFOA): Integer; stdcall;
+{$EXTERNALSYM DsBrowseForContainerA}
+function DsBrowseForContainer(const pInfo: DSBROWSEINFO): Integer; stdcall;
+{$EXTERNALSYM DsBrowseForContainer}
+
+//BUGBUG: these are here to keep old clients building - remove soon
+
+function DsGetIcon(dwFlags: DWORD; pszObjectClass: LPWSTR;
+  cxImage, cyImage: Integer): HICON; stdcall;
+{$EXTERNALSYM DsGetIcon}
+procedure DsGetFriendlyClassName(pszObjectClass, pszBuffer: LPWSTR;
+  cchBuffer: UINT); stdcall;
+{$EXTERNALSYM DsGetFriendlyClassName}
+
+implementation
+
+const
+  dsuiext = 'dsuiext.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DsBrowseForContainerW: Pointer;
+
+function DsBrowseForContainerW;
+begin
+  GetProcedureAddress(_DsBrowseForContainerW, dsuiext, 'DsBrowseForContainerW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsBrowseForContainerW]
+  end;
+end;
+
+var
+  _DsBrowseForContainerA: Pointer;
+
+function DsBrowseForContainerA;
+begin
+  GetProcedureAddress(_DsBrowseForContainerA, dsuiext, 'DsBrowseForContainerA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsBrowseForContainerA]
+  end;
+end;
+
+var
+  _DsBrowseForContainer: Pointer;
+
+function DsBrowseForContainer;
+begin
+  GetProcedureAddress(_DsBrowseForContainer, dsuiext, 'DsBrowseForContainer' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsBrowseForContainer]
+  end;
+end;
+
+var
+  _DsGetIcon: Pointer;
+
+function DsGetIcon;
+begin
+  GetProcedureAddress(_DsGetIcon, dsuiext, 'DsGetIcon');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetIcon]
+  end;
+end;
+
+var
+  _DsGetFriendlyClassName: Pointer;
+
+procedure DsGetFriendlyClassName;
+begin
+  GetProcedureAddress(_DsGetFriendlyClassName, dsuiext, 'DsGetFriendlyClassName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetFriendlyClassName]
+  end;
+end;
+
+{$ELSE}
+
+function DsBrowseForContainerW; external dsuiext name 'DsBrowseForContainerW';
+function DsBrowseForContainerA; external dsuiext name 'DsBrowseForContainerA';
+function DsBrowseForContainer; external dsuiext name 'DsBrowseForContainer' + AWSuffix;
+function DsGetIcon; external dsuiext name 'DsGetIcon';
+procedure DsGetFriendlyClassName; external dsuiext name 'DsGetFriendlyClassName';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 1014 - 0
packages/extra/winunits/jwadsgetdc.pas

@@ -0,0 +1,1014 @@
+{******************************************************************************}
+{                                                                              }
+{ Directory Services API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dsgetdc.h, released June 2000. The original Pascal     }
+{ code is: DsGetDc.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDSGetDc;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "DsGetDC.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaNtSecApi, JwaWinNT, JwaWinType;
+
+//
+// Structure definitions
+//
+
+//
+// Flags to passed to DsGetDcName
+//
+
+const
+  DS_FORCE_REDISCOVERY = $00000001;
+  {$EXTERNALSYM DS_FORCE_REDISCOVERY}
+
+  DS_DIRECTORY_SERVICE_REQUIRED  = $00000010;
+  {$EXTERNALSYM DS_DIRECTORY_SERVICE_REQUIRED}
+  DS_DIRECTORY_SERVICE_PREFERRED = $00000020;
+  {$EXTERNALSYM DS_DIRECTORY_SERVICE_PREFERRED}
+  DS_GC_SERVER_REQUIRED          = $00000040;
+  {$EXTERNALSYM DS_GC_SERVER_REQUIRED}
+  DS_PDC_REQUIRED                = $00000080;
+  {$EXTERNALSYM DS_PDC_REQUIRED}
+  DS_BACKGROUND_ONLY             = $00000100;
+  {$EXTERNALSYM DS_BACKGROUND_ONLY}
+  DS_IP_REQUIRED                 = $00000200;
+  {$EXTERNALSYM DS_IP_REQUIRED}
+  DS_KDC_REQUIRED                = $00000400;
+  {$EXTERNALSYM DS_KDC_REQUIRED}
+  DS_TIMESERV_REQUIRED           = $00000800;
+  {$EXTERNALSYM DS_TIMESERV_REQUIRED}
+  DS_WRITABLE_REQUIRED           = $00001000;
+  {$EXTERNALSYM DS_WRITABLE_REQUIRED}
+  DS_GOOD_TIMESERV_PREFERRED     = $00002000;
+  {$EXTERNALSYM DS_GOOD_TIMESERV_PREFERRED}
+  DS_AVOID_SELF                  = $00004000;
+  {$EXTERNALSYM DS_AVOID_SELF}
+  DS_ONLY_LDAP_NEEDED            = $00008000;
+  {$EXTERNALSYM DS_ONLY_LDAP_NEEDED}
+
+  DS_IS_FLAT_NAME = $00010000;
+  {$EXTERNALSYM DS_IS_FLAT_NAME}
+  DS_IS_DNS_NAME  = $00020000;
+  {$EXTERNALSYM DS_IS_DNS_NAME}
+
+  DS_RETURN_DNS_NAME  = $40000000;
+  {$EXTERNALSYM DS_RETURN_DNS_NAME}
+  DS_RETURN_FLAT_NAME = DWORD($80000000);
+  {$EXTERNALSYM DS_RETURN_FLAT_NAME}
+
+  DSGETDC_VALID_FLAGS =
+    DS_FORCE_REDISCOVERY or
+    DS_DIRECTORY_SERVICE_REQUIRED or
+    DS_DIRECTORY_SERVICE_PREFERRED or
+    DS_GC_SERVER_REQUIRED or
+    DS_PDC_REQUIRED or
+    DS_BACKGROUND_ONLY or
+    DS_IP_REQUIRED or
+    DS_KDC_REQUIRED or
+    DS_TIMESERV_REQUIRED or
+    DS_WRITABLE_REQUIRED or
+    DS_GOOD_TIMESERV_PREFERRED or
+    DS_AVOID_SELF or
+    DS_ONLY_LDAP_NEEDED or
+    DS_IS_FLAT_NAME or
+    DS_IS_DNS_NAME or
+    DS_RETURN_FLAT_NAME or
+    DS_RETURN_DNS_NAME;
+  {$EXTERNALSYM DSGETDC_VALID_FLAGS}
+
+//
+// Structure returned from DsGetDcName
+//
+
+type
+  PDOMAIN_CONTROLLER_INFOA = ^DOMAIN_CONTROLLER_INFOA;
+  {$EXTERNALSYM PDOMAIN_CONTROLLER_INFOA}
+  _DOMAIN_CONTROLLER_INFOA = record
+    DomainControllerName: LPSTR;
+    DomainControllerAddress: LPSTR;
+    DomainControllerAddressType: ULONG;
+    DomainGuid: GUID;
+    DomainName: LPSTR;
+    DnsForestName: LPSTR;
+    Flags: ULONG;
+    DcSiteName: LPSTR;
+    ClientSiteName: LPSTR;
+  end;
+  {$EXTERNALSYM _DOMAIN_CONTROLLER_INFOA}
+  DOMAIN_CONTROLLER_INFOA = _DOMAIN_CONTROLLER_INFOA;
+  {$EXTERNALSYM DOMAIN_CONTROLLER_INFOA}
+  TDomainControllerInfoA = DOMAIN_CONTROLLER_INFOA;
+  PDomainControllerInfoA = PDOMAIN_CONTROLLER_INFOA;
+
+  PDOMAIN_CONTROLLER_INFOW = ^DOMAIN_CONTROLLER_INFOW;
+  {$EXTERNALSYM PDOMAIN_CONTROLLER_INFOW}
+  _DOMAIN_CONTROLLER_INFOW = record
+    DomainControllerName: LPWSTR;
+    DomainControllerAddress: LPWSTR;
+    DomainControllerAddressType: ULONG;
+    DomainGuid: GUID;
+    DomainName: LPWSTR;
+    DnsForestName: LPWSTR;
+    Flags: ULONG;
+    DcSiteName: LPWSTR;
+    ClientSiteName: LPWSTR;
+  end;
+  {$EXTERNALSYM _DOMAIN_CONTROLLER_INFOW}
+  DOMAIN_CONTROLLER_INFOW = _DOMAIN_CONTROLLER_INFOW;
+  {$EXTERNALSYM DOMAIN_CONTROLLER_INFOW}
+  TDomainControllerInfoW = DOMAIN_CONTROLLER_INFOW;
+  PDomainControllerInfoW = PDOMAIN_CONTROLLER_INFOW;
+
+  {$IFDEF UNICODE}
+  DOMAIN_CONTROLLER_INFO = DOMAIN_CONTROLLER_INFOW;
+  {$EXTERNALSYM DOMAIN_CONTROLLER_INFO}
+  PDOMAIN_CONTROLLER_INFO = PDOMAIN_CONTROLLER_INFOW;
+  {$EXTERNALSYM PDOMAIN_CONTROLLER_INFO}
+  TDomainControllerInfo = TDomainControllerInfoW;
+  PDomainControllerInfo = PDomainControllerInfoW;
+  {$ELSE}
+  DOMAIN_CONTROLLER_INFO = DOMAIN_CONTROLLER_INFOA;
+  {$EXTERNALSYM DOMAIN_CONTROLLER_INFO}
+  PDOMAIN_CONTROLLER_INFO = PDOMAIN_CONTROLLER_INFOA;
+  {$EXTERNALSYM PDOMAIN_CONTROLLER_INFO}
+  TDomainControllerInfo = TDomainControllerInfoA;
+  PDomainControllerInfo = PDomainControllerInfoA;
+  {$ENDIF UNICODE}
+
+//
+// Values for DomainControllerAddressType
+//
+
+const
+  DS_INET_ADDRESS    = 1;
+  {$EXTERNALSYM DS_INET_ADDRESS}
+  DS_NETBIOS_ADDRESS = 2;
+  {$EXTERNALSYM DS_NETBIOS_ADDRESS}
+
+//
+// Values for returned Flags
+//
+
+  DS_PDC_FLAG           = $00000001; // DC is PDC of Domain
+  {$EXTERNALSYM DS_PDC_FLAG}
+  DS_GC_FLAG            = $00000004; // DC is a GC of forest
+  {$EXTERNALSYM DS_GC_FLAG}
+  DS_LDAP_FLAG          = $00000008; // Server supports an LDAP server
+  {$EXTERNALSYM DS_LDAP_FLAG}
+  DS_DS_FLAG            = $00000010; // DC supports a DS and is a Domain Controller
+  {$EXTERNALSYM DS_DS_FLAG}
+  DS_KDC_FLAG           = $00000020; // DC is running KDC service
+  {$EXTERNALSYM DS_KDC_FLAG}
+  DS_TIMESERV_FLAG      = $00000040; // DC is running time service
+  {$EXTERNALSYM DS_TIMESERV_FLAG}
+  DS_CLOSEST_FLAG       = $00000080; // DC is in closest site to client
+  {$EXTERNALSYM DS_CLOSEST_FLAG}
+  DS_WRITABLE_FLAG      = $00000100; // DC has a writable DS
+  {$EXTERNALSYM DS_WRITABLE_FLAG}
+  DS_GOOD_TIMESERV_FLAG = $00000200; // DC is running time service (and has clock hardware)
+  {$EXTERNALSYM DS_GOOD_TIMESERV_FLAG}
+  DS_NDNC_FLAG          = $00000400; // DomainName is non-domain NC serviced by the LDAP server
+  {$EXTERNALSYM DS_NDNC_FLAG}
+  DS_PING_FLAGS         = $0000FFFF; // Flags returned on ping
+  {$EXTERNALSYM DS_PING_FLAGS}
+
+  DS_DNS_CONTROLLER_FLAG = $20000000; // DomainControllerName is a DNS name
+  {$EXTERNALSYM DS_DNS_CONTROLLER_FLAG}
+  DS_DNS_DOMAIN_FLAG     = $40000000; // DomainName is a DNS name
+  {$EXTERNALSYM DS_DNS_DOMAIN_FLAG}
+  DS_DNS_FOREST_FLAG     = DWORD($80000000); // DnsForestName is a DNS name
+  {$EXTERNALSYM DS_DNS_FOREST_FLAG}
+
+//
+// Function Prototypes
+//
+
+function DsGetDcNameA(ComputerName, DomainName: LPCSTR; DomainGuid: LPGUID;
+  SiteName: LPCSTR; Flags: ULONG; var DomainControllerInfo: PDOMAIN_CONTROLLER_INFOA): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcNameA}
+function DsGetDcNameW(ComputerName, DomainName: LPCWSTR; DomainGuid: LPGUID;
+  SiteName: LPCWSTR; Flags: ULONG; var DomainControllerInfo: PDOMAIN_CONTROLLER_INFOW): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcNameW}
+function DsGetDcName(ComputerName, DomainName: LPCTSTR; DomainGuid: LPGUID;
+  SiteName: LPCTSTR; Flags: ULONG; var DomainControllerInfo: PDOMAIN_CONTROLLER_INFO): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcName}
+
+function DsGetSiteNameA(ComputerName: LPCSTR; var SiteName: LPSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetSiteNameA}
+function DsGetSiteNameW(ComputerName: LPCWSTR; var SiteName: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetSiteNameW}
+function DsGetSiteName(ComputerName: LPCTSTR; var SiteName: LPTSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetSiteName}
+
+function DsValidateSubnetNameA(SubnetName: LPCSTR): DWORD; stdcall;
+{$EXTERNALSYM DsValidateSubnetNameA}
+function DsValidateSubnetNameW(SubnetName: LPCWSTR): DWORD; stdcall;
+{$EXTERNALSYM DsValidateSubnetNameW}
+function DsValidateSubnetName(SubnetName: LPCTSTR): DWORD; stdcall;
+{$EXTERNALSYM DsValidateSubnetName}
+
+//
+// Only include if winsock2.h has been included
+//
+
+// Types from Winsock2.h 
+
+type
+  sockaddr = record
+    sa_family: Word;              // address family
+    sa_data: array [0..13]of Char;   // up to 14 bytes of direct address
+  end;
+  {$EXTERNALSYM sockaddr}
+
+  PSOCKADDR = ^SOCKADDR;
+  {$EXTERNALSYM PSOCKADDR}
+  LPSOCKADDR = PSOCKADDR;
+  {$EXTERNALSYM LPSOCKADDR}
+
+  _SOCKET_ADDRESS = record
+    lpSockaddr: LPSOCKADDR;
+    iSockaddrLength: Integer;
+  end;
+  {$EXTERNALSYM _SOCKET_ADDRESS}
+  SOCKET_ADDRESS = _SOCKET_ADDRESS;
+  {$EXTERNALSYM SOCKET_ADDRESS}
+  PSOCKET_ADDRESS = ^SOCKET_ADDRESS;
+  {$EXTERNALSYM PSOCKET_ADDRESS}
+  LPSOCKET_ADDRESS = PSOCKET_ADDRESS;
+  {$EXTERNALSYM LPSOCKET_ADDRESS}
+  TSocketAddress = SOCKET_ADDRESS;
+  PSocketAddress = LPSOCKET_ADDRESS;
+
+function DsAddressToSiteNamesA(ComputerName: LPCSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames: PPChar): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNamesA}
+function DsAddressToSiteNamesW(ComputerName: LPCWSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames: PPWideChar): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNamesW}
+function DsAddressToSiteNames(ComputerName: LPCTSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames: PPTCHAR): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNames}
+
+function DsAddressToSiteNamesExA(ComputerName: LPCSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames, SubnetNames: PPChar): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNamesExA}
+function DsAddressToSiteNamesExW(ComputerName: LPCWSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames, SubnetNames: PPWideChar): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNamesExW}
+function DsAddressToSiteNamesEx(ComputerName: LPCTSTR; EntryCount: DWORD;
+  SocketAddresses: PSOCKET_ADDRESS; var SiteNames, SubnetNames: PPTCHAR): DWORD; stdcall;
+{$EXTERNALSYM DsAddressToSiteNamesEx}
+
+//
+// API to enumerate trusted domains
+//
+
+const
+  DS_DOMAIN_IN_FOREST       = $0001; // Domain is a member of the forest
+  {$EXTERNALSYM DS_DOMAIN_IN_FOREST}
+  DS_DOMAIN_DIRECT_OUTBOUND = $0002; // Domain is directly trusted
+  {$EXTERNALSYM DS_DOMAIN_DIRECT_OUTBOUND}
+  DS_DOMAIN_TREE_ROOT       = $0004; // Domain is root of a tree in the forest
+  {$EXTERNALSYM DS_DOMAIN_TREE_ROOT}
+  DS_DOMAIN_PRIMARY         = $0008; // Domain is the primary domain of queried server
+  {$EXTERNALSYM DS_DOMAIN_PRIMARY}
+  DS_DOMAIN_NATIVE_MODE     = $0010; // Primary domain is running in native mode
+  {$EXTERNALSYM DS_DOMAIN_NATIVE_MODE}
+  DS_DOMAIN_DIRECT_INBOUND  = $0020; // Domain is directly trusting
+  {$EXTERNALSYM DS_DOMAIN_DIRECT_INBOUND}
+  DS_DOMAIN_VALID_FLAGS = DS_DOMAIN_IN_FOREST or DS_DOMAIN_DIRECT_OUTBOUND or
+    DS_DOMAIN_TREE_ROOT or DS_DOMAIN_PRIMARY or DS_DOMAIN_NATIVE_MODE or
+    DS_DOMAIN_DIRECT_INBOUND;
+  {$EXTERNALSYM DS_DOMAIN_VALID_FLAGS}
+
+type
+  PDS_DOMAIN_TRUSTSW = ^DS_DOMAIN_TRUSTSW;
+  {$EXTERNALSYM PDS_DOMAIN_TRUSTSW}
+  _DS_DOMAIN_TRUSTSW = record
+    //
+    // Name of the trusted domain.
+    //
+    NetbiosDomainName: LPWSTR;
+    DnsDomainName: LPWSTR;
+    //
+    // Flags defining attributes of the trust.
+    //
+    Flags: ULONG;
+    //
+    // Index to the domain that is the parent of this domain.
+    //  Only defined if NETLOGON_DOMAIN_IN_FOREST is set and
+    //      NETLOGON_DOMAIN_TREE_ROOT is not set.
+    //
+    ParentIndex: ULONG;
+    //
+    // The trust type and attributes of this trust.
+    //
+    // If NETLOGON_DOMAIN_DIRECTLY_TRUSTED is not set,
+    //  these value are infered.
+    //
+    TrustType: ULONG;
+    TrustAttributes: ULONG;
+    //
+    // The SID of the trusted domain.
+    //
+    // If NETLOGON_DOMAIN_DIRECTLY_TRUSTED is not set,
+    //  this value will be NULL.
+    //
+    DomainSid: PSID;
+    //
+    // The GUID of the trusted domain.
+    //
+    DomainGuid: GUID;
+  end;
+  {$EXTERNALSYM _DS_DOMAIN_TRUSTSW}
+  DS_DOMAIN_TRUSTSW = _DS_DOMAIN_TRUSTSW;
+  {$EXTERNALSYM DS_DOMAIN_TRUSTSW}
+  TDsDomainTrustsW = DS_DOMAIN_TRUSTSW;
+  PDsDomainTrustsW = PDS_DOMAIN_TRUSTSW;
+
+//
+// ANSI version of the above struct
+//
+
+  PDS_DOMAIN_TRUSTSA = ^DS_DOMAIN_TRUSTSA;
+  {$EXTERNALSYM PDS_DOMAIN_TRUSTSA}
+  _DS_DOMAIN_TRUSTSA = record
+    NetbiosDomainName: LPSTR;
+    DnsDomainName: LPSTR;
+    Flags: ULONG;
+    ParentIndex: ULONG;
+    TrustType: ULONG;
+    TrustAttributes: ULONG;
+    DomainSid: PSID;
+    DomainGuid: GUID;
+  end;
+  {$EXTERNALSYM _DS_DOMAIN_TRUSTSA}
+  DS_DOMAIN_TRUSTSA = _DS_DOMAIN_TRUSTSA;
+  {$EXTERNALSYM DS_DOMAIN_TRUSTSA}
+  TDsDomainTrustsA = DS_DOMAIN_TRUSTSA;
+  PDsDomainTrustsA = PDS_DOMAIN_TRUSTSA;
+
+  {$IFDEF UNICODE}
+  DS_DOMAIN_TRUSTS = DS_DOMAIN_TRUSTSW;
+  {$EXTERNALSYM DS_DOMAIN_TRUSTS}
+  PDS_DOMAIN_TRUSTS = PDS_DOMAIN_TRUSTSW;
+  {$EXTERNALSYM PDS_DOMAIN_TRUSTS}
+  TDsDomainTrusts = TDsDomainTrustsW;
+  PDsDomainTrusts = PDsDomainTrustsW;
+  {$ELSE}
+  DS_DOMAIN_TRUSTS = DS_DOMAIN_TRUSTSA;
+  {$EXTERNALSYM DS_DOMAIN_TRUSTS}
+  PDS_DOMAIN_TRUSTS = PDS_DOMAIN_TRUSTSA;
+  {$EXTERNALSYM PDS_DOMAIN_TRUSTS}
+  TDsDomainTrusts = TDsDomainTrustsA;
+  PDsDomainTrusts = PDsDomainTrustsA;
+  {$ENDIF UNICODE}
+
+function DsEnumerateDomainTrustsA(ServerName: LPSTR; Flags: ULONG;
+  var Domains: PDS_DOMAIN_TRUSTSA; var DomainCount: ULONG): DWORD; stdcall;
+{$EXTERNALSYM DsEnumerateDomainTrustsA}
+function DsEnumerateDomainTrustsW(ServerName: LPWSTR; Flags: ULONG;
+  var Domains: PDS_DOMAIN_TRUSTSW; var DomainCount: ULONG): DWORD; stdcall;
+{$EXTERNALSYM DsEnumerateDomainTrustsW}
+function DsEnumerateDomainTrusts(ServerName: LPTSTR; Flags: ULONG;
+  var Domains: PDS_DOMAIN_TRUSTS; var DomainCount: ULONG): DWORD; stdcall;
+{$EXTERNALSYM DsEnumerateDomainTrusts}
+
+//
+// Only define this API if the caller has #included the pre-requisite 
+// ntlsa.h or ntsecapi.h  
+//
+
+function DsGetForestTrustInformationW(ServerName, TrustedDomainName: LPCWSTR;
+  Flags: DWORD; var ForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION): DWORD; stdcall;
+{$EXTERNALSYM DsGetForestTrustInformationW}
+
+const
+  DS_GFTI_UPDATE_TDO    = $1;     // Update TDO with information returned
+  {$EXTERNALSYM DS_GFTI_UPDATE_TDO}
+  DS_GFTI_VALID_FLAGS   = $1;     // All valid flags to DsGetForestTrustInformation
+  {$EXTERNALSYM DS_GFTI_VALID_FLAGS}
+
+function DsMergeForestTrustInformationW(DomainName: LPCWSTR; NewForestTrustInfo,
+  OldForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION;
+  var MergedForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION): DWORD; stdcall;
+{$EXTERNALSYM DsMergeForestTrustInformationW}
+
+function DsGetDcSiteCoverageA(ServerName: LPCSTR; var EntryCount: ULONG;
+  var SiteNames: PPChar): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcSiteCoverageA}
+function DsGetDcSiteCoverageW(ServerName: LPCWSTR; var EntryCount: ULONG;
+  var SiteNames: PPWideChar): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcSiteCoverageW}
+function DsGetDcSiteCoverage(ServerName: LPCTSTR; var EntryCount: ULONG;
+  var SiteNames: PPTCHAR): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcSiteCoverage}
+
+function DsDeregisterDnsHostRecordsA(ServerName, DnsDomainName: LPSTR;
+  DomainGuid, DsaGuid: LPGUID; DnsHostName: LPSTR): DWORD; stdcall;
+{$EXTERNALSYM DsDeregisterDnsHostRecordsA}
+function DsDeregisterDnsHostRecordsW(ServerName, DnsDomainName: LPWSTR;
+  DomainGuid, DsaGuid: LPGUID; DnsHostName: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM DsDeregisterDnsHostRecordsW}
+function DsDeregisterDnsHostRecords(ServerName, DnsDomainName: LPTSTR;
+  DomainGuid, DsaGuid: LPGUID; DnsHostName: LPTSTR): DWORD; stdcall;
+{$EXTERNALSYM DsDeregisterDnsHostRecords}
+
+//
+// Option flags passed to DsGetDcOpen
+//
+
+const
+  DS_ONLY_DO_SITE_NAME         = $01;   // Non-site specific names should be avoided.
+  {$EXTERNALSYM DS_ONLY_DO_SITE_NAME}
+  DS_NOTIFY_AFTER_SITE_RECORDS = $02;   // Return ERROR_FILEMARK_DETECTED after all
+  {$EXTERNALSYM DS_NOTIFY_AFTER_SITE_RECORDS}
+                                        //  site specific records have been processed.
+
+  DS_OPEN_VALID_OPTION_FLAGS = DS_ONLY_DO_SITE_NAME or DS_NOTIFY_AFTER_SITE_RECORDS;
+  {$EXTERNALSYM DS_OPEN_VALID_OPTION_FLAGS}
+
+//
+// Valid DcFlags for DsGetDcOpen
+//
+
+  DS_OPEN_VALID_FLAGS =
+    DS_FORCE_REDISCOVERY or
+    DS_ONLY_LDAP_NEEDED or
+    DS_KDC_REQUIRED or
+    DS_PDC_REQUIRED or
+    DS_GC_SERVER_REQUIRED or
+    DS_WRITABLE_REQUIRED;
+  {$EXTERNALSYM DS_OPEN_VALID_FLAGS}
+
+function DsGetDcOpenW(DnsName: LPCWSTR; OptionFlags: ULONG; SiteName: LPCWSTR;
+  DomainGuid: PGUID; DnsForestName: LPCWSTR; DcFlags: ULONG;
+  var RetGetDcContext: HANDLE): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcOpenW}
+
+function DsGetDcOpenA(DnsName: LPCSTR; OptionFlags: ULONG; SiteName: LPCSTR;
+  DomainGuid: PGUID; DnsForestName: LPCSTR; DcFlags: ULONG;
+  var RetGetDcContext: HANDLE): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcOpenA}
+function DsGetDcOpen(DnsName: LPCTSTR; OptionFlags: ULONG; SiteName: LPCTSTR;
+  DomainGuid: PGUID; DnsForestName: LPCTSTR; DcFlags: ULONG;
+  var RetGetDcContext: HANDLE): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcOpen}
+
+function DsGetDcNextA(GetDcContextHandle: HANDLE; SockAddressCount: PULONG;
+  SockAddresses: LPSOCKET_ADDRESS; DnsHostName: LPSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcNextA}
+function DsGetDcNextW(GetDcContextHandle: HANDLE; SockAddressCount: PULONG;
+  SockAddresses: LPSOCKET_ADDRESS; DnsHostName: LPWSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcNextW}
+function DsGetDcNext(GetDcContextHandle: HANDLE; SockAddressCount: PULONG;
+  SockAddresses: LPSOCKET_ADDRESS; DnsHostName: LPTSTR): DWORD; stdcall;
+{$EXTERNALSYM DsGetDcNext}
+
+procedure DsGetDcCloseW(GetDcContextHandle: HANDLE); stdcall;
+{$EXTERNALSYM DsGetDcCloseW}
+procedure DsGetDcClose(GetDcContextHandle: HANDLE); stdcall;
+{$EXTERNALSYM DsGetDcClose}
+
+implementation
+
+const
+  netapi32 = 'netapi32.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DsGetDcNameA: Pointer;
+
+function DsGetDcNameA;
+begin
+  GetProcedureAddress(_DsGetDcNameA, netapi32, 'DsGetDcNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcNameA]
+  end;
+end;
+
+var
+  _DsGetDcNameW: Pointer;
+
+function DsGetDcNameW;
+begin
+  GetProcedureAddress(_DsGetDcNameW, netapi32, 'DsGetDcNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcNameW]
+  end;
+end;
+
+var
+  _DsGetDcName: Pointer;
+
+function DsGetDcName;
+begin
+  GetProcedureAddress(_DsGetDcName, netapi32, 'DsGetDcName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcName]
+  end;
+end;
+
+var
+  _DsGetSiteNameA: Pointer;
+
+function DsGetSiteNameA;
+begin
+  GetProcedureAddress(_DsGetSiteNameA, netapi32, 'DsGetSiteNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetSiteNameA]
+  end;
+end;
+
+var
+  _DsGetSiteNameW: Pointer;
+
+function DsGetSiteNameW;
+begin
+  GetProcedureAddress(_DsGetSiteNameW, netapi32, 'DsGetSiteNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetSiteNameW]
+  end;
+end;
+
+var
+  _DsGetSiteName: Pointer;
+
+function DsGetSiteName;
+begin
+  GetProcedureAddress(_DsGetSiteName, netapi32, 'DsGetSiteName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetSiteName]
+  end;
+end;
+
+var
+  _DsValidateSubnetNameA: Pointer;
+
+function DsValidateSubnetNameA;
+begin
+  GetProcedureAddress(_DsValidateSubnetNameA, netapi32, 'DsValidateSubnetNameA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsValidateSubnetNameA]
+  end;
+end;
+
+var
+  _DsValidateSubnetNameW: Pointer;
+
+function DsValidateSubnetNameW;
+begin
+  GetProcedureAddress(_DsValidateSubnetNameW, netapi32, 'DsValidateSubnetNameW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsValidateSubnetNameW]
+  end;
+end;
+
+var
+  _DsValidateSubnetName: Pointer;
+
+function DsValidateSubnetName;
+begin
+  GetProcedureAddress(_DsValidateSubnetName, netapi32, 'DsValidateSubnetName' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsValidateSubnetName]
+  end;
+end;
+
+var
+  _DsAddressToSiteNamesA: Pointer;
+
+function DsAddressToSiteNamesA;
+begin
+  GetProcedureAddress(_DsAddressToSiteNamesA, netapi32, 'DsAddressToSiteNamesA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNamesA]
+  end;
+end;
+
+var
+  _DsAddressToSiteNamesW: Pointer;
+
+function DsAddressToSiteNamesW;
+begin
+  GetProcedureAddress(_DsAddressToSiteNamesW, netapi32, 'DsAddressToSiteNamesW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNamesW]
+  end;
+end;
+
+var
+  _DsAddressToSiteNames: Pointer;
+
+function DsAddressToSiteNames;
+begin
+  GetProcedureAddress(_DsAddressToSiteNames, netapi32, 'DsAddressToSiteNames' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNames]
+  end;
+end;
+
+var
+  _DsAddressToSiteNamesExA: Pointer;
+
+function DsAddressToSiteNamesExA;
+begin
+  GetProcedureAddress(_DsAddressToSiteNamesExA, netapi32, 'DsAddressToSiteNamesExA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNamesExA]
+  end;
+end;
+
+var
+  _DsAddressToSiteNamesExW: Pointer;
+
+function DsAddressToSiteNamesExW;
+begin
+  GetProcedureAddress(_DsAddressToSiteNamesExW, netapi32, 'DsAddressToSiteNamesExW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNamesExW]
+  end;
+end;
+
+var
+  _DsAddressToSiteNamesEx: Pointer;
+
+function DsAddressToSiteNamesEx;
+begin
+  GetProcedureAddress(_DsAddressToSiteNamesEx, netapi32, 'DsAddressToSiteNamesEx' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsAddressToSiteNamesEx]
+  end;
+end;
+
+var
+  _DsEnumerateDomainTrustsA: Pointer;
+
+function DsEnumerateDomainTrustsA;
+begin
+  GetProcedureAddress(_DsEnumerateDomainTrustsA, netapi32, 'DsEnumerateDomainTrustsA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsEnumerateDomainTrustsA]
+  end;
+end;
+
+var
+  _DsEnumerateDomainTrustsW: Pointer;
+
+function DsEnumerateDomainTrustsW;
+begin
+  GetProcedureAddress(_DsEnumerateDomainTrustsW, netapi32, 'DsEnumerateDomainTrustsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsEnumerateDomainTrustsW]
+  end;
+end;
+
+var
+  _DsEnumerateDomainTrusts: Pointer;
+
+function DsEnumerateDomainTrusts;
+begin
+  GetProcedureAddress(_DsEnumerateDomainTrusts, netapi32, 'DsEnumerateDomainTrusts' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsEnumerateDomainTrusts]
+  end;
+end;
+
+var
+  _DsGetForestTrustInformationW: Pointer;
+
+function DsGetForestTrustInformationW;
+begin
+  GetProcedureAddress(_DsGetForestTrustInformationW, netapi32, 'DsGetForestTrustInformationW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetForestTrustInformationW]
+  end;
+end;
+
+var
+  _DsMergeForestTrustInformationW: Pointer;
+
+function DsMergeForestTrustInformationW;
+begin
+  GetProcedureAddress(_DsMergeForestTrustInformationW, netapi32, 'DsMergeForestTrustInformationW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsMergeForestTrustInformationW]
+  end;
+end;
+
+var
+  _DsGetDcSiteCoverageA: Pointer;
+
+function DsGetDcSiteCoverageA;
+begin
+  GetProcedureAddress(_DsGetDcSiteCoverageA, netapi32, 'DsGetDcSiteCoverageA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcSiteCoverageA]
+  end;
+end;
+
+var
+  _DsGetDcSiteCoverageW: Pointer;
+
+function DsGetDcSiteCoverageW;
+begin
+  GetProcedureAddress(_DsGetDcSiteCoverageW, netapi32, 'DsGetDcSiteCoverageW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcSiteCoverageW]
+  end;
+end;
+
+var
+  _DsGetDcSiteCoverage: Pointer;
+
+function DsGetDcSiteCoverage;
+begin
+  GetProcedureAddress(_DsGetDcSiteCoverage, netapi32, 'DsGetDcSiteCoverage' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcSiteCoverage]
+  end;
+end;
+
+var
+  _DsDeregisterDnsHostRecordsA: Pointer;
+
+function DsDeregisterDnsHostRecordsA;
+begin
+  GetProcedureAddress(_DsDeregisterDnsHostRecordsA, netapi32, 'DsDeregisterDnsHostRecordsA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsDeregisterDnsHostRecordsA]
+  end;
+end;
+
+var
+  _DsDeregisterDnsHostRecordsW: Pointer;
+
+function DsDeregisterDnsHostRecordsW;
+begin
+  GetProcedureAddress(_DsDeregisterDnsHostRecordsW, netapi32, 'DsDeregisterDnsHostRecordsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsDeregisterDnsHostRecordsW]
+  end;
+end;
+
+var
+  _DsDeregisterDnsHostRecords: Pointer;
+
+function DsDeregisterDnsHostRecords;
+begin
+  GetProcedureAddress(_DsDeregisterDnsHostRecords, netapi32, 'DsDeregisterDnsHostRecords' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsDeregisterDnsHostRecords]
+  end;
+end;
+
+var
+  _DsGetDcOpenW: Pointer;
+
+function DsGetDcOpenW;
+begin
+  GetProcedureAddress(_DsGetDcOpenW, netapi32, 'DsGetDcOpenW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcOpenW]
+  end;
+end;
+
+var
+  _DsGetDcOpenA: Pointer;
+
+function DsGetDcOpenA;
+begin
+  GetProcedureAddress(_DsGetDcOpenA, netapi32, 'DsGetDcOpenA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcOpenA]
+  end;
+end;
+
+var
+  _DsGetDcOpen: Pointer;
+
+function DsGetDcOpen;
+begin
+  GetProcedureAddress(_DsGetDcOpen, netapi32, 'DsGetDcOpen' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcOpen]
+  end;
+end;
+
+var
+  _DsGetDcNextW: Pointer;
+
+function DsGetDcNextW;
+begin
+  GetProcedureAddress(_DsGetDcNextW, netapi32, 'DsGetDcNextW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcNextW]
+  end;
+end;
+
+var
+  _DsGetDcNextA: Pointer;
+
+function DsGetDcNextA;
+begin
+  GetProcedureAddress(_DsGetDcNextA, netapi32, 'DsGetDcNextA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcNextA]
+  end;
+end;
+
+var
+  _DsGetDcNext: Pointer;
+
+function DsGetDcNext;
+begin
+  GetProcedureAddress(_DsGetDcNext, netapi32, 'DsGetDcNext' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcNext]
+  end;
+end;
+
+var
+  _DsGetDcCloseW: Pointer;
+
+procedure DsGetDcCloseW;
+begin
+  GetProcedureAddress(_DsGetDcCloseW, netapi32, 'DsGetDcCloseW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcCloseW]
+  end;
+end;
+
+var
+  _DsGetDcClose: Pointer;
+
+procedure DsGetDcClose;
+begin
+  GetProcedureAddress(_DsGetDcClose, netapi32, 'DsGetDcClose');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsGetDcClose]
+  end;
+end;
+
+{$ELSE}
+
+function DsGetDcNameA; external netapi32 name 'DsGetDcNameA';
+function DsGetDcNameW; external netapi32 name 'DsGetDcNameW';
+function DsGetDcName; external netapi32 name 'DsGetDcName' + AWSuffix;
+function DsGetSiteNameA; external netapi32 name 'DsGetSiteNameA';
+function DsGetSiteNameW; external netapi32 name 'DsGetSiteNameW';
+function DsGetSiteName; external netapi32 name 'DsGetSiteName' + AWSuffix;
+function DsValidateSubnetNameA; external netapi32 name 'DsValidateSubnetNameA';
+function DsValidateSubnetNameW; external netapi32 name 'DsValidateSubnetNameW';
+function DsValidateSubnetName; external netapi32 name 'DsValidateSubnetName' + AWSuffix;
+function DsAddressToSiteNamesA; external netapi32 name 'DsAddressToSiteNamesA';
+function DsAddressToSiteNamesW; external netapi32 name 'DsAddressToSiteNamesW';
+function DsAddressToSiteNames; external netapi32 name 'DsAddressToSiteNames' + AWSuffix;
+function DsAddressToSiteNamesExA; external netapi32 name 'DsAddressToSiteNamesExA';
+function DsAddressToSiteNamesExW; external netapi32 name 'DsAddressToSiteNamesExW';
+function DsAddressToSiteNamesEx; external netapi32 name 'DsAddressToSiteNamesEx' + AWSuffix;
+function DsEnumerateDomainTrustsA; external netapi32 name 'DsEnumerateDomainTrustsA';
+function DsEnumerateDomainTrustsW; external netapi32 name 'DsEnumerateDomainTrustsW';
+function DsEnumerateDomainTrusts; external netapi32 name 'DsEnumerateDomainTrusts' + AWSuffix;
+function DsGetForestTrustInformationW; external netapi32 name 'DsGetForestTrustInformationW';
+function DsMergeForestTrustInformationW; external netapi32 name 'DsMergeForestTrustInformationW';
+function DsGetDcSiteCoverageA; external netapi32 name 'DsGetDcSiteCoverageA';
+function DsGetDcSiteCoverageW; external netapi32 name 'DsGetDcSiteCoverageW';
+function DsGetDcSiteCoverage; external netapi32 name 'DsGetDcSiteCoverage' + AWSuffix;
+function DsDeregisterDnsHostRecordsA; external netapi32 name 'DsDeregisterDnsHostRecordsA';
+function DsDeregisterDnsHostRecordsW; external netapi32 name 'DsDeregisterDnsHostRecordsW';
+function DsDeregisterDnsHostRecords; external netapi32 name 'DsDeregisterDnsHostRecords' + AWSuffix;
+function DsGetDcOpenW; external netapi32 name 'DsGetDcOpenW';
+function DsGetDcOpenA; external netapi32 name 'DsGetDcOpenA';
+function DsGetDcOpen; external netapi32 name 'DsGetDcOpen' + AWSuffix;
+function DsGetDcNextW; external netapi32 name 'DsGetDcNextW';
+function DsGetDcNextA; external netapi32 name 'DsGetDcNextA';
+function DsGetDcNext; external netapi32 name 'DsGetDcNext' + AWSuffix;
+procedure DsGetDcCloseW; external netapi32 name 'DsGetDcCloseW';
+procedure DsGetDcClose; external netapi32 name 'DsGetDcClose';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 425 - 0
packages/extra/winunits/jwadskquota.pas

@@ -0,0 +1,425 @@
+{******************************************************************************}
+{                                                                              }
+{ Disk Quota's API interface Unit for Object Pascal                            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dskquota.h, released June 2000. The original Pascal    }
+{ code is: DskQuota.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDskQuota;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "DskQuota.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaWinNT, JwaWinType;
+
+const
+
+//
+// Class IDs
+//
+// {7988B571-EC89-11cf-9C00-00AA00A14F56}
+
+  CLSID_DiskQuotaControl: TGUID = (
+    D1:$7988b571; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM CLSID_DiskQuotaControl}
+
+//
+// Interface IDs
+//
+// {7988B572-EC89-11cf-9C00-00AA00A14F56}
+
+  IID_IDiskQuotaControl: TGUID = (
+    D1:$7988b572; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM IID_IDiskQuotaControl}
+
+// {7988B574-EC89-11cf-9C00-00AA00A14F56}
+
+  IID_IDiskQuotaUser: TGUID = (
+    D1:$7988b574; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM IID_IDiskQuotaUser}
+
+// {7988B576-EC89-11cf-9C00-00AA00A14F56}
+
+  IID_IDiskQuotaUserBatch: TGUID = (
+    D1:$7988b576; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM IID_IDiskQuotaUserBatch}
+
+// {7988B577-EC89-11cf-9C00-00AA00A14F56}
+
+  IID_IEnumDiskQuotaUsers: TGUID = (
+    D1:$7988b577; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM IID_IEnumDiskQuotaUsers}
+
+// {7988B579-EC89-11cf-9C00-00AA00A14F56}
+
+  IID_IDiskQuotaEvents: TGUID = (
+    D1:$7988b579; D2:$ec89; D3:$11cf; D4:($9c, $0, $0, $aa, $0, $a1, $4f, $56));
+  {$EXTERNALSYM IID_IDiskQuotaEvents}
+
+//
+// Definitions for value and bits in DWORD returned by
+// IDiskQuotaControl::GetQuotaState.
+//
+
+  DISKQUOTA_STATE_DISABLED       = $00000000;
+  {$EXTERNALSYM DISKQUOTA_STATE_DISABLED}
+  DISKQUOTA_STATE_TRACK          = $00000001;
+  {$EXTERNALSYM DISKQUOTA_STATE_TRACK}
+  DISKQUOTA_STATE_ENFORCE        = $00000002;
+  {$EXTERNALSYM DISKQUOTA_STATE_ENFORCE}
+  DISKQUOTA_STATE_MASK           = $00000003;
+  {$EXTERNALSYM DISKQUOTA_STATE_MASK}
+  DISKQUOTA_FILESTATE_INCOMPLETE = $00000100;
+  {$EXTERNALSYM DISKQUOTA_FILESTATE_INCOMPLETE}
+  DISKQUOTA_FILESTATE_REBUILDING = $00000200;
+  {$EXTERNALSYM DISKQUOTA_FILESTATE_REBUILDING}
+  DISKQUOTA_FILESTATE_MASK       = $00000300;
+  {$EXTERNALSYM DISKQUOTA_FILESTATE_MASK}
+
+//
+// Helper macros for setting and testing state value.
+//
+
+function DISKQUOTA_SET_DISABLED(var s: DWORD): DWORD;
+{$EXTERNALSYM DISKQUOTA_SET_DISABLED}
+function DISKQUOTA_SET_TRACKED(var s: DWORD): DWORD;
+{$EXTERNALSYM DISKQUOTA_SET_TRACKED}
+function DISKQUOTA_SET_ENFORCED(var s: DWORD): DWORD;
+{$EXTERNALSYM DISKQUOTA_SET_ENFORCED}
+function DISKQUOTA_IS_DISABLED(s: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_IS_DISABLED}
+function DISKQUOTA_IS_TRACKED(s: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_IS_TRACKED}
+function DISKQUOTA_IS_ENFORCED(s: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_IS_ENFORCED}
+
+//
+// These file state flags are read-only.
+//
+
+function DISKQUOTA_FILE_INCOMPLETE(s: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_FILE_INCOMPLETE}
+function DISKQUOTA_FILE_REBUILDING(s: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_FILE_REBUILDING}
+
+//
+// Definitions for bits in DWORD returned by
+// IDiskQuotaControl::GetQuotaLogFlags.
+//
+
+const
+  DISKQUOTA_LOGFLAG_USER_THRESHOLD = $00000001;
+  {$EXTERNALSYM DISKQUOTA_LOGFLAG_USER_THRESHOLD}
+  DISKQUOTA_LOGFLAG_USER_LIMIT     = $00000002;
+  {$EXTERNALSYM DISKQUOTA_LOGFLAG_USER_LIMIT}
+
+//
+// Helper macros to interrogate a log flags DWORD.
+//
+
+function DISKQUOTA_IS_LOGGED_USER_THRESHOLD(f: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_IS_LOGGED_USER_THRESHOLD}
+function DISKQUOTA_IS_LOGGED_USER_LIMIT(f: DWORD): BOOL;
+{$EXTERNALSYM DISKQUOTA_IS_LOGGED_USER_LIMIT}
+
+//
+// Helper macros to set/clear bits in a log flags DWORD.
+//
+
+function DISKQUOTA_SET_LOG_USER_THRESHOLD(f: DWORD; yn: BOOL): DWORD;
+{$EXTERNALSYM DISKQUOTA_SET_LOG_USER_THRESHOLD}
+function DISKQUOTA_SET_LOG_USER_LIMIT(f: DWORD; yn: BOOL): DWORD;
+{$EXTERNALSYM DISKQUOTA_SET_LOG_USER_LIMIT}
+
+//
+// Per-user quota information.
+//
+
+type
+  PDISKQUOTA_USER_INFORMATION = ^DISKQUOTA_USER_INFORMATION;
+  {$EXTERNALSYM PDISKQUOTA_USER_INFORMATION}
+  DiskQuotaUserInformation = record
+    QuotaUsed: LONGLONG;
+    QuotaThreshold: LONGLONG;
+    QuotaLimit: LONGLONG;
+  end;
+  {$EXTERNALSYM DiskQuotaUserInformation}
+  DISKQUOTA_USER_INFORMATION = DiskQuotaUserInformation;
+  {$EXTERNALSYM DISKQUOTA_USER_INFORMATION}
+  TDiskQuotaUserInformation = DISKQUOTA_USER_INFORMATION;
+  PDiskQuotaUserInformation = PDISKQUOTA_USER_INFORMATION;
+
+//
+// Values for fNameResolution argument to:
+//
+//      IDiskQuotaControl::AddUserSid
+//      IDiskQuotaControl::AddUserName
+//      IDiskQuotaControl::FindUserSid
+//      IDiskQuotaControl::CreateEnumUsers
+//
+
+const
+  DISKQUOTA_USERNAME_RESOLVE_NONE  = 0;
+  {$EXTERNALSYM DISKQUOTA_USERNAME_RESOLVE_NONE}
+  DISKQUOTA_USERNAME_RESOLVE_SYNC  = 1;
+  {$EXTERNALSYM DISKQUOTA_USERNAME_RESOLVE_SYNC}
+  DISKQUOTA_USERNAME_RESOLVE_ASYNC = 2;
+  {$EXTERNALSYM DISKQUOTA_USERNAME_RESOLVE_ASYNC}
+
+//
+// Values for status returned by IDiskQuotaUser::GetAccountStatus.
+//
+
+  DISKQUOTA_USER_ACCOUNT_RESOLVED    = 0;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_RESOLVED}
+  DISKQUOTA_USER_ACCOUNT_UNAVAILABLE = 1;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_UNAVAILABLE}
+  DISKQUOTA_USER_ACCOUNT_DELETED     = 2;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_DELETED}
+  DISKQUOTA_USER_ACCOUNT_INVALID     = 3;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_INVALID}
+  DISKQUOTA_USER_ACCOUNT_UNKNOWN     = 4;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_UNKNOWN}
+  DISKQUOTA_USER_ACCOUNT_UNRESOLVED  = 5;
+  {$EXTERNALSYM DISKQUOTA_USER_ACCOUNT_UNRESOLVED}
+
+//
+// IDiskQuotaUser represents a single user quota record on a particular
+// NTFS volume.  Objects using this interface are instantiated
+// through several IDiskQuotaControl methods.
+//
+
+type
+  IDiskQuotaUser = interface (IUnknown)
+  ['{7988B574-EC89-11cf-9C00-00AA00A14F56}']
+    function GetID(var pulID: ULONG): HRESULT; stdcall;
+    function GetName(pszAccountContainer: LPWSTR; cchAccountContainer: DWORD;
+      pszLogonName: LPWSTR; cchLogonName: DWORD; pszDisplayName: LPWSTR;
+      cchDisplayName: DWORD): HRESULT; stdcall;
+    function GetSidLength(var pdwLength: DWORD): HRESULT; stdcall;
+    function GetSid(pbSidBuffer: LPBYTE; cbSidBuffer: DWORD): HRESULT; stdcall;
+    function GetQuotaThreshold(var pllThreshold: LONGLONG): HRESULT; stdcall;
+    function GetQuotaThresholdText(pszText: LPWSTR; cchText: DWORD): HRESULT; stdcall;
+    function GetQuotaLimit(var pllLimit: LONGLONG): HRESULT; stdcall;
+    function GetQuotaLimitText(pszText: LPWSTR; cchText: DWORD): HRESULT; stdcall;
+    function GetQuotaUsed(var pllUsed: LONGLONG): HRESULT; stdcall;
+    function GetQuotaUsedText(pszText: LPWSTR; cchText: DWORD): HRESULT; stdcall;
+    function GetQuotaInformation(pbQuotaInfo: LPVOID; cbQuotaInfo: DWORD): HRESULT; stdcall;
+    function SetQuotaThreshold(llThreshold: LONGLONG; fWriteThrough: BOOL): HRESULT; stdcall;
+    function SetQuotaLimit(llLimit: LONGLONG; fWriteThrough: BOOL): HRESULT; stdcall;
+    function Invalidate: HRESULT; stdcall;
+    function GetAccountStatus(var pdwStatus: DWORD): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiskQuotaUser}
+
+  DISKQUOTA_USER = IDiskQuotaUser;
+  {$EXTERNALSYM DISKQUOTA_USER}
+  PDISKQUOTA_USER = ^DISKQUOTA_USER;
+  {$EXTERNALSYM PDISKQUOTA_USER}
+
+//
+// IEnumDiskQuotaUsers represents an enumerator created by
+// IDiskQuotaControl for the purpose of enumerating individual user quota
+// records on a particular volume.  Each record is represented through
+// the IDiskQuotaUser interface.
+//
+
+  IEnumDiskQuotaUsers = interface (IUnknown)
+  ['{7988B577-EC89-11cf-9C00-00AA00A14F56}']
+    function Next(cUsers: DWORD; var rgUsers: IDiskQuotaUser; pcUsersFetched: LPDWORD): HRESULT; stdcall;
+    function Skip(cUsers: DWORD): HRESULT; stdcall;
+    function Reset: HRESULT; stdcall;
+    function Clone(out ppEnum: IEnumDiskQuotaUsers): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEnumDiskQuotaUsers}
+
+  ENUM_DISKQUOTA_USERS = IEnumDiskQuotaUsers;
+  {$EXTERNALSYM ENUM_DISKQUOTA_USERS}
+  PENUM_DISKQUOTA_USERS = ^ENUM_DISKQUOTA_USERS;
+  {$EXTERNALSYM PENUM_DISKQUOTA_USERS}
+
+//
+// IDiskQuotaUserBatch represents a collection of IDiskQuotaUser
+// pointers for the purpose of grouping updates to quota information.
+//
+
+  IDiskQuotaUserBatch = interface (IUnknown)
+  ['{7988B576-EC89-11cf-9C00-00AA00A14F56}']
+    function Add(pUser: IDiskQuotaUser): HRESULT; stdcall;
+    function Remove(pUser: IDiskQuotaUser): HRESULT; stdcall;
+    function RemoveAll: HRESULT; stdcall;
+    function FlushToDisk: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiskQuotaUserBatch}
+
+  DISKQUOTA_USER_BATCH = IDiskQuotaUserBatch;
+  {$EXTERNALSYM DISKQUOTA_USER_BATCH}
+  PDISKQUOTA_USER_BATCH = ^DISKQUOTA_USER_BATCH;
+  {$EXTERNALSYM PDISKQUOTA_USER_BATCH}
+
+//
+// IDiskQuotaControl represents a disk volume, providing query and
+// control of that volume's quota information.
+//
+
+  IDiskQuotaControl = interface (IConnectionPointContainer)
+  ['{7988B571-EC89-11cf-9C00-00AA00A14F56}']
+    function Initialize(pszPath: LPCWSTR; bReadWrite: BOOL): HRESULT; stdcall;
+    function SetQuotaState(dwState: DWORD): HRESULT; stdcall;
+    function GetQuotaState(var pdwState: DWORD): HRESULT; stdcall;
+    function SetQuotaLogFlags(dwFlags: DWORD): HRESULT; stdcall;
+    function GetQuotaLogFlags(var pdwFlags: DWORD): HRESULT; stdcall;
+    function SetDefaultQuotaThreshold(llThreshold: LONGLONG): HRESULT; stdcall;
+    function GetDefaultQuotaThreshold(var pllThreshold: LONGLONG): HRESULT; stdcall;
+    function GetDefaultQuotaThresholdText(pszText: LPWSTR; cchText: DWORD): HRESULT; stdcall;
+    function SetDefaultQuotaLimit(llLimit: LONGLONG): HRESULT; stdcall;
+    function GetDefaultQuotaLimit(var pllLimit: LONGLONG): HRESULT; stdcall;
+    function GetDefaultQuotaLimitText(pszText: LPWSTR; cchText: DWORD): HRESULT; stdcall;
+    function AddUserSid(pUserSid: PSID; fNameResolution: DWORD;
+      out ppUser: IDiskQuotaUser): HRESULT; stdcall;
+    function AddUserName(pszLogonName: LPCWSTR; fNameResolution: DWORD;
+      out ppUser: IDiskQuotaUser): HRESULT; stdcall;
+    function DeleteUser(pUser: IDiskQuotaUser): HRESULT; stdcall;
+    function FindUserSid(pUserSid: PSID; fNameResolution: DWORD;
+      out ppUser: IDiskQuotaUser): HRESULT; stdcall;
+    function FindUserName(pszLogonName: LPCWSTR; out ppUser: IDiskQuotaUser): HRESULT; stdcall;
+    function CreateEnumUsers(rgpUserSids: PSID; cpSids, fNameResolution: DWORD;
+      out ppEnum: IEnumDiskQuotaUsers): HRESULT; stdcall;
+    function CreateUserBatch(out ppBatch: IDiskQuotaUserBatch): HRESULT; stdcall;
+    function InvalidateSidNameCache: HRESULT; stdcall;
+    function GiveUserNameResolutionPriority(pUser: IDiskQuotaUser): HRESULT; stdcall;
+    function ShutdownNameResolution: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiskQuotaControl}
+
+  DISKQUOTA_CONTROL = IDiskQuotaControl;
+  {$EXTERNALSYM DISKQUOTA_CONTROL}
+  PDISKQUOTA_CONTROL = ^DISKQUOTA_CONTROL;
+  {$EXTERNALSYM PDISKQUOTA_CONTROL}
+
+  IDiskQuotaEvents = interface (IUnknown)
+  ['{7988B579-EC89-11cf-9C00-00AA00A14F56}']
+    function OnUserNameChanged(pUser: IDiskQuotaUser): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiskQuotaEvents}
+
+  DISKQUOTA_EVENTS = IDiskQuotaEvents;
+  {$EXTERNALSYM DISKQUOTA_EVENTS;}
+  PDISKQUOTA_EVENTS = ^DISKQUOTA_EVENTS;
+  {$EXTERNALSYM PDISKQUOTA_EVENTS;}
+
+implementation
+
+function DISKQUOTA_SET_DISABLED(var s: DWORD): DWORD;
+begin
+  s := DISKQUOTA_STATE_DISABLED;
+  Result := s;
+end;
+
+function DISKQUOTA_SET_TRACKED(var s: DWORD): DWORD;
+begin
+  s := DISKQUOTA_STATE_TRACK;
+  Result := s;
+end;
+
+function DISKQUOTA_SET_ENFORCED(var s: DWORD): DWORD;
+begin
+  s := DISKQUOTA_STATE_ENFORCE;
+  Result := s;
+end;
+
+function DISKQUOTA_IS_DISABLED(s: DWORD): BOOL;
+begin
+  Result := (DISKQUOTA_STATE_DISABLED = (s and DISKQUOTA_STATE_MASK));
+end;
+
+function DISKQUOTA_IS_TRACKED(s: DWORD): BOOL;
+begin
+  Result := (DISKQUOTA_STATE_TRACK = (s and DISKQUOTA_STATE_MASK));
+end;
+
+function DISKQUOTA_IS_ENFORCED(s: DWORD): BOOL;
+begin
+  Result := (DISKQUOTA_STATE_ENFORCE = (s and DISKQUOTA_STATE_MASK));
+end;
+
+function DISKQUOTA_FILE_INCOMPLETE(s: DWORD): BOOL;
+begin
+  Result := (0 <> (s and DISKQUOTA_FILESTATE_INCOMPLETE));
+end;
+
+function DISKQUOTA_FILE_REBUILDING(s: DWORD): BOOL;
+begin
+  Result := (0 <> (s and DISKQUOTA_FILESTATE_REBUILDING));
+end;
+
+function DISKQUOTA_IS_LOGGED_USER_THRESHOLD(f: DWORD): BOOL;
+begin
+  Result := (0 <> (f and DISKQUOTA_LOGFLAG_USER_THRESHOLD));
+end;
+
+function DISKQUOTA_IS_LOGGED_USER_LIMIT(f: DWORD): BOOL;
+begin
+  Result := (0 <> (f and DISKQUOTA_LOGFLAG_USER_LIMIT));
+end;
+
+function DISKQUOTA_SET_LOG_USER_THRESHOLD(f: DWORD; yn: BOOL): DWORD;
+begin
+  Result := f and (not DISKQUOTA_LOGFLAG_USER_THRESHOLD);
+  if yn then
+    Result := Result or DISKQUOTA_LOGFLAG_USER_THRESHOLD;
+end;
+
+function DISKQUOTA_SET_LOG_USER_LIMIT(f: DWORD; yn: BOOL): DWORD;
+begin
+  Result := f and (not DISKQUOTA_LOGFLAG_USER_LIMIT);
+  if yn then
+    Result := Result or DISKQUOTA_LOGFLAG_USER_LIMIT;
+end;
+
+end.

+ 223 - 0
packages/extra/winunits/jwadsquery.pas

@@ -0,0 +1,223 @@
+{******************************************************************************}
+{                                                                              }
+{ Directory Services Query API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dsquery.h, released November 2002. The original Pascal }
+{ code is: DSQuery.pas, released March 2002. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDSQuery;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dsquery.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaCmnQuery, JwaWinType;
+
+const
+  CLSID_DsQuery: TGUID = (D1:$8a23e65e; D2:$31c2; D3:$11d0; D4:($89, $1c, $0, $a0, $24, $ab, $2d, $bb));
+  {$EXTERNALSYM CLSID_DsQuery}
+
+//
+// standard forms shipped in dsquery.dll
+//
+
+  CLSID_DsFindObjects: TGUID = (D1:$83ee3fe1; D2:$57d9; D3:$11d0; D4:($b9, $32, $0, $a0, $24, $ab, $2d, $bb));
+  {$EXTERNALSYM CLSID_DsFindObjects}
+  CLSID_DsFindPeople: TGUID = (D1:$83ee3fe2; D2:$57d9; D3:$11d0; D4:($b9, $32, $0, $a0, $24, $ab, $2d, $bb));
+  {$EXTERNALSYM CLSID_DsFindPeople}
+  CLSID_DsFindPrinter: TGUID = (D1:$b577f070; D2:$7ee2; D3:$11d0; D4:($91, $3f, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsFindPrinter}
+  CLSID_DsFindComputer: TGUID = (D1:$16006700; D2:$87ad; D3:$11d0; D4:($91, $40, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsFindComputer}
+  CLSID_DsFindVolume: TGUID = (D1:$c1b3cbf1; D2:$886a; D3:$11d0; D4:($91, $40, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsFindVolume}
+  CLSID_DsFindContainer: TGUID = (D1:$c1b3cbf2; D2:$886a; D3:$11d0; D4:($91, $40, $0, $aa, $0, $c1, $6e, $65));
+  {$EXTERNALSYM CLSID_DsFindContainer}
+  CLSID_DsFindAdvanced: TGUID = (D1:$83ee3fe3; D2:$57d9; D3:$11d0; D4:($b9, $32, $0, $a0, $24, $ab, $2d, $bb));
+  {$EXTERNALSYM CLSID_DsFindAdvanced}
+
+//
+// admin forms
+//
+
+  CLSID_DsFindDomainController: TGUID = (D1:$538c7b7e; D2:$d25e; D3:$11d0; D4:($97, $42, $0, $a0, $c9, $6, $af, $45));
+  {$EXTERNALSYM CLSID_DsFindDomainController}
+  CLSID_DsFindFrsMembers: TGUID = (D1:$94ce4b18; D2:$b3d3; D3:$11d1; D4:($b9, $b4, $0, $c0, $4f, $d8, $d5, $b0));
+  {$EXTERNALSYM CLSID_DsFindFrsMembers}
+
+//
+// DSQUERYINITPARAMS
+// -----------------
+//  This structured is used when creating a new query view.
+//
+
+const
+  DSQPF_NOSAVE                 = $00000001; // = 1 => remove save verb
+  {$EXTERNALSYM DSQPF_NOSAVE}
+  DSQPF_SAVELOCATION           = $00000002; // = 1 => pSaveLocation contains directory to save queries into
+  {$EXTERNALSYM DSQPF_SAVELOCATION}
+  DSQPF_SHOWHIDDENOBJECTS      = $00000004; // = 1 => show objects marked as "hidden" in results
+  {$EXTERNALSYM DSQPF_SHOWHIDDENOBJECTS}
+  DSQPF_ENABLEADMINFEATURES    = $00000008; // = 1 => show admin verbs, property pages etc
+  {$EXTERNALSYM DSQPF_ENABLEADMINFEATURES}
+  DSQPF_ENABLEADVANCEDFEATURES = $00000010; // = 1 => set the advanced flag for the property pages
+  {$EXTERNALSYM DSQPF_ENABLEADVANCEDFEATURES}
+  DSQPF_HASCREDENTIALS         = $00000020; // = 1 => pServer, pUserName & pPassword are valid
+  {$EXTERNALSYM DSQPF_HASCREDENTIALS}
+  DSQPF_NOCHOOSECOLUMNS        = $00000040; // = 1 => remove choose columns from view
+  {$EXTERNALSYM DSQPF_NOCHOOSECOLUMNS}
+
+type
+  LPDSQUERYINITPARAMS = ^DSQUERYINITPARAMS;
+  {$EXTERNALSYM LPDSQUERYINITPARAMS}
+  DSQUERYINITPARAMS = record
+    cbStruct: DWORD;
+    dwFlags: DWORD;
+    pDefaultScope: LPWSTR; // -> Active Directory path to use as scope / == NULL for none
+    pDefaultSaveLocation: LPWSTR; // -> Directory to save queries into / == NULL default location
+    pUserName: LPWSTR; // -> user name to authenticate with
+    pPassword: LPWSTR; // -> password for authentication
+    pServer: LPWSTR; // -> server to use for obtaining trusts etc
+  end;
+  {$EXTERNALSYM DSQUERYINITPARAMS}
+  TDsQueryInitParams = DSQUERYINITPARAMS;
+  PDsQueryInitParams = LPDSQUERYINITPARAMS;
+
+//
+// DSQUERYPARAMS
+// -------------
+//  The DS query handle takes a packed structure which contains the
+//  columns and query to be issued.
+//
+
+const
+  CFSTR_DSQUERYPARAMS = TEXT('DsQueryParameters');
+  {$EXTERNALSYM CFSTR_DSQUERYPARAMS}
+
+  DSCOLUMNPROP_ADSPATH     = LONG(-1);
+  {$EXTERNALSYM DSCOLUMNPROP_ADSPATH}
+  DSCOLUMNPROP_OBJECTCLASS = LONG(-2);
+  {$EXTERNALSYM DSCOLUMNPROP_OBJECTCLASS}
+
+type
+  LPDSCOLUMN = ^DSCOLUMN;
+  {$EXTERNALSYM LPDSCOLUMN}
+  DSCOLUMN = record
+    dwFlags: DWORD; // flags for this column
+    fmt: INT; // list view form information
+    cx: INT; // default column width
+    idsName: INT; // resource ID for the column dispaly name
+    offsetProperty: LONG; // offset to BSTR defining column ADs property name
+    dwReserved: DWORD; // reserved field
+  end;
+  {$EXTERNALSYM DSCOLUMN}
+  TDsColumn = DSCOLUMN;
+  PDsColumn = LPDSCOLUMN;
+
+  LPDSQUERYPARAMS = ^DSQUERYPARAMS;
+  {$EXTERNALSYM LPDSQUERYPARAMS}
+  DSQUERYPARAMS = record
+    cbStruct: DWORD;
+    dwFlags: DWORD;
+    hInstance: HINSTANCE; // instance handle used for string extraction
+    offsetQuery: LONG; // offset to LDAP filter string
+    iColumns: LONG; // column count
+    dwReserved: DWORD; // reserved field for this query
+    aColumns: array [0..0] of DSCOLUMN; // array of column descriptions
+  end;
+  {$EXTERNALSYM DSQUERYPARAMS}
+  TDsQueryParams = DSQUERYPARAMS;
+  PDsQueryParams = LPDSQUERYPARAMS;
+
+//
+// CF_DSQUERYSCOPE
+// ---------------
+//  A clipboard format the puts a string version of the scope into a
+//  storage medium via GlobalAlloc.
+//
+
+const
+  CFSTR_DSQUERYSCOPE = TEXT('DsQueryScope');
+  {$EXTERNALSYM CFSTR_DSQUERYSCOPE}
+
+//
+// DSQPM_GETCLASSLIST
+// ------------------
+//  This page message is sent to the form pages to retrieve the list of classes
+//  that the pages are going to query from.  This is used by the feild selector
+//  and the property well to build its list of display classes.
+//
+
+type
+  LPDSQUERYCLASSLIST = ^DSQUERYCLASSLIST;
+  {$EXTERNALSYM LPDSQUERYCLASSLIST}
+  DSQUERYCLASSLIST = record
+    cbStruct: DWORD;
+    cClasses: LONG; // number of classes in array
+    offsetClass: array [0..0] of DWORD; // offset to the class names (UNICODE)
+  end;
+  {$EXTERNALSYM DSQUERYCLASSLIST}
+  TDsQueryClassList = DSQUERYCLASSLIST;
+  PDsQueryClassList = LPDSQUERYCLASSLIST;
+
+const
+  DSQPM_GETCLASSLIST = CQPM_HANDLERSPECIFIC + 0; // wParam == flags, lParam = LPLPDSQUERYCLASSLIST
+  {$EXTERNALSYM DSQPM_GETCLASSLIST}
+
+//
+// DSQPM_HELPTOPICS
+// ----------------
+//  This page message is sent to the form pages to allow them to handle the
+//  "Help Topics" verb.
+//
+
+  DSQPM_HELPTOPICS = CQPM_HANDLERSPECIFIC + 1; // wParam = 0, lParam = hWnd parent
+  {$EXTERNALSYM DSQPM_HELPTOPICS}
+
+implementation
+
+end.

+ 216 - 0
packages/extra/winunits/jwadsrole.pas

@@ -0,0 +1,216 @@
+{******************************************************************************}
+{                                                                              }
+{ Directory Services API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dsrole.h, released June 2000. The original Pascal      }
+{ code is: DsRole.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDSRole;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dsrole.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+// Domain information
+//
+
+type
+  _DSROLE_MACHINE_ROLE = (
+    DsRole_RoleStandaloneWorkstation,
+    DsRole_RoleMemberWorkstation,
+    DsRole_RoleStandaloneServer,
+    DsRole_RoleMemberServer,
+    DsRole_RoleBackupDomainController,
+    DsRole_RolePrimaryDomainController);
+  {$EXTERNALSYM _DSROLE_MACHINE_ROLE}
+  DSROLE_MACHINE_ROLE = _DSROLE_MACHINE_ROLE;
+  {$EXTERNALSYM DSROLE_MACHINE_ROLE}
+  TDsRoleMachineRole = DSROLE_MACHINE_ROLE;
+
+//
+// Previous server state
+//
+
+  _DSROLE_SERVER_STATE = (
+    DsRoleServerUnknown,
+    DsRoleServerPrimary,
+    DsRoleServerBackup);
+  {$EXTERNALSYM DSROLE_SERVER_STATE}
+  DSROLE_SERVER_STATE = _DSROLE_SERVER_STATE;
+  {$EXTERNALSYM DSROLE_SERVER_STATE}
+  PDSROLE_SERVER_STATE = ^DSROLE_SERVER_STATE;
+  {$EXTERNALSYM PDSROLE_SERVER_STATE}
+  TDsRoleServerState = DSROLE_SERVER_STATE;
+
+  _DSROLE_PRIMARY_DOMAIN_INFO_LEVEL = (
+    DsRoleFiller0,
+    DsRolePrimaryDomainInfoBasic,
+    DsRoleUpgradeStatus,
+    DsRoleOperationState);
+  {$EXTERNALSYM _DSROLE_PRIMARY_DOMAIN_INFO_LEVEL}
+  DSROLE_PRIMARY_DOMAIN_INFO_LEVEL = _DSROLE_PRIMARY_DOMAIN_INFO_LEVEL;
+  {$EXTERNALSYM DSROLE_PRIMARY_DOMAIN_INFO_LEVEL}
+  TDsRolePrimaryDomainInfoLevel = DSROLE_PRIMARY_DOMAIN_INFO_LEVEL;
+
+//
+// Flags to be used with the PRIMARY_DOMAIN_INFO_LEVEL structures below
+//
+
+const
+  DSROLE_PRIMARY_DS_RUNNING          = $00000001;
+  {$EXTERNALSYM DSROLE_PRIMARY_DS_RUNNING}
+  DSROLE_PRIMARY_DS_MIXED_MODE       = $00000002;
+  {$EXTERNALSYM DSROLE_PRIMARY_DS_MIXED_MODE}
+  DSROLE_UPGRADE_IN_PROGRESS         = $00000004;
+  {$EXTERNALSYM DSROLE_UPGRADE_IN_PROGRESS}
+  DSROLE_PRIMARY_DOMAIN_GUID_PRESENT = $01000000;
+  {$EXTERNALSYM DSROLE_PRIMARY_DOMAIN_GUID_PRESENT}
+
+//
+// Structure that correspond to the DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
+//
+
+type
+  PDSROLE_PRIMARY_DOMAIN_INFO_BASIC = ^DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
+  {$EXTERNALSYM PDSROLE_PRIMARY_DOMAIN_INFO_BASIC}
+  _DSROLE_PRIMARY_DOMAIN_INFO_BASIC = record
+    MachineRole: DSROLE_MACHINE_ROLE;
+    Flags: ULONG;
+    DomainNameFlat: LPWSTR;
+    DomainNameDns: LPWSTR;
+    DomainForestName: LPWSTR;
+    DomainGuid: GUID;
+  end;
+  {$EXTERNALSYM _DSROLE_PRIMARY_DOMAIN_INFO_BASIC}
+  DSROLE_PRIMARY_DOMAIN_INFO_BASIC = _DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
+  {$EXTERNALSYM DSROLE_PRIMARY_DOMAIN_INFO_BASIC}
+  TDsRolePrimaryDomainInfoBasic = DSROLE_PRIMARY_DOMAIN_INFO_BASIC;
+  PDsRolePrimaryDomainInfoBasic = PDSROLE_PRIMARY_DOMAIN_INFO_BASIC;
+
+  PDSROLE_UPGRADE_STATUS_INFO = ^DSROLE_UPGRADE_STATUS_INFO;
+  {$EXTERNALSYM PDSROLE_UPGRADE_STATUS_INFO}
+  _DSROLE_UPGRADE_STATUS_INFO = record
+    OperationState: ULONG;
+    PreviousServerState: DSROLE_SERVER_STATE;
+  end;
+  {$EXTERNALSYM _DSROLE_UPGRADE_STATUS_INFO}
+  DSROLE_UPGRADE_STATUS_INFO = _DSROLE_UPGRADE_STATUS_INFO;
+  {$EXTERNALSYM DSROLE_UPGRADE_STATUS_INFO}
+  TDsRoleUpgradeStatusInfo = DSROLE_UPGRADE_STATUS_INFO;
+  PDsRoleUpgradeStatusInfo = PDSROLE_UPGRADE_STATUS_INFO;
+
+  _DSROLE_OPERATION_STATE = (
+    DsRoleOperationIdle,
+    DsRoleOperationActive,
+    DsRoleOperationNeedReboot);
+  {$EXTERNALSYM _DSROLE_OPERATION_STATE}
+  DSROLE_OPERATION_STATE = _DSROLE_OPERATION_STATE;
+  {$EXTERNALSYM DSROLE_OPERATION_STATE}
+  TDsRoleOperationState = DSROLE_OPERATION_STATE;
+
+  PDSROLE_OPERATION_STATE_INFO = ^DSROLE_OPERATION_STATE_INFO;
+  {$EXTERNALSYM PDSROLE_OPERATION_STATE_INFO}
+  _DSROLE_OPERATION_STATE_INFO = record
+    OperationState: DSROLE_OPERATION_STATE;
+  end;
+  {$EXTERNALSYM _DSROLE_OPERATION_STATE_INFO}
+  DSROLE_OPERATION_STATE_INFO = _DSROLE_OPERATION_STATE_INFO;
+  {$EXTERNALSYM DSROLE_OPERATION_STATE_INFO}
+  TDsRoleOperationStateInfo = DSROLE_OPERATION_STATE_INFO;
+  PDsRoleOperationStateInfo = PDSROLE_OPERATION_STATE_INFO;
+
+function DsRoleGetPrimaryDomainInformation(lpServer: LPCWSTR;
+  InfoLevel: DSROLE_PRIMARY_DOMAIN_INFO_LEVEL; var Buffer: PVOID): DWORD; stdcall;
+{$EXTERNALSYM DsRoleGetPrimaryDomainInformation}
+
+procedure DsRoleFreeMemory(Buffer: PVOID); stdcall;
+{$EXTERNALSYM DsRoleFreeMemory}
+
+implementation
+
+const
+  netapi32 = 'netapi32.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DsRoleGetPrimaryDomainInfo: Pointer;
+
+function DsRoleGetPrimaryDomainInformation;
+begin
+  GetProcedureAddress(_DsRoleGetPrimaryDomainInfo, netapi32, 'DsRoleGetPrimaryDomainInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsRoleGetPrimaryDomainInfo]
+  end;
+end;
+
+var
+  _DsRoleFreeMemory: Pointer;
+
+procedure DsRoleFreeMemory;
+begin
+  GetProcedureAddress(_DsRoleFreeMemory, netapi32, 'DsRoleFreeMemory');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DsRoleFreeMemory]
+  end;
+end;
+
+{$ELSE}
+
+function DsRoleGetPrimaryDomainInformation; external netapi32 name 'DsRoleGetPrimaryDomainInformation';
+procedure DsRoleFreeMemory; external netapi32 name 'DsRoleFreeMemory';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 175 - 0
packages/extra/winunits/jwadssec.pas

@@ -0,0 +1,175 @@
+{******************************************************************************}
+{                                                                              }
+{ AD Security Property Pages API interface Unit for Object Pascal              }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: dssec.h, released Feb 2003. The original Pascal        }
+{ code is: DsSec.pas, released December 2003. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaDsSec;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "dssec.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaWinNT, JwaPrSht;
+
+//+---------------------------------------------------------------------------
+//
+//  Function:   PFNREADOBJECTSECURITY
+//
+//  Synopsis:   Reads the security descriptor of a DS object
+//
+//  Arguments:  [IN  LPCWSTR]               --  ADS path of DS Object
+//              [IN  SECURITY_INFORMATION]  --  Which SD parts to read
+//              [OUT PSECURITY_DESCRIPTOR*] --  Return SD here. Caller frees with LocalFree
+//              [IN  LPARAM]                --  Context param
+//
+//  Return:     HRESULT
+//
+//----------------------------------------------------------------------------
+//
+//  Function:   PFNWRITEOBJECTSECURITY
+//
+//  Synopsis:   Writes a security descriptor to a DS object
+//
+//  Arguments:  [IN  LPCWSTR]               --  ADS path of DS Object
+//              [IN  SECURITY_INFORMATION]  --  Which SD parts to write
+//              [OUT PSECURITY_DESCRIPTOR]  --  Security descriptor to write
+//              [IN  LPARAM]                --  Context param
+//
+//  Return:     HRESULT
+//
+//----------------------------------------------------------------------------
+
+type
+  PFNREADOBJECTSECURITY = function(p1: LPCWSTR; p2: SECURITY_INFORMATION; p3: PPSECURITY_DESCRIPTOR; p4: LPARAM): HRESULT; stdcall;
+  {$EXTERNALSYM PFNREADOBJECTSECURITY}
+  PFNWRITEOBJECTSECURITY = function(p1: LPCWSTR; p2: SECURITY_INFORMATION; p3: PSECURITY_DESCRIPTOR; p4: LPARAM): HRESULT; stdcall;
+  {$EXTERNALSYM PFNWRITEOBJECTSECURITY}
+
+const
+  DSSI_READ_ONLY           = $00000001;
+  {$EXTERNALSYM DSSI_READ_ONLY}
+  DSSI_NO_ACCESS_CHECK     = $00000002;
+  {$EXTERNALSYM DSSI_NO_ACCESS_CHECK}
+  DSSI_NO_EDIT_SACL        = $00000004;
+  {$EXTERNALSYM DSSI_NO_EDIT_SACL}
+  DSSI_NO_EDIT_OWNER       = $00000008;
+  {$EXTERNALSYM DSSI_NO_EDIT_OWNER}
+  DSSI_IS_ROOT             = $00000010;
+  {$EXTERNALSYM DSSI_IS_ROOT}
+  DSSI_NO_FILTER           = $00000020;
+  {$EXTERNALSYM DSSI_NO_FILTER}
+  DSSI_NO_READONLY_MESSAGE = $00000040;
+  {$EXTERNALSYM DSSI_NO_READONLY_MESSAGE}
+
+//+---------------------------------------------------------------------------
+//
+//  Function:   DSCreateSecurityPage
+//
+//  Synopsis:   Creates a Security property page for a DS object
+//
+//  Arguments:  [IN  pwszObjectPath]    --  Full ADS path of DS object
+//              [IN  pwszObjectClass]   --  Class of the object (optional)
+//              [IN  dwFlags]           --  Combination of DSSI_* flags
+//              [OUT phPage]            --  HPROPSHEETPAGE returned here
+//              [IN  pfnReadSD]         --  Optional function for reading SD
+//              [IN  pfnWriteSD]        --  Optional function for writing SD
+//              [IN  LPARAM]            --  Passed to pfnReadSD/pfnWriteSD
+//
+//  Return:     HRESULT
+//
+//----------------------------------------------------------------------------
+
+function DSCreateSecurityPage(
+  pwszObjectPath: LPCWSTR;
+  pwszObjectClass: LPCWSTR;
+  dwFlags: DWORD;
+  out phPage: HPROPSHEETPAGE;
+  pfnReadSD: PFNREADOBJECTSECURITY;
+  pfnWriteSD: PFNWRITEOBJECTSECURITY;
+  lpContext:LPARAM): HRESULT; stdcall;
+{$EXTERNALSYM DSCreateSecurityPage}
+
+type
+  PFNDSCREATESECPAGE = function(
+    pwszObjectPath: LPCWSTR;
+    pwszObjectClass: LPCWSTR;
+    dwFlags: DWORD;
+    out phPage: HPROPSHEETPAGE;
+    pfnReadSD: PFNREADOBJECTSECURITY;
+    pfnWriteSD: PFNWRITEOBJECTSECURITY;
+    lpContext:LPARAM): HRESULT; stdcall;
+  {$EXTERNALSYM PFNDSCREATESECPAGE}
+
+implementation
+
+const
+  dssec = 'dssec.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _DSCreateSecurityPage: Pointer;
+
+function DSCreateSecurityPage;
+begin
+  GetProcedureAddress(_DSCreateSecurityPage, dssec, 'DSCreateSecurityPage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DSCreateSecurityPage]
+  end;
+end;
+
+{$ELSE}
+
+function DSCreateSecurityPage; external dssec name 'DSCreateSecurityPage';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 168 - 0
packages/extra/winunits/jwaerrorrep.pas

@@ -0,0 +1,168 @@
+{******************************************************************************}
+{                                                                              }
+{ Windows Error Reporting API interface unit for Object Pascal                 }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: errorrep.h, released June 2000. The original Pascal    }
+{ code is: ErrorRep.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaErrorRep;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "errorrep.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinBase, JwaWinType;
+
+type
+  tagEFaultRepRetVal = (
+    frrvOk,
+    frrvOkManifest,
+    frrvOkQueued,
+    frrvErr,
+    frrvErrNoDW,
+    frrvErrTimeout,
+    frrvLaunchDebugger,
+    frrvOkHeadless);
+  {$EXTERNALSYM tagEFaultRepRetVal}
+  EFaultRepRetVal = tagEFaultRepRetVal;
+  {$EXTERNALSYM EFaultRepRetVal}
+
+function ReportFault(pep: LPEXCEPTION_POINTERS; dwOpt: DWORD): EFaultRepRetVal; stdcall;
+{$EXTERNALSYM ReportFault}
+function AddERExcludedApplicationA(szApplication: LPCSTR): BOOL; stdcall;
+{$EXTERNALSYM AddERExcludedApplicationA}
+function AddERExcludedApplicationW(wszApplication: LPCWSTR): BOOL; stdcall;
+{$EXTERNALSYM AddERExcludedApplicationW}
+
+type
+  pfn_REPORTFAULT = function(pep: LPEXCEPTION_POINTERS; dwOpt: DWORD): EFaultRepRetVal; stdcall;
+  {$EXTERNALSYM pfn_REPORTFAULT}
+  pfn_ADDEREXCLUDEDAPPLICATIONA = function(szApplication: LPCSTR): BOOL; stdcall;
+  {$EXTERNALSYM pfn_ADDEREXCLUDEDAPPLICATIONA}
+  pfn_ADDEREXCLUDEDAPPLICATIONW = function(wszApplication: LPCWSTR): BOOL; stdcall;
+  {$EXTERNALSYM pfn_ADDEREXCLUDEDAPPLICATIONW}
+
+function AddERExcludedApplication(wszApplication: LPCTSTR): BOOL; stdcall;
+{$EXTERNALSYM AddERExcludedApplication}
+type
+  pfn_ADDEREXCLUDEDAPPLICATION = pfn_ADDEREXCLUDEDAPPLICATIONW;
+  {$EXTERNALSYM pfn_ADDEREXCLUDEDAPPLICATION}
+
+implementation
+
+const
+  faultreplib = 'faultrep.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _ReportFault: Pointer;
+
+function ReportFault;
+begin
+  GetProcedureAddress(_ReportFault, faultreplib, 'ReportFault');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReportFault]
+  end;
+end;
+
+var
+  _AddERExcludedApplicationA: Pointer;
+
+function AddERExcludedApplicationA;
+begin
+  GetProcedureAddress(_AddERExcludedApplicationA, faultreplib, 'AddERExcludedApplicationA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AddERExcludedApplicationA]
+  end;
+end;
+
+var
+  _AddERExcludedApplicationW: Pointer;
+
+function AddERExcludedApplicationW;
+begin
+  GetProcedureAddress(_AddERExcludedApplicationW, faultreplib, 'AddERExcludedApplicationW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AddERExcludedApplicationW]
+  end;
+end;
+
+var
+  _AddERExcludedApplication: Pointer;
+
+function AddERExcludedApplication;
+begin
+  GetProcedureAddress(_AddERExcludedApplication, faultreplib, 'AddERExcludedApplication' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AddERExcludedApplication]
+  end;
+end;
+
+{$ELSE}
+
+function ReportFault; external faultreplib name 'ReportFault';
+function AddERExcludedApplicationA; external faultreplib name 'AddERExcludedApplicationA';
+function AddERExcludedApplicationW; external faultreplib name 'AddERExcludedApplicationW';
+function AddERExcludedApplication; external faultreplib name 'AddERExcludedApplication' + AWSuffix;
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 93 - 0
packages/extra/winunits/jwaexcpt.pas

@@ -0,0 +1,93 @@
+{******************************************************************************}
+{                                                                              }
+{ C/C++ SEH Intrinsics interface Unit for Object Pascal                        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: excpt.h, released August 2001. The original Pascal     }
+{ code is: Excpt.pas, released December 2000. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaExcpt;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "excpt.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+// This file contains the definitions and prototypes for the compiler-
+// dependent intrinsics, support functions and keywords which implement
+// the structured exception handling extensions.
+
+//
+// Exception disposition return values.
+//
+
+type
+  _EXCEPTION_DISPOSITION = (
+    ExceptionContinueExecution,
+    ExceptionContinueSearch,
+    ExceptionNestedException,
+    ExceptionCollidedUnwind);
+  {$EXTERNALSYM _EXCEPTION_DISPOSITION}
+  EXCEPTION_DISPOSITION = _EXCEPTION_DISPOSITION;
+  {$EXTERNALSYM EXCEPTION_DISPOSITION}
+  TExceptionDisposition = EXCEPTION_DISPOSITION;
+
+//
+// Legal values for expression in except().
+//
+
+const
+  EXCEPTION_EXECUTE_HANDLER      = 1;
+  {$EXTERNALSYM EXCEPTION_EXECUTE_HANDLER}
+  EXCEPTION_CONTINUE_SEARCH      = 0;
+  {$EXTERNALSYM EXCEPTION_CONTINUE_SEARCH}
+  EXCEPTION_CONTINUE_EXECUTION   = DWORD(-1);
+  {$EXTERNALSYM EXCEPTION_CONTINUE_EXECUTION}
+
+implementation
+
+end.

+ 207 - 0
packages/extra/winunits/jwafaxdev.pas

@@ -0,0 +1,207 @@
+{******************************************************************************}
+{                                                                              }
+{ Fax Device Provider API interface unit for Object Pascal                     }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: faxdev.h, released November 2001. The original Pascal  }
+{ code is: FaxDev.pas, released April 2002. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaFaxDev;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "faxdev.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaPrSht;
+
+//
+// FAX status constants
+//
+
+const
+  FS_INITIALIZING     = $20000000;
+  {$EXTERNALSYM FS_INITIALIZING}
+  FS_DIALING          = $20000001;
+  {$EXTERNALSYM FS_DIALING}
+  FS_TRANSMITTING     = $20000002;
+  {$EXTERNALSYM FS_TRANSMITTING}
+  FS_RECEIVING        = $20000004;
+  {$EXTERNALSYM FS_RECEIVING}
+  FS_COMPLETED        = $20000008;
+  {$EXTERNALSYM FS_COMPLETED}
+  FS_HANDLED          = $20000010;
+  {$EXTERNALSYM FS_HANDLED}
+  FS_LINE_UNAVAILABLE = $20000020;
+  {$EXTERNALSYM FS_LINE_UNAVAILABLE}
+  FS_BUSY             = $20000040;
+  {$EXTERNALSYM FS_BUSY}
+  FS_NO_ANSWER        = $20000080;
+  {$EXTERNALSYM FS_NO_ANSWER}
+  FS_BAD_ADDRESS      = $20000100;
+  {$EXTERNALSYM FS_BAD_ADDRESS}
+  FS_NO_DIAL_TONE     = $20000200;
+  {$EXTERNALSYM FS_NO_DIAL_TONE}
+  FS_DISCONNECTED     = $20000400;
+  {$EXTERNALSYM FS_DISCONNECTED}
+  FS_FATAL_ERROR      = $20000800; 
+  {$EXTERNALSYM FS_FATAL_ERROR}
+  FS_NOT_FAX_CALL     = $20001000;
+  {$EXTERNALSYM FS_NOT_FAX_CALL}
+  FS_CALL_DELAYED     = $20002000;
+  {$EXTERNALSYM FS_CALL_DELAYED}
+  FS_CALL_BLACKLISTED = $20004000;
+  {$EXTERNALSYM FS_CALL_BLACKLISTED}
+  FS_USER_ABORT       = $20200000;
+  {$EXTERNALSYM FS_USER_ABORT}
+  FS_ANSWERED         = $20800000;
+  {$EXTERNALSYM FS_ANSWERED}
+
+//
+// data structures
+//
+
+type
+  HCALL = HANDLE; // todo from TAPI
+
+  PFAX_SEND = ^FAX_SEND;
+  {$EXTERNALSYM PFAX_SEND}
+  _FAX_SEND = record
+    SizeOfStruct: DWORD;
+    FileName: LPWSTR;
+    CallerName: LPWSTR;
+    CallerNumber: LPWSTR;
+    ReceiverName: LPWSTR;
+    ReceiverNumber: LPWSTR;
+    Branding: BOOL;
+    CallHandle: HCALL;
+    Reserved: array [0..2] of DWORD;
+  end;
+  {$EXTERNALSYM _FAX_SEND}
+  FAX_SEND = _FAX_SEND;
+  {$EXTERNALSYM FAX_SEND}
+  TFaxSend = FAX_SEND;
+  PFaxSend = PFAX_SEND;
+
+  PFAX_RECEIVE = ^FAX_RECEIVE;
+  {$EXTERNALSYM PFAX_RECEIVE}
+  _FAX_RECEIVE = record
+    SizeOfStruct: DWORD;
+    FileName: LPWSTR;
+    ReceiverName: LPWSTR;
+    ReceiverNumber: LPWSTR;
+    Reserved: array [0..3] of DWORD;
+  end;
+  {$EXTERNALSYM _FAX_RECEIVE}
+  FAX_RECEIVE = _FAX_RECEIVE;
+  {$EXTERNALSYM FAX_RECEIVE}
+  TFaxReceive = FAX_RECEIVE;
+  PFaxReceive = PFAX_RECEIVE;
+
+  PFAX_DEV_STATUS = ^FAX_DEV_STATUS;
+  {$EXTERNALSYM PFAX_DEV_STATUS}
+  _FAX_DEV_STATUS = record
+    SizeOfStruct: DWORD;
+    StatusId: DWORD;
+    StringId: DWORD;
+    PageCount: DWORD;
+    CSI: LPWSTR;
+    CallerId: LPWSTR;
+    RoutingInfo: LPWSTR;
+    ErrorCode: DWORD;
+    Reserved: array [0..2] of DWORD;
+  end;
+  {$EXTERNALSYM _FAX_DEV_STATUS}
+  FAX_DEV_STATUS = _FAX_DEV_STATUS;
+  {$EXTERNALSYM FAX_DEV_STATUS}
+  TFaxDevStatus = FAX_DEV_STATUS;
+  PFaxDevStatus = PFAX_DEV_STATUS;
+
+  PFAX_SERVICE_CALLBACK = function(FaxHandle: HANDLE; DeviceId: DWORD; Param1, Param2, Param3: DWORD_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PFAX_SERVICE_CALLBACK}
+
+  PFAX_LINECALLBACK = procedure(FaxHandle: HANDLE; hDevice, dwMessage: DWORD; dwInstance, wParam1, dwParam2, dwParam3: DWORD_PTR); stdcall;
+  {$EXTERNALSYM PFAX_LINECALLBACK}
+
+type
+  PFAX_SEND_CALLBACK = function(FaxHandle: HANDLE; CallHandle: HCALL; Reserved1, Reserved2: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAX_SEND_CALLBACK}
+
+const
+  FAXDEVRECEIVE_SIZE = 4096;
+  {$EXTERNALSYM FAXDEVRECEIVE_SIZE}
+
+const
+  FAXDEVREPORTSTATUS_SIZE = 4096;
+  {$EXTERNALSYM FAXDEVREPORTSTATUS_SIZE}
+
+type
+  HLINEAPP = HANDLE; // todo from TAPI
+  HLINE = HANDLE; // todo form TAPI
+
+  PFAXDEVINITIALIZE = function(LineAppHandle: HLINEAPP; HeapHandle: HANDLE; out LineCallbackFunction: PFAX_LINECALLBACK; FaxServiceCallback: PFAX_SERVICE_CALLBACK): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVINITIALIZE}
+  PFAXDEVSHUTDOWN = function : HRESULT; stdcall;
+  {$EXTERNALSYM PFAXDEVSHUTDOWN}
+  PFAXDEVVIRTUALDEVICECREATION = function(DeviceCount: LPDWORD; DeviceNamePrefix: LPWSTR; DeviceIdPrefix: LPDWORD; CompletionPort: HANDLE; CompletionKey: ULONG_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVVIRTUALDEVICECREATION}
+  PFAXDEVSTARTJOB = function(LineHandle: HLINE; DeviceId: DWORD; FaxHandle: PHANDLE; CompletionPortHandle: HANDLE; CompletionKey: ULONG_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVSTARTJOB}
+  PFAXDEVENDJOB = function(FaxHandle: HANDLE): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVENDJOB}
+  PFAXDEVSEND = function(FaxHandle: HANDLE; FaxSend: PFAX_SEND; FaxSendCallback: PFAX_SEND_CALLBACK): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVSEND}
+  PFAXDEVRECEIVE = function(FaxHandle: HANDLE; CallHandle: HCALL; FaxReceive: PFAX_RECEIVE): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVRECEIVE}
+  PFAXDEVREPORTSTATUS = function(FaxHandle: HANDLE; FaxStatus: PFAX_DEV_STATUS; FaxStatusSize: DWORD; FaxStatusSizeRequired: LPDWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVREPORTSTATUS}
+  PFAXDEVABORTOPERATION = function(FaxHandle: HANDLE): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVABORTOPERATION}
+  PFAXDEVCONFIGURE = function(out PropSheetPage: HPROPSHEETPAGE): BOOL; stdcall;
+  {$EXTERNALSYM PFAXDEVCONFIGURE}
+
+implementation
+
+end.

+ 126 - 0
packages/extra/winunits/jwafaxext.pas

@@ -0,0 +1,126 @@
+{******************************************************************************}
+{                                                                              }
+{ Fax Config and Notififcation Extensions API interface unit for Object Pascal }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: faxext.h, released November 2001. The original Pascal  }
+{ code is: FaxExt.pas, released April 2002. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaFaxExt;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "faxext.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+{************************************
+*                                   *
+*   Extension configuration data    *
+*                                   *
+************************************}
+
+type
+  FAX_ENUM_DEVICE_ID_SOURCE = (
+    DEV_ID_SRC_FAX,         // Device id is generated by the fax server
+    DEV_ID_SRC_TAPI);       // Device id is generated by a TAPI TSP (of FSP).
+  {$EXTERNALSYM FAX_ENUM_DEVICE_ID_SOURCE}
+  TFaxEnumDeviceIdSource = FAX_ENUM_DEVICE_ID_SOURCE;
+
+//
+// Prototype of FaxExtGetData 
+// 
+
+type
+  PFAX_EXT_GET_DATA = function(dwDeviceId: DWORD; DevIdSrc: FAX_ENUM_DEVICE_ID_SOURCE; lpcwstrDataGUID: LPCWSTR; out ppData: LPBYTE; lpdwDataSize: LPDWORD): DWORD; stdcall;
+  {$EXTERNALSYM PFAX_EXT_GET_DATA}
+
+//
+// Prototype of FaxExtSetData
+//
+
+  PFAX_EXT_SET_DATA = function(hInst: HINSTANCE; dwDeviceId: DWORD; DevIdSrc: FAX_ENUM_DEVICE_ID_SOURCE; lpcwstrDataGUID: LPCWSTR; pData: LPBYTE; dwDataSize: DWORD): DWORD; stdcall;
+  {$EXTERNALSYM PFAX_EXT_SET_DATA}
+
+  PFAX_EXT_CONFIG_CHANGE = function(dwDeviceId: DWORD; lpcwstrDataGUID: LPCWSTR; lpData: LPBYTE; dwDataSize: DWORD): HRESULT; stdcall;
+  {$EXTERNALSYM PFAX_EXT_CONFIG_CHANGE}
+
+//
+// Prototype of FaxExtRegisterForEvents 
+//
+
+  PFAX_EXT_REGISTER_FOR_EVENTS = function(hInst: HINSTANCE; dwDeviceId: DWORD; DevIdSrc: FAX_ENUM_DEVICE_ID_SOURCE; lpcwstrDataGUID: LPCWSTR; lpConfigChangeCallback: PFAX_EXT_CONFIG_CHANGE): HANDLE; stdcall;
+  {$EXTERNALSYM PFAX_EXT_REGISTER_FOR_EVENTS}
+
+//
+// Prototype of FaxExtUnregisterForEvents 
+//
+
+  PFAX_EXT_UNREGISTER_FOR_EVENTS = function(hNotification: HANDLE): DWORD; stdcall;
+  {$EXTERNALSYM PFAX_EXT_UNREGISTER_FOR_EVENTS}
+
+//
+// Prototype of FaxExtFreeBuffer
+//
+
+  PFAX_EXT_FREE_BUFFER = procedure(lpvBuffer: LPVOID); stdcall;
+  {$EXTERNALSYM PFAX_EXT_FREE_BUFFER}
+
+//
+// The extension should implement and export the following function:
+//
+
+  PFAX_EXT_INITIALIZE_CONFIG = function(
+    pFaxExtGetData: PFAX_EXT_GET_DATA;
+    pFaxExtSetData: PFAX_EXT_SET_DATA;
+    pFaxExtRegisterForEvents: PFAX_EXT_REGISTER_FOR_EVENTS;
+    pFaxExtUnregisterForEvents: PFAX_EXT_UNREGISTER_FOR_EVENTS;
+    pFaxExtFreeBuffer: PFAX_EXT_FREE_BUFFER): HRESULT; stdcall;
+  {$EXTERNALSYM PFAX_EXT_INITIALIZE_CONFIG}
+
+implementation
+
+end.

+ 99 - 0
packages/extra/winunits/jwafaxmmc.pas

@@ -0,0 +1,99 @@
+{******************************************************************************}
+{                                                                              }
+{ Fax MMC Extension Components API interface unit for Object Pascal            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: faxmmc.h, released November 2001. The original Pascal  }
+{ code is: FaxMmc.pas, released April 2002. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaFaxMmc;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "faxmmc.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+type
+  OLESTR = WideString; // todo 
+
+const
+  FAXSRV_DEVICE_NODETYPE_GUID_STR = OLESTR('{3115A19A-6251-46ac-9425-14782858B8C9}');
+  {$EXTERNALSYM FAXSRV_DEVICE_NODETYPE_GUID_STR}
+  FAXSRV_DEVICE_NODETYPE_GUID: TGUID = '{3115A19A-6251-46ac-9425-14782858B8C9}';
+  {$EXTERNALSYM FAXSRV_DEVICE_NODETYPE_GUID}
+
+  FAXSRV_DEVICE_PROVIDER_NODETYPE_GUID_STR = OLESTR('{BD38E2AC-B926-4161-8640-0F6956EE2BA3}');
+  {$EXTERNALSYM FAXSRV_DEVICE_PROVIDER_NODETYPE_GUID_STR}
+  FAXSRV_DEVICE_PROVIDER_NODETYPE_GUID: TGUID = '{BD38E2AC-B926-4161-8640-0F6956EE2BA3}';
+  {$EXTERNALSYM FAXSRV_DEVICE_PROVIDER_NODETYPE_GUID}
+
+  FAXSRV_ROUTING_METHOD_NODETYPE_GUID_STR = OLESTR('{220D2CB0-85A9-4a43-B6E8-9D66B44F1AF5}');
+  {$EXTERNALSYM FAXSRV_ROUTING_METHOD_NODETYPE_GUID_STR}
+  FAXSRV_ROUTING_METHOD_NODETYPE_GUID: TGUID = '{220D2CB0-85A9-4a43-B6E8-9D66B44F1AF5}';
+  {$EXTERNALSYM FAXSRV_ROUTING_METHOD_NODETYPE_GUID}
+
+  FAXSRV_MAX_GUID_LEN          = SizeOf(FAXSRV_DEVICE_NODETYPE_GUID_STR) div SizeOf(WCHAR);
+  {$EXTERNALSYM FAXSRV_MAX_GUID_LEN}
+  FAXSRV_MAX_SERVER_NAME       = MAX_PATH;
+  {$EXTERNALSYM FAXSRV_MAX_SERVER_NAME}
+  FAXSRV_MAX_ROUTEEXT_NAME_LEN = MAX_PATH;
+  {$EXTERNALSYM FAXSRV_MAX_ROUTEEXT_NAME_LEN}
+
+  CF_MSFAXSRV_DEVICE_ID           = TEXT('FAXSRV_DeviceID');
+  {$EXTERNALSYM CF_MSFAXSRV_DEVICE_ID}
+  CF_MSFAXSRV_FSP_GUID            = TEXT('FAXSRV_FSPGuid');
+  {$EXTERNALSYM CF_MSFAXSRV_FSP_GUID}
+  CF_MSFAXSRV_SERVER_NAME         = TEXT('FAXSRV_ServerName');
+  {$EXTERNALSYM CF_MSFAXSRV_SERVER_NAME}
+  CF_MSFAXSRV_ROUTEEXT_NAME       = TEXT('FAXSRV_RoutingExtName');
+  {$EXTERNALSYM CF_MSFAXSRV_ROUTEEXT_NAME}
+  CF_MSFAXSRV_ROUTING_METHOD_GUID = TEXT('FAXSRV_RoutingMethodGuid');
+  {$EXTERNALSYM CF_MSFAXSRV_ROUTING_METHOD_GUID}
+
+implementation
+
+end.

+ 167 - 0
packages/extra/winunits/jwafaxroute.pas

@@ -0,0 +1,167 @@
+{******************************************************************************}
+{                                                                              }
+{  Fax Routing Extension API interface unit for Object Pascal                  }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: faxroute.h, released November 2001. The original Pascal}
+{ code is: FaxRoute.pas, released April 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaFaxRoute;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "faxroute.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+// microsoft routing guids
+//
+
+const
+  MS_FAXROUTE_PRINTING_GUID = TEXT('{aec1b37c-9af2-11d0-abf7-00c04fd91a4e}');
+  {$EXTERNALSYM MS_FAXROUTE_PRINTING_GUID}
+  MS_FAXROUTE_FOLDER_GUID   = TEXT('{92041a90-9af2-11d0-abf7-00c04fd91a4e}');
+  {$EXTERNALSYM MS_FAXROUTE_FOLDER_GUID}
+  MS_FAXROUTE_EMAIL_GUID    = TEXT('{6bbf7bfe-9af2-11d0-abf7-00c04fd91a4e}');
+  {$EXTERNALSYM MS_FAXROUTE_EMAIL_GUID}
+
+//
+// callback routines
+//
+
+type
+  PFAXROUTEADDFILE = function(JobId: DWORD; FileName: LPCWSTR; Guid: LPGUID): LONG; stdcall;
+  {$EXTERNALSYM PFAXROUTEADDFILE}
+  PFAXROUTEDELETEFILE = function(JobId: DWORD; FileName: LPCWSTR): LONG; stdcall;
+  {$EXTERNALSYM PFAXROUTEDELETEFILE}
+  PFAXROUTEGETFILE = function(JobId, Index: DWORD; FileNameBuffer: LPWSTR; RequiredSize: LPDWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEGETFILE}
+  PFAXROUTEENUMFILE = function(JobId: DWORD; GuidOwner, GuidCaller: LPGUID; FileName: LPCWSTR; Context: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEENUMFILE}
+  PFAXROUTEENUMFILES = function(JobId: DWORD; Guid: LPGUID; FileEnumerator: PFAXROUTEENUMFILE; Context: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEENUMFILES}
+  PFAXROUTEMODIFYROUTINGDATA = function(JobId: DWORD; RoutingGuid: LPCWSTR; RoutingData: LPBYTE; RoutingDataSize: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEMODIFYROUTINGDATA}
+
+  PFAX_ROUTE_CALLBACKROUTINES = ^FAX_ROUTE_CALLBACKROUTINES;
+  {$EXTERNALSYM PFAX_ROUTE_CALLBACKROUTINES}
+  _FAX_ROUTE_CALLBACKROUTINES = record
+    SizeOfStruct: DWORD; // size of the struct set by the fax service
+    FaxRouteAddFile: PFAXROUTEADDFILE;
+    FaxRouteDeleteFile: PFAXROUTEDELETEFILE;
+    FaxRouteGetFile: PFAXROUTEGETFILE;
+    FaxRouteEnumFiles: PFAXROUTEENUMFILES;
+    FaxRouteModifyRoutingData: PFAXROUTEMODIFYROUTINGDATA;
+  end;
+  {$EXTERNALSYM _FAX_ROUTE_CALLBACKROUTINES}
+  FAX_ROUTE_CALLBACKROUTINES = _FAX_ROUTE_CALLBACKROUTINES;
+  {$EXTERNALSYM FAX_ROUTE_CALLBACKROUTINES}
+  TFaxRouteCallbackRoutines = FAX_ROUTE_CALLBACKROUTINES;
+  PFaxRouteCallbackRoutines = PFAX_ROUTE_CALLBACKROUTINES;
+
+//
+// routing data structure
+//
+
+  PFAX_ROUTE = ^FAX_ROUTE;
+  {$EXTERNALSYM PFAX_ROUTE}
+  _FAX_ROUTE = record
+    SizeOfStruct: DWORD; // size of the struct set by the fax service
+    JobId: DWORD; // Fax job identifier
+    ElapsedTime: DWORDLONG; // Elapsed time for whole fax job in Coordinated Universal Time (UTC)
+    ReceiveTime: DWORDLONG; // Starting time for fax job in Coordinated Universal Time (UTC)
+    PageCount: DWORD; // Number of pages received
+    Csid: LPCWSTR; // Called station identifier
+    Tsid: LPCWSTR; // Transmitting station identifier
+    CallerId: LPCWSTR; // Caller id
+    RoutingInfo: LPCWSTR; // Routing info such as DID, T.30-subaddress, etc.
+    ReceiverName: LPCWSTR; // Receiver's name
+    ReceiverNumber: LPCWSTR; // Receiver's fax number
+    DeviceName: LPCWSTR; // Device name for the line that received the fax
+    DeviceId: DWORD; // Permenant line identifier for the receiving device
+    RoutingInfoData: LPBYTE; // Routing infor data to override configured info
+    RoutingInfoDataSize: DWORD; // Size of routing info data
+  end;
+  {$EXTERNALSYM _FAX_ROUTE}
+  FAX_ROUTE = _FAX_ROUTE;
+  {$EXTERNALSYM FAX_ROUTE}
+  TFaxRoute = FAX_ROUTE;
+  PFaxRoute = PFAX_ROUTE;
+
+  FAXROUTE_ENABLE = DWORD;
+  {$EXTERNALSYM FAXROUTE_ENABLE}
+  TFaxRouteEnabl = FAXROUTE_ENABLE;
+
+const
+  QUERY_STATUS = DWORD(-1);
+  {$EXTERNALSYM QUERY_STATUS}
+  STATUS_DISABLE = 0;
+  {$EXTERNALSYM STATUS_DISABLE}
+  STATUS_ENABLE = 1;
+  {$EXTERNALSYM STATUS_ENABLE}
+
+//
+// prototypes
+//
+
+type
+  PFAXROUTEINITIALIZE = function(HeapHandle: HANDLE; FaxRouteCallbackRoutines: PFAX_ROUTE_CALLBACKROUTINES): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEINITIALIZE}
+  PFAXROUTEMETHOD = function(FaxRoute: PFAX_ROUTE; P: PVOID; D: LPDWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEMETHOD}
+  PFAXROUTEDEVICEENABLE = function(RoutingGuid: LPCWSTR; DeviceId: DWORD; Enabled: LONG): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEDEVICEENABLE}
+  PFAXROUTEDEVICECHANGENOTIFICATION = function(DeviceId: DWORD; NewDevice: BOOL): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEDEVICECHANGENOTIFICATION}
+  PFAXROUTEGETROUTINGINFO = function(RoutingGuid: LPCWSTR; DeviceId: DWORD; RoutingInfo: LPBYTE; RoutingInfoSize: LPDWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTEGETROUTINGINFO}
+  PFAXROUTESETROUTINGINFO = function(RoutingGuid: LPCWSTR; DeviceId: DWORD; RoutingInfo: LPBYTE; RoutingInfoSize: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PFAXROUTESETROUTINGINFO}
+
+implementation
+
+end.

+ 950 - 0
packages/extra/winunits/jwagpedit.pas

@@ -0,0 +1,950 @@
+{******************************************************************************}
+{                                                                              }
+{ Group Policy API interface Unit for Object Pascal                            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: gpedit.h, released June 2000. The original Pascal      }
+{ code is: GPEdit.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaGPEdit;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "GPEdit.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {TODO}, JwaPrSht, JwaWinType;
+
+type
+  LPOLESTR = POleStr;
+  {$NODEFINE LPOLESTR}
+
+//-----------------------------------------------------------------------------
+//
+// GPEDIT.H - Definitions and prototypes for Group Policy
+//
+// Copyright 1997-1999, Microsoft Corporation
+//
+//-----------------------------------------------------------------------------
+
+//
+// Terminology
+//
+// Group Policy Editor  -  The tool to view a Group Policy Object.
+//
+// Group Policy Object  -  A collection of administrator defined policies.
+//                         Each Group Policy Object (GPO) has both file system
+//                         and Active Directory storage available to it.
+//
+// IGPEInformation      -  The interface MMC Snapin Extensions use to
+//                         talk to the Group Policy Editor.
+//
+// IGroupPolicyObject   -  The interface used to create/edit a GPO directly
+//                         without going through the Group Policy Editor
+//
+
+//
+// Group Policy Editor MMC SnapIn GUID
+//
+// {8FC0B734-A0E1-11d1-A7D3-0000F87571E3}
+
+const
+  CLSID_GPESnapIn: TGUID = (
+    D1:$8fc0b734; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM CLSID_GPESnapIn}
+
+//
+// Group Policy Editor node ids
+//
+
+//
+// Computer Configuration\Windows Settings
+// {8FC0B737-A0E1-11d1-A7D3-0000F87571E3}
+//
+
+  NODEID_Machine: TGUID = (
+    D1:$8fc0b737; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM NODEID_Machine}
+
+//
+// Computer Configuration\Software Settings
+// {8FC0B73A-A0E1-11d1-A7D3-0000F87571E3}
+//
+
+  NODEID_MachineSWSettings: TGUID = (
+    D1:$8fc0b73a; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM NODEID_MachineSWSettings}
+
+//
+// User Configuration\Windows Settings
+// {8FC0B738-A0E1-11d1-A7D3-0000F87571E3}
+//
+
+  NODEID_User: TGUID = (
+    D1:$8fc0b738; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM NODEID_User}
+
+//
+// User Configuration\Software Settings
+// {8FC0B73C-A0E1-11d1-A7D3-0000F87571E3}
+//
+
+  NODEID_UserSWSettings: TGUID = (
+    D1:$8fc0b73c; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM NODEID_UserSWSettings}
+
+//
+// IGPEInformation interface id
+//
+// {8FC0B735-A0E1-11d1-A7D3-0000F87571E3}
+
+  IID_IGPEInformation: TGUID = (
+    D1:$8fc0b735; D2:$a0e1; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM IID_IGPEInformation}
+
+//
+// Group Policy Object class id
+//
+// {EA502722-A23D-11d1-A7D3-0000F87571E3}
+
+  CLSID_GroupPolicyObject: TGUID = (
+    D1:$ea502722; D2:$a23d; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM CLSID_GroupPolicyObject}
+
+//
+// Group Policy Object interface id
+//
+// {EA502723-A23D-11d1-A7D3-0000F87571E3}
+
+  IID_IGroupPolicyObject: TGUID = (
+    D1:$ea502723; D2:$a23d; D3:$11d1; D4:($a7, $d3, $0, $0, $f8, $75, $71, $e3));
+  {$EXTERNALSYM IID_IGroupPolicyObject}
+
+//
+// GUID that identifies the registry extension
+//
+
+  REGISTRY_EXTENSION_GUID: TGUID = (
+    D1:$35378EAC; D2:$683F; D3:$11D2; D4:($A8, $9A, $00, $C0, $4F, $BB, $CF, $A2));
+  {$EXTERNALSYM IID_IGroupPolicyObject}
+
+//========================================================================================
+//
+// Resultant Set of Policy node ids
+//
+//========================================================================================
+
+//
+// Resultant Set of Policy MMC SnapIn GUID
+//
+// {6DC3804B-7212-458D-ADB0-9A07E2AE1FA2}
+
+  CLSID_RSOPSnapIn: TGUID = (
+    D1:$6dc3804b; D2:$7212; D3:$458d; D4:($ad, $b0, $9a, $07, $e2, $ae, $1f, $a2));
+  {$EXTERNALSYM CLSID_RSOPSnapIn}
+
+//
+// Computer Configuration\Windows Settings
+// {BD4C1A2E-0B7A-4A62-A6B0-C0577539C97E}
+//
+
+  NODEID_RSOPMachine: TGUID = (
+    D1:$bd4c1a2e; D2:$0b7a; D3:$4a62; D4:($a6, $b0, $c0, $57, $75, $39, $c9, $7e));
+  {$EXTERNALSYM NODEID_RSOPMachine}
+
+//
+// Computer Configuration\Software Settings
+// {6A76273E-EB8E-45DB-94C5-25663A5f2C1A}
+//
+
+  NODEID_RSOPMachineSWSettings: TGUID = (
+    D1:$6a76273e; D2:$eb8e; D3:$45db; D4:($94, $c5, $25, $66, $3a, $5f, $2c, $1a));
+  {$EXTERNALSYM NODEID_RSOPMachineSWSettings}
+
+//
+// User Configuration\Windows Settings
+// {AB87364F-0CEC-4CD8-9BF8-898F34628FB8}
+//
+
+  NODEID_RSOPUser: TGUID = (
+    D1:$ab87364f; D2:$0cec; D3:$4cd8; D4:($9b, $f8, $89, $8f, $34, $62, $8f, $b8));
+  {$EXTERNALSYM NODEID_RSOPUser}
+
+//
+// User Configuration\Software Settings
+// {E52C5CE3-FD27-4402-84DE-D9A5F2858910}
+//
+
+  NODEID_RSOPUserSWSettings: TGUID = (
+    D1:$e52c5ce3; D2:$fd27; D3:$4402; D4:($84, $de, $d9, $a5, $f2, $85, $89, $10));
+  {$EXTERNALSYM NODEID_RSOPUserSWSettings}
+
+//
+// IRSOPInformation interface id
+//
+// {9A5A81B5-D9C7-49EF-9D11-DDF50968C48D}
+
+  IID_IRSOPInformation: TGUID = (
+    D1:$9a5a81b5; D2:$d9c7; D3:$49ef; D4:($9d, $11, $dd, $f5, $09, $68, $c4, $8d));
+  {$EXTERNALSYM IID_IRSOPInformation}
+
+// #include <objbase.h>
+
+//
+// Group Policy Object Section flags
+//
+
+const
+  GPO_SECTION_ROOT                = 0;  // Root
+  {$EXTERNALSYM GPO_SECTION_ROOT}
+  GPO_SECTION_USER                = 1;  // User
+  {$EXTERNALSYM GPO_SECTION_USER}
+  GPO_SECTION_MACHINE             = 2;  // Machine
+  {$EXTERNALSYM GPO_SECTION_MACHINE}
+
+//
+// Group Policy Object types
+//
+
+type
+  _GROUP_POLICY_OBJECT_TYPE = (
+    GPOTypeLocal,                         // GPO on the local machine
+    GPOTypeRemote,                        // GPO on a remote machine
+    GPOTypeDS);                           // GPO in the Active Directory
+  {$EXTERNALSYM _GROUP_POLICY_OBJECT_TYPE}
+  GROUP_POLICY_OBJECT_TYPE = _GROUP_POLICY_OBJECT_TYPE;
+  {$EXTERNALSYM GROUP_POLICY_OBJECT_TYPE}
+  PGROUP_POLICY_OBJECT_TYPE = ^GROUP_POLICY_OBJECT_TYPE;
+  {$EXTERNALSYM PGROUP_POLICY_OBJECT_TYPE}
+  TGroupPolicyObjectType = GROUP_POLICY_OBJECT_TYPE;
+  PGroupPolicyObjectType = PGROUP_POLICY_OBJECT_TYPE;
+
+//
+// Group Policy Hint types
+//
+
+  _GROUP_POLICY_HINT_TYPE = (
+    GPHintUnknown,                          // No link information available
+    GPHintMachine,                          // GPO linked to a machine (local or remote)
+    GPHintSite,                             // GPO linked to a site
+    GPHintDomain,                           // GPO linked to a domain
+    GPHintOrganizationalUnit);              // GPO linked to a organizational unit
+  {$EXTERNALSYM _GROUP_POLICY_HINT_TYPE}
+  GROUP_POLICY_HINT_TYPE = _GROUP_POLICY_HINT_TYPE;
+  {$EXTERNALSYM GROUP_POLICY_HINT_TYPE}
+  PGROUP_POLICY_HINT_TYPE = ^GROUP_POLICY_HINT_TYPE;
+  {$EXTERNALSYM PGROUP_POLICY_HINT_TYPE}
+  TGroupPolicyHintType = GROUP_POLICY_HINT_TYPE;
+  PGroupPolicyHintType = PGROUP_POLICY_HINT_TYPE;
+
+  IGPEInformation = interface (IUnknown)
+  ['{8FC0B735-A0E1-11d1-A7D3-0000F87571E3}']
+
+    // *** IGPEInformation methods ***
+
+    //
+    // Returns the unique Group Policy Object name (a GUID)
+    //
+    // pszName contains the name on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the friendly display name for this Group Policy Object
+    //
+    // pszName contains the name on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetDisplayName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Returns a registry key handle for the requested section.  The returned
+    // key is the root of the registry, not the Policies subkey.  To set / read
+    // a value in the Policies subkey, you will need to call RegOpenKeyEx to
+    // open Software\Policies subkey first.
+    //
+    // The handle has been opened with ALL ACCESS rights.  Call RegCloseKey
+    // on the handle when finished.
+    //
+    // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
+    // hKey contains the registry key on return
+    //
+
+    function GetRegistryKey(dwSection: DWORD; var hKey: HKEY): HRESULT; stdcall;
+
+    //
+    // Returns the Active Directory path to the root of the request section.
+    // The path is in ADSI name format.
+    //
+    // dwSection is one of the GPO_SECTION_* flags
+    // pszPath contains the path on return
+    // cchMaxPath is the max number of characters that can be stored in pszPath
+    //
+
+    function GetDSPath(dwSection: DWORD; pszPath: LPOLESTR; cchMaxPath: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the UNC path to the root of the requested section.
+    //
+    // dwSection is one of the GPO_SECTION_* flags
+    // pszPath contains the path on return
+    // cchMaxPath is the number of characters that can be stored in pszPath.
+    //
+
+    function GetFileSysPath(dwSection: DWORD; pszPath: LPOLESTR; cchMaxPath: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the user preferences (options)
+    //
+    // Currently, there are no options defined.  This is reserved for future use.
+    //
+    // dwOptions receives a bitmask value
+    //
+
+    function GetOptions(var dwOptions: DWORD): HRESULT; stdcall;
+
+    //
+    // Returns the type of GPO being edited.
+    //
+    // The three types are:  a GPO in the Active Directory, the GPO on the local machine,
+    // and the GPO on a remote machine.
+    //
+    // Machine GPOs only have file system storage (no Active Directory storage available).
+    // If GetDSPath is called for a machine GPO, the function will succeed
+    // and the returned buffer will be the empty string ""
+    //
+    // Active Directory GPOs have both file system and Active Directory storage available to them.
+    //
+    // gpoType receives one of the type flags listed above.
+    //
+
+    function GetType(var gpoType: GROUP_POLICY_OBJECT_TYPE): HRESULT; stdcall;
+
+    //
+    // Returns the type of Active Directory object (or machine) that could be linked to
+    // this GPO
+    //
+    // This is a hint api only.  The GPE does not know which Active Directory objects are
+    // linked to a particular GPO, but it can offer a hint based upon how the
+    // user started the GPE.
+    //
+    // Use this method with great caution.  Some extensions might want to
+    // customize their user interface based upon the scoping for this GPO,
+    // but it is easy to offer the wrong namespace.  Best advice is to
+    // always offer your full user interface, but if you choose to use this
+    // method, always offer your full user interface if you recieve the
+    // unknown hint back.
+    //
+    // gpHint receives one of the hint flags listed above.
+    //
+
+    function GetHint(var gpHint: GROUP_POLICY_HINT_TYPE): HRESULT; stdcall;
+
+    //
+    // Informs the Group Policy Editor that policy settings have changed.
+    // Extensions MUST call this methold every time a change is made
+    // to a Group Policy Object.
+    //
+    // bMachine specifies if machine or user policy has changed.
+    // bAdd specifies whether this is an add or delete.
+    // pGuidExtension is the guid or unique name of extension that
+    //    will process this GPO.
+    // pGuidSnapin is the guid or unique name of snapin that is making
+    //    this call
+    //
+
+    function PolicyChanged(bMachine, bAdd: BOOL; const pGuidExtension, pGuidSnapin: GUID): HRESULT; stdcall;
+
+  end;
+  {$EXTERNALSYM IGPEInformation}
+
+  LPGPEINFORMATION = ^IGPEInformation;
+  {$EXTERNALSYM LPGPEINFORMATION}
+
+//
+// Group Policy Object open / creation flags
+//
+
+const
+  GPO_OPEN_LOAD_REGISTRY     = $00000001;  // Load the registry files
+  {$EXTERNALSYM GPO_OPEN_LOAD_REGISTRY}
+  GPO_OPEN_READ_ONLY         = $00000002;  // Open the GPO as read only
+  {$EXTERNALSYM GPO_OPEN_READ_ONLY}
+
+//
+// Group Policy Object option flags
+//
+
+const
+  GPO_OPTION_DISABLE_USER    = $00000001;  // The user portion of this GPO is disabled
+  {$EXTERNALSYM GPO_OPTION_DISABLE_USER}
+  GPO_OPTION_DISABLE_MACHINE = $00000002;  // The machine portion of this GPO is disabled
+  {$EXTERNALSYM GPO_OPTION_DISABLE_MACHINE}
+
+type
+  IGroupPolicyObject = interface (IUnknown)
+  ['{EA502723-A23D-11d1-A7D3-0000F87571E3}']
+
+    // *** IGroupPolicyObject methods ***
+
+    //
+    // Creates a new GPO in the Active Directory with the given friendly name
+    // and opens it via OpenDSGPO().  If pszDomainName contains a domain
+    // controller name, the GPO will be created on that DC.  If it does not
+    // specify a domain controller name, the method will select a DC on
+    // the callers behalf.
+    //
+    // pszDomainName contains the ADSI path of the domain root
+    // pszDisplayName contains the friendly display name
+    // dwFlags is a bitmask of GPO open / creation flags listed above
+    //
+
+    function New(pszDomainName, pszDisplayName: LPOLESTR; dwFlags: DWORD): HRESULT; stdcall;
+
+    //
+    // Opens the specified Group Policy Object in the Active Directory
+    // based upon the passed in flags.  If pszPath contains a domain
+    // controller name, the GPO will be opened on that DC.  If it does
+    // not contain a domain controller name, the method will select a
+    // DC on the callers behalf.  If the registry is not loaded,
+    // GetRegistryKey() will return E_FAIL.
+    //
+    // pszPath contains the ADSI path to the GPO to open
+    // dwFlags is a bitmask of GPO open / creation flags listed above
+    //
+
+    function OpenDSGPO(pszPath: LPOLESTR; dwFlags: DWORD): HRESULT; stdcall;
+
+    //
+    // Opens the default Group Policy Object on this machine with the
+    // dwFlags options listed above.  If the registry is not loaded,
+    // GetRegistryKey() will return E_FAIL.
+    //
+    // dwFlags is a bitmask of GPO open / creation flags listed above
+    //
+
+    function OpenLocalMachineGPO(dwFlags: DWORD): HRESULT; stdcall;
+
+    //
+    // Opens the default Group Policy Object on a remote machine with the
+    // dwFlags options listed above.  If the registry is not loaded,
+    // GetRegistryKey() will return E_FAIL.
+    //
+    // pszComputerName contains the machine name in \\machine format
+    // dwFlags is a bitmask of GPO open / creation flags listed above
+    //
+
+    function OpenRemoteMachineGPO(pszComputerName: LPOLESTR; dwFlags: DWORD): HRESULT; stdcall;
+
+    //
+    // Flushes the registry settings to disk and updates the revision
+    // number of the GPO.
+    //
+    // bMachine specifies if machine or user should be saved.
+    // bAdd specifies whether this is an add or delete.
+    // pGuidExtension is the guid or unique name of extension that
+    //    will process this GPO.
+    // pGuid is a guid
+    //
+
+    function Save(bMachine, bAdd: BOOL; const pGuidExtension, pGuid: GUID): HRESULT; stdcall;
+
+    //
+    // Deletes this Group Policy Object.
+    //
+    // After calling this method, no other methods are valid to call
+    // since the data will have been deleted.
+    //
+
+    function Delete: HRESULT; stdcall;
+
+    //
+    // Returns the unique Group Policy Object name
+    //
+    // For Active Directory policy objects, this is a GUID
+    // For the local policy object, it is the string "Local"
+    // For remote policy objects, it is the computername
+    //
+    // pszName contains the name on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the friendly display name for this Group Policy Object
+    //
+    // pszName contains the name on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetDisplayName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Sets the friendly display name for this Group Policy Object
+    //
+    // pszName is the new display name
+    //
+
+    function SetDisplayName(pszName: LPOLESTR): HRESULT; stdcall;
+
+    //
+    // Returns the path to the Group Policy Object
+    //
+    //
+    // If the GPO is an Active Directory object, the path is in ADSI name format.
+    // If the GPO is a machine object, it is a file system path
+    //
+    // pszPath contains the path on return
+    // cchMaxPath is the max number of characters that can be stored in pszPath
+    //
+
+    function GetPath(pszPath: LPOLESTR; cchMaxPath: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the Active Directory path to the root of the request section.
+    // The path is in DN name format.
+    //
+    // dwSection is one of the GPO_SECTION_* flags
+    // pszPath contains the path on return
+    // cchMaxPath is the max number of characters that can be stored in pszPath
+    //
+
+    function GetDSPath(dwSection: DWORD; pszPath: LPOLESTR; cchMaxPath: Integer): HRESULT; stdcall;
+
+    //
+    // Returns the UNC path to the root of the requested section.
+    //
+    // dwSection is one of the GPO_SECTION_* flags
+    // pszPath contains the path on return
+    // cchMaxPath is the number of characters that can be stored in pszPath.
+    //
+
+    function GetFileSysPath(dwSection: DWORD; pszPath: LPOLESTR; cchMaxPath: Integer): HRESULT; stdcall;
+
+    //
+    // Returns a registry key handle for the requested section.  The returned
+    // key is the root of the registry, not the Policies subkey.  To set / read
+    // a value in the Policies subkey, you will need to call RegOpenKeyEx to
+    // open Software\Policies subkey first.
+    //
+    // The handle has been opened with ALL ACCESS rights.  Call RegCloseKey
+    // on the handle when finished.
+    //
+    // If the GPO was loaded / created without the registry being loaded
+    // this method will return E_FAIL.
+    //
+    // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
+    // hKey contains the registry key on return
+    //
+
+    function GetRegistryKey(dwSection: DWORD; var hKey: HKEY): HRESULT; stdcall;
+
+    //
+    // Returns any options for this Group Policy Object
+    //
+    // dwOptions receives the GPO_OPTION_* flags
+    //
+
+    function GetOptions(var dwOptions: DWORD): HRESULT; stdcall;
+
+    //
+    // Sets any options for this Group Policy Object
+    //
+    // This method sets any options for this GPO.  To change
+    // an option, that flag must be set in the mask field.
+    // If the flag is in the mask field, then the dwOptions
+    // field is read for the current state.
+    //
+    // For example:  to disable the GPO, make this call
+    //
+    //    SetOptions (GPO_OPTION_DISABLED, GPO_OPTION_DISABLED);
+    //
+    // dwOptions specifies one or more GPO_OPTION_* flags
+    // dwMask specificies which of the dwOptions to change
+    //
+
+    function SetOptions(dwOptions, dwMask: DWORD): HRESULT; stdcall;
+
+    //
+    // Returns the type of GPO being edited.
+    //
+    // The three types are:  a GPO in the Active Directory, the GPO on the local machine,
+    // and the GPO on a remote machine.
+    //
+    // Machine GPOs only have file system storage (no Active Directory storage available).
+    // If GetDSPath is called for a machine GPO, the function will succeed
+    // and the returned buffer will be the empty string ""
+    //
+    // Active Directory GPOs have both file system and Active Directory storage available to them.
+    //
+    // gpoType receives one of the type flags
+    //
+
+    function GetType(var gpoType: GROUP_POLICY_OBJECT_TYPE): HRESULT; stdcall;
+
+    //
+    // Returns the machine name of the remote GPO
+    //
+    // This method returns the name passed to OpenRemoteMachineGPO.
+    //
+    // pszName contains the name on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetMachineName(pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Returns an array of property sheet pages and the number of pages
+    // in the array
+    //
+    // Note, this method will allocate memory for the array with
+    // LocalAlloc.  When finished, the caller should free the array
+    // with LocalFree
+    //
+    // hPages address of the pointer for the array of property sheet pages
+    // uPageCount receives the number of pages in the array
+    //
+
+    function GetPropertySheetPages(var hPages: PHPROPSHEETPAGE; var uPageCount: UINT): HRESULT; stdcall;
+    
+  end;
+  {$EXTERNALSYM IGroupPolicyObject}
+
+  LPGROUPPOLICYOBJECT = ^IGroupPolicyObject;
+  {$EXTERNALSYM LPGROUPPOLICYOBJECT}
+
+//
+// RSOP flags
+//
+
+const
+  RSOP_INFO_FLAG_DIAGNOSTIC_MODE = $00000001; // Running in diagnostic mode vs planning mode
+  {$EXTERNALSYM RSOP_INFO_FLAG_DIAGNOSTIC_MODE}
+
+type
+  IRSOPInformation = interface (IUnknown)
+  ['{9A5A81B5-D9C7-49EF-9D11-DDF50968C48D}']
+
+    // *** IRSOPInformation methods ***
+
+    //
+    // Returns the namespace for the RSOP data
+    //
+    // dwSection is either GPO_SECTION_USER or GPO_SECTION_MACHINE
+    // pszName contains the namespace on return
+    // cchMaxLength is the max number of characters that can be stored in pszName
+    //
+
+    function GetNamespace(dwSection: DWORD; pszName: LPOLESTR; cchMaxLength: Integer): HRESULT; stdcall;
+
+    //
+    // Returns information about the RSOP session
+    //
+    // pdwFlags points to a DWORD which contains the flags on return
+    //
+
+    function GetFlags(var pdwFlags: DWORD): HRESULT; stdcall;
+
+    //
+    // Returns the event log text for a specific entry
+    //
+    // lpEventSource - event log source name
+    // lpEventLogName - event log name
+    // lpEventTime - event log time in WMI datetime format
+    // dwEventID - event ID
+    // lpText - Receives a pointer to a buffer containing the text.
+    //          The caller should free this buffer with CoTaskMemFree.
+    //
+
+    function GetEventLogEntryText(pszEventSource, pszEventLogName, pszEventTime: LPOLESTR;
+      dwEventID: DWORD; out ppszText: LPOLESTR): HRESULT; stdcall;
+
+  end;
+  {$EXTERNALSYM IRSOPInformation}
+
+  LPRSOPINFORMATION = IRSOPInformation;
+  {$EXTERNALSYM LPRSOPINFORMATION}
+
+//=============================================================================
+//
+// CreateGPOLink
+//
+// Creates a link to a GPO for the specified Site, Domain, or Organizational Unit
+//
+// lpGPO         - ADSI path to the GPO
+// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
+// fHighPriority - Create the link as the highest or lowest priority
+//
+// Returns:  S_OK if successful
+//
+//=============================================================================
+
+function CreateGPOLink(lpGPO, lpContainer: LPOLESTR; fHighPriority: BOOL): HRESULT; stdcall;
+{$EXTERNALSYM CreateGPOLink}
+
+//=============================================================================
+//
+// DeleteGPOLink
+//
+// Deletes a link to a GPO for the specified Site, Domain, or Organizational Unit
+//
+// lpGPO         - ADSI path to the GPO
+// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
+//
+// Returns:  S_OK if successful
+//
+//=============================================================================
+
+function DeleteGPOLink(lpGPO, lpContainer: LPOLESTR): HRESULT; stdcall;
+{$EXTERNALSYM DeleteGPOLink}
+
+//=============================================================================
+//
+// DeleteAllGPOLinks
+//
+// Deletes all GPO links for the specified Site, Domain, or Organizational Unit
+//
+// lpContainer   - ADSI path to the Site, Domain, or Organizational Unit
+//
+// Returns:  S_OK if successful
+//
+//=============================================================================
+
+function DeleteAllGPOLinks(lpContainer: LPOLESTR): HRESULT; stdcall;
+{$EXTERNALSYM DeleteAllGPOLinks}
+
+//=============================================================================
+//
+// BrowseForGPO
+//
+// Displays the GPO browser dialog
+//
+// lpBrowseInfo   - Address of a GPOBROWSEINFO structure
+//
+// Returns:  S_OK if successful
+//
+//=============================================================================
+
+//
+// Flags passed in the dwFlags field of the GPOBROWSEINFO structure
+//
+
+const
+  GPO_BROWSE_DISABLENEW          = $00000001;   // Disables the New GPO functionality on all pages except "All"
+  {$EXTERNALSYM GPO_BROWSE_DISABLENEW}
+  GPO_BROWSE_NOCOMPUTERS         = $00000002;   // Removes the Computers tab
+  {$EXTERNALSYM GPO_BROWSE_NOCOMPUTERS}
+  GPO_BROWSE_NODSGPOS            = $00000004;   // Removes the Domain/OU and Sites tabs
+  {$EXTERNALSYM GPO_BROWSE_NODSGPOS}
+  GPO_BROWSE_OPENBUTTON          = $00000008;   // Change the Ok button to say Open
+  {$EXTERNALSYM GPO_BROWSE_OPENBUTTON}
+  GPO_BROWSE_INITTOALL           = $00000010;   // Initialize the dialog focused on the All pane
+  {$EXTERNALSYM GPO_BROWSE_INITTOALL}
+
+type
+  tag_GPOBROWSEINFO = record
+    dwSize: DWORD;                      // [in] Initialized to the size of this structure
+    dwFlags: DWORD;                     // [in] Flags defined above
+    hwndOwner: HWND;                    // [in] Parent window handle (can be NULL)
+    lpTitle: LPOLESTR;                  // [in] Title bar text.  If NULL, "Browse for a Group Policy Object" will be the default text
+    lpInitialOU: LPOLESTR;              // [in] Initial Domain/Organizational Unit to open focus on
+    lpDSPath: LPOLESTR;                 // [in/out] Pointer to the buffer that receives the Active Directory GPO path
+    dwDSPathSize: DWORD;                // [in] Size in characters of buffer given in lpDSPath
+    lpName: LPOLESTR;                   // [in/out] Pointer to a buffer that receives either the computer name or
+                                        //          the friendly name of the GPO (can be NULL)
+    dwNameSize: DWORD;                  // [in] Size in characters of buffer given in lpName
+    gpoType: GROUP_POLICY_OBJECT_TYPE;  // [out] Specifies the type of GPO
+    gpoHint: GROUP_POLICY_HINT_TYPE;    // [out] Specifies a hint of the GPO association
+  end;
+  {$EXTERNALSYM tag_GPOBROWSEINFO}
+  GPOBROWSEINFO = tag_GPOBROWSEINFO;
+  {$EXTERNALSYM GPOBROWSEINFO}
+  LPGPOBROWSEINFO = ^GPOBROWSEINFO;
+  TGpoBrowseInfo = GPOBROWSEINFO;
+  PGpoBrowseInfo = LPGPOBROWSEINFO;
+
+function BrowseForGPO(var lpBrowseInfo: GPOBROWSEINFO): HRESULT; stdcall;
+{$EXTERNALSYM BrowseForGPO}
+
+//=============================================================================
+//
+// ImportRSoPData
+//
+// Imports a data file generated by ExportRSoPData
+//
+// lpNameSpace   - Namespace to place the data in
+// lpFileName    - Filename containing the data
+//
+// Returns:  S_OK if successful
+//
+// Notes:    The namespace specified in lpNameSpace must exist prior to calling
+//           this function.
+//
+//=============================================================================
+
+function ImportRSoPData(lpNameSpace, lpFileName: LPOLESTR): HRESULT; stdcall;
+{$EXTERNALSYM ImportRSoPData}
+
+//=============================================================================
+//
+// ExportRSoPData
+//
+// Exports a WBEM namespace containing RSoP information to a data file.
+// This data file can be imported to a WBEM namespace using ImportRSoPData.
+//
+// lpNameSpace   - Namespace to read the data from
+// lpFileName    - Filename to receive the data
+//
+// Returns:  S_OK if successful
+//
+// Notes:    This function should be called twice.  Once for the user data
+//           and once for the computer data.
+//
+//=============================================================================
+
+function ExportRSoPData(lpNameSpace, lpFileName: LPOLESTR): HRESULT; stdcall;
+{$EXTERNALSYM ExportRSoPData}
+
+implementation
+
+const
+  gpeditlib = 'gpedit.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _CreateGPOLink: Pointer;
+
+function CreateGPOLink;
+begin
+  GetProcedureAddress(_CreateGPOLink, gpeditlib, 'CreateGPOLink');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CreateGPOLink]
+  end;
+end;
+
+var
+  _DeleteGPOLink: Pointer;
+
+function DeleteGPOLink;
+begin
+  GetProcedureAddress(_DeleteGPOLink, gpeditlib, 'DeleteGPOLink');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteGPOLink]
+  end;
+end;
+
+var
+  _DeleteAllGPOLinks: Pointer;
+
+function DeleteAllGPOLinks;
+begin
+  GetProcedureAddress(_DeleteAllGPOLinks, gpeditlib, 'DeleteAllGPOLinks');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteAllGPOLinks]
+  end;
+end;
+
+var
+  _BrowseForGPO: Pointer;
+
+function BrowseForGPO;
+begin
+  GetProcedureAddress(_BrowseForGPO, gpeditlib, 'BrowseForGPO');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BrowseForGPO]
+  end;
+end;
+
+var
+  _ImportRSoPData: Pointer;
+
+function ImportRSoPData;
+begin
+  GetProcedureAddress(_ImportRSoPData, gpeditlib, 'ImportRSoPData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImportRSoPData]
+  end;
+end;
+
+var
+  _ExportRSoPData: Pointer;
+
+function ExportRSoPData;
+begin
+  GetProcedureAddress(_ExportRSoPData, gpeditlib, 'ExportRSoPData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ExportRSoPData]
+  end;
+end;
+
+{$ELSE}
+
+function CreateGPOLink; external gpeditlib name 'CreateGPOLink';
+function DeleteGPOLink; external gpeditlib name 'DeleteGPOLink';
+function DeleteAllGPOLinks; external gpeditlib name 'DeleteAllGPOLinks';
+function BrowseForGPO; external gpeditlib name 'BrowseForGPO';
+function ImportRSoPData; external gpeditlib name 'ImportRSoPData';
+function ExportRSoPData; external gpeditlib name 'ExportRSoPData';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 93 - 0
packages/extra/winunits/jwahherror.pas

@@ -0,0 +1,93 @@
+{******************************************************************************}
+{                                                                              }
+{ HTML Help Error API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: hherror.h, released Dec 2002. The original Pascal      }
+{ code is: HhError.pas, released Dec 2002. The initial developer of the        }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): Robert Chandler  (robert att helpware dott net)              }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaHhError;
+
+interface
+
+{$WEAKPACKAGEUNIT}
+
+{$I jediapilib.inc}
+
+uses
+  JwaWinType, JwaWinError;
+
+// Published: http://support.microsoft.com/default.aspx?scid=kb;en-us;297768
+
+type
+  // HH_LAST_ERROR Command Related structures and constants
+  // Used by command HH_GET_LAST_ERROR
+  // You must call SysFreeString(xx.description) to free BSTR
+
+  tagHH_LAST_ERROR = packed record
+    cbStruct: Integer;      // sizeof this structure
+    hr: HRESULT;            // Specifies the last error code.
+    description: PWideChar; // (BSTR) Specifies a Unicode string containing a description of the error.
+  end;
+  HH_LAST_ERROR = tagHH_LAST_ERROR;
+  THHLastError = tagHH_LAST_ERROR;
+
+// Error codes
+
+const
+  HH_E_FILENOTFOUND        = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0201); // %1 could not be found.
+  HH_E_TOPICDOESNOTEXIST   = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0202); // The requested topic does not exist.
+  HH_E_INVALIDHELPFILE     = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0203); // %1 is not a valid help file.
+  HH_E_NOCONTEXTIDS        = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $020A); // Help file does not contain context ids.
+  HH_E_CONTEXTIDDOESNTEXIT = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $020B); // The context id does not exist.
+
+  // 0x0300 - 0x03FF reserved for keywords
+
+  HH_E_KEYWORD_NOT_FOUND       = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0300); // no hits found.
+  HH_E_KEYWORD_IS_PLACEHOLDER  = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0301); // keyword is a placeholder or a "runaway" see also.
+  HH_E_KEYWORD_NOT_IN_SUBSET   = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0302); // no hits found because of subset exclusion.
+  HH_E_KEYWORD_NOT_IN_INFOTYPE = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0303); // no hits found because of infotype exclusion.
+  HH_E_KEYWORD_EXCLUDED        = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0304); // no hits found because of infotype and subset exclusion.
+  HH_E_KEYWORD_NOT_SUPPORTED   = HRESULT((ERROR_SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $0305); // no hits found because of keywords not being supported in this mode.
+
+implementation
+
+end.

+ 90 - 0
packages/extra/winunits/jwahtmlGuid.pas

@@ -0,0 +1,90 @@
+{******************************************************************************}
+{                                                                              }
+{ GUID Definitions for HTML Viewer object API interface Unit for Object Pascal }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: htmlguid.h, released November 2002. The original Pascal}
+{ code is: HtmlGuid.pas, released March 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaHtmlGuid;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "htmlguid.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+const
+// GUID for HTML viewer is: {25336920-03F9-11cf-8FD0-00AA00686F13}
+  CLSID_HTMLViewer: TGUID = (D1:$25336920; D2:$3f9; D3:$11cf; D4:($8f, $d0, $0, $aa, $0, $68, $6f, $13));
+  {$EXTERNALSYM CLSID_HTMLViewer}
+
+// GUID for BSCB proxy is: {25336922-03F9-11cf-8FD0-00AA00686F13}
+  CLSID_HTMLBSCBProxy: TGUID = (D1:$25336922; D2:$3f9; D3:$11cf; D4:($8f, $d0, $0, $aa, $0, $68, $6f, $13));
+  {$EXTERNALSYM CLSID_HTMLBSCBProxy}
+
+// The GUID used to identify the TypeLib of the HTML Page
+// {71BC8840-60BB-11cf-8B97-00AA00476DA6}
+  GUID_PageTL: TGUID = (D1:$71bc8840; D2:$60bb; D3:$11cf; D4:($8b, $97, $0, $aa, $0, $47, $6d, $a6));
+  {$EXTERNALSYM GUID_PageTL}
+
+// The GUID used to identify the Primary dispinterface of the HTML Page
+// {71BC8841-60BB-11cf-8B97-00AA00476DA6}
+  IID_PageProps: TGUID = (D1:$71bc8841; D2:$60bb; D3:$11cf; D4:($8b, $97, $0, $aa, $0, $47, $6d, $a6));
+  {$EXTERNALSYM IID_PageProps}
+
+// The GUID used to identify the Event dispinterface of the HTML Page
+// The page events are currently commented out but will be added later
+// so I grabbed a guid for the events now.
+// {71BC8842-60BB-11cf-8B97-00AA00476DA6}
+  IID_PageEvents: TGUID = (D1:$71bc8842; D2:$60bb; D3:$11cf; D4:($8b, $97, $0, $aa, $0, $47, $6d, $a6));
+  {$EXTERNALSYM IID_PageEvents}
+
+// The GUID used to identify the coclass of the HTML Page
+// {71BC8843-60BB-11cf-8B97-00AA00476DA6}
+  CLSID_Page: TGUID = (D1:$71bc8843; D2:$60bb; D3:$11cf; D4:($8b, $97, $0, $aa, $0, $47, $6d, $a6));
+  {$EXTERNALSYM CLSID_Page}
+
+implementation
+
+end.

+ 831 - 0
packages/extra/winunits/jwahtmlhelp.pas

@@ -0,0 +1,831 @@
+{******************************************************************************}
+{                                                                              }
+{ HTML Help API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: htmlhelp.h, released July 2000. The original Pascal    }
+{ code is: HtmlHelp.pas, released September 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): Robert Chandler  (robert att helpware dott net)              }
+{                 Kurt Senfer (ks att siemens dott dk)                         }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaHtmlHelp;
+
+{$I jediapilib.inc}
+
+interface
+
+{$WEAKPACKAGEUNIT}
+
+(*$HPPEMIT ''*)
+(*$HPPEMIT '#include "htmlhelp.h"'*)
+(*$HPPEMIT ''*)
+(*$HPPEMIT 'typedef struct tagHH_LAST_ERROR'*)
+(*$HPPEMIT '{'*)
+(*$HPPEMIT '  int     cbStruct ;'*)
+(*$HPPEMIT '  HRESULT hr ;'*)
+(*$HPPEMIT '  BSTR    description ;'*)
+(*$HPPEMIT '} HH_LAST_ERROR ;'*)
+(*$HPPEMIT ''*)
+
+uses
+  {$IFDEF HAS_UNIT_VARIANTS}
+  Variants,
+  {$ENDIF HAS_UNIT_VARIANTS}
+  JwaWinType, JwaWinUser;
+
+// Commands to pass to HtmlHelp()
+
+const
+  HH_DISPLAY_TOPIC           = $0000;
+  {$EXTERNALSYM HH_DISPLAY_TOPIC}
+  HH_HELP_FINDER             = $0000;      // WinHelp equivalent
+  {$EXTERNALSYM HH_HELP_FINDER}
+  HH_DISPLAY_TOC             = $0001;      // not currently implemented
+  {$EXTERNALSYM HH_DISPLAY_TOC}
+  HH_DISPLAY_INDEX           = $0002;      // not currently implemented
+  {$EXTERNALSYM HH_DISPLAY_INDEX}
+  HH_DISPLAY_SEARCH          = $0003;      // not currently implemented
+  {$EXTERNALSYM HH_DISPLAY_SEARCH}
+  HH_SET_WIN_TYPE            = $0004;
+  {$EXTERNALSYM HH_SET_WIN_TYPE}
+  HH_GET_WIN_TYPE            = $0005;
+  {$EXTERNALSYM HH_GET_WIN_TYPE}
+  HH_GET_WIN_HANDLE          = $0006;
+  {$EXTERNALSYM HH_GET_WIN_HANDLE}
+  HH_ENUM_INFO_TYPE          = $0007;      // Get Info type name, call repeatedly to enumerate, -1 at end
+  {$EXTERNALSYM HH_ENUM_INFO_TYPE}
+  HH_SET_INFO_TYPE           = $0008;      // Add Info type to filter.
+  {$EXTERNALSYM HH_SET_INFO_TYPE}
+  HH_SYNC                    = $0009;
+  {$EXTERNALSYM HH_SYNC}
+  {$IFDEF HTMLHELP11}
+  HH_ADD_NAV_UI              = $000A;      // not currently implemented
+  {$EXTERNALSYM HH_ADD_NAV_UI}
+  HH_ADD_BUTTON              = $000B;      // not currently implemented
+  {$EXTERNALSYM HH_ADD_BUTTON}
+  HH_GETBROWSER_APP          = $000C;      // not currently implemented
+  {$EXTERNALSYM HH_GETBROWSER_APP}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HH_RESERVED1               = $000A;
+  {$EXTERNALSYM HH_RESERVED1}
+  HH_RESERVED2               = $000B;
+  {$EXTERNALSYM HH_RESERVED2}
+  HH_RESERVED3               = $000C;
+  {$EXTERNALSYM HH_RESERVED3}
+  {$ENDIF HTMLHELP12}
+  HH_KEYWORD_LOOKUP          = $000D;
+  {$EXTERNALSYM HH_KEYWORD_LOOKUP}
+  HH_DISPLAY_TEXT_POPUP      = $000E;      // display string resource id or text in a popup window
+  {$EXTERNALSYM HH_DISPLAY_TEXT_POPUP}
+  HH_HELP_CONTEXT            = $000F;      // display mapped numeric value in dwData
+  {$EXTERNALSYM HH_HELP_CONTEXT}
+  HH_TP_HELP_CONTEXTMENU     = $0010;      // text popup help, same as WinHelp HELP_CONTEXTMENU
+  {$EXTERNALSYM HH_TP_HELP_CONTEXTMENU}
+  HH_TP_HELP_WM_HELP         = $0011;      // text popup help, same as WinHelp HELP_WM_HELP
+  {$EXTERNALSYM HH_TP_HELP_WM_HELP}
+  HH_CLOSE_ALL               = $0012;      // close all windows opened directly or indirectly by the caller
+  {$EXTERNALSYM HH_CLOSE_ALL}
+  HH_ALINK_LOOKUP            = $0013;      // ALink version of HH_KEYWORD_LOOKUP
+  {$EXTERNALSYM HH_ALINK_LOOKUP}
+  HH_GET_LAST_ERROR          = $0014;      // not currently implemented, See HHERROR.h
+  {$EXTERNALSYM HH_GET_LAST_ERROR}
+  HH_ENUM_CATEGORY           = $0015;      // Get category name, call repeatedly to enumerate, -1 at end
+  {$EXTERNALSYM HH_ENUM_CATEGORY}
+  HH_ENUM_CATEGORY_IT        = $0016;      // Get category info type members, call repeatedly to enumerate, -1 at end
+  {$EXTERNALSYM HH_ENUM_CATEGORY_IT}
+  HH_RESET_IT_FILTER         = $0017;      // Clear the info type filter of all info types.
+  {$EXTERNALSYM HH_RESET_IT_FILTER}
+  HH_SET_INCLUSIVE_FILTER    = $0018;      // set inclusive filtering method for untyped topics to be included in display
+  {$EXTERNALSYM HH_SET_INCLUSIVE_FILTER}
+  HH_SET_EXCLUSIVE_FILTER    = $0019;      // set exclusive filtering method for untyped topics to be excluded from display
+  {$EXTERNALSYM HH_SET_EXCLUSIVE_FILTER}
+  {$IFDEF HTMLHELP11}
+  HH_SET_GUID                = $001A;      // For Microsoft Installer -- dwData is a pointer to the GUID string
+  {$EXTERNALSYM HH_SET_GUID}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HH_INITIALIZE              = $001C;      // Initializes the help system.
+  {$EXTERNALSYM HH_INITIALIZE}
+  HH_UNINITIALIZE            = $001D;      // Uninitializes the help system.
+  {$EXTERNALSYM HH_UNINITIALIZE}
+  HH_PRETRANSLATEMESSAGE     = $00FD;      // Pumps messages. (NULL, NULL, MSG*).
+  {$EXTERNALSYM HH_PRETRANSLATEMESSAGE}
+  HH_SET_GLOBAL_PROPERTY     = $00FC;      // Set a global property. (NULL, NULL, HH_GPROP)
+  {$EXTERNALSYM HH_SET_GLOBAL_PROPERTY}
+  {$ENDIF HTMLHELP12}
+
+  {$IFDEF HTMLHELP11}
+  HH_INTERNAL                = $00FF;      // Used internally.
+  {$EXTERNALSYM HH_INTERNAL}
+  {$ENDIF HTMLHELP11}
+
+  {$IFDEF HTMLHELP12}
+  HHWIN_PROP_TAB_AUTOHIDESHOW = 1 shl 0; // Automatically hide/show tri-pane window
+  {$EXTERNALSYM HHWIN_PROP_TAB_AUTOHIDESHOW}
+  {$ENDIF HTMLHELP12}
+  HHWIN_PROP_ONTOP           = 1 shl 1;  // Top-most window (not currently implemented)
+  {$EXTERNALSYM HHWIN_PROP_ONTOP}
+  HHWIN_PROP_NOTITLEBAR      = 1 shl 2;  // no title bar
+  {$EXTERNALSYM HHWIN_PROP_NOTITLEBAR}
+  HHWIN_PROP_NODEF_STYLES    = 1 shl 3;  // no default window styles (only HH_WINTYPE.dwStyles)
+  {$EXTERNALSYM HHWIN_PROP_NODEF_STYLES}
+  HHWIN_PROP_NODEF_EXSTYLES  = 1 shl 4;  // no default extended window styles (only HH_WINTYPE.dwExStyles)
+  {$EXTERNALSYM HHWIN_PROP_NODEF_EXSTYLES}
+  HHWIN_PROP_TRI_PANE        = 1 shl 5;  // use a tri-pane window
+  {$EXTERNALSYM HHWIN_PROP_TRI_PANE}
+  HHWIN_PROP_NOTB_TEXT       = 1 shl 6;  // no text on toolbar buttons
+  {$EXTERNALSYM HHWIN_PROP_NOTB_TEXT}
+  HHWIN_PROP_POST_QUIT       = 1 shl 7;  // post WM_QUIT message when window closes
+  {$EXTERNALSYM HHWIN_PROP_POST_QUIT}
+  HHWIN_PROP_AUTO_SYNC       = 1 shl 8;  // automatically ssync contents and index
+  {$EXTERNALSYM HHWIN_PROP_AUTO_SYNC}
+  HHWIN_PROP_TRACKING        = 1 shl 9;  // send tracking notification messages
+  {$EXTERNALSYM HHWIN_PROP_TRACKING}
+  HHWIN_PROP_TAB_SEARCH      = 1 shl 10; // include search tab in navigation pane
+  {$EXTERNALSYM HHWIN_PROP_TAB_SEARCH}
+  HHWIN_PROP_TAB_HISTORY     = 1 shl 11; // include history tab in navigation pane
+  {$EXTERNALSYM HHWIN_PROP_TAB_HISTORY}
+  {$IFDEF HTMLHELP11}
+  HHWIN_PROP_TAB_BOOKMARKS   = 1 shl 12; // include bookmark tab in navigation pane
+  {$EXTERNALSYM HHWIN_PROP_TAB_BOOKMARKS}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HHWIN_PROP_TAB_FAVORITES   = 1 shl 12; // include favorites tab in navigation pane
+  {$EXTERNALSYM HHWIN_PROP_TAB_FAVORITES}
+  {$ENDIF HTMLHELP12}
+  HHWIN_PROP_CHANGE_TITLE    = 1 shl 13; // Put current HTML title in title bar
+  {$EXTERNALSYM HHWIN_PROP_CHANGE_TITLE}
+  HHWIN_PROP_NAV_ONLY_WIN    = 1 shl 14; // Only display the navigation window
+  {$EXTERNALSYM HHWIN_PROP_NAV_ONLY_WIN}
+  HHWIN_PROP_NO_TOOLBAR      = 1 shl 15; // Don't display a toolbar
+  {$EXTERNALSYM HHWIN_PROP_NO_TOOLBAR}
+  HHWIN_PROP_MENU            = 1 shl 16; // Menu
+  {$EXTERNALSYM HHWIN_PROP_MENU}
+  HHWIN_PROP_TAB_ADVSEARCH   = 1 shl 17; // Advanced FTS UI.
+  {$EXTERNALSYM HHWIN_PROP_TAB_ADVSEARCH}
+  HHWIN_PROP_USER_POS        = 1 shl 18; // After initial creation, user controls window size/Position
+  {$EXTERNALSYM HHWIN_PROP_USER_POS}
+{$IFDEF HTMLHELP12}
+  HHWIN_PROP_TAB_CUSTOM1     = 1 shl 19; // Use custom tab #1
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM1}
+  HHWIN_PROP_TAB_CUSTOM2     = 1 shl 20; // Use custom tab #2
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM2}
+  HHWIN_PROP_TAB_CUSTOM3     = 1 shl 21; // Use custom tab #3
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM3}
+  HHWIN_PROP_TAB_CUSTOM4     = 1 shl 22; // Use custom tab #4
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM4}
+  HHWIN_PROP_TAB_CUSTOM5     = 1 shl 23; // Use custom tab #5
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM5}
+  HHWIN_PROP_TAB_CUSTOM6     = 1 shl 24; // Use custom tab #6
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM6}
+  HHWIN_PROP_TAB_CUSTOM7     = 1 shl 25; // Use custom tab #7
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM7}
+  HHWIN_PROP_TAB_CUSTOM8     = 1 shl 26; // Use custom tab #8
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM8}
+  HHWIN_PROP_TAB_CUSTOM9     = 1 shl 27; // Use custom tab #9
+  {$EXTERNALSYM HHWIN_PROP_TAB_CUSTOM9}
+  HHWIN_TB_MARGIN            = 1 shl 28; // the window type has a margin
+  {$EXTERNALSYM HHWIN_TB_MARGIN}
+{$ENDIF HTMLHELP12}
+
+  HHWIN_PARAM_PROPERTIES     = 1 shl 1;  // valid fsWinProperties
+  {$EXTERNALSYM HHWIN_PARAM_PROPERTIES}
+  HHWIN_PARAM_STYLES         = 1 shl 2;  // valid dwStyles
+  {$EXTERNALSYM HHWIN_PARAM_STYLES}
+  HHWIN_PARAM_EXSTYLES       = 1 shl 3;  // valid dwExStyles
+  {$EXTERNALSYM HHWIN_PARAM_EXSTYLES}
+  HHWIN_PARAM_RECT           = 1 shl 4;  // valid rcWindowPos
+  {$EXTERNALSYM HHWIN_PARAM_RECT}
+  HHWIN_PARAM_NAV_WIDTH      = 1 shl 5;  // valid iNavWidth
+  {$EXTERNALSYM HHWIN_PARAM_NAV_WIDTH}
+  HHWIN_PARAM_SHOWSTATE      = 1 shl 6;  // valid nShowState
+  {$EXTERNALSYM HHWIN_PARAM_SHOWSTATE}
+  HHWIN_PARAM_INFOTYPES      = 1 shl 7;  // valid apInfoTypes
+  {$EXTERNALSYM HHWIN_PARAM_INFOTYPES}
+  HHWIN_PARAM_TB_FLAGS       = 1 shl 8;  // valid fsToolBarFlags
+  {$EXTERNALSYM HHWIN_PARAM_TB_FLAGS}
+  HHWIN_PARAM_EXPANSION      = 1 shl 9;  // valid fNotExpanded
+  {$EXTERNALSYM HHWIN_PARAM_EXPANSION}
+  HHWIN_PARAM_TABPOS         = 1 shl 10; // valid tabpos
+  {$EXTERNALSYM HHWIN_PARAM_TABPOS}
+  HHWIN_PARAM_TABORDER       = 1 shl 11; // valid taborder
+  {$EXTERNALSYM HHWIN_PARAM_TABORDER}
+  HHWIN_PARAM_HISTORY_COUNT  = 1 shl 12; // valid cHistory
+  {$EXTERNALSYM HHWIN_PARAM_HISTORY_COUNT}
+  HHWIN_PARAM_CUR_TAB        = 1 shl 13; // valid curNavType
+  {$EXTERNALSYM HHWIN_PARAM_CUR_TAB}
+
+  HHWIN_BUTTON_EXPAND        = 1 shl 1;  // Expand/contract button
+  {$EXTERNALSYM HHWIN_BUTTON_EXPAND}
+  HHWIN_BUTTON_BACK          = 1 shl 2;  // Back button
+  {$EXTERNALSYM HHWIN_BUTTON_BACK}
+  HHWIN_BUTTON_FORWARD       = 1 shl 3;  // Forward button
+  {$EXTERNALSYM HHWIN_BUTTON_FORWARD}
+  HHWIN_BUTTON_STOP          = 1 shl 4;  // Stop button
+  {$EXTERNALSYM HHWIN_BUTTON_STOP}
+  HHWIN_BUTTON_REFRESH       = 1 shl 5;  // Refresh button
+  {$EXTERNALSYM HHWIN_BUTTON_REFRESH}
+  HHWIN_BUTTON_HOME          = 1 shl 6;  // Home button
+  {$EXTERNALSYM HHWIN_BUTTON_HOME}
+  HHWIN_BUTTON_BROWSE_FWD    = 1 shl 7;  // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_BROWSE_FWD}
+  HHWIN_BUTTON_BROWSE_BCK    = 1 shl 8;  // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_BROWSE_BCK}
+  HHWIN_BUTTON_NOTES         = 1 shl 9;  // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_NOTES}
+  HHWIN_BUTTON_CONTENTS      = 1 shl 10; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_CONTENTS}
+  HHWIN_BUTTON_SYNC          = 1 shl 11; // Sync button
+  {$EXTERNALSYM HHWIN_BUTTON_SYNC}
+  HHWIN_BUTTON_OPTIONS       = 1 shl 12; // Options button
+  {$EXTERNALSYM HHWIN_BUTTON_OPTIONS}
+  HHWIN_BUTTON_PRINT         = 1 shl 13; // Print button
+  {$EXTERNALSYM HHWIN_BUTTON_PRINT}
+  HHWIN_BUTTON_INDEX         = 1 shl 14; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_INDEX}
+  HHWIN_BUTTON_SEARCH        = 1 shl 15; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_SEARCH}
+  HHWIN_BUTTON_HISTORY       = 1 shl 16; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_HISTORY}
+  {$IFDEF HTMLHELP11}
+  HHWIN_BUTTON_BOOKMARKS     = 1 shl 17; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_BOOKMARKS}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HHWIN_BUTTON_FAVORITES     = 1 shl 17; // not implemented
+  {$EXTERNALSYM HHWIN_BUTTON_FAVORITES}
+  {$ENDIF HTMLHELP12}
+  HHWIN_BUTTON_JUMP1         = 1 shl 18;
+  {$EXTERNALSYM HHWIN_BUTTON_JUMP1}
+  HHWIN_BUTTON_JUMP2         = 1 shl 19;
+  {$EXTERNALSYM HHWIN_BUTTON_JUMP2}
+  HHWIN_BUTTON_ZOOM          = 1 shl 20;
+  {$EXTERNALSYM HHWIN_BUTTON_ZOOM}
+  HHWIN_BUTTON_TOC_NEXT      = 1 shl 21;
+  {$EXTERNALSYM HHWIN_BUTTON_TOC_NEXT}
+  HHWIN_BUTTON_TOC_PREV      = 1 shl 22;
+  {$EXTERNALSYM HHWIN_BUTTON_TOC_PREV}
+
+  HHWIN_DEF_BUTTONS = HHWIN_BUTTON_EXPAND or HHWIN_BUTTON_BACK or
+                      HHWIN_BUTTON_OPTIONS or HHWIN_BUTTON_PRINT;
+  {$EXTERNALSYM HHWIN_DEF_BUTTONS}
+
+// Button IDs
+
+  IDTB_EXPAND       = 200;
+  {$EXTERNALSYM IDTB_EXPAND}
+  IDTB_CONTRACT     = 201;
+  {$EXTERNALSYM IDTB_CONTRACT}
+  IDTB_STOP         = 202;
+  {$EXTERNALSYM IDTB_STOP}
+  IDTB_REFRESH      = 203;
+  {$EXTERNALSYM IDTB_REFRESH}
+  IDTB_BACK         = 204;
+  {$EXTERNALSYM IDTB_BACK}
+  IDTB_HOME         = 205;
+  {$EXTERNALSYM IDTB_HOME}
+  IDTB_SYNC         = 206;
+  {$EXTERNALSYM IDTB_SYNC}
+  IDTB_PRINT        = 207;
+  {$EXTERNALSYM IDTB_PRINT}
+  IDTB_OPTIONS      = 208;
+  {$EXTERNALSYM IDTB_OPTIONS}
+  IDTB_FORWARD      = 209;
+  {$EXTERNALSYM IDTB_FORWARD}
+  IDTB_NOTES        = 210;                 // not implemented
+  {$EXTERNALSYM IDTB_NOTES}
+  IDTB_BROWSE_FWD   = 211;
+  {$EXTERNALSYM IDTB_BROWSE_FWD}
+  IDTB_BROWSE_BACK  = 212;
+  {$EXTERNALSYM IDTB_BROWSE_BACK}
+  IDTB_CONTENTS     = 213;                 // not implemented
+  {$EXTERNALSYM IDTB_CONTENTS}
+  IDTB_INDEX        = 214;                 // not implemented
+  {$EXTERNALSYM IDTB_INDEX}
+  IDTB_SEARCH       = 215;                 // not implemented
+  {$EXTERNALSYM IDTB_SEARCH}
+  IDTB_HISTORY      = 216;                 // not implemented
+  {$EXTERNALSYM IDTB_HISTORY}
+  {$IFDEF HTMLHELP11}
+  IDTB_BOOKMARKS    = 217;                 // not implemented
+  {$EXTERNALSYM IDTB_BOOKMARKS}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  IDTB_FAVORITES    = 217;                 // not implemented
+  {$EXTERNALSYM IDTB_FAVORITES}
+  {$ENDIF HTMLHELP12}
+  IDTB_JUMP1        = 218;
+  {$EXTERNALSYM IDTB_JUMP1}
+  IDTB_JUMP2        = 219;
+  {$EXTERNALSYM IDTB_JUMP2}
+  IDTB_CUSTOMIZE    = 221;
+  {$EXTERNALSYM IDTB_CUSTOMIZE}
+  IDTB_ZOOM         = 222;
+  {$EXTERNALSYM IDTB_ZOOM}
+  IDTB_TOC_NEXT     = 223;
+  {$EXTERNALSYM IDTB_TOC_NEXT}
+  IDTB_TOC_PREV     = 224;
+  {$EXTERNALSYM IDTB_TOC_PREV}
+
+// Notification codes
+
+  HHN_FIRST         = -860;
+  {$EXTERNALSYM HHN_FIRST}
+  HHN_LAST          = -879;
+  {$EXTERNALSYM HHN_LAST}
+
+  HHN_NAVCOMPLETE   = HHN_FIRST - 0;
+  {$EXTERNALSYM HHN_NAVCOMPLETE}
+  HHN_TRACK         = HHN_FIRST - 1;
+  {$EXTERNALSYM HHN_TRACK}
+  HHN_WINDOW_CREATE = HHN_FIRST - 2;
+  {$EXTERNALSYM HHN_WINDOW_CREATE}
+
+type
+  PHHLastError = ^THHLastError;
+  tagHH_LAST_ERROR = packed record
+    cbStruct: INT;          // size of this structure
+    hr: HRESULT;            // the last error code.
+    description: LPWSTR;    // a description of the error (unicode string - BSTR).
+  end;
+  THHLastError = tagHH_LAST_ERROR;
+
+  PHHNNotify = ^THHNNotify;
+  tagHHN_NOTIFY = packed record
+    hdr: NMHDR;
+    pszUrl: PCSTR;                         // multibyte null-terminated string
+  end;
+  {$EXTERNALSYM tagHHN_NOTIFY}
+  HHN_NOTIFY = tagHHN_NOTIFY;
+  {$EXTERNALSYM HHN_NOTIFY}
+  THHNNotify = tagHHN_NOTIFY;
+
+  PHHPopup = ^THHPopup;
+  tagHH_POPUP = packed record
+    cbStruct: Integer;                     // sizeof this structure
+    hinst_: HINSTANCE;                     // instance handle for string resource
+    idString: UINT;                        // string resource id, or text id if pszFile is specified in HtmlHelp call
+    pszText: LPCTSTR;                      // used if idString is zero
+    pt: POINT;                             // top center of popup window
+    clrForeGround: COLORREF;               // use -1 for default
+    clrBackground: COLORREF;               // use -1 for default
+    rcMargins: RECT;                       // amount of space between edges of window and text, -1 for each member to ignore
+    pszFont: LPCTSTR;                      // facename, point size, char set, BOLD ITALIC UNDERLINE
+  end;
+  {$EXTERNALSYM tagHH_POPUP}
+  HH_POPUP = tagHH_POPUP;
+  {$EXTERNALSYM HH_POPUP}
+  THHPopup = tagHH_POPUP;
+
+  PHHAKLink = ^THHAKLink;
+  tagHH_AKLINK = packed record
+    cbStruct: Integer;                     // sizeof this structure
+    fReserved: BOOL;                       // must be FALSE (really!)
+    pszKeywords: LPCTSTR;                  // semi-colon separated keywords
+    pszUrl: LPCTSTR;                       // URL to jump to if no keywords found (may be NULL)
+    pszMsgText: LPCTSTR;                   // Message text to display in MessageBox if pszUrl is NULL and no keyword match
+    pszMsgTitle: LPCTSTR;                  // Message text to display in MessageBox if pszUrl is NULL and no keyword match
+    pszWindow: LPCTSTR;                    // Window to display URL in
+    fIndexOnFail: BOOL;                    // Displays index if keyword lookup fails.
+  end;
+  {$EXTERNALSYM tagHH_AKLINK}
+  HH_AKLINK = tagHH_AKLINK;
+  {$EXTERNALSYM HH_AKLINK}
+  THHAKLink = tagHH_AKLINK;
+
+const
+  HHWIN_NAVTYPE_TOC          = 0;
+  {$EXTERNALSYM HHWIN_NAVTYPE_TOC}
+  HHWIN_NAVTYPE_INDEX        = 1;
+  {$EXTERNALSYM HHWIN_NAVTYPE_INDEX}
+  HHWIN_NAVTYPE_SEARCH       = 2;
+  {$EXTERNALSYM HHWIN_NAVTYPE_SEARCH}
+  {$IFDEF HTMLHELP11}
+  HHWIN_NAVTYPE_BOOKMARKS    = 3;
+  {$EXTERNALSYM HHWIN_NAVTYPE_BOOKMARKS}
+  HHWIN_NAVTYPE_HISTORY      = 4;          //not implemented
+  {$EXTERNALSYM HHWIN_NAVTYPE_HISTORY}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HHWIN_NAVTYPE_FAVORITES    = 3;
+  {$EXTERNALSYM HHWIN_NAVTYPE_FAVORITES}
+  HHWIN_NAVTYPE_HISTORY      = 4;          //not implemented
+  {$EXTERNALSYM HHWIN_NAVTYPE_HISTORY}
+  HHWIN_NAVTYPE_AUTHOR       = 5;
+  {$EXTERNALSYM HHWIN_NAVTYPE_AUTHOR}
+  HHWIN_NAVTYPE_CUSTOM_FIRST = 11;
+  {$EXTERNALSYM HHWIN_NAVTYPE_CUSTOM_FIRST}
+{$ENDIF HTMLHELP12}
+
+  IT_INCLUSIVE = 0;
+  {$EXTERNALSYM IT_INCLUSIVE}
+  IT_EXCLUSIVE = 1;
+  {$EXTERNALSYM IT_EXCLUSIVE}
+  IT_HIDDEN    = 2;
+  {$EXTERNALSYM IT_HIDDEN}
+
+type
+  PHHEnumIT = ^THHEnumIT;
+  tagHH_ENUM_IT = packed record
+    cbStruct: Integer;        // size of this structure
+    iType: Integer;           // the type of the information type ie. Inclusive, Exclusive, or Hidden
+    pszCatName: LPCSTR;       // Set to the name of the Category to enumerate the info types in a category; else NULL
+    pszITName: LPCSTR;        // volitile pointer to the name of the infotype. Allocated by call. Caller responsible for freeing
+    pszITDescription: LPCSTR; // volitile pointer to the description of the infotype.
+  end;
+  {$EXTERNALSYM tagHH_ENUM_IT}
+  HH_ENUM_IT = tagHH_ENUM_IT;
+  {$EXTERNALSYM HH_ENUM_IT}
+  PHH_ENUM_IT = ^tagHH_ENUM_IT;
+  {$EXTERNALSYM PHH_ENUM_IT}
+  THHEnumIT = tagHH_ENUM_IT;
+
+  PHHEnumCat = ^THHEnumCat;
+  tagHH_ENUM_CAT = packed record
+    cbStruct: Integer;         // size of this structure
+    pszCatName: LPCSTR;        // volitile pointer to the category name
+    pszCatDescription: LPCSTR; // volitile pointer to the category description
+  end;
+  {$EXTERNALSYM tagHH_ENUM_CAT}
+  HH_ENUM_CAT = tagHH_ENUM_CAT;
+  {$EXTERNALSYM HH_ENUM_CAT}
+  PHH_ENUM_CAT = ^tagHH_ENUM_CAT;
+  {$EXTERNALSYM PHH_ENUM_CAT}
+  THHEnumCat = tagHH_ENUM_CAT;
+
+  PHHSetInfoType = ^THHSetInfoType;
+  tagHH_SET_INFOTYPE = packed record
+    cbStruct: Integer;        // the size of this structure
+    pszCatName: LPCSTR;       // the name of the category, if any, the InfoType is a member of.
+    pszInfoTypeName: LPCSTR;  // the name of the info type to add to the filter
+  end;
+  {$EXTERNALSYM tagHH_SET_INFOTYPE}
+  HH_SET_INFOTYPE = tagHH_SET_INFOTYPE;
+  {$EXTERNALSYM HH_SET_INFOTYPE}
+  PHH_SET_INFOTYPE = ^tagHH_SET_INFOTYPE;
+  {$EXTERNALSYM PHH_SET_INFOTYPE}
+  THHSetInfoType = tagHH_SET_INFOTYPE;
+
+  HH_INFOTYPE = DWORD;
+  {$EXTERNALSYM HH_INFOTYPE}
+  PHH_INFOTYPE = ^HH_INFOTYPE;
+  {$EXTERNALSYM PHH_INFOTYPE}
+  PHHInfoType = ^THHInfoType;
+  THHInfoType = HH_INFOTYPE;
+
+const
+  HHWIN_NAVTAB_TOP    = 0;
+  {$EXTERNALSYM HHWIN_NAVTAB_TOP}
+  HHWIN_NAVTAB_LEFT   = 1;
+  {$EXTERNALSYM HHWIN_NAVTAB_LEFT}
+  HHWIN_NAVTAB_BOTTOM = 2;
+  {$EXTERNALSYM HHWIN_NAVTAB_BOTTOM}
+
+  HH_MAX_TABS         = 19;
+  {$EXTERNALSYM HH_MAX_TABS}
+
+  HH_TAB_CONTENTS     = 0;
+  {$EXTERNALSYM HH_TAB_CONTENTS}
+  HH_TAB_INDEX        = 1;
+  {$EXTERNALSYM HH_TAB_INDEX}
+  HH_TAB_SEARCH       = 2;
+  {$EXTERNALSYM HH_TAB_SEARCH}
+  {$IFDEF HTMLHELP11}
+  HH_TAB_BOOKMARKS    = 3;
+  {$EXTERNALSYM HH_TAB_BOOKMARKS}
+  HH_TAB_HISTORY      = 4;
+  {$EXTERNALSYM HH_TAB_HISTORY}
+  {$ENDIF HTMLHELP11}
+  {$IFDEF HTMLHELP12}
+  HH_TAB_FAVORITES    = 3;
+  {$EXTERNALSYM HH_TAB_FAVORITES}
+  HH_TAB_HISTORY      = 4;
+  {$EXTERNALSYM HH_TAB_HISTORY}
+  HH_TAB_AUTHOR       = 5;
+  {$EXTERNALSYM HH_TAB_AUTHOR}
+
+  HH_TAB_CUSTOM_FIRST = 11;
+  {$EXTERNALSYM HH_TAB_CUSTOM_FIRST}
+  HH_TAB_CUSTOM_LAST  = HH_MAX_TABS;
+  {$EXTERNALSYM HH_TAB_CUSTOM_LAST}
+
+  HH_MAX_TABS_CUSTOM  = HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1;
+  {$EXTERNALSYM HH_MAX_TABS_CUSTOM}
+{$ENDIF HTMLHELP12}
+
+// HH_DISPLAY_SEARCH Command Related Structures and Constants
+
+  HH_FTS_DEFAULT_PROXIMITY = -1;
+  {$EXTERNALSYM HH_FTS_DEFAULT_PROXIMITY}
+
+type
+  PHHFtsQuery = ^THHFtsQuery;
+  tagHH_FTS_QUERY = packed record
+    cbStruct: Integer;         // Sizeof structure in bytes.
+    fUniCodeStrings: BOOL;     // TRUE if all strings are unicode.
+    pszSearchQuery: LPCTSTR;   // String containing the search query.
+    iProximity: LONG;          // Word proximity.
+    fStemmedSearch: BOOL;      // TRUE for StemmedSearch only.
+    fTitleOnly: BOOL;          // TRUE for Title search only.
+    fExecute: BOOL;            // TRUE to initiate the search.
+    pszWindow: LPCTSTR;        // Window to display in
+  end;
+  {$EXTERNALSYM tagHH_FTS_QUERY}
+  HH_FTS_QUERY = tagHH_FTS_QUERY;
+  {$EXTERNALSYM HH_FTS_QUERY}
+  THHFtsQuery = tagHH_FTS_QUERY;
+
+  PHHWinType = ^THHWinType;
+  tagHH_WINTYPE = packed record
+    cbStruct: Integer;      // IN: size of this structure including all Information Types
+    fUniCodeStrings: BOOL;  // IN/OUT: TRUE if all strings are in UNICODE
+    pszType: LPCTSTR;       // IN/OUT: Name of a type of window
+    fsValidMembers: DWORD;  // IN: Bit flag of valid members (HHWIN_PARAM_)
+    fsWinProperties: DWORD; // IN/OUT: Properties/attributes of the window (HHWIN_)
+
+    pszCaption: LPCTSTR;    // IN/OUT: Window title
+    dwStyles: DWORD;        // IN/OUT: Window styles
+    dwExStyles: DWORD;      // IN/OUT: Extended Window styles
+    rcWindowPos: RECT;      // IN: Starting position, OUT: current position
+    nShowState: Integer;    // IN: show state (e.g., SW_SHOW)
+
+    hwndHelp: HWND;         // OUT: window handle
+    hwndCaller: HWND;       // OUT: who called this window
+
+    paInfoTypes: PHHInfoType; // IN: Pointer to an array of Information Types
+
+    { The following members are only valid if HHWIN_PROP_TRI_PANE is set }
+
+    hwndToolBar: HWND;      // OUT: toolbar window in tri-pane window
+    hwndNavigation: HWND;   // OUT: navigation window in tri-pane window
+    hwndHTML: HWND;         // OUT: window displaying HTML in tri-pane window
+    iNavWidth: Integer;     // IN/OUT: width of navigation window
+    rcHTML: RECT;           // OUT: HTML window coordinates
+
+    pszToc: LPCTSTR;        // IN: Location of the table of contents file
+    pszIndex: LPCTSTR;      // IN: Location of the index file
+    pszFile: LPCTSTR;       // IN: Default location of the html file
+    pszHome: LPCTSTR;       // IN/OUT: html file to display when Home button is clicked
+    fsToolBarFlags: DWORD;  // IN: flags controling the appearance of the toolbar
+    fNotExpanded: BOOL;     // IN: TRUE/FALSE to contract or expand, OUT: current state
+    curNavType: Integer;    // IN/OUT: UI to display in the navigational pane
+    tabpos: Integer;        // IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
+    idNotify: Integer;      // IN: ID to use for WM_NOTIFY messages
+    tabOrder: array[0..HH_MAX_TABS] of Byte; // IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
+    cHistory: Integer;      // IN/OUT: number of history items to keep (default is 30)
+    pszJump1: LPCTSTR;      // Text for HHWIN_BUTTON_JUMP1
+    pszJump2: LPCTSTR;      // Text for HHWIN_BUTTON_JUMP2
+    pszUrlJump1: LPCTSTR;   // URL for HHWIN_BUTTON_JUMP1
+    pszUrlJump2: LPCTSTR;   // URL for HHWIN_BUTTON_JUMP2
+    rcMinSize: RECT;        // Minimum size for window (ignored in version 1)
+    cbInfoTypes: Integer;   // size of paInfoTypes;
+    {$IFDEF HTMLHELP12}
+    pszCustomTabs: LPCTSTR; // multiple zero-terminated Strings
+    {$ENDIF HTMLHELP12}
+  end;
+  {$EXTERNALSYM tagHH_WINTYPE}
+  HH_WINTYPE = tagHH_WINTYPE;
+  {$EXTERNALSYM HH_WINTYPE}
+  PHH_WINTYPE = ^tagHH_WINTYPE;
+  {$EXTERNALSYM PHH_WINTYPE}
+  THHWinType = tagHH_WINTYPE;
+
+const
+  HHACT_TAB_CONTENTS  = 0;
+  {$EXTERNALSYM HHACT_TAB_CONTENTS}
+  HHACT_TAB_INDEX     = 1;
+  {$EXTERNALSYM HHACT_TAB_INDEX}
+  HHACT_TAB_SEARCH    = 2;
+  {$EXTERNALSYM HHACT_TAB_SEARCH}
+  HHACT_TAB_HISTORY   = 3;
+  {$EXTERNALSYM HHACT_TAB_HISTORY}
+  HHACT_TAB_FAVORITES = 4;
+  {$EXTERNALSYM HHACT_TAB_FAVORITES}
+  HHACT_EXPAND        = 5;
+  {$EXTERNALSYM HHACT_EXPAND}
+  HHACT_CONTRACT      = 6;
+  {$EXTERNALSYM HHACT_CONTRACT}
+  HHACT_BACK          = 7;
+  {$EXTERNALSYM HHACT_BACK}
+  HHACT_FORWARD       = 8;
+  {$EXTERNALSYM HHACT_FORWARD}
+  HHACT_STOP          = 9;
+  {$EXTERNALSYM HHACT_STOP}
+  HHACT_REFRESH       = 10;
+  {$EXTERNALSYM HHACT_REFRESH}
+  HHACT_HOME          = 11;
+  {$EXTERNALSYM HHACT_HOME}
+  HHACT_SYNC          = 12;
+  {$EXTERNALSYM HHACT_SYNC}
+  HHACT_OPTIONS       = 13;
+  {$EXTERNALSYM HHACT_OPTIONS}
+  HHACT_PRINT         = 14;
+  {$EXTERNALSYM HHACT_PRINT}
+  HHACT_HIGHLIGHT     = 15;
+  {$EXTERNALSYM HHACT_HIGHLIGHT}
+  HHACT_CUSTOMIZE     = 16;
+  {$EXTERNALSYM HHACT_CUSTOMIZE}
+  HHACT_JUMP1         = 17;
+  {$EXTERNALSYM HHACT_JUMP1}
+  HHACT_JUMP2         = 18;
+  {$EXTERNALSYM HHACT_JUMP2}
+  HHACT_ZOOM          = 19;
+  {$EXTERNALSYM HHACT_ZOOM}
+  HHACT_TOC_NEXT      = 20;
+  {$EXTERNALSYM HHACT_TOC_NEXT}
+  HHACT_TOC_PREV      = 21;
+  {$EXTERNALSYM HHACT_TOC_PREV}
+  HHACT_NOTES         = 22;
+  {$EXTERNALSYM HHACT_NOTES}
+  HHACT_LAST_ENUM     = 23;
+  {$EXTERNALSYM HHACT_LAST_ENUM}
+
+type
+  PHHNTrack = ^THHNTrack;
+  tagHHNTRACK = packed record
+    hdr: NMHDR;
+    pszCurUrl: PCSTR;        // Multi-byte, null-terminated string
+    idAction: Integer;       // HHACT_ value
+    phhWinType: PHHWinType;  // Current window type structure
+  end;
+  {$EXTERNALSYM tagHHNTRACK}
+  HHNTRACK = tagHHNTRACK;
+  {$EXTERNALSYM HHNTRACK}
+  THHNTrack = tagHHNTRACK;
+
+function HtmlHelpA(hwndCaller: HWND; pszFile: LPCSTR; uCommand: UINT; dwData: DWORD_PTR): HWND; stdcall;
+{$EXTERNALSYM HtmlHelpA}
+function HtmlHelpW(hwndCaller: HWND; pszFile: LPCWSTR; uCommand: UINT; dwData: DWORD_PTR): HWND; stdcall;
+{$EXTERNALSYM HtmlHelpW}
+function HtmlHelp(hwndCaller: HWND; pszFile: LPCTSTR; uCommand: UINT; dwData: DWORD_PTR): HWND; stdcall;
+
+// Use the following for GetProcAddress to load from hhctrl.ocx
+
+const
+  ATOM_HTMLHELP_API_ANSI    = LPTSTR(DWORD(WORD(14)));
+  {$EXTERNALSYM ATOM_HTMLHELP_API_ANSI}
+  ATOM_HTMLHELP_API_UNICODE = LPTSTR(DWORD(WORD(15)));
+  {$EXTERNALSYM ATOM_HTMLHELP_API_UNICODE}
+
+{$IFDEF HTMLHELP12}
+// Global Control Properties
+
+const
+  HH_GPROPID_SINGLETHREAD     = 1; // VARIANT_BOOL: True for single thread
+  {$EXTERNALSYM HH_GPROPID_SINGLETHREAD}
+  HH_GPROPID_TOOLBAR_MARGIN   = 2; // long: Provides a left/right margin around the toolbar.
+  {$EXTERNALSYM HH_GPROPID_TOOLBAR_MARGIN}
+  HH_GPROPID_UI_LANGUAGE      = 3; // long: LangId of the UI.
+  {$EXTERNALSYM HH_GPROPID_UI_LANGUAGE}
+  HH_GPROPID_CURRENT_SUBSET   = 4; // BSTR: Current subset.
+  {$EXTERNALSYM HH_GPROPID_CURRENT_SUBSET}
+  HH_GPROPID_CONTENT_LANGUAGE = 5; // long: LandId for desired content.
+  {$EXTERNALSYM HH_GPROPID_CONTENT_LANGUAGE}
+
+type
+  HH_GPROPID = HH_GPROPID_SINGLETHREAD..HH_GPROPID_CONTENT_LANGUAGE;
+  {$EXTERNALSYM HH_GPROPID}
+  THHGPropID = HH_GPROPID;
+
+// Global Property structure
+
+  PHHGlobalProperty = ^THHGlobalProperty;
+  tagHH_GLOBAL_PROPERTY = record
+    id: THHGPropID;
+    Dummy: Integer;                        // MVB: Added to enforce 8-byte packing
+    var_: OleVariant;
+  end;
+  HH_GLOBAL_PROPERTY = tagHH_GLOBAL_PROPERTY;
+  THHGlobalProperty = tagHH_GLOBAL_PROPERTY;
+
+{$ENDIF HTMLHELP12}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+uses
+  JwaWinBase, JwaWinError, JwaWinNT, JwaWinReg;
+{$ENDIF DYNAMIC_LINK}
+
+const
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+function GetOCXPath: string;
+const
+  HHPathRegKey = 'CLSID\{adb880a6-d8ff-11cf-9377-00aa003b7a11}\InprocServer32';
+var
+  HHKey: HKEY;
+  R, PathSize, ValueType: DWORD;
+  Path: string;
+begin
+  R := ERROR_PATH_NOT_FOUND;
+  if RegOpenKeyExA(HKEY_CLASSES_ROOT, PChar(HHPathRegKey), 0, KEY_QUERY_VALUE, HHKey) = ERROR_SUCCESS then
+  begin
+    ValueType := 0;
+    PathSize := 0;
+    if RegQueryValueExA(HHKey, PChar(''), nil, @ValueType, nil, @PathSize) = ERROR_SUCCESS then
+    begin
+      if ValueType = REG_SZ then
+      begin
+        SetLength(Path, PathSize);
+        R := RegQueryValueExA(HHKey, PChar(''), nil, @ValueType, PByte(Path), @PathSize);
+        Result := PChar(Path);
+      end;
+    end;
+    RegCloseKey(HHKey);
+  end;
+  if R <> ERROR_SUCCESS then
+    Result := 'hhctrl.ocx';
+end;
+
+var
+  _HtmlHelpA: Pointer;
+  _HtmlHelpW: Pointer;
+  _HtmlHelp: Pointer;
+
+function HtmlHelpA;
+begin
+  GetProcedureAddress(_HtmlHelpA, GetOCXPath, 'HtmlHelpA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_HtmlHelpA]
+  end;
+end;
+
+function HtmlHelpW;
+begin
+  GetProcedureAddress(_HtmlHelpW, GetOCXPath, 'HtmlHelpW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_HtmlHelpW]
+  end;
+end;
+
+function HtmlHelp;
+begin
+  GetProcedureAddress(_HtmlHelp, GetOCXPath, 'HtmlHelp' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_HtmlHelp]
+  end;
+end;
+
+{$ELSE}
+
+const
+  hhctrl = 'hhctrl.ocx';
+
+function HtmlHelpA; external hhctrl name 'HtmlHelpA';
+function HtmlHelpW; external hhctrl name 'HtmlHelpW';
+function HtmlHelp; external hhctrl name 'HtmlHelp' + AWSuffix;
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 116 - 0
packages/extra/winunits/jwaiaccess.pas

@@ -0,0 +1,116 @@
+{******************************************************************************}
+{                                                                              }
+{ Access and Audit Control interfaces API interface Unit for Object Pascal     }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iaccess.h, released November 2002. The original Pascal }
+{ code is: IAccess.pas, released March 2002. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIAccess;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iaccess.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaAccCtrl, JwaWinType;
+
+{****************************************************************************
+ *  Storage access control interface
+ ****************************************************************************}
+
+// All nested structures are allocated in the same block of memory.
+// Thus these types are freed with a single call to CoTaskMemFree.
+
+type
+  PACTRL_ACCESSW_ALLOCATE_ALL_NODES = PACTRL_ACCESSW;
+  {$EXTERNALSYM PACTRL_ACCESSW_ALLOCATE_ALL_NODES}
+  PActrlAccessWAllocateAllNodes = PACTRL_ACCESSW_ALLOCATE_ALL_NODES;
+  PACTRL_AUDITW_ALLOCATE_ALL_NODES = PACTRL_AUDITW;
+  {$EXTERNALSYM PACTRL_AUDITW_ALLOCATE_ALL_NODES}
+  PActrlAuditWAllocateAllNodes = PACTRL_AUDITW_ALLOCATE_ALL_NODES;
+
+const
+  IID_IAccessControl = '{EEDD23E0-8410-11CE-A1C3-08002B2B8D8F}';
+  {$EXTERNALSYM IID_IAccessControl}
+
+type
+  IAccessControl = interface (IUnknown)
+  ['{EEDD23E0-8410-11CE-A1C3-08002B2B8D8F}']
+    function GrantAccessRights(pAccessList: PACTRL_ACCESSW): HRESULT; stdcall;
+    function SetAccessRights(pAccessList: PACTRL_ACCESSW): HRESULT; stdcall;
+    function SetOwner(pOwner: PTRUSTEEW; pGroup: PTRUSTEEW): HRESULT; stdcall;
+    function RevokeAccessRights(lpProperty: LPWSTR; cTrustees: ULONG; prgTrustees: PTRUSTEEW): HRESULT; stdcall;
+    function GetAllAccessRights(lpProperty: LPWSTR; var ppAccessList: PACTRL_ACCESSW_ALLOCATE_ALL_NODES; var ppOwner, ppGroup: PTRUSTEEW): HRESULT; stdcall;
+    function IsAccessAllowed(pTrustee: PTRUSTEEW; lpProperty: LPWSTR; AccessRights: ACCESS_RIGHTS; var pfAccessAllowed: BOOL): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IAccessControl}
+
+{****************************************************************************
+ *  Storage audit control interface
+ ****************************************************************************}
+
+const
+  IID_IAuditControl = '{1da6292f-bc66-11ce-aae3-00aa004c2737}';
+  {$EXTERNALSYM IID_IAuditControl}
+
+type
+  IAuditControl = interface (IUnknown)
+  ['{1da6292f-bc66-11ce-aae3-00aa004c2737}']
+    function GrantAuditRights(pAuditList: PACTRL_AUDITW): HRESULT; stdcall;
+    function SetAuditRights(pAuditList: PACTRL_AUDITW): HRESULT; stdcall;
+    function RevokeAuditRights(lpProperty: LPWSTR; cTrustees: ULONG; prgTrustees: PTRUSTEEW): HRESULT; stdcall;
+    function GetAllAuditRights(lpProperty: LPWSTR; var ppAuditList: PACTRL_AUDITW): HRESULT; stdcall;
+    //
+    // Determines if the given trustee with the state audit rights will generate an audit event if the object is accessed.
+    //
+    function IsAccessAudited(pTrustee: PTRUSTEEW; AuditRights: ACCESS_RIGHTS; var pfAccessAudited: BOOL): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IAuditControl}
+
+implementation
+
+end.
+

+ 130 - 0
packages/extra/winunits/jwaiadmext.pas

@@ -0,0 +1,130 @@
+{******************************************************************************}
+{                                                                              }
+{ IISAdmin Extensions API interface Unit for Object Pascal                     }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iadmext.h, released November 2002. The original Pascal }
+{ code is: IAdmExt.pas, released March 2002. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIAdmExt;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iadmext.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaIisCnfg, JwaWinType;
+
+//
+// The Main Interface. All extensions must support this interface.
+//
+// {51DFE970-F6F2-11d0-B9BD-00A0C922E750}
+
+const
+  IID_IADMEXT: TGUID = (D1:$51dfe970; D2:$f6f2; D3:$11d0; D4:($b9, $bd, $0, $a0, $c9, $22, $e7, $50));
+  {$EXTERNALSYM IID_IADMEXT}
+
+//
+// InProcess COM Registration. All extensions must write a subkey name by the
+// CLSID for the above interface under this key in the Registry.
+//
+
+  IISADMIN_EXTENSIONS_REG_KEYA = 'SOFTWARE\Microsoft\InetStp\Extensions';
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_REG_KEYA}
+  IISADMIN_EXTENSIONS_REG_KEYW = WideString('SOFTWARE\Microsoft\InetStp\Extensions');
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_REG_KEYW}
+  IISADMIN_EXTENSIONS_REG_KEY  = TEXT('SOFTWARE\Microsoft\InetStp\Extensions');
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_REG_KEY}
+
+//
+// COM Registration. CLSIDS for the DCOM interface provided by these extensions will
+// be written to this key and ID by IISADMIN as a multisz property.
+//
+// This is intended for use by other applications which need to find out what classid's are
+// registered.
+//
+
+  IISADMIN_EXTENSIONS_CLSID_MD_KEYA = 'LM/IISADMIN/EXTENSIONS/DCOMCLSIDS';
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_CLSID_MD_KEYA}
+  IISADMIN_EXTENSIONS_CLSID_MD_KEYW = WideString('LM/IISADMIN/EXTENSIONS/DCOMCLSIDS');
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_CLSID_MD_KEYW}
+  IISADMIN_EXTENSIONS_CLSID_MD_KEY  = TEXT('LM/IISADMIN/EXTENSIONS/DCOMCLSIDS');
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_CLSID_MD_KEY}
+  IISADMIN_EXTENSIONS_CLSID_MD_ID   = MD_IISADMIN_EXTENSIONS;
+  {$EXTERNALSYM IISADMIN_EXTENSIONS_CLSID_MD_ID}
+
+type
+  IADMEXT = interface (IUnknown)
+  ['{51DFE970-F6F2-11d0-B9BD-00A0C922E750}']
+    //
+    // All methods below will be called under a thread which has called
+    // CoInitializeEx(NULL, COINIT_MULTITHREADED).
+    //
+    // The IMSAdminBase Object will be available during all of these calls.
+    //
+
+    //
+    // Initialize will be called by IISADMIN when it initializes.
+    //
+    function Initialize: HRESULT; stdcall;
+
+    //
+    // EnumDcomCLSIDs will be called by IISADMIN when it initializes,
+    // and the returned CLSIDs will be written to the metabase at
+    // the path IISADMIN_EXTENSIONS_CLSID_MD_KEY.
+    //
+    function EnumDcomCLSIDs(var pclsidDcom: CLSID; dwEnumIndex: DWORD): HRESULT; stdcall;
+
+    //
+    // Terminate will be called by IISADMIN when it terminates.
+    //
+    function Terminate: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IADMEXT}
+
+implementation
+
+end.
+

+ 445 - 0
packages/extra/winunits/jwaicmpapi.pas

@@ -0,0 +1,445 @@
+{******************************************************************************}
+{                                                                              }
+{ ICMP Echo API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: icmpapi.h, released Feb 2003. The original Pascal      }
+{ code is: IcmpApi.pas, released December 2003. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIcmpApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "icmpapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaIpExport, JwaNative, JwaWS2tcpip;
+
+//    Declarations for the Win32 ICMP Echo request API.
+
+//
+// Exported Routines.
+//
+
+//++
+//
+// Routine Name:
+//
+//     IcmpCreateFile
+//
+// Routine Description:
+//
+//     Opens a handle on which ICMP Echo Requests can be issued.
+//
+// Arguments:
+//
+//     None.
+//
+// Return Value:
+//
+//     An open file handle or INVALID_HANDLE_VALUE. Extended error information
+//     is available by calling GetLastError().
+//
+//--
+
+function IcmpCreateFile: HANDLE; stdcall;
+{$EXTERNALSYM IcmpCreateFile}
+
+//++
+//
+// Routine Name:
+//
+//     Icmp6CreateFile
+//
+// Routine Description:
+//
+//     Opens a handle on which ICMPv6 Echo Requests can be issued.
+//
+// Arguments:
+//
+//     None.
+//
+// Return Value:
+//
+//     An open file handle or INVALID_HANDLE_VALUE. Extended error information
+//     is available by calling GetLastError().
+//
+//--
+
+function Icmp6CreateFile: HANDLE; stdcall;
+{$EXTERNALSYM Icmp6CreateFile}
+
+//++
+//
+// Routine Name:
+//
+//     IcmpCloseHandle
+//
+// Routine Description:
+//
+//     Closes a handle opened by ICMPOpenFile.
+//
+// Arguments:
+//
+//     IcmpHandle  - The handle to close.
+//
+// Return Value:
+//
+//     TRUE if the handle was closed successfully, otherwise FALSE. Extended
+//     error information is available by calling GetLastError().
+//
+//--
+
+function IcmpCloseHandle(IcmpHandle: HANDLE): BOOL; stdcall;
+{$EXTERNALSYM IcmpCloseHandle}
+
+//++
+//
+// Routine Name:
+//
+//     IcmpSendEcho
+//
+// Routine Description:
+//
+//     Sends an ICMP Echo request and returns any replies. The
+//     call returns when the timeout has expired or the reply buffer
+//     is filled.
+//
+// Arguments:
+//
+//     IcmpHandle           - An open handle returned by ICMPCreateFile.
+//
+//     DestinationAddress   - The destination of the echo request.
+//
+//     RequestData          - A buffer containing the data to send in the
+//                            request.
+//
+//     RequestSize          - The number of bytes in the request data buffer.
+//
+//     RequestOptions       - Pointer to the IP header options for the request.
+//                            May be NULL.
+//
+//     ReplyBuffer          - A buffer to hold any replies to the request.
+//                            On return, the buffer will contain an array of
+//                            ICMP_ECHO_REPLY structures followed by the
+//                            options and data for the replies. The buffer
+//                            should be large enough to hold at least one
+//                            ICMP_ECHO_REPLY structure plus
+//                            MAX(RequestSize, 8) bytes of data since an ICMP
+//                            error message contains 8 bytes of data.
+//
+//     ReplySize            - The size in bytes of the reply buffer.
+//
+//     Timeout              - The time in milliseconds to wait for replies.
+//
+// Return Value:
+//
+//     Returns the number of ICMP_ECHO_REPLY structures stored in ReplyBuffer.
+//     The status of each reply is contained in the structure. If the return
+//     value is zero, extended error information is available via
+//     GetLastError().
+//
+//--
+
+function IcmpSendEcho(
+  IcmpHandle: HANDLE;
+  DestinationAddress: IpAddr;
+  RequestData: LPVOID;
+  RequestSize: WORD;
+  RequestOptions: PIP_OPTION_INFORMATION;
+  ReplyBuffer: LPVOID;
+  ReplySize: DWORD;
+  Timeout: DWORD): DWORD; stdcall;
+{$EXTERNALSYM IcmpSendEcho}
+
+//++
+//
+// Routine Description:
+//
+//    Sends an ICMP Echo request and the call returns either immediately
+//    (if Event or ApcRoutine is NonNULL) or returns after the specified
+//    timeout.   The ReplyBuffer contains the ICMP responses, if any.
+//
+// Arguments:
+//
+//    IcmpHandle           - An open handle returned by ICMPCreateFile.
+//
+//    Event                - This is the event to be signalled whenever an IcmpResponse
+//                           comes in.
+//
+//    ApcRoutine           - This routine would be called when the calling thread
+//                           is in an alertable thread and an ICMP reply comes in.
+//
+//    ApcContext           - This optional parameter is given to the ApcRoutine when
+//                           this call succeeds.
+//
+//    DestinationAddress   - The destination of the echo request.
+//
+//    RequestData          - A buffer containing the data to send in the
+//                           request.
+//
+//    RequestSize          - The number of bytes in the request data buffer.
+//
+//    RequestOptions       - Pointer to the IP header options for the request.
+//                           May be NULL.
+//
+//    ReplyBuffer          - A buffer to hold any replies to the request.
+//                           On return, the buffer will contain an array of
+//                           ICMP_ECHO_REPLY structures followed by options
+//                           and data. The buffer must be large enough to
+//                           hold at least one ICMP_ECHO_REPLY structure.
+//                           It should be large enough to also hold
+//                           8 more bytes of data - this is the size of
+//                           an ICMP error message.
+//
+//    ReplySize            - The size in bytes of the reply buffer.
+//
+//    Timeout              - The time in milliseconds to wait for replies.
+//                           This is NOT used if ApcRoutine is not NULL or if Event
+//                           is not NULL.
+//
+// Return Value:
+//
+//    Returns the number of replies received and stored in ReplyBuffer. If
+//    the return value is zero, extended error information is available
+//    via GetLastError().
+//
+// Remarks:
+//
+//    On NT platforms,
+//    If used Asynchronously (either ApcRoutine or Event is specified), then
+//    ReplyBuffer and ReplySize are still needed.  This is where the response
+//    comes in.
+//    ICMP Response data is copied to the ReplyBuffer provided, and the caller of
+//    this function has to parse it asynchronously.  The function IcmpParseReply
+//    is provided for this purpose.
+//
+//    On non-NT platforms,
+//    Event, ApcRoutine and ApcContext are IGNORED.
+//
+//--
+
+function IcmpSendEcho2(
+  IcmpHandle: HANDLE;
+  Event: HANDLE;
+  ApcRoutine: PIO_APC_ROUTINE;
+  ApcContext: PVOID;
+  DestinationAddress: IpAddr;
+  RequestData: LPVOID;
+  RequestSize: WORD;
+  RequestOptions: PIP_OPTION_INFORMATION;
+  ReplyBuffer: LPVOID;
+  ReplySize: DWORD;
+  Timeout: DWORD): DWORD; stdcall;
+
+function Icmp6SendEcho2(
+  IcmpHandle: HANDLE;
+  Event: HANDLE;
+  ApcRoutine: PIO_APC_ROUTINE;
+  ApcContext: PVOID;
+  SourceAddress: Psockaddr_in6;
+  DestinationAddress: Psockaddr_in6;
+  RequestData,
+  RequestSize: WORD;
+  RequestOptions: PIP_OPTION_INFORMATION;
+  ReplyBuffer: LPVOID;
+  ReplySize: DWORD;
+  Timeout: DWORD): DWORD; stdcall;
+
+//++
+//
+// Routine Description:
+//
+//    Parses the reply buffer provided and returns the number of ICMP responses found.
+//
+// Arguments:
+//
+//    ReplyBuffer            - This must be the same buffer that was passed to IcmpSendEcho2
+//                             This is rewritten to hold an array of ICMP_ECHO_REPLY structures.
+//                             (i.e. the type is PICMP_ECHO_REPLY).
+//
+//    ReplySize              - This must be the size of the above buffer.
+//
+// Return Value:
+//    Returns the number of ICMP responses found.  If there is an errors, return value is
+//    zero.  The error can be determined by a call to GetLastError.
+//
+// Remarks:
+//    This function SHOULD NOT BE USED on a reply buffer that was passed to SendIcmpEcho.
+//    SendIcmpEcho actually parses the buffer before returning back to the user.  This function
+//    is meant to be used only with SendIcmpEcho2.
+//--
+
+function IcmpParseReplies(ReplyBuffer: LPVOID; ReplySize: DWORD): DWORD; stdcall;
+{$EXTERNALSYM IcmpParseReplies}
+
+function Icmp6ParseReplies(ReplyBuffer: LPVOID; ReplySize: DWORD): DWORD; stdcall;
+{$EXTERNALSYM Icmp6ParseReplies}
+
+implementation
+
+const
+  icmplib = 'iphlpapi.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _IcmpCreateFile: Pointer;
+
+function IcmpCreateFile;
+begin
+  GetProcedureAddress(_IcmpCreateFile, icmplib, 'IcmpCreateFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IcmpCreateFile]
+  end;
+end;
+
+var
+  _Icmp6CreateFile: Pointer;
+
+function Icmp6CreateFile;
+begin
+  GetProcedureAddress(_Icmp6CreateFile, icmplib, 'Icmp6CreateFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_Icmp6CreateFile]
+  end;
+end;
+
+var
+  _IcmpCloseHandle: Pointer;
+
+function IcmpCloseHandle;
+begin
+  GetProcedureAddress(_IcmpCloseHandle, icmplib, 'IcmpCloseHandle');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IcmpCloseHandle]
+  end;
+end;
+
+var
+  _IcmpSendEcho: Pointer;
+
+function IcmpSendEcho;
+begin
+  GetProcedureAddress(_IcmpSendEcho, icmplib, 'IcmpSendEcho');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IcmpSendEcho]
+  end;
+end;
+
+var
+  _IcmpSendEcho2: Pointer;
+
+function IcmpSendEcho2;
+begin
+  GetProcedureAddress(_IcmpSendEcho2, icmplib, 'IcmpSendEcho2');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IcmpSendEcho2]
+  end;
+end;
+
+var
+  _Icmp6SendEcho2: Pointer;
+
+function Icmp6SendEcho2;
+begin
+  GetProcedureAddress(_Icmp6SendEcho2, icmplib, 'Icmp6SendEcho2');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_Icmp6SendEcho2]
+  end;
+end;
+
+var
+  _IcmpParseReplies: Pointer;
+
+function IcmpParseReplies;
+begin
+  GetProcedureAddress(_IcmpParseReplies, icmplib, 'IcmpParseReplies');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IcmpParseReplies]
+  end;
+end;
+
+var
+  _Icmp6ParseReplies: Pointer;
+
+function Icmp6ParseReplies;
+begin
+  GetProcedureAddress(_Icmp6ParseReplies, icmplib, 'Icmp6ParseReplies');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_Icmp6ParseReplies]
+  end;
+end;
+
+{$ELSE}
+
+function IcmpCreateFile; external icmplib name 'IcmpCreateFile';
+function Icmp6CreateFile; external icmplib name 'Icmp6CreateFile';
+function IcmpCloseHandle; external icmplib name 'IcmpCloseHandle';
+function IcmpSendEcho; external icmplib name 'IcmpSendEcho';
+function IcmpSendEcho2; external icmplib name 'IcmpSendEcho2';
+function Icmp6SendEcho2; external icmplib name 'Icmp6SendEcho2';
+function IcmpParseReplies; external icmplib name 'IcmpParseReplies';
+function Icmp6ParseReplies; external icmplib name 'Icmp6ParseReplies';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 1773 - 0
packages/extra/winunits/jwaiiscnfg.pas

@@ -0,0 +1,1773 @@
+{******************************************************************************}
+{                                                                              }
+{  IIS Public Metdata IDs API interface Unit for Object Pascal                 }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iiscnfg.h, released November 2002. The original Pascal }
+{ code is: IisCnfg.pas, released March 2002. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+unit JwaIisCnfg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iiscnfg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+// Paths
+//
+
+const
+  IIS_MD_LOCAL_MACHINE_PATH = 'LM';
+  {$EXTERNALSYM IIS_MD_LOCAL_MACHINE_PATH}
+
+//
+// Name of the default publishing root under an instance
+//
+
+  IIS_MD_INSTANCE_ROOT = 'Root';
+  {$EXTERNALSYM IIS_MD_INSTANCE_ROOT}
+
+//
+//  ISAPI Filters are kept in a list under the instances and the service (for
+//  global filters) in the following format:
+//
+//  LM/W3Svc/<Instance>/Filters
+//      MD_FILTER_LOAD_ORDER  "Filter1, Filter2, Filter3"
+//
+//  LM/W3Svc/<Instance>/Filters/Filter1
+//      MD_FILTER_IMAGE_PATH  "d:\inetsrv\myfilter.dll"
+//
+//  LM/W3Svc/<Instance>/Filters/Filter2
+//      MD_FILTER_IMAGE_PATH  "d:\inetsrv\otherfilter.dll"
+//
+
+  IIS_MD_ISAPI_FILTERS = '/Filters';
+  {$EXTERNALSYM IIS_MD_ISAPI_FILTERS}
+
+//
+// Path below each service to the key that publishes service information
+//
+
+  IIS_MD_SVC_INFO_PATH = 'Info';
+  {$EXTERNALSYM IIS_MD_SVC_INFO_PATH}
+
+//
+// ADSI schema properties path
+//
+
+  IIS_MD_ADSI_SCHEMA_PATH_A = '/Schema';
+  {$EXTERNALSYM IIS_MD_ADSI_SCHEMA_PATH_A}
+  IIS_MD_ADSI_SCHEMA_PATH_W = WideString('/Schema');
+  {$EXTERNALSYM IIS_MD_ADSI_SCHEMA_PATH_W}
+  IIS_MD_ADSI_METAID_BEGIN  = 130000;
+  {$EXTERNALSYM IIS_MD_ADSI_METAID_BEGIN}
+
+//
+// user types
+//
+// There are two user types:
+//
+//   Server configuration - All the properties for configuring the server that
+//      are not applicable to files and directories - such as Port, Host name,
+//      Server comment, Connection timeout etc.
+//
+//  File/Dir configuration - All the properties that can be configured down to
+//      the files and directories - such as Access permissions (Read, Write etc),
+//      Extension mapping, IP Security etc.
+//
+
+  IIS_MD_UT_SERVER       = 1; // Server configuration parameters
+  {$EXTERNALSYM IIS_MD_UT_SERVER}
+  IIS_MD_UT_FILE         = 2; // File/Dir inheritable properties
+  {$EXTERNALSYM IIS_MD_UT_FILE}
+  IIS_MD_UT_WAM          = 100; // Web Application configuration parameters
+  {$EXTERNALSYM IIS_MD_UT_WAM}
+  ASP_MD_UT_APP          = 101; // ASP application configuration parameters
+  {$EXTERNALSYM ASP_MD_UT_APP}
+  IIS_MD_UT_END_RESERVED = 2000; // All user types below this are reserved for IIS services
+  {$EXTERNALSYM IIS_MD_UT_END_RESERVED}
+
+//
+//  Metabase property IDs must be unique.  This table defines reserved ranges
+//
+
+  IIS_MD_ID_BEGIN_RESERVED    = $00000001; // IIS reserved range
+  {$EXTERNALSYM IIS_MD_ID_BEGIN_RESERVED}
+  IIS_MD_ID_END_RESERVED      = $00007fff;
+  {$EXTERNALSYM IIS_MD_ID_END_RESERVED}
+  ASP_MD_ID_BEGIN_RESERVED    = $00007000; // ASP reserved range, subrange of IIS.
+  {$EXTERNALSYM ASP_MD_ID_BEGIN_RESERVED}
+  ASP_MD_ID_END_RESERVED      = $000074ff;
+  {$EXTERNALSYM ASP_MD_ID_END_RESERVED}
+  WAM_MD_ID_BEGIN_RESERVED    = $00007500; // ASP reserved range, subrange of IIS.
+  {$EXTERNALSYM WAM_MD_ID_BEGIN_RESERVED}
+  WAM_MD_ID_END_RESERVED      = $00007fff;
+  {$EXTERNALSYM WAM_MD_ID_END_RESERVED}
+  FP_MD_ID_BEGIN_RESERVED     = $00008000; // Front page reserved range
+  {$EXTERNALSYM FP_MD_ID_BEGIN_RESERVED}
+  FP_MD_ID_END_RESERVED       = $00008fff;
+  {$EXTERNALSYM FP_MD_ID_END_RESERVED}
+  SMTP_MD_ID_BEGIN_RESERVED   = $00009000;
+  {$EXTERNALSYM SMTP_MD_ID_BEGIN_RESERVED}
+  SMTP_MD_ID_END_RESERVED     = $00009fff;
+  {$EXTERNALSYM SMTP_MD_ID_END_RESERVED}
+  POP3_MD_ID_BEGIN_RESERVED   = $0000a000;
+  {$EXTERNALSYM POP3_MD_ID_BEGIN_RESERVED}
+  POP3_MD_ID_END_RESERVED     = $0000afff;
+  {$EXTERNALSYM POP3_MD_ID_END_RESERVED}
+  NNTP_MD_ID_BEGIN_RESERVED   = $0000b000;
+  {$EXTERNALSYM NNTP_MD_ID_BEGIN_RESERVED}
+  NNTP_MD_ID_END_RESERVED     = $0000bfff;
+  {$EXTERNALSYM NNTP_MD_ID_END_RESERVED}
+  IMAP_MD_ID_BEGIN_RESERVED   = $0000c000;
+  {$EXTERNALSYM IMAP_MD_ID_BEGIN_RESERVED}
+  IMAP_MD_ID_END_RESERVED     = $0000cfff;
+  {$EXTERNALSYM IMAP_MD_ID_END_RESERVED}
+  MSCS_MD_ID_BEGIN_RESERVED   = $0000d000;
+  {$EXTERNALSYM MSCS_MD_ID_BEGIN_RESERVED}
+  MSCS_MD_ID_END_RESERVED     = $0000dfff;
+  {$EXTERNALSYM MSCS_MD_ID_END_RESERVED}
+  APPCTR_MD_ID_BEGIN_RESERVED = $0000e000;
+  {$EXTERNALSYM APPCTR_MD_ID_BEGIN_RESERVED}
+  APPCTR_MD_ID_END_RESERVED   = $0000efff;
+  {$EXTERNALSYM APPCTR_MD_ID_END_RESERVED}
+
+  USER_MD_ID_BASE_RESERVED    = $0000ffff;
+  {$EXTERNALSYM USER_MD_ID_BASE_RESERVED}
+
+//
+//  General server related attributes - these should be added in the metabase
+//  with a user type of IIS_MD_UT_SERVER
+//
+
+  IIS_MD_SERVER_BASE = 1000;
+  {$EXTERNALSYM IIS_MD_SERVER_BASE}
+
+//
+//  These are global to all services and should only be set at
+//  the IIS root
+//
+
+  MD_MAX_BANDWIDTH         = IIS_MD_SERVER_BASE + 0;
+  {$EXTERNALSYM MD_MAX_BANDWIDTH}
+  MD_KEY_TYPE              = IIS_MD_SERVER_BASE + 2;
+  {$EXTERNALSYM MD_KEY_TYPE}
+  MD_MAX_BANDWIDTH_BLOCKED = IIS_MD_SERVER_BASE + 3;
+  {$EXTERNALSYM MD_MAX_BANDWIDTH_BLOCKED}
+  MD_SCHEMA_METAID         = IIS_MD_SERVER_BASE + 4;
+  {$EXTERNALSYM MD_SCHEMA_METAID}
+
+//
+//  These properties are applicable to both HTTP and FTP virtual
+//  servers
+//
+
+  MD_SERVER_COMMAND            = IIS_MD_SERVER_BASE + 12;
+  {$EXTERNALSYM MD_SERVER_COMMAND}
+  MD_CONNECTION_TIMEOUT        = IIS_MD_SERVER_BASE + 13;
+  {$EXTERNALSYM MD_CONNECTION_TIMEOUT}
+  MD_MAX_CONNECTIONS           = IIS_MD_SERVER_BASE + 14;
+  {$EXTERNALSYM MD_MAX_CONNECTIONS}
+  MD_SERVER_COMMENT            = IIS_MD_SERVER_BASE + 15;
+  {$EXTERNALSYM MD_SERVER_COMMENT}
+  MD_SERVER_STATE              = IIS_MD_SERVER_BASE + 16;
+  {$EXTERNALSYM MD_SERVER_STATE}
+  MD_SERVER_AUTOSTART          = IIS_MD_SERVER_BASE + 17;
+  {$EXTERNALSYM MD_SERVER_AUTOSTART}
+  MD_SERVER_SIZE               = IIS_MD_SERVER_BASE + 18;
+  {$EXTERNALSYM MD_SERVER_SIZE}
+  MD_SERVER_LISTEN_BACKLOG     = IIS_MD_SERVER_BASE + 19;
+  {$EXTERNALSYM MD_SERVER_LISTEN_BACKLOG}
+  MD_SERVER_LISTEN_TIMEOUT     = IIS_MD_SERVER_BASE + 20;
+  {$EXTERNALSYM MD_SERVER_LISTEN_TIMEOUT}
+  MD_DOWNLEVEL_ADMIN_INSTANCE  = IIS_MD_SERVER_BASE + 21;
+  {$EXTERNALSYM MD_DOWNLEVEL_ADMIN_INSTANCE}
+  MD_LEVELS_TO_SCAN            = IIS_MD_SERVER_BASE + 22;
+  {$EXTERNALSYM MD_LEVELS_TO_SCAN}
+  MD_SERVER_BINDINGS           = IIS_MD_SERVER_BASE + 23;
+  {$EXTERNALSYM MD_SERVER_BINDINGS}
+  MD_MAX_ENDPOINT_CONNECTIONS  = IIS_MD_SERVER_BASE + 24;
+  {$EXTERNALSYM MD_MAX_ENDPOINT_CONNECTIONS}
+  MD_SERVER_CONFIGURATION_INFO = IIS_MD_SERVER_BASE + 27;
+  {$EXTERNALSYM MD_SERVER_CONFIGURATION_INFO}
+  MD_IISADMIN_EXTENSIONS       = IIS_MD_SERVER_BASE + 28;
+  {$EXTERNALSYM MD_IISADMIN_EXTENSIONS}
+  MD_DISABLE_SOCKET_POOLING    = IIS_MD_SERVER_BASE + 29;
+  {$EXTERNALSYM MD_DISABLE_SOCKET_POOLING}
+  MD_METADATA_ID_REGISTRATION  = IIS_MD_SERVER_BASE + 30;
+  {$EXTERNALSYM MD_METADATA_ID_REGISTRATION}
+
+//
+//  These properties are specific to HTTP and belong to the website
+//
+
+  IIS_MD_HTTP_BASE = 2000;
+  {$EXTERNALSYM IIS_MD_HTTP_BASE}
+
+  MD_SECURE_BINDINGS = IIS_MD_HTTP_BASE + 21;
+  {$EXTERNALSYM MD_SECURE_BINDINGS}
+
+  MD_FILTER_LOAD_ORDER   = IIS_MD_HTTP_BASE + 40;
+  {$EXTERNALSYM MD_FILTER_LOAD_ORDER}
+  MD_FILTER_IMAGE_PATH   = IIS_MD_HTTP_BASE + 41;
+  {$EXTERNALSYM MD_FILTER_IMAGE_PATH}
+  MD_FILTER_STATE        = IIS_MD_HTTP_BASE + 42;
+  {$EXTERNALSYM MD_FILTER_STATE}
+  MD_FILTER_ENABLED      = IIS_MD_HTTP_BASE + 43;
+  {$EXTERNALSYM MD_FILTER_ENABLED}
+  MD_FILTER_FLAGS        = IIS_MD_HTTP_BASE + 44;
+  {$EXTERNALSYM MD_FILTER_FLAGS}
+  MD_FILTER_DESCRIPTION  = IIS_MD_HTTP_BASE + 45;
+  {$EXTERNALSYM MD_FILTER_DESCRIPTION}
+  MD_FILTER_ENABLE_CACHE = IIS_MD_HTTP_BASE + 46;
+  {$EXTERNALSYM MD_FILTER_ENABLE_CACHE}
+
+  MD_ADV_NOTIFY_PWD_EXP_IN_DAYS = IIS_MD_HTTP_BASE + 63;
+  {$EXTERNALSYM MD_ADV_NOTIFY_PWD_EXP_IN_DAYS}
+  MD_ADV_CACHE_TTL              = IIS_MD_HTTP_BASE + 64;
+  {$EXTERNALSYM MD_ADV_CACHE_TTL}
+  MD_AUTH_CHANGE_FLAGS          = IIS_MD_HTTP_BASE + 68;
+  {$EXTERNALSYM MD_AUTH_CHANGE_FLAGS}
+
+  MD_PROCESS_NTCR_IF_LOGGED_ON = IIS_MD_HTTP_BASE + 70;
+  {$EXTERNALSYM MD_PROCESS_NTCR_IF_LOGGED_ON}
+
+  MD_FRONTPAGE_WEB         = IIS_MD_HTTP_BASE + 72;
+  {$EXTERNALSYM MD_FRONTPAGE_WEB}
+  MD_IN_PROCESS_ISAPI_APPS = IIS_MD_HTTP_BASE + 73;
+  {$EXTERNALSYM MD_IN_PROCESS_ISAPI_APPS}
+
+  MD_ALLOW_PATH_INFO_FOR_SCRIPT_MAPPINGS = IIS_MD_HTTP_BASE + 95;
+  {$EXTERNALSYM MD_ALLOW_PATH_INFO_FOR_SCRIPT_MAPPINGS}
+
+  MD_APP_FRIENDLY_NAME             = IIS_MD_HTTP_BASE + 102;
+  {$EXTERNALSYM MD_APP_FRIENDLY_NAME}
+  MD_APP_ROOT                      = IIS_MD_HTTP_BASE + 103;
+  {$EXTERNALSYM MD_APP_ROOT}
+  MD_APP_ISOLATED                  = IIS_MD_HTTP_BASE + 104;
+  {$EXTERNALSYM MD_APP_ISOLATED}
+  MD_APP_WAM_CLSID                 = IIS_MD_HTTP_BASE + 105;
+  {$EXTERNALSYM MD_APP_WAM_CLSID}
+  MD_APP_PACKAGE_ID                = IIS_MD_HTTP_BASE + 106;
+  {$EXTERNALSYM MD_APP_PACKAGE_ID}
+  MD_APP_PACKAGE_NAME              = IIS_MD_HTTP_BASE + 107;
+  {$EXTERNALSYM MD_APP_PACKAGE_NAME}
+  MD_APP_OOP_RECOVER_LIMIT         = IIS_MD_HTTP_BASE + 110;
+  {$EXTERNALSYM MD_APP_OOP_RECOVER_LIMIT}
+  MD_APP_PERIODIC_RESTART_TIME     = IIS_MD_HTTP_BASE + 111;
+  {$EXTERNALSYM MD_APP_PERIODIC_RESTART_TIME}
+  MD_APP_PERIODIC_RESTART_REQUESTS = IIS_MD_HTTP_BASE + 112;
+  {$EXTERNALSYM MD_APP_PERIODIC_RESTART_REQUESTS}
+  MD_APP_PERIODIC_RESTART_SCHEDULE = IIS_MD_HTTP_BASE + 113;
+  {$EXTERNALSYM MD_APP_PERIODIC_RESTART_SCHEDULE}
+  MD_APP_SHUTDOWN_TIME_LIMIT       = IIS_MD_HTTP_BASE + 114;
+  {$EXTERNALSYM MD_APP_SHUTDOWN_TIME_LIMIT}
+
+  MD_ADMIN_INSTANCE = IIS_MD_HTTP_BASE + 115;
+  {$EXTERNALSYM MD_ADMIN_INSTANCE}
+
+  MD_CUSTOM_ERROR_DESC = IIS_MD_HTTP_BASE + 120;
+  {$EXTERNALSYM MD_CUSTOM_ERROR_DESC}
+
+//
+//  Client Access License parameters
+//
+
+//
+// CPU Accounting and Throttling Properties
+//
+
+//
+// The enabled flags are per Application or CGI
+//
+
+  MD_CPU_RESET_INTERVAL   = IIS_MD_HTTP_BASE + 144;
+  {$EXTERNALSYM MD_CPU_RESET_INTERVAL}
+
+//
+//  Site Server properties
+//
+
+//
+// Properties to disable/restrict request handlers.
+//
+
+  MD_ISAPI_RESTRICTION_LIST         = IIS_MD_HTTP_BASE + 163;
+  {$EXTERNALSYM MD_ISAPI_RESTRICTION_LIST}
+  MD_CGI_RESTRICTION_LIST           = IIS_MD_HTTP_BASE + 164;
+  {$EXTERNALSYM MD_CGI_RESTRICTION_LIST}
+  MD_APP_DEPENDENCIES               = IIS_MD_HTTP_BASE + 167;
+  {$EXTERNALSYM MD_APP_DEPENDENCIES}
+  MD_WEB_SVC_EXT_RESTRICTION_LIST   = IIS_MD_HTTP_BASE + 168;
+  {$EXTERNALSYM MD_WEB_SVC_EXT_RESTRICTION_LIST}
+
+  MD_MD_SERVER_SS_AUTH_MAPPING = IIS_MD_HTTP_BASE + 200;
+  {$EXTERNALSYM MD_MD_SERVER_SS_AUTH_MAPPING}
+
+//
+// valid values for MD_CERT_CHECK_MODE
+//
+
+  MD_CERT_NO_REVOC_CHECK                  = $00000001;
+  {$EXTERNALSYM MD_CERT_NO_REVOC_CHECK}
+  MD_CERT_CACHE_RETRIEVAL_ONLY            = $00000002;
+  {$EXTERNALSYM MD_CERT_CACHE_RETRIEVAL_ONLY}
+  MD_CERT_CHECK_REVOCATION_FRESHNESS_TIME = $00000004;
+  {$EXTERNALSYM MD_CERT_CHECK_REVOCATION_FRESHNESS_TIME}
+  MD_CERT_NO_USAGE_CHECK                  = $00010000;
+  {$EXTERNALSYM MD_CERT_NO_USAGE_CHECK}
+
+//
+// HTTP Compression properties.  All are global and unheritable.
+//
+
+  MD_HC_COMPRESSION_DIRECTORY       = IIS_MD_HTTP_BASE + 210;
+  {$EXTERNALSYM MD_HC_COMPRESSION_DIRECTORY}
+  MD_HC_CACHE_CONTROL_HEADER        = IIS_MD_HTTP_BASE + 211;
+  {$EXTERNALSYM MD_HC_CACHE_CONTROL_HEADER}
+  MD_HC_EXPIRES_HEADER              = IIS_MD_HTTP_BASE + 212;
+  {$EXTERNALSYM MD_HC_EXPIRES_HEADER}
+  MD_HC_DO_DYNAMIC_COMPRESSION      = IIS_MD_HTTP_BASE + 213;
+  {$EXTERNALSYM MD_HC_DO_DYNAMIC_COMPRESSION}
+  MD_HC_DO_STATIC_COMPRESSION       = IIS_MD_HTTP_BASE + 214;
+  {$EXTERNALSYM MD_HC_DO_STATIC_COMPRESSION}
+  MD_HC_DO_ON_DEMAND_COMPRESSION    = IIS_MD_HTTP_BASE + 215;
+  {$EXTERNALSYM MD_HC_DO_ON_DEMAND_COMPRESSION}
+  MD_HC_DO_DISK_SPACE_LIMITING      = IIS_MD_HTTP_BASE + 216;
+  {$EXTERNALSYM MD_HC_DO_DISK_SPACE_LIMITING}
+  MD_HC_NO_COMPRESSION_FOR_HTTP_10  = IIS_MD_HTTP_BASE + 217;
+  {$EXTERNALSYM MD_HC_NO_COMPRESSION_FOR_HTTP_10}
+  MD_HC_NO_COMPRESSION_FOR_PROXIES  = IIS_MD_HTTP_BASE + 218;
+  {$EXTERNALSYM MD_HC_NO_COMPRESSION_FOR_PROXIES}
+  MD_HC_NO_COMPRESSION_FOR_RANGE    = IIS_MD_HTTP_BASE + 219;
+  {$EXTERNALSYM MD_HC_NO_COMPRESSION_FOR_RANGE}
+  MD_HC_SEND_CACHE_HEADERS          = IIS_MD_HTTP_BASE + 220;
+  {$EXTERNALSYM MD_HC_SEND_CACHE_HEADERS}
+  MD_HC_MAX_DISK_SPACE_USAGE        = IIS_MD_HTTP_BASE + 221;
+  {$EXTERNALSYM MD_HC_MAX_DISK_SPACE_USAGE}
+  MD_HC_IO_BUFFER_SIZE              = IIS_MD_HTTP_BASE + 222;
+  {$EXTERNALSYM MD_HC_IO_BUFFER_SIZE}
+  MD_HC_COMPRESSION_BUFFER_SIZE     = IIS_MD_HTTP_BASE + 223;
+  {$EXTERNALSYM MD_HC_COMPRESSION_BUFFER_SIZE}
+  MD_HC_MAX_QUEUE_LENGTH            = IIS_MD_HTTP_BASE + 224;
+  {$EXTERNALSYM MD_HC_MAX_QUEUE_LENGTH}
+  MD_HC_FILES_DELETED_PER_DISK_FREE = IIS_MD_HTTP_BASE + 225;
+  {$EXTERNALSYM MD_HC_FILES_DELETED_PER_DISK_FREE}
+  MD_HC_MIN_FILE_SIZE_FOR_COMP      = IIS_MD_HTTP_BASE + 226;
+  {$EXTERNALSYM MD_HC_MIN_FILE_SIZE_FOR_COMP}
+
+  MD_HC_COMPRESSION_DLL           = IIS_MD_HTTP_BASE + 237;
+  {$EXTERNALSYM MD_HC_COMPRESSION_DLL}
+  MD_HC_FILE_EXTENSIONS           = IIS_MD_HTTP_BASE + 238;
+  {$EXTERNALSYM MD_HC_FILE_EXTENSIONS}
+  //MD_HC_MIME_TYPE                 = IIS_MD_HTTP_BASE + 239;
+  //{$EXTERNALSYM MD_HC_MIME_TYPE}
+  MD_HC_PRIORITY                  = IIS_MD_HTTP_BASE + 240;
+  {$EXTERNALSYM MD_HC_PRIORITY}
+  MD_HC_DYNAMIC_COMPRESSION_LEVEL = IIS_MD_HTTP_BASE + 241;
+  {$EXTERNALSYM MD_HC_DYNAMIC_COMPRESSION_LEVEL}
+  MD_HC_ON_DEMAND_COMP_LEVEL      = IIS_MD_HTTP_BASE + 242;
+  {$EXTERNALSYM MD_HC_ON_DEMAND_COMP_LEVEL}
+  MD_HC_CREATE_FLAGS              = IIS_MD_HTTP_BASE + 243;
+  {$EXTERNALSYM MD_HC_CREATE_FLAGS}
+  MD_HC_SCRIPT_FILE_EXTENSIONS    = IIS_MD_HTTP_BASE + 244;
+  {$EXTERNALSYM MD_HC_SCRIPT_FILE_EXTENSIONS}
+
+  MD_HC_DO_NAMESPACE_DYNAMIC_COMPRESSION = IIS_MD_HTTP_BASE + 255;
+  {$EXTERNALSYM MD_HC_DO_NAMESPACE_DYNAMIC_COMPRESSION}
+  MD_HC_DO_NAMESPACE_STATIC_COMPRESSION  = IIS_MD_HTTP_BASE + 256;
+  {$EXTERNALSYM MD_HC_DO_NAMESPACE_STATIC_COMPRESSION}
+
+//
+// Generic property indicating a failure status code - Can be used under
+// any component that can fail (virtual directory, filters, applications etc)
+//
+
+  MD_WIN32_ERROR = IIS_MD_SERVER_BASE + 99;
+  {$EXTERNALSYM MD_WIN32_ERROR}
+
+//
+// Virtual root properties - note MD_ACCESS_PERM is also generally set at
+// the virtual directory.  These are used for both HTTP and FTP
+//
+
+  IIS_MD_VR_BASE = 3000;
+  {$EXTERNALSYM IIS_MD_VR_BASE}
+
+  MD_VR_PATH             = IIS_MD_VR_BASE + 1;
+  {$EXTERNALSYM MD_VR_PATH}
+  MD_VR_USERNAME         = IIS_MD_VR_BASE + 2;
+  {$EXTERNALSYM MD_VR_USERNAME}
+  MD_VR_PASSWORD         = IIS_MD_VR_BASE + 3;
+  {$EXTERNALSYM MD_VR_PASSWORD}
+  MD_VR_PASSTHROUGH      = IIS_MD_VR_BASE + 6;
+  {$EXTERNALSYM MD_VR_PASSTHROUGH}
+  MD_VR_NO_CACHE         = IIS_MD_VR_BASE + 7;
+  {$EXTERNALSYM MD_VR_NO_CACHE}
+  //MD_VR_IGNORE_TRANSLATE = IIS_MD_VR_BASE + 8;
+  //{$EXTERNALSYM MD_VR_IGNORE_TRANSLATE}
+
+//
+//  Logging related attributes
+//
+
+  IIS_MD_LOG_BASE = 4000;
+  {$EXTERNALSYM IIS_MD_LOG_BASE}
+
+  MD_LOG_TYPE              = IIS_MD_LOG_BASE + 0;
+  {$EXTERNALSYM MD_LOG_TYPE}
+  MD_LOGFILE_DIRECTORY     = IIS_MD_LOG_BASE + 1;
+  {$EXTERNALSYM MD_LOGFILE_DIRECTORY}
+  MD_LOG_UNUSED1           = IIS_MD_LOG_BASE + 2;
+  {$EXTERNALSYM MD_LOG_UNUSED1}
+  MD_LOGFILE_PERIOD        = IIS_MD_LOG_BASE + 3;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD}
+  MD_LOGFILE_TRUNCATE_SIZE = IIS_MD_LOG_BASE + 4;
+  {$EXTERNALSYM MD_LOGFILE_TRUNCATE_SIZE}
+  MD_LOG_PLUGIN_MOD_ID     = IIS_MD_LOG_BASE + 5;
+  {$EXTERNALSYM MD_LOG_PLUGIN_MOD_ID}
+  MD_LOG_PLUGIN_UI_ID      = IIS_MD_LOG_BASE + 6;
+  {$EXTERNALSYM MD_LOG_PLUGIN_UI_ID}
+  MD_LOGSQL_DATA_SOURCES   = IIS_MD_LOG_BASE + 7;
+  {$EXTERNALSYM MD_LOGSQL_DATA_SOURCES}
+  MD_LOGSQL_TABLE_NAME     = IIS_MD_LOG_BASE + 8;
+  {$EXTERNALSYM MD_LOGSQL_TABLE_NAME}
+  MD_LOGSQL_USER_NAME      = IIS_MD_LOG_BASE + 9;
+  {$EXTERNALSYM MD_LOGSQL_USER_NAME}
+  MD_LOGSQL_PASSWORD       = IIS_MD_LOG_BASE + 10;
+  {$EXTERNALSYM MD_LOGSQL_PASSWORD}
+  MD_LOG_PLUGIN_ORDER      = IIS_MD_LOG_BASE + 11;
+  {$EXTERNALSYM MD_LOG_PLUGIN_ORDER}
+  MD_LOG_PLUGINS_AVAILABLE = IIS_MD_LOG_BASE + 12;
+  {$EXTERNALSYM MD_LOG_PLUGINS_AVAILABLE}
+  MD_LOGEXT_FIELD_MASK     = IIS_MD_LOG_BASE + 13;
+  {$EXTERNALSYM MD_LOGEXT_FIELD_MASK}
+  MD_LOGEXT_FIELD_MASK2    = IIS_MD_LOG_BASE + 14;
+  {$EXTERNALSYM MD_LOGEXT_FIELD_MASK2}
+
+//
+// Allow W3C logging file naming and rollover based on Local Time
+//
+
+  MD_LOGFILE_LOCALTIME_ROLLOVER = IIS_MD_LOG_BASE + 15;
+  {$EXTERNALSYM MD_LOGFILE_LOCALTIME_ROLLOVER}
+
+  IIS_MD_LOG_LAST = MD_LOGFILE_LOCALTIME_ROLLOVER;
+  {$EXTERNALSYM IIS_MD_LOG_LAST}
+
+//
+// Global Flag to denote that IIS will generate one centralized
+// binary log file rather than a separate file per web site
+//
+
+  MD_GLOBAL_BINARY_LOGGING_ENABLED = IIS_MD_LOG_BASE + 16;
+  {$EXTERNALSYM MD_GLOBAL_BINARY_LOGGING_ENABLED}
+
+//
+// Log type
+//
+
+  MD_LOG_TYPE_DISABLED = 0;
+  {$EXTERNALSYM MD_LOG_TYPE_DISABLED}
+  MD_LOG_TYPE_ENABLED  = 1;
+  {$EXTERNALSYM MD_LOG_TYPE_ENABLED}
+
+//
+// LOGGING values
+//
+
+  MD_LOGFILE_PERIOD_NONE    = 0;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_NONE}
+  MD_LOGFILE_PERIOD_MAXSIZE = 0;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_MAXSIZE}
+  MD_LOGFILE_PERIOD_DAILY   = 1;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_DAILY}
+  MD_LOGFILE_PERIOD_WEEKLY  = 2;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_WEEKLY}
+  MD_LOGFILE_PERIOD_MONTHLY = 3;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_MONTHLY}
+  MD_LOGFILE_PERIOD_HOURLY  = 4;
+  {$EXTERNALSYM MD_LOGFILE_PERIOD_HOURLY}
+
+//
+// Field masks for extended logging
+// Fields are logged in order of increasing mask value
+//
+
+  MD_EXTLOG_DATE             = $00000001;
+  {$EXTERNALSYM MD_EXTLOG_DATE}
+  MD_EXTLOG_TIME             = $00000002;
+  {$EXTERNALSYM MD_EXTLOG_TIME}
+  MD_EXTLOG_CLIENT_IP        = $00000004;
+  {$EXTERNALSYM MD_EXTLOG_CLIENT_IP}
+  MD_EXTLOG_USERNAME         = $00000008;
+  {$EXTERNALSYM MD_EXTLOG_USERNAME}
+  MD_EXTLOG_SITE_NAME        = $00000010;
+  {$EXTERNALSYM MD_EXTLOG_SITE_NAME}
+  MD_EXTLOG_COMPUTER_NAME    = $00000020;
+  {$EXTERNALSYM MD_EXTLOG_COMPUTER_NAME}
+  MD_EXTLOG_SERVER_IP        = $00000040;
+  {$EXTERNALSYM MD_EXTLOG_SERVER_IP}
+  MD_EXTLOG_METHOD           = $00000080;
+  {$EXTERNALSYM MD_EXTLOG_METHOD}
+  MD_EXTLOG_URI_STEM         = $00000100;
+  {$EXTERNALSYM MD_EXTLOG_URI_STEM}
+  MD_EXTLOG_URI_QUERY        = $00000200;
+  {$EXTERNALSYM MD_EXTLOG_URI_QUERY}
+  MD_EXTLOG_HTTP_STATUS      = $00000400;
+  {$EXTERNALSYM MD_EXTLOG_HTTP_STATUS}
+  MD_EXTLOG_WIN32_STATUS     = $00000800;
+  {$EXTERNALSYM MD_EXTLOG_WIN32_STATUS}
+  MD_EXTLOG_BYTES_SENT       = $00001000;
+  {$EXTERNALSYM MD_EXTLOG_BYTES_SENT}
+  MD_EXTLOG_BYTES_RECV       = $00002000;
+  {$EXTERNALSYM MD_EXTLOG_BYTES_RECV}
+  MD_EXTLOG_TIME_TAKEN       = $00004000;
+  {$EXTERNALSYM MD_EXTLOG_TIME_TAKEN}
+  MD_EXTLOG_SERVER_PORT      = $00008000;
+  {$EXTERNALSYM MD_EXTLOG_SERVER_PORT}
+  MD_EXTLOG_USER_AGENT       = $00010000;
+  {$EXTERNALSYM MD_EXTLOG_USER_AGENT}
+  MD_EXTLOG_COOKIE           = $00020000;
+  {$EXTERNALSYM MD_EXTLOG_COOKIE}
+  MD_EXTLOG_REFERER          = $00040000;
+  {$EXTERNALSYM MD_EXTLOG_REFERER}
+  MD_EXTLOG_PROTOCOL_VERSION = $00080000;
+  {$EXTERNALSYM MD_EXTLOG_PROTOCOL_VERSION}
+  MD_EXTLOG_HOST             = $00100000;
+  {$EXTERNALSYM MD_EXTLOG_HOST}
+  MD_EXTLOG_HTTP_SUB_STATUS  = $00200000;
+  {$EXTERNALSYM MD_EXTLOG_HTTP_SUB_STATUS}
+
+  MD_DEFAULT_EXTLOG_FIELDS = MD_EXTLOG_CLIENT_IP or MD_EXTLOG_TIME or MD_EXTLOG_METHOD or
+    MD_EXTLOG_URI_STEM or MD_EXTLOG_HTTP_STATUS or MD_EXTLOG_HTTP_SUB_STATUS;
+  {$EXTERNALSYM MD_DEFAULT_EXTLOG_FIELDS}
+
+//
+// Custom Logging related attributes
+//
+
+  IIS_MD_LOGCUSTOM_BASE = 4500;
+  {$EXTERNALSYM IIS_MD_LOGCUSTOM_BASE}
+
+//
+// Custom Logging configuration attributes
+//
+
+  MD_LOGCUSTOM_PROPERTY_NAME     = IIS_MD_LOGCUSTOM_BASE + 1;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_NAME}
+  MD_LOGCUSTOM_PROPERTY_HEADER   = IIS_MD_LOGCUSTOM_BASE + 2;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_HEADER}
+  MD_LOGCUSTOM_PROPERTY_ID       = IIS_MD_LOGCUSTOM_BASE + 3;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_ID}
+  MD_LOGCUSTOM_PROPERTY_MASK     = IIS_MD_LOGCUSTOM_BASE + 4;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_MASK}
+  MD_LOGCUSTOM_PROPERTY_DATATYPE = IIS_MD_LOGCUSTOM_BASE + 5;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_DATATYPE}
+  MD_LOGCUSTOM_SERVICES_STRING   = IIS_MD_LOGCUSTOM_BASE + 6; // MultiSZ List of services that the property is applicable to.
+  {$EXTERNALSYM MD_LOGCUSTOM_SERVICES_STRING}
+
+  MD_LOGCUSTOM_PROPERTY_NODE_ID  = IIS_MD_LOGCUSTOM_BASE + 8;
+  {$EXTERNALSYM MD_LOGCUSTOM_PROPERTY_NODE_ID}
+
+  IIS_MD_LOGCUSTOM_LAST = MD_LOGCUSTOM_PROPERTY_NODE_ID;
+  {$EXTERNALSYM IIS_MD_LOGCUSTOM_LAST}
+
+//
+// Valid values for Custom Logging's MD_LOGCUSTOM_PROPERTY_DATATYPE field
+//
+
+  MD_LOGCUSTOM_DATATYPE_INT    = 0;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_INT}
+  MD_LOGCUSTOM_DATATYPE_UINT   = 1;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_UINT}
+  MD_LOGCUSTOM_DATATYPE_LONG   = 2;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_LONG}
+  MD_LOGCUSTOM_DATATYPE_ULONG  = 3;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_ULONG}
+  MD_LOGCUSTOM_DATATYPE_FLOAT  = 4;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_FLOAT}
+  MD_LOGCUSTOM_DATATYPE_DOUBLE = 5;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_DOUBLE}
+  MD_LOGCUSTOM_DATATYPE_LPSTR  = 6;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_LPSTR}
+  MD_LOGCUSTOM_DATATYPE_LPWSTR = 7;
+  {$EXTERNALSYM MD_LOGCUSTOM_DATATYPE_LPWSTR}
+
+//
+//  ISAPI Filter Notification Flags
+//
+
+  MD_NOTIFY_SECURE_PORT    = $00000001;
+  {$EXTERNALSYM MD_NOTIFY_SECURE_PORT}
+  MD_NOTIFY_NONSECURE_PORT = $00000002;
+  {$EXTERNALSYM MD_NOTIFY_NONSECURE_PORT}
+
+  MD_NOTIFY_READ_RAW_DATA      = $00008000;
+  {$EXTERNALSYM MD_NOTIFY_READ_RAW_DATA}
+  MD_NOTIFY_PREPROC_HEADERS    = $00004000;
+  {$EXTERNALSYM MD_NOTIFY_PREPROC_HEADERS}
+  MD_NOTIFY_AUTHENTICATION     = $00002000;
+  {$EXTERNALSYM MD_NOTIFY_AUTHENTICATION}
+  MD_NOTIFY_URL_MAP            = $00001000;
+  {$EXTERNALSYM MD_NOTIFY_URL_MAP}
+  MD_NOTIFY_ACCESS_DENIED      = $00000800;
+  {$EXTERNALSYM MD_NOTIFY_ACCESS_DENIED}
+  MD_NOTIFY_SEND_RESPONSE      = $00000040;
+  {$EXTERNALSYM MD_NOTIFY_SEND_RESPONSE}
+  MD_NOTIFY_SEND_RAW_DATA      = $00000400;
+  {$EXTERNALSYM MD_NOTIFY_SEND_RAW_DATA}
+  MD_NOTIFY_LOG                = $00000200;
+  {$EXTERNALSYM MD_NOTIFY_LOG}
+  MD_NOTIFY_END_OF_REQUEST     = $00000080;
+  {$EXTERNALSYM MD_NOTIFY_END_OF_REQUEST}
+  MD_NOTIFY_END_OF_NET_SESSION = $00000100;
+  {$EXTERNALSYM MD_NOTIFY_END_OF_NET_SESSION}
+  MD_NOTIFY_AUTH_COMPLETE      = $04000000;
+  {$EXTERNALSYM MD_NOTIFY_AUTH_COMPLETE}
+
+//
+//  ISAPI Filter ordering flags
+//
+
+  MD_NOTIFY_ORDER_HIGH    = $00080000;
+  {$EXTERNALSYM MD_NOTIFY_ORDER_HIGH}
+  MD_NOTIFY_ORDER_MEDIUM  = $00040000;
+  {$EXTERNALSYM MD_NOTIFY_ORDER_MEDIUM}
+  MD_NOTIFY_ORDER_LOW     = $00020000;
+  {$EXTERNALSYM MD_NOTIFY_ORDER_LOW}
+  MD_NOTIFY_ORDER_DEFAULT = MD_NOTIFY_ORDER_LOW;
+  {$EXTERNALSYM MD_NOTIFY_ORDER_DEFAULT}
+
+  MD_NOTIFY_ORDER_MASK = MD_NOTIFY_ORDER_HIGH or MD_NOTIFY_ORDER_MEDIUM or MD_NOTIFY_ORDER_LOW;
+  {$EXTERNALSYM MD_NOTIFY_ORDER_MASK}
+
+//
+//  These are FTP specific properties
+//
+
+  IIS_MD_FTP_BASE = 5000;
+  {$EXTERNALSYM IIS_MD_FTP_BASE}
+
+  MD_EXIT_MESSAGE            = IIS_MD_FTP_BASE + 1;
+  {$EXTERNALSYM MD_EXIT_MESSAGE}
+  MD_GREETING_MESSAGE        = IIS_MD_FTP_BASE + 2;
+  {$EXTERNALSYM MD_GREETING_MESSAGE}
+  MD_MAX_CLIENTS_MESSAGE     = IIS_MD_FTP_BASE + 3;
+  {$EXTERNALSYM MD_MAX_CLIENTS_MESSAGE}
+  MD_MSDOS_DIR_OUTPUT        = IIS_MD_FTP_BASE + 4;
+  {$EXTERNALSYM MD_MSDOS_DIR_OUTPUT}
+  MD_ALLOW_ANONYMOUS         = IIS_MD_FTP_BASE + 5;
+  {$EXTERNALSYM MD_ALLOW_ANONYMOUS}
+  MD_ANONYMOUS_ONLY          = IIS_MD_FTP_BASE + 6;
+  {$EXTERNALSYM MD_ANONYMOUS_ONLY}
+  MD_LOG_ANONYMOUS           = IIS_MD_FTP_BASE + 7;
+  {$EXTERNALSYM MD_LOG_ANONYMOUS}
+  MD_LOG_NONANONYMOUS        = IIS_MD_FTP_BASE + 8;
+  {$EXTERNALSYM MD_LOG_NONANONYMOUS}
+  MD_ALLOW_REPLACE_ON_RENAME = IIS_MD_FTP_BASE + 9;
+  {$EXTERNALSYM MD_ALLOW_REPLACE_ON_RENAME}
+  MD_SHOW_4_DIGIT_YEAR       = IIS_MD_FTP_BASE + 10;
+  {$EXTERNALSYM MD_SHOW_4_DIGIT_YEAR}
+  MD_BANNER_MESSAGE          = IIS_MD_FTP_BASE + 11;
+  {$EXTERNALSYM MD_BANNER_MESSAGE}
+  MD_USER_ISOLATION          = IIS_MD_FTP_BASE + 12;
+  {$EXTERNALSYM MD_USER_ISOLATION}
+  MD_FTP_LOG_IN_UTF_8        = IIS_MD_FTP_BASE + 13;
+  {$EXTERNALSYM MD_FTP_LOG_IN_UTF_8}
+  MD_AD_CONNECTIONS_USERNAME = IIS_MD_FTP_BASE + 14;
+  {$EXTERNALSYM MD_AD_CONNECTIONS_USERNAME}
+  MD_AD_CONNECTIONS_PASSWORD = IIS_MD_FTP_BASE + 15;
+  {$EXTERNALSYM MD_AD_CONNECTIONS_PASSWORD}
+  MD_PASSIVE_PORT_RANGE      = IIS_MD_FTP_BASE + 16;
+  {$EXTERNALSYM MD_PASSIVE_PORT_RANGE}
+
+//
+//  These are SSL specific properties
+//
+
+  IIS_MD_SSL_BASE = 5500;
+  {$EXTERNALSYM IIS_MD_SSL_BASE}
+
+  MD_SSL_PUBLIC_KEY   = IIS_MD_SSL_BASE + 0;
+  {$EXTERNALSYM MD_SSL_PUBLIC_KEY}
+  MD_SSL_PRIVATE_KEY  = IIS_MD_SSL_BASE + 1;
+  {$EXTERNALSYM MD_SSL_PRIVATE_KEY}
+  MD_SSL_KEY_PASSWORD = IIS_MD_SSL_BASE + 2;
+  {$EXTERNALSYM MD_SSL_KEY_PASSWORD}
+  MD_SSL_KEY_REQUEST  = IIS_MD_SSL_BASE + 3;
+  {$EXTERNALSYM MD_SSL_KEY_REQUEST}
+
+//
+// These are server certificate properties
+//
+//
+// These are Certificate Trust List properties
+//
+
+//
+// Metabase property that defines whether to use DS mapper or not
+//
+
+  MD_SSL_USE_DS_MAPPER = IIS_MD_SSL_BASE + 19;
+  {$EXTERNALSYM MD_SSL_USE_DS_MAPPER}
+
+  MD_SSL_ALWAYS_NEGO_CLIENT_CERT = IIS_MD_SSL_BASE + 21;
+  {$EXTERNALSYM MD_SSL_ALWAYS_NEGO_CLIENT_CERT}
+
+//
+// Metabase properties that are used by the CertWiz ActiveX control, that
+// is used for the Certificate/CTL UI management tool
+//
+
+//
+// Metabase properties used for Fortezza certificates
+//
+
+//
+// Metabase properties that are used by the CertWiz ActiveX control to keep
+// track of the user's entry history, and whether DEBUG is enabled.  We keep
+// these private properties on a per VS basis.
+//
+
+//  File and Directory related properties - these should be added in the
+//  metabase with a user type of IIS_MD_UT_FILE
+//
+
+  IIS_MD_FILE_PROP_BASE = 6000;
+  {$EXTERNALSYM IIS_MD_FILE_PROP_BASE}
+
+  MD_AUTHORIZATION              = IIS_MD_FILE_PROP_BASE;
+  {$EXTERNALSYM MD_AUTHORIZATION}
+  MD_REALM                      = IIS_MD_FILE_PROP_BASE + 1;
+  {$EXTERNALSYM MD_REALM}
+  MD_HTTP_EXPIRES               = IIS_MD_FILE_PROP_BASE + 2;
+  {$EXTERNALSYM MD_HTTP_EXPIRES}
+  MD_HTTP_PICS                  = IIS_MD_FILE_PROP_BASE + 3;
+  {$EXTERNALSYM MD_HTTP_PICS}
+  MD_HTTP_CUSTOM                = IIS_MD_FILE_PROP_BASE + 4;
+  {$EXTERNALSYM MD_HTTP_CUSTOM}
+  MD_DIRECTORY_BROWSING         = IIS_MD_FILE_PROP_BASE + 5;
+  {$EXTERNALSYM MD_DIRECTORY_BROWSING}
+  MD_DEFAULT_LOAD_FILE          = IIS_MD_FILE_PROP_BASE + 6;
+  {$EXTERNALSYM MD_DEFAULT_LOAD_FILE}
+  MD_CUSTOM_ERROR               = IIS_MD_FILE_PROP_BASE + 8;
+  {$EXTERNALSYM MD_CUSTOM_ERROR}
+  MD_FOOTER_DOCUMENT            = IIS_MD_FILE_PROP_BASE + 9;
+  {$EXTERNALSYM MD_FOOTER_DOCUMENT}
+  MD_FOOTER_ENABLED             = IIS_MD_FILE_PROP_BASE + 10;
+  {$EXTERNALSYM MD_FOOTER_ENABLED}
+  MD_HTTP_REDIRECT              = IIS_MD_FILE_PROP_BASE + 11;
+  {$EXTERNALSYM MD_HTTP_REDIRECT}
+  MD_DEFAULT_LOGON_DOMAIN       = IIS_MD_FILE_PROP_BASE + 12;
+  {$EXTERNALSYM MD_DEFAULT_LOGON_DOMAIN}
+  MD_LOGON_METHOD               = IIS_MD_FILE_PROP_BASE + 13;
+  {$EXTERNALSYM MD_LOGON_METHOD}
+  MD_SCRIPT_MAPS                = IIS_MD_FILE_PROP_BASE + 14;
+  {$EXTERNALSYM MD_SCRIPT_MAPS}
+  MD_MIME_MAP                   = IIS_MD_FILE_PROP_BASE + 15;
+  {$EXTERNALSYM MD_MIME_MAP}
+  MD_ACCESS_PERM                = IIS_MD_FILE_PROP_BASE + 16;
+  {$EXTERNALSYM MD_ACCESS_PERM}
+  MD_IP_SEC                     = IIS_MD_FILE_PROP_BASE + 19;
+  {$EXTERNALSYM MD_IP_SEC}
+  MD_ANONYMOUS_USER_NAME        = IIS_MD_FILE_PROP_BASE + 20;
+  {$EXTERNALSYM MD_ANONYMOUS_USER_NAME}
+  MD_ANONYMOUS_PWD              = IIS_MD_FILE_PROP_BASE + 21;
+  {$EXTERNALSYM MD_ANONYMOUS_PWD}
+  MD_ANONYMOUS_USE_SUBAUTH      = IIS_MD_FILE_PROP_BASE + 22;
+  {$EXTERNALSYM MD_ANONYMOUS_USE_SUBAUTH}
+  MD_DONT_LOG                   = IIS_MD_FILE_PROP_BASE + 23;
+  {$EXTERNALSYM MD_DONT_LOG}
+  MD_ADMIN_ACL                  = IIS_MD_FILE_PROP_BASE + 27;
+  {$EXTERNALSYM MD_ADMIN_ACL}
+  MD_SSI_EXEC_DISABLED          = IIS_MD_FILE_PROP_BASE + 28;
+  {$EXTERNALSYM MD_SSI_EXEC_DISABLED}
+  MD_DO_REVERSE_DNS             = IIS_MD_FILE_PROP_BASE + 29;
+  {$EXTERNALSYM MD_DO_REVERSE_DNS}
+  MD_SSL_ACCESS_PERM            = IIS_MD_FILE_PROP_BASE + 30;
+  {$EXTERNALSYM MD_SSL_ACCESS_PERM}
+  MD_AUTHORIZATION_PERSISTENCE  = IIS_MD_FILE_PROP_BASE + 31;
+  {$EXTERNALSYM MD_AUTHORIZATION_PERSISTENCE}
+  MD_NTAUTHENTICATION_PROVIDERS = IIS_MD_FILE_PROP_BASE + 32;
+  {$EXTERNALSYM MD_NTAUTHENTICATION_PROVIDERS}
+  MD_SCRIPT_TIMEOUT             = IIS_MD_FILE_PROP_BASE + 33;
+  {$EXTERNALSYM MD_SCRIPT_TIMEOUT}
+  MD_CACHE_EXTENSIONS           = IIS_MD_FILE_PROP_BASE + 34;
+  {$EXTERNALSYM MD_CACHE_EXTENSIONS}
+  MD_CREATE_PROCESS_AS_USER     = IIS_MD_FILE_PROP_BASE + 35;
+  {$EXTERNALSYM MD_CREATE_PROCESS_AS_USER}
+  MD_CREATE_PROC_NEW_CONSOLE    = IIS_MD_FILE_PROP_BASE + 36;
+  {$EXTERNALSYM MD_CREATE_PROC_NEW_CONSOLE}
+  MD_POOL_IDC_TIMEOUT           = IIS_MD_FILE_PROP_BASE + 37;
+  {$EXTERNALSYM MD_POOL_IDC_TIMEOUT}
+  MD_ALLOW_KEEPALIVES           = IIS_MD_FILE_PROP_BASE + 38;
+  {$EXTERNALSYM MD_ALLOW_KEEPALIVES}
+  MD_IS_CONTENT_INDEXED         = IIS_MD_FILE_PROP_BASE + 39;
+  {$EXTERNALSYM MD_IS_CONTENT_INDEXED}
+  MD_CC_NO_CACHE                = IIS_MD_FILE_PROP_BASE + 41;
+  {$EXTERNALSYM MD_CC_NO_CACHE}
+  MD_CC_MAX_AGE                 = IIS_MD_FILE_PROP_BASE + 42;
+  {$EXTERNALSYM MD_CC_MAX_AGE}
+  MD_CC_OTHER                   = IIS_MD_FILE_PROP_BASE + 43;
+  {$EXTERNALSYM MD_CC_OTHER}
+  MD_REDIRECT_HEADERS           = IIS_MD_FILE_PROP_BASE + 44;
+  {$EXTERNALSYM MD_REDIRECT_HEADERS}
+  MD_UPLOAD_READAHEAD_SIZE      = IIS_MD_FILE_PROP_BASE + 45;
+  {$EXTERNALSYM MD_UPLOAD_READAHEAD_SIZE}
+  MD_PUT_READ_SIZE              = IIS_MD_FILE_PROP_BASE + 46;
+  {$EXTERNALSYM MD_PUT_READ_SIZE}
+  MD_USE_DIGEST_SSP             = IIS_MD_FILE_PROP_BASE + 47;
+  {$EXTERNALSYM MD_USE_DIGEST_SSP}
+
+  MD_ENABLE_URL_AUTHORIZATION     = IIS_MD_FILE_PROP_BASE + 48;
+  {$EXTERNALSYM MD_ENABLE_URL_AUTHORIZATION}
+  MD_URL_AUTHORIZATION_STORE_NAME = IIS_MD_FILE_PROP_BASE + 49;
+  {$EXTERNALSYM MD_URL_AUTHORIZATION_STORE_NAME}
+  MD_URL_AUTHORIZATION_SCOPE_NAME = IIS_MD_FILE_PROP_BASE + 50;
+  {$EXTERNALSYM MD_URL_AUTHORIZATION_SCOPE_NAME}
+
+  MD_MAX_REQUEST_ENTITY_ALLOWED   = IIS_MD_FILE_PROP_BASE + 51;
+  {$EXTERNALSYM MD_MAX_REQUEST_ENTITY_ALLOWED}
+
+  MD_PASSPORT_REQUIRE_AD_MAPPING  = IIS_MD_FILE_PROP_BASE + 52;
+  {$EXTERNALSYM MD_PASSPORT_REQUIRE_AD_MAPPING}
+
+  MD_URL_AUTHORIZATION_IMPERSONATION_LEVEL   = IIS_MD_FILE_PROP_BASE + 53;
+  {$EXTERNALSYM MD_URL_AUTHORIZATION_IMPERSONATION_LEVEL}
+
+  ASP_MD_SERVER_BASE = 7000;
+  {$EXTERNALSYM ASP_MD_SERVER_BASE}
+
+  MD_ASP_BUFFERINGON               = ASP_MD_SERVER_BASE + 0;
+  {$EXTERNALSYM MD_ASP_BUFFERINGON}
+  MD_ASP_LOGERRORREQUESTS          = ASP_MD_SERVER_BASE + 1;
+  {$EXTERNALSYM MD_ASP_LOGERRORREQUESTS}
+  MD_ASP_SCRIPTERRORSSENTTOBROWSER = ASP_MD_SERVER_BASE + 2;
+  {$EXTERNALSYM MD_ASP_SCRIPTERRORSSENTTOBROWSER}
+  MD_ASP_SCRIPTERRORMESSAGE        = ASP_MD_SERVER_BASE + 3;
+  {$EXTERNALSYM MD_ASP_SCRIPTERRORMESSAGE}
+  MD_ASP_SCRIPTFILECACHESIZE       = ASP_MD_SERVER_BASE + 4;
+  {$EXTERNALSYM MD_ASP_SCRIPTFILECACHESIZE}
+  MD_ASP_SCRIPTENGINECACHEMAX      = ASP_MD_SERVER_BASE + 5;
+  {$EXTERNALSYM MD_ASP_SCRIPTENGINECACHEMAX}
+  MD_ASP_SCRIPTTIMEOUT             = ASP_MD_SERVER_BASE + 6;
+  {$EXTERNALSYM MD_ASP_SCRIPTTIMEOUT}
+  MD_ASP_SESSIONTIMEOUT            = ASP_MD_SERVER_BASE + 7;
+  {$EXTERNALSYM MD_ASP_SESSIONTIMEOUT}
+  MD_ASP_ENABLEPARENTPATHS         = ASP_MD_SERVER_BASE + 8;
+  {$EXTERNALSYM MD_ASP_ENABLEPARENTPATHS}
+  MD_ASP_MEMFREEFACTOR             = ASP_MD_SERVER_BASE + 9; // OBSOLETE
+  {$EXTERNALSYM MD_ASP_MEMFREEFACTOR}
+  MD_ASP_MINUSEDBLOCKS             = ASP_MD_SERVER_BASE + 10; // OBSOLETE
+  {$EXTERNALSYM MD_ASP_MINUSEDBLOCKS}
+  MD_ASP_ALLOWSESSIONSTATE         = ASP_MD_SERVER_BASE + 11;
+  {$EXTERNALSYM MD_ASP_ALLOWSESSIONSTATE}
+  MD_ASP_SCRIPTLANGUAGE            = ASP_MD_SERVER_BASE + 12;
+  {$EXTERNALSYM MD_ASP_SCRIPTLANGUAGE}
+  MD_ASP_QUEUETIMEOUT              = ASP_MD_SERVER_BASE + 13;
+  {$EXTERNALSYM MD_ASP_QUEUETIMEOUT}
+  MD_ASP_ALLOWOUTOFPROCCOMPONENTS  = ASP_MD_SERVER_BASE + 14;
+  {$EXTERNALSYM MD_ASP_ALLOWOUTOFPROCCOMPONENTS}
+  MD_ASP_ALLOWOUTOFPROCCMPNTS      = MD_ASP_ALLOWOUTOFPROCCOMPONENTS; // Deprecated.  Use MD_ASP_ALLOWOUTOFPROCCMPNTS
+  {$EXTERNALSYM MD_ASP_ALLOWOUTOFPROCCMPNTS}
+  MD_ASP_EXCEPTIONCATCHENABLE      = ASP_MD_SERVER_BASE + 15;
+  {$EXTERNALSYM MD_ASP_EXCEPTIONCATCHENABLE}
+  MD_ASP_CODEPAGE                  = ASP_MD_SERVER_BASE + 16;
+  {$EXTERNALSYM MD_ASP_CODEPAGE}
+  MD_ASP_SCRIPTLANGUAGELIST        = ASP_MD_SERVER_BASE + 17;
+  {$EXTERNALSYM MD_ASP_SCRIPTLANGUAGELIST}
+  MD_ASP_ENABLESERVERDEBUG         = ASP_MD_SERVER_BASE + 18;
+  {$EXTERNALSYM MD_ASP_ENABLESERVERDEBUG}
+  MD_ASP_ENABLECLIENTDEBUG         = ASP_MD_SERVER_BASE + 19;
+  {$EXTERNALSYM MD_ASP_ENABLECLIENTDEBUG}
+  MD_ASP_TRACKTHREADINGMODEL       = ASP_MD_SERVER_BASE + 20;
+  {$EXTERNALSYM MD_ASP_TRACKTHREADINGMODEL}
+// added for IIS 5.0
+  MD_ASP_ENABLEASPHTMLFALLBACK    = ASP_MD_SERVER_BASE + 21;
+  {$EXTERNALSYM MD_ASP_ENABLEASPHTMLFALLBACK}
+  MD_ASP_ENABLECHUNKEDENCODING    = ASP_MD_SERVER_BASE + 22;
+  {$EXTERNALSYM MD_ASP_ENABLECHUNKEDENCODING}
+  MD_ASP_ENABLETYPELIBCACHE       = ASP_MD_SERVER_BASE + 23;
+  {$EXTERNALSYM MD_ASP_ENABLETYPELIBCACHE}
+  MD_ASP_ERRORSTONTLOG            = ASP_MD_SERVER_BASE + 24;
+  {$EXTERNALSYM MD_ASP_ERRORSTONTLOG}
+  MD_ASP_PROCESSORTHREADMAX       = ASP_MD_SERVER_BASE + 25;
+  {$EXTERNALSYM MD_ASP_PROCESSORTHREADMAX}
+  MD_ASP_REQEUSTQUEUEMAX          = ASP_MD_SERVER_BASE + 26;
+  {$EXTERNALSYM MD_ASP_REQEUSTQUEUEMAX}
+  MD_ASP_ENABLEAPPLICATIONRESTART = ASP_MD_SERVER_BASE + 27;
+  {$EXTERNALSYM MD_ASP_ENABLEAPPLICATIONRESTART}
+  MD_ASP_QUEUECONNECTIONTESTTIME  = ASP_MD_SERVER_BASE + 28;
+  {$EXTERNALSYM MD_ASP_QUEUECONNECTIONTESTTIME}
+  MD_ASP_SESSIONMAX               = ASP_MD_SERVER_BASE + 29;
+  {$EXTERNALSYM MD_ASP_SESSIONMAX}
+
+// thread gate
+//  MD_ASP_THREADGATEENABLED    = ASP_MD_SERVER_BASE + 30;
+//  {$EXTERNALSYM MD_ASP_THREADGATEENABLED}
+//  MD_ASP_THREADGATETIMESLICE  = ASP_MD_SERVER_BASE + 31;
+//  {$EXTERNALSYM MD_ASP_THREADGATETIMESLICE}
+//  MD_ASP_THREADGATESLEEPDELAY = ASP_MD_SERVER_BASE + 32;
+//  {$EXTERNALSYM MD_ASP_THREADGATESLEEPDELAY}
+//  MD_ASP_THREADGATESLEEPMAX   = ASP_MD_SERVER_BASE + 33;
+//  {$EXTERNALSYM MD_ASP_THREADGATESLEEPMAX}
+//  MD_ASP_THREADGATELOADLOW    = ASP_MD_SERVER_BASE + 34;
+//  {$EXTERNALSYM MD_ASP_THREADGATELOADLOW}
+//  MD_ASP_THREADGATELOADHIGH   = ASP_MD_SERVER_BASE + 35;
+//  {$EXTERNALSYM MD_ASP_THREADGATELOADHIGH}
+
+// added IIS5.1
+
+// persist template cache
+  MD_ASP_DISKTEMPLATECACHEDIRECTORY = ASP_MD_SERVER_BASE + 36;
+  {$EXTERNALSYM MD_ASP_DISKTEMPLATECACHEDIRECTORY}
+  MD_ASP_MAXDISKTEMPLATECACHEFILES  = ASP_MD_SERVER_BASE + 40;
+  {$EXTERNALSYM MD_ASP_MAXDISKTEMPLATECACHEFILES}
+  MD_ASP_EXECUTEINMTA               = ASP_MD_SERVER_BASE + 41;
+  {$EXTERNALSYM MD_ASP_EXECUTEINMTA}
+  MD_ASP_LCID                       = ASP_MD_SERVER_BASE + 42;
+  {$EXTERNALSYM MD_ASP_LCID}
+  MD_ASP_KEEPSESSIONIDSECURE        = ASP_MD_SERVER_BASE + 43;
+  {$EXTERNALSYM MD_ASP_KEEPSESSIONIDSECURE}
+
+// added IIS6.0
+
+// Services without components integration
+  MD_ASP_SERVICE_FLAGS           = ASP_MD_SERVER_BASE + 44;
+  {$EXTERNALSYM MD_ASP_SERVICE_FLAGS}
+  MD_ASP_SERVICE_FLAG_TRACKER    = ASP_MD_SERVER_BASE + 45;
+  {$EXTERNALSYM MD_ASP_SERVICE_FLAG_TRACKER}
+  MD_ASP_SERVICE_FLAG_FUSION     = ASP_MD_SERVER_BASE + 46;
+  {$EXTERNALSYM MD_ASP_SERVICE_FLAG_FUSION}
+  MD_ASP_SERVICE_FLAG_PARTITIONS = ASP_MD_SERVER_BASE + 47;
+  {$EXTERNALSYM MD_ASP_SERVICE_FLAG_PARTITIONS}
+  MD_ASP_SERVICE_PARTITION_ID    = ASP_MD_SERVER_BASE + 48;
+  {$EXTERNALSYM MD_ASP_SERVICE_PARTITION_ID}
+  MD_ASP_SERVICE_SXS_NAME        = ASP_MD_SERVER_BASE + 49;
+  {$EXTERNALSYM MD_ASP_SERVICE_SXS_NAME}
+
+// Valid flags for MD_ASP_SERVICE_FLAGS property
+
+  MD_ASP_SERVICE_ENABLE_TRACKER  = 1;
+  {$EXTERNALSYM MD_ASP_SERVICE_ENABLE_TRACKER}
+  MD_ASP_SERVICE_ENABLE_SXS      = 2;
+  {$EXTERNALSYM MD_ASP_SERVICE_ENABLE_SXS}
+  MD_ASP_SERVICE_USE_PARTITION   = 4;
+  {$EXTERNALSYM MD_ASP_SERVICE_USE_PARTITION}
+
+// Line number calculation flag.
+
+  MD_ASP_CALCLINENUMBER             = ASP_MD_SERVER_BASE + 50;
+  {$EXTERNALSYM MD_ASP_CALCLINENUMBER}
+
+  MD_ASP_RUN_ONEND_ANON             = ASP_MD_SERVER_BASE + 51;
+  {$EXTERNALSYM MD_ASP_RUN_ONEND_ANON}
+
+  MD_ASP_BUFFER_LIMIT               = ASP_MD_SERVER_BASE + 52;
+  {$EXTERNALSYM MD_ASP_BUFFER_LIMIT}
+
+  MD_ASP_MAX_REQUEST_ENTITY_ALLOWED = ASP_MD_SERVER_BASE + 53;
+  {$EXTERNALSYM MD_ASP_MAX_REQUEST_ENTITY_ALLOWED}
+
+  MD_ASP_ID_LAST                    = ASP_MD_SERVER_BASE + 53;
+  {$EXTERNALSYM MD_ASP_ID_LAST}
+
+//
+//  Valid values for WAM
+//
+
+  WAM_MD_SERVER_BASE = 7500;
+  {$EXTERNALSYM WAM_MD_SERVER_BASE}
+
+  MD_WAM_USER_NAME = WAM_MD_SERVER_BASE + 1;
+  {$EXTERNALSYM MD_WAM_USER_NAME}
+  MD_WAM_PWD       = WAM_MD_SERVER_BASE + 2;
+  {$EXTERNALSYM MD_WAM_PWD}
+
+// added IIS6
+
+//
+//  Valid values for APP POOL
+//
+
+  IIS_MD_APPPOOL_BASE = 9000;
+  {$EXTERNALSYM IIS_MD_APPPOOL_BASE}
+
+  MD_APPPOOL_PERIODIC_RESTART_TIME          = IIS_MD_APPPOOL_BASE + 1;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_TIME}
+  MD_APPPOOL_PERIODIC_RESTART_REQUEST_COUNT = IIS_MD_APPPOOL_BASE + 2;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_REQUEST_COUNT}
+  MD_APPPOOL_MAX_PROCESS_COUNT              = IIS_MD_APPPOOL_BASE + 3;
+  {$EXTERNALSYM MD_APPPOOL_MAX_PROCESS_COUNT}
+  MD_APPPOOL_PINGING_ENABLED                = IIS_MD_APPPOOL_BASE + 4;
+  {$EXTERNALSYM MD_APPPOOL_PINGING_ENABLED}
+  MD_APPPOOL_IDLE_TIMEOUT                   = IIS_MD_APPPOOL_BASE + 5;
+  {$EXTERNALSYM MD_APPPOOL_IDLE_TIMEOUT}
+  MD_APPPOOL_RAPID_FAIL_PROTECTION_ENABLED  = IIS_MD_APPPOOL_BASE + 6;
+  {$EXTERNALSYM MD_APPPOOL_RAPID_FAIL_PROTECTION_ENABLED}
+  MD_APPPOOL_SMP_AFFINITIZED                = IIS_MD_APPPOOL_BASE + 7;
+  {$EXTERNALSYM MD_APPPOOL_SMP_AFFINITIZED}
+  MD_APPPOOL_SMP_AFFINITIZED_PROCESSOR_MASK = IIS_MD_APPPOOL_BASE + 8;
+  {$EXTERNALSYM MD_APPPOOL_SMP_AFFINITIZED_PROCESSOR_MASK}
+  MD_APPPOOL_ORPHAN_PROCESSES_FOR_DEBUGGING = IIS_MD_APPPOOL_BASE + 9;
+  {$EXTERNALSYM MD_APPPOOL_ORPHAN_PROCESSES_FOR_DEBUGGING}
+
+  //MD_APPPOOL_RUN_AS_LOCALSYSTEM                 = IIS_MD_APPPOOL_BASE + 10;
+  //{$EXTERNALSYM MD_APPPOOL_RUN_AS_LOCALSYSTEM}
+  MD_APPPOOL_STARTUP_TIMELIMIT                  = IIS_MD_APPPOOL_BASE + 11;
+  {$EXTERNALSYM MD_APPPOOL_STARTUP_TIMELIMIT}
+  MD_APPPOOL_SHUTDOWN_TIMELIMIT                 = IIS_MD_APPPOOL_BASE + 12;
+  {$EXTERNALSYM MD_APPPOOL_SHUTDOWN_TIMELIMIT}
+  MD_APPPOOL_PING_INTERVAL                      = IIS_MD_APPPOOL_BASE + 13;
+  {$EXTERNALSYM MD_APPPOOL_PING_INTERVAL}
+  MD_APPPOOL_PING_RESPONSE_TIMELIMIT            = IIS_MD_APPPOOL_BASE + 14;
+  {$EXTERNALSYM MD_APPPOOL_PING_RESPONSE_TIMELIMIT}
+  MD_APPPOOL_DISALLOW_OVERLAPPING_ROTATION      = IIS_MD_APPPOOL_BASE + 15;
+  {$EXTERNALSYM MD_APPPOOL_DISALLOW_OVERLAPPING_ROTATION}
+  //MD_APPPOOL_ORPHAN_ACTION                      = IIS_MD_APPPOOL_BASE + 16;
+  //{$EXTERNALSYM MD_APPPOOL_ORPHAN_ACTION}
+  MD_APPPOOL_UL_APPPOOL_QUEUE_LENGTH            = IIS_MD_APPPOOL_BASE + 17;
+  {$EXTERNALSYM MD_APPPOOL_UL_APPPOOL_QUEUE_LENGTH}
+  MD_APPPOOL_DISALLOW_ROTATION_ON_CONFIG_CHANGE = IIS_MD_APPPOOL_BASE + 18;
+  {$EXTERNALSYM MD_APPPOOL_DISALLOW_ROTATION_ON_CONFIG_CHANGE}
+  //MD_APPPOOL_FRIENDLY_NAME                      = IIS_MD_APPPOOL_BASE + 19;
+  //{$EXTERNALSYM MD_APPPOOL_FRIENDLY_NAME}
+  MD_APPPOOL_PERIODIC_RESTART_SCHEDULE          = IIS_MD_APPPOOL_BASE + 20;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_SCHEDULE}
+  MD_APPPOOL_IDENTITY_TYPE                      = IIS_MD_APPPOOL_BASE + 21;
+  {$EXTERNALSYM MD_APPPOOL_IDENTITY_TYPE}
+  MD_CPU_ACTION                                 = IIS_MD_APPPOOL_BASE + 22;
+  {$EXTERNALSYM MD_CPU_ACTION}
+  MD_CPU_LIMIT                                  = IIS_MD_APPPOOL_BASE + 23;
+  {$EXTERNALSYM MD_CPU_LIMIT}
+  MD_APPPOOL_PERIODIC_RESTART_MEMORY            = IIS_MD_APPPOOL_BASE + 24;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_MEMORY}
+  //MD_DISABLE_PUBLISHING                         = IIS_MD_APPPOOL_BASE + 25;
+  //{$EXTERNALSYM MD_DISABLE_PUBLISHING}
+  MD_APPPOOL_COMMAND                            = IIS_MD_APPPOOL_BASE + 26;
+  {$EXTERNALSYM MD_APPPOOL_COMMAND}
+  MD_APPPOOL_STATE                              = IIS_MD_APPPOOL_BASE + 27;
+  {$EXTERNALSYM MD_APPPOOL_STATE}
+  MD_APPPOOL_AUTO_START                         = IIS_MD_APPPOOL_BASE + 28;
+  {$EXTERNALSYM MD_APPPOOL_AUTO_START}
+  MD_RAPID_FAIL_PROTECTION_INTERVAL             = IIS_MD_APPPOOL_BASE + 29;
+  {$EXTERNALSYM MD_RAPID_FAIL_PROTECTION_INTERVAL}
+  MD_RAPID_FAIL_PROTECTION_MAX_CRASHES          = IIS_MD_APPPOOL_BASE + 30;
+  {$EXTERNALSYM MD_RAPID_FAIL_PROTECTION_MAX_CRASHES}
+  MD_APPPOOL_ORPHAN_ACTION_EXE                  = IIS_MD_APPPOOL_BASE + 31;
+  {$EXTERNALSYM MD_APPPOOL_ORPHAN_ACTION_EXE}
+  MD_APPPOOL_ORPHAN_ACTION_PARAMS               = IIS_MD_APPPOOL_BASE + 32;
+  {$EXTERNALSYM MD_APPPOOL_ORPHAN_ACTION_PARAMS}
+
+//
+// Load balancer properties
+//
+
+  MD_LOAD_BALANCER_CAPABILITIES                 = IIS_MD_APPPOOL_BASE + 34;
+  {$EXTERNALSYM MD_LOAD_BALANCER_CAPABILITIES}
+
+//
+//  Valid values for APP POOL
+//
+
+  MD_APPPOOL_AUTO_SHUTDOWN_EXE                = IIS_MD_APPPOOL_BASE + 35;
+  {$EXTERNALSYM MD_APPPOOL_AUTO_SHUTDOWN_EXE}
+  MD_APPPOOL_AUTO_SHUTDOWN_PARAMS             = IIS_MD_APPPOOL_BASE + 36;
+  {$EXTERNALSYM MD_APPPOOL_AUTO_SHUTDOWN_PARAMS}
+  MD_APP_POOL_LOG_EVENT_ON_RECYCLE            = IIS_MD_APPPOOL_BASE + 37;
+  {$EXTERNALSYM MD_APP_POOL_LOG_EVENT_ON_RECYCLE}
+  MD_APPPOOL_PERIODIC_RESTART_PRIVATE_MEMORY  = IIS_MD_APPPOOL_BASE + 38;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_PRIVATE_MEMORY}
+
+//
+// Valid values for MD_APP_POOL_LOG_EVENT_ON_RECYCLE
+//
+
+  MD_APP_POOL_RECYCLE_TIME                    = 1;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_TIME}
+  MD_APP_POOL_RECYCLE_REQUESTS                = 2;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_REQUESTS}
+  MD_APP_POOL_RECYCLE_SCHEDULE                = 4;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_SCHEDULE}
+  MD_APP_POOL_RECYCLE_MEMORY                  = 8;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_MEMORY}
+  MD_APP_POOL_RECYCLE_ISAPI_UNHEALTHY         = 16;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_ISAPI_UNHEALTHY}
+  MD_APP_POOL_RECYCLE_ON_DEMAND               = 32;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_ON_DEMAND}
+  MD_APP_POOL_RECYCLE_CONFIG_CHANGE           = 64;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_CONFIG_CHANGE}
+  MD_APP_POOL_RECYCLE_PRIVATE_MEMORY          = 128;
+  {$EXTERNALSYM MD_APP_POOL_RECYCLE_PRIVATE_MEMORY}
+
+//
+// Valid values for MD_CPU_ACTION
+//
+
+  MD_CPU_NO_ACTION = 0;
+  {$EXTERNALSYM MD_CPU_NO_ACTION}
+  MD_CPU_KILL_W3WP = 1;
+  {$EXTERNALSYM MD_CPU_KILL_W3WP}
+  MD_CPU_TRACE     = 2;
+  {$EXTERNALSYM MD_CPU_TRACE}
+  MD_CPU_THROTTLE  = 3;
+  {$EXTERNALSYM MD_CPU_THROTTLE}
+
+//
+// Valid values for MD_APPPOOL_COMMAND
+//
+
+  MD_APPPOOL_COMMAND_START = 1;
+  {$EXTERNALSYM MD_APPPOOL_COMMAND_START}
+  MD_APPPOOL_COMMAND_STOP  = 2;
+  {$EXTERNALSYM MD_APPPOOL_COMMAND_STOP}
+
+//
+// Valid values for MD_APPPOOL_STATE
+//
+
+  MD_APPPOOL_STATE_STARTING = 1;
+  {$EXTERNALSYM MD_APPPOOL_STATE_STARTING}
+  MD_APPPOOL_STATE_STARTED  = 2;
+  {$EXTERNALSYM MD_APPPOOL_STATE_STARTED}
+  MD_APPPOOL_STATE_STOPPING = 3;
+  {$EXTERNALSYM MD_APPPOOL_STATE_STOPPING}
+  MD_APPPOOL_STATE_STOPPED  = 4;
+  {$EXTERNALSYM MD_APPPOOL_STATE_STOPPED}
+
+//
+// Valid values for MD_APPPOOL_IDENTITY_TYPE
+//
+
+  MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM        = 0;
+  {$EXTERNALSYM MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM}
+  MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE       = 1;
+  {$EXTERNALSYM MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE}
+  MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE     = 2;
+  {$EXTERNALSYM MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE}
+  MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER       = 3;
+  {$EXTERNALSYM MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER}
+
+//
+// Valid values for MD_LOAD_BALANCER_CAPABILITIES
+//
+
+  MD_LOAD_BALANCER_CAPABILITIES_BASIC         = 1;
+  {$EXTERNALSYM MD_LOAD_BALANCER_CAPABILITIES_BASIC}
+  MD_LOAD_BALANCER_CAPABILITIES_SOPHISTICATED = 2;
+  {$EXTERNALSYM MD_LOAD_BALANCER_CAPABILITIES_SOPHISTICATED}
+
+//
+// Valid values for MD_APPPOOL_STATE
+//
+
+  IIS_MD_APP_BASE                         = 9100;
+  {$EXTERNALSYM IIS_MD_APP_BASE}
+  MD_APP_APPPOOL_ID                       = IIS_MD_APP_BASE + 1;
+  {$EXTERNALSYM MD_APP_APPPOOL_ID}
+  MD_APP_ALLOW_TRANSIENT_REGISTRATION     = IIS_MD_APP_BASE + 2;
+  {$EXTERNALSYM MD_APP_ALLOW_TRANSIENT_REGISTRATION}
+  MD_APP_AUTO_START                       = IIS_MD_APP_BASE + 3;
+  {$EXTERNALSYM MD_APP_AUTO_START}
+  MD_APPPOOL_PERIODIC_RESTART_CONNECTIONS = IIS_MD_APP_BASE + 4;
+  {$EXTERNALSYM MD_APPPOOL_PERIODIC_RESTART_CONNECTIONS}
+
+//
+// TODO: These are duplicate definitions. Remove them if no one is using it.
+//
+
+  MD_APPPOOL_APPPOOL_ID                   = IIS_MD_APP_BASE + 101;
+  {$EXTERNALSYM MD_APPPOOL_APPPOOL_ID}
+  MD_APPPOOL_ALLOW_TRANSIENT_REGISTRATION = IIS_MD_APP_BASE + 102;
+  {$EXTERNALSYM MD_APPPOOL_ALLOW_TRANSIENT_REGISTRATION}
+  // commented out so we can build
+  //MD_APPPOOL_AUTO_START                         = IIS_MD_APP_BASE + 103;
+
+  IIS_MD_GLOBAL_BASE                            = 9200;
+  {$EXTERNALSYM IIS_MD_GLOBAL_BASE}
+  MD_MAX_GLOBAL_BANDWIDTH                       = IIS_MD_GLOBAL_BASE + 1;
+  {$EXTERNALSYM MD_MAX_GLOBAL_BANDWIDTH}
+  MD_GLOBAL_STANDARD_APP_MODE_ENABLED           = IIS_MD_GLOBAL_BASE + 3;
+  {$EXTERNALSYM MD_GLOBAL_STANDARD_APP_MODE_ENABLED}
+  MD_HEADER_WAIT_TIMEOUT                        = IIS_MD_GLOBAL_BASE + 4;
+  {$EXTERNALSYM MD_HEADER_WAIT_TIMEOUT}
+  MD_MIN_FILE_BYTES_PER_SEC                     = IIS_MD_GLOBAL_BASE + 5;
+  {$EXTERNALSYM MD_MIN_FILE_BYTES_PER_SEC}
+  MD_GLOBAL_LOG_IN_UTF_8                        = IIS_MD_GLOBAL_BASE + 6;
+  {$EXTERNALSYM MD_GLOBAL_LOG_IN_UTF_8}
+  MD_DEMAND_START_THRESHOLD                     = IIS_MD_GLOBAL_BASE + 7;
+  {$EXTERNALSYM MD_DEMAND_START_THRESHOLD}
+
+  MD_GLOBAL_SESSIONKEY                              = 9999;
+  {$EXTERNALSYM MD_GLOBAL_SESSIONKEY}
+  MD_ROOT_ENABLE_EDIT_WHILE_RUNNING                 = 9998;
+  {$EXTERNALSYM MD_ROOT_ENABLE_EDIT_WHILE_RUNNING}
+  MD_GLOBAL_CHANGE_NUMBER                           = 9997;
+  {$EXTERNALSYM MD_GLOBAL_CHANGE_NUMBER}
+  MD_ROOT_ENABLE_HISTORY                            = 9996;
+  {$EXTERNALSYM MD_ROOT_ENABLE_HISTORY}
+  MD_ROOT_MAX_HISTORY_FILES                         = 9995;
+  {$EXTERNALSYM MD_ROOT_MAX_HISTORY_FILES}
+  MD_GLOBAL_EDIT_WHILE_RUNNING_MAJOR_VERSION_NUMBER = 9994;
+  {$EXTERNALSYM MD_GLOBAL_EDIT_WHILE_RUNNING_MAJOR_VERSION_NUMBER}
+  MD_GLOBAL_EDIT_WHILE_RUNNING_MINOR_VERSION_NUMBER = 9993;
+  {$EXTERNALSYM MD_GLOBAL_EDIT_WHILE_RUNNING_MINOR_VERSION_NUMBER}
+  MD_GLOBAL_XMLSCHEMATIMESTAMP                      = 9992;
+  {$EXTERNALSYM MD_GLOBAL_XMLSCHEMATIMESTAMP}
+  MD_GLOBAL_BINSCHEMATIMESTAMP                      = 9991;
+  {$EXTERNALSYM MD_GLOBAL_BINSCHEMATIMESTAMP}
+  MD_COMMENTS                                       = 9990;
+  {$EXTERNALSYM MD_COMMENTS}
+  MD_LOCATION                                       = 9989;
+  {$EXTERNALSYM MD_LOCATION}
+  MD_MAX_ERROR_FILES                                = 9988;
+  {$EXTERNALSYM MD_MAX_ERROR_FILES}
+
+//
+//  Valid values for MD_AUTHORIZATION
+//
+
+  MD_AUTH_ANONYMOUS = $00000001;
+  {$EXTERNALSYM MD_AUTH_ANONYMOUS}
+  MD_AUTH_BASIC     = $00000002;
+  {$EXTERNALSYM MD_AUTH_BASIC}
+  MD_AUTH_NT        = $00000004; // Use NT auth provider (like NTLM)
+  {$EXTERNALSYM MD_AUTH_NT}
+  MD_AUTH_PASSPORT  = $00000040;
+  {$EXTERNALSYM MD_AUTH_PASSPORT}
+
+//
+//  Valid values for MD_AUTHORIZATION_PERSISTENCE
+//
+
+  MD_AUTH_SINGLEREQUEST              = $00000040;
+  {$EXTERNALSYM MD_AUTH_SINGLEREQUEST}
+  MD_AUTH_SINGLEREQUESTIFPROXY       = $00000080;
+  {$EXTERNALSYM MD_AUTH_SINGLEREQUESTIFPROXY}
+  MD_AUTH_SINGLEREQUESTALWAYSIFPROXY = $00000100;
+  {$EXTERNALSYM MD_AUTH_SINGLEREQUESTALWAYSIFPROXY}
+
+//
+//  Valid values for MD_ACCESS_PERM
+//
+
+  MD_ACCESS_READ              = $00000001; // Allow for Read
+  {$EXTERNALSYM MD_ACCESS_READ}
+  MD_ACCESS_WRITE             = $00000002; // Allow for Write
+  {$EXTERNALSYM MD_ACCESS_WRITE}
+  MD_ACCESS_EXECUTE           = $00000004; // Allow for Execute
+  {$EXTERNALSYM MD_ACCESS_EXECUTE}
+  MD_ACCESS_SOURCE            = $00000010; // Apply access mask to source
+  {$EXTERNALSYM MD_ACCESS_SOURCE}
+  MD_ACCESS_SCRIPT            = $00000200; // Allow for Script execution
+  {$EXTERNALSYM MD_ACCESS_SCRIPT}
+  MD_ACCESS_NO_REMOTE_WRITE   = $00000400; // Local host access only
+  {$EXTERNALSYM MD_ACCESS_NO_REMOTE_WRITE}
+  MD_ACCESS_NO_REMOTE_READ    = $00001000; // Local host access only
+  {$EXTERNALSYM MD_ACCESS_NO_REMOTE_READ}
+  MD_ACCESS_NO_REMOTE_EXECUTE = $00002000; // Local host access only
+  {$EXTERNALSYM MD_ACCESS_NO_REMOTE_EXECUTE}
+  MD_ACCESS_NO_REMOTE_SCRIPT  = $00004000; // Local host access only
+  {$EXTERNALSYM MD_ACCESS_NO_REMOTE_SCRIPT}
+  MD_ACCESS_NO_PHYSICAL_DIR   = $00008000; // VR maps to no physical path
+  {$EXTERNALSYM MD_ACCESS_NO_PHYSICAL_DIR}
+
+  MD_NONSSL_ACCESS_MASK = (MD_ACCESS_READ or MD_ACCESS_WRITE or MD_ACCESS_EXECUTE or
+    MD_ACCESS_SOURCE or MD_ACCESS_SCRIPT or MD_ACCESS_NO_REMOTE_READ or
+    MD_ACCESS_NO_REMOTE_WRITE or MD_ACCESS_NO_REMOTE_EXECUTE or MD_ACCESS_NO_REMOTE_SCRIPT or
+    MD_ACCESS_NO_PHYSICAL_DIR);
+  {$EXTERNALSYM MD_NONSSL_ACCESS_MASK}
+
+//
+//  Valid values for MD_SSL_ACCESS_PERM
+//
+
+  MD_ACCESS_SSL          = $00000008; // Require SSL
+  {$EXTERNALSYM MD_ACCESS_SSL}
+  MD_ACCESS_NEGO_CERT    = $00000020; // Allow client SSL certs
+  {$EXTERNALSYM MD_ACCESS_NEGO_CERT}
+  MD_ACCESS_REQUIRE_CERT = $00000040; // Require client SSL certs
+  {$EXTERNALSYM MD_ACCESS_REQUIRE_CERT}
+  MD_ACCESS_MAP_CERT     = $00000080; // Map SSL cert to NT account
+  {$EXTERNALSYM MD_ACCESS_MAP_CERT}
+  MD_ACCESS_SSL128       = $00000100; // Require 128 bit SSL
+  {$EXTERNALSYM MD_ACCESS_SSL128}
+
+  MD_SSL_ACCESS_MASK = MD_ACCESS_SSL or MD_ACCESS_NEGO_CERT or MD_ACCESS_REQUIRE_CERT or MD_ACCESS_MAP_CERT or MD_ACCESS_SSL128;
+  {$EXTERNALSYM MD_SSL_ACCESS_MASK}
+
+  MD_ACCESS_MASK = $0000ffff;
+  {$EXTERNALSYM MD_ACCESS_MASK}
+
+//
+//  Valid values for MD_DIRECTORY_BROWSING
+//
+
+  MD_DIRBROW_SHOW_DATE      = $00000002;
+  {$EXTERNALSYM MD_DIRBROW_SHOW_DATE}
+  MD_DIRBROW_SHOW_TIME      = $00000004;
+  {$EXTERNALSYM MD_DIRBROW_SHOW_TIME}
+  MD_DIRBROW_SHOW_SIZE      = $00000008;
+  {$EXTERNALSYM MD_DIRBROW_SHOW_SIZE}
+  MD_DIRBROW_SHOW_EXTENSION = $00000010;
+  {$EXTERNALSYM MD_DIRBROW_SHOW_EXTENSION}
+  MD_DIRBROW_LONG_DATE      = $00000020;
+  {$EXTERNALSYM MD_DIRBROW_LONG_DATE}
+
+  MD_DIRBROW_ENABLED     = DWORD($80000000); // Allow directory browsing
+  {$EXTERNALSYM MD_DIRBROW_ENABLED}
+  MD_DIRBROW_LOADDEFAULT = $40000000; // Load default doc if exists
+  {$EXTERNALSYM MD_DIRBROW_LOADDEFAULT}
+
+  MD_DIRBROW_MASK = (MD_DIRBROW_SHOW_DATE or MD_DIRBROW_SHOW_TIME or MD_DIRBROW_SHOW_SIZE or
+    MD_DIRBROW_SHOW_EXTENSION or MD_DIRBROW_LONG_DATE or MD_DIRBROW_LOADDEFAULT or MD_DIRBROW_ENABLED);
+  {$EXTERNALSYM MD_DIRBROW_MASK}
+
+//
+//  Valid values for MD_LOGON_METHOD
+//
+
+  MD_LOGON_INTERACTIVE       = 0;
+  {$EXTERNALSYM MD_LOGON_INTERACTIVE}
+  MD_LOGON_BATCH             = 1;
+  {$EXTERNALSYM MD_LOGON_BATCH}
+  MD_LOGON_NETWORK           = 2;
+  {$EXTERNALSYM MD_LOGON_NETWORK}
+  MD_LOGON_NETWORK_CLEARTEXT = 3;
+  {$EXTERNALSYM MD_LOGON_NETWORK_CLEARTEXT}
+
+//
+//  Valid values for MD_PASSPORT_REQUIRE_AD_MAPPING
+//
+
+  MD_PASSPORT_NO_MAPPING    = 0;
+  {$EXTERNALSYM MD_PASSPORT_NO_MAPPING}
+  MD_PASSPORT_TRY_MAPPING   = 1;
+  {$EXTERNALSYM MD_PASSPORT_TRY_MAPPING}
+  MD_PASSPORT_NEED_MAPPING  = 2;
+  {$EXTERNALSYM MD_PASSPORT_NEED_MAPPING}
+
+//
+// Valid values for MD_NOTIFY_EXAUTH
+//
+
+  MD_NOTIFEXAUTH_NTLMSSL = 1;
+  {$EXTERNALSYM MD_NOTIFEXAUTH_NTLMSSL}
+
+//
+//  Valid values for MD_FILTER_STATE
+//
+
+  MD_FILTER_STATE_LOADED   = 1;
+  {$EXTERNALSYM MD_FILTER_STATE_LOADED}
+  MD_FILTER_STATE_UNLOADED = 4;
+  {$EXTERNALSYM MD_FILTER_STATE_UNLOADED}
+
+//
+//  Valid values for MD_SERVER_STATE
+//
+
+  MD_SERVER_STATE_STARTING   = 1;
+  {$EXTERNALSYM MD_SERVER_STATE_STARTING}
+  MD_SERVER_STATE_STARTED    = 2;
+  {$EXTERNALSYM MD_SERVER_STATE_STARTED}
+  MD_SERVER_STATE_STOPPING   = 3;
+  {$EXTERNALSYM MD_SERVER_STATE_STOPPING}
+  MD_SERVER_STATE_STOPPED    = 4;
+  {$EXTERNALSYM MD_SERVER_STATE_STOPPED}
+  MD_SERVER_STATE_PAUSING    = 5;
+  {$EXTERNALSYM MD_SERVER_STATE_PAUSING}
+  MD_SERVER_STATE_PAUSED     = 6;
+  {$EXTERNALSYM MD_SERVER_STATE_PAUSED}
+  MD_SERVER_STATE_CONTINUING = 7;
+  {$EXTERNALSYM MD_SERVER_STATE_CONTINUING}
+
+//
+//  Valid values for MD_SERVER_COMMAND
+//
+
+  MD_SERVER_COMMAND_START    = 1;
+  {$EXTERNALSYM MD_SERVER_COMMAND_START}
+  MD_SERVER_COMMAND_STOP     = 2;
+  {$EXTERNALSYM MD_SERVER_COMMAND_STOP}
+  MD_SERVER_COMMAND_PAUSE    = 3;
+  {$EXTERNALSYM MD_SERVER_COMMAND_PAUSE}
+  MD_SERVER_COMMAND_CONTINUE = 4;
+  {$EXTERNALSYM MD_SERVER_COMMAND_CONTINUE}
+
+//
+//  Valid values for MD_SERVER_SIZE
+//
+
+  MD_SERVER_SIZE_SMALL  = 0;
+  {$EXTERNALSYM MD_SERVER_SIZE_SMALL}
+  MD_SERVER_SIZE_MEDIUM = 1;
+  {$EXTERNALSYM MD_SERVER_SIZE_MEDIUM}
+  MD_SERVER_SIZE_LARGE  = 2;
+  {$EXTERNALSYM MD_SERVER_SIZE_LARGE}
+
+//
+// Valid values for MD_SERVER_CONFIG_INFO
+//
+
+  MD_SERVER_CONFIG_SSL_40        = $00000001;
+  {$EXTERNALSYM MD_SERVER_CONFIG_SSL_40}
+  MD_SERVER_CONFIG_SSL_128       = $00000002;
+  {$EXTERNALSYM MD_SERVER_CONFIG_SSL_128}
+  MD_SERVER_CONFIG_ALLOW_ENCRYPT = $00000004;
+  {$EXTERNALSYM MD_SERVER_CONFIG_ALLOW_ENCRYPT}
+  MD_SERVER_CONFIG_AUTO_PW_SYNC  = $00000008;
+  {$EXTERNALSYM MD_SERVER_CONFIG_AUTO_PW_SYNC}
+
+  // todo MD_SERVER_CONFIG_ENCRYPT unknown!
+  //MD_SERVER_CONFIGURATION_MASK = MD_SERVER_CONFIG_SSL_40 or MD_SERVER_CONFIG_SSL_128 or MD_SERVER_CONFIG_ENCRYPT or MD_SERVER_CONFIG_AUTO_PW_SYNC;
+  //{$EXTERNALSYM MD_SERVER_CONFIGURATION_MASK}
+
+//
+// Valid values for MD_SCRIPT_MAPS flag field
+//
+
+  MD_SCRIPTMAPFLAG_SCRIPT          = $00000001;
+  {$EXTERNALSYM MD_SCRIPTMAPFLAG_SCRIPT}
+  MD_SCRIPTMAPFLAG_CHECK_PATH_INFO = $00000004;
+  {$EXTERNALSYM MD_SCRIPTMAPFLAG_CHECK_PATH_INFO}
+
+//
+//  Bogus value - do not use
+//
+
+  MD_SCRIPTMAPFLAG_ALLOWED_ON_READ_DIR = $00000001;
+  {$EXTERNALSYM MD_SCRIPTMAPFLAG_ALLOWED_ON_READ_DIR}
+
+//
+// Valid values for MD_AUTH_CHANGE_ENABLE
+//
+
+  MD_AUTH_CHANGE_UNSECURE   = $00000001;
+  {$EXTERNALSYM MD_AUTH_CHANGE_UNSECURE}
+  MD_AUTH_CHANGE_DISABLE    = $00000002;
+  {$EXTERNALSYM MD_AUTH_CHANGE_DISABLE}
+  MD_AUTH_ADVNOTIFY_DISABLE = $00000004;
+  {$EXTERNALSYM MD_AUTH_ADVNOTIFY_DISABLE}
+
+//
+//  Valide substatus errors for MD_CUSTOM_ERROR
+//
+
+  MD_ERROR_SUB401_LOGON        = 1;
+  {$EXTERNALSYM MD_ERROR_SUB401_LOGON}
+  MD_ERROR_SUB401_LOGON_CONFIG = 2;
+  {$EXTERNALSYM MD_ERROR_SUB401_LOGON_CONFIG}
+  MD_ERROR_SUB401_LOGON_ACL    = 3;
+  {$EXTERNALSYM MD_ERROR_SUB401_LOGON_ACL}
+  MD_ERROR_SUB401_FILTER       = 4;
+  {$EXTERNALSYM MD_ERROR_SUB401_FILTER}
+  MD_ERROR_SUB401_APPLICATION  = 5;
+  {$EXTERNALSYM MD_ERROR_SUB401_APPLICATION}
+  MD_ERROR_SUB401_URLAUTH_POLICY = 7;
+  {$EXTERNALSYM MD_ERROR_SUB401_URLAUTH_POLICY}
+
+  MD_ERROR_SUB403_EXECUTE_ACCESS_DENIED = 1;
+  {$EXTERNALSYM MD_ERROR_SUB403_EXECUTE_ACCESS_DENIED}
+  MD_ERROR_SUB403_READ_ACCESS_DENIED    = 2;
+  {$EXTERNALSYM MD_ERROR_SUB403_READ_ACCESS_DENIED}
+  MD_ERROR_SUB403_WRITE_ACCESS_DENIED   = 3;
+  {$EXTERNALSYM MD_ERROR_SUB403_WRITE_ACCESS_DENIED}
+  MD_ERROR_SUB403_SSL_REQUIRED          = 4;
+  {$EXTERNALSYM MD_ERROR_SUB403_SSL_REQUIRED}
+  MD_ERROR_SUB403_SSL128_REQUIRED       = 5;
+  {$EXTERNALSYM MD_ERROR_SUB403_SSL128_REQUIRED}
+  MD_ERROR_SUB403_ADDR_REJECT           = 6;
+  {$EXTERNALSYM MD_ERROR_SUB403_ADDR_REJECT}
+  MD_ERROR_SUB403_CERT_REQUIRED         = 7;
+  {$EXTERNALSYM MD_ERROR_SUB403_CERT_REQUIRED}
+  MD_ERROR_SUB403_SITE_ACCESS_DENIED    = 8;
+  {$EXTERNALSYM MD_ERROR_SUB403_SITE_ACCESS_DENIED}
+  MD_ERROR_SUB403_TOO_MANY_USERS        = 9;
+  {$EXTERNALSYM MD_ERROR_SUB403_TOO_MANY_USERS}
+  MD_ERROR_SUB403_INVALID_CNFG          = 10;
+  {$EXTERNALSYM MD_ERROR_SUB403_INVALID_CNFG}
+  MD_ERROR_SUB403_PWD_CHANGE            = 11;
+  {$EXTERNALSYM MD_ERROR_SUB403_PWD_CHANGE}
+  MD_ERROR_SUB403_MAPPER_DENY_ACCESS    = 12;
+  {$EXTERNALSYM MD_ERROR_SUB403_MAPPER_DENY_ACCESS}
+  MD_ERROR_SUB403_CERT_REVOKED          = 13;
+  {$EXTERNALSYM MD_ERROR_SUB403_CERT_REVOKED}
+  MD_ERROR_SUB403_DIR_LIST_DENIED       = 14;
+  {$EXTERNALSYM MD_ERROR_SUB403_DIR_LIST_DENIED}
+  MD_ERROR_SUB403_CAL_EXCEEDED          = 15;
+  {$EXTERNALSYM MD_ERROR_SUB403_CAL_EXCEEDED}
+  MD_ERROR_SUB403_CERT_BAD              = 16;
+  {$EXTERNALSYM MD_ERROR_SUB403_CERT_BAD}
+  MD_ERROR_SUB403_CERT_TIME_INVALID     = 17;
+  {$EXTERNALSYM MD_ERROR_SUB403_CERT_TIME_INVALID}
+  MD_ERROR_SUB403_APPPOOL_DENIED        = 18;
+  {$EXTERNALSYM MD_ERROR_SUB403_APPPOOL_DENIED}
+  MD_ERROR_SUB403_INSUFFICIENT_PRIVILEGE_FOR_CGI = 19;
+  {$EXTERNALSYM MD_ERROR_SUB403_INSUFFICIENT_PRIVILEGE_FOR_CGI}
+  MD_ERROR_SUB403_PASSPORT_LOGIN_FAILURE = 20;
+  {$EXTERNALSYM MD_ERROR_SUB403_PASSPORT_LOGIN_FAILURE}
+
+  MD_ERROR_SUB404_SITE_NOT_FOUND       = 1;
+  {$EXTERNALSYM MD_ERROR_SUB404_SITE_NOT_FOUND}
+  MD_ERROR_SUB404_DENIED_BY_POLICY     = 2;
+  {$EXTERNALSYM MD_ERROR_SUB404_DENIED_BY_POLICY}
+  MD_ERROR_SUB404_DENIED_BY_MIMEMAP    = 3;
+  {$EXTERNALSYM MD_ERROR_SUB404_DENIED_BY_MIMEMAP}
+
+  MD_ERROR_SUB500_UNC_ACCESS           = 16;
+  {$EXTERNALSYM MD_ERROR_SUB500_UNC_ACCESS}
+  MD_ERROR_SUB500_URLAUTH_NO_STORE     = 17;
+  {$EXTERNALSYM MD_ERROR_SUB500_URLAUTH_NO_STORE}
+  MD_ERROR_SUB500_URLAUTH_STORE_ERROR  = 18;
+  {$EXTERNALSYM MD_ERROR_SUB500_URLAUTH_STORE_ERROR}
+  MD_ERROR_SUB500_BAD_METADATA         = 19;
+  {$EXTERNALSYM MD_ERROR_SUB500_BAD_METADATA}
+  MD_ERROR_SUB500_URLAUTH_NO_SCOPE     = 20;
+  {$EXTERNALSYM MD_ERROR_SUB500_URLAUTH_NO_SCOPE}
+
+  MD_ERROR_SUB502_TIMEOUT        = 1;
+  {$EXTERNALSYM MD_ERROR_SUB502_TIMEOUT}
+  MD_ERROR_SUB502_PREMATURE_EXIT = 2;
+  {$EXTERNALSYM MD_ERROR_SUB502_PREMATURE_EXIT}
+
+  MD_ERROR_SUB503_CPU_LIMIT = 1;
+  {$EXTERNALSYM MD_ERROR_SUB503_CPU_LIMIT}
+
+//
+// Valid access rights for ACE entries in MD_ADMIN_ACL
+//
+
+  MD_ACR_READ                = $00000001;
+  {$EXTERNALSYM MD_ACR_READ}
+  MD_ACR_WRITE               = $00000002;
+  {$EXTERNALSYM MD_ACR_WRITE}
+  MD_ACR_RESTRICTED_WRITE    = $00000020;
+  {$EXTERNALSYM MD_ACR_RESTRICTED_WRITE}
+  MD_ACR_UNSECURE_PROPS_READ = $00000080;
+  {$EXTERNALSYM MD_ACR_UNSECURE_PROPS_READ}
+  MD_ACR_ENUM_KEYS           = $00000008;
+  {$EXTERNALSYM MD_ACR_ENUM_KEYS}
+  MD_ACR_WRITE_DAC           = $00040000;
+  {$EXTERNALSYM MD_ACR_WRITE_DAC}
+
+//
+// Valid modes for MD_USER_ISOLATION
+//
+
+  MD_USER_ISOLATION_NONE    = 0;
+  {$EXTERNALSYM MD_USER_ISOLATION_NONE}
+  MD_USER_ISOLATION_BASIC   = 1;
+  {$EXTERNALSYM MD_USER_ISOLATION_BASIC}
+  MD_USER_ISOLATION_AD      = 2;
+  {$EXTERNALSYM MD_USER_ISOLATION_AD}
+  MD_USER_ISOLATION_LAST    = 2;
+  {$EXTERNALSYM MD_USER_ISOLATION_LAST}
+
+//
+// MD_IP_SEC binary format description
+//
+
+(*
+
+  This object is composed of 4 lists : 2 lists ( deny & grant ) of network addresses,
+  the only allowed family is AF_INET.
+  Each of this list is composed of sublists, one for each ( network address family,
+  significant subnet mask ) combination. The significant subnet mask is stored as
+  ( number of bytes all 1 ( 0xff ), bitmask in last byte ).
+  This is followed by 2 lists ( deny & grant ) of DNS names. Each of these lists is
+  composed of sublists, based on then number of components in the DNS name
+  e.g. "microsoft.com" has 2 components, "www.msft.com" has 3.
+
+Header:
+    SELFREFINDEX    iDenyAddr;      // address deny list
+                                    // points to ADDRESS_HEADER
+    SELFREFINDEX    iGrantAddr;     // address grant list
+                                    // points to ADDRESS_HEADER
+    SELFREFINDEX    iDenyName;      // DNS name deny list
+                                    // points to NAME_HEADER
+    SELFREFINDEX    iGrantName;     // DNS name grant list
+                                    // points to NAME_HEADER
+    DWORD           dwFlags;
+    DWORD           cRefSize;       // size of reference area ( in bytes )
+
+ADDRESS_HEADER :
+    DWORD               cEntries;   // # of Entries[]
+    DWORD               cAddresses; // total # of addresses in all
+                                    // ADDRESS_LIST_ENTRY
+    ADDRESS_LIST_ENTRY  Entries[];
+
+ADDRESS_LIST_ENTRY :
+    DWORD           iFamily;
+    DWORD           cAddresses;
+    DWORD           cFullBytes;
+    DWORD           LastByte;
+    SELFREFINDEX    iFirstAddress;  // points to array of addresses
+
+NAME_HEADER :
+    DWORD           cEntries;
+    DWORD           cNames;         // total # of names for all Entries[]
+    NAME_LIST_ENTRY Entries[];
+
+Name list entry :
+    DWORD           cComponents;    // # of DNS components
+    DWORD           cNames;
+    SELFREFINDEX    iName[];        // array of references to DNS names
+
+This is followed by address arrays & names pointed to by iFirstAddress & iName
+Names are '\0' delimited
+
+SELFREFINDEX is a DWORD offset from start of structure with high bit set to 1
+
+*)
+
+//
+// Macros
+//
+
+{TODO structure declaration is in generated file
+procedure MD_SET_DATA_RECORD(_pMDR, _id, _attr, _utype, _dtype, _dlen, _pData);
+}
+
+//
+// IIS ADSI Admin Object class names
+//
+
+  IIS_CLASS_COMPUTER         = 'IIsComputer';
+  {$EXTERNALSYM IIS_CLASS_COMPUTER}
+  IIS_CLASS_WEB_SERVICE      = 'IIsWebService';
+  {$EXTERNALSYM IIS_CLASS_WEB_SERVICE}
+  IIS_CLASS_WEB_SERVER       = 'IIsWebServer';
+  {$EXTERNALSYM IIS_CLASS_WEB_SERVER}
+  IIS_CLASS_WEB_INFO         = 'IIsWebInfo';
+  {$EXTERNALSYM IIS_CLASS_WEB_INFO}
+  IIS_CLASS_WEB_DIR          = 'IIsWebDirectory';
+  {$EXTERNALSYM IIS_CLASS_WEB_DIR}
+  IIS_CLASS_WEB_VDIR         = 'IIsWebVirtualDir';
+  {$EXTERNALSYM IIS_CLASS_WEB_VDIR}
+  IIS_CLASS_WEB_FILE         = 'IIsWebFile';
+  {$EXTERNALSYM IIS_CLASS_WEB_FILE}
+  IIS_CLASS_FTP_SERVICE      = 'IIsFtpService';
+  {$EXTERNALSYM IIS_CLASS_FTP_SERVICE}
+  IIS_CLASS_FTP_SERVER       = 'IIsFtpServer';
+  {$EXTERNALSYM IIS_CLASS_FTP_SERVER}
+  IIS_CLASS_FTP_INFO         = 'IIsFtpInfo';
+  {$EXTERNALSYM IIS_CLASS_FTP_INFO}
+  IIS_CLASS_FTP_VDIR         = 'IIsFtpVirtualDir';
+  {$EXTERNALSYM IIS_CLASS_FTP_VDIR}
+  IIS_CLASS_FILTERS          = 'IIsFilters';
+  {$EXTERNALSYM IIS_CLASS_FILTERS}
+  IIS_CLASS_FILTER           = 'IIsFilter';
+  {$EXTERNALSYM IIS_CLASS_FILTER}
+  IIS_CLASS_LOG_MODULES      = 'IIsLogModules';
+  {$EXTERNALSYM IIS_CLASS_LOG_MODULES}
+  IIS_CLASS_LOG_MODULE       = 'IIsLogModule';
+  {$EXTERNALSYM IIS_CLASS_LOG_MODULE}
+  IIS_CLASS_MIMEMAP          = 'IIsMimeMap';
+  {$EXTERNALSYM IIS_CLASS_MIMEMAP}
+  IIS_CLASS_CERTMAPPER       = 'IIsCertMapper';
+  {$EXTERNALSYM IIS_CLASS_CERTMAPPER}
+  IIS_CLASS_COMPRESS_SCHEMES = 'IIsCompressionSchemes';
+  {$EXTERNALSYM IIS_CLASS_COMPRESS_SCHEMES}
+  IIS_CLASS_COMPRESS_SCHEME  = 'IIsCompressionScheme';
+  {$EXTERNALSYM IIS_CLASS_COMPRESS_SCHEME}
+
+  IIS_CLASS_COMPUTER_W         = WideString('IIsComputer');
+  {$EXTERNALSYM IIS_CLASS_COMPUTER_W}
+  IIS_CLASS_WEB_SERVICE_W      = WideString('IIsWebService');
+  {$EXTERNALSYM IIS_CLASS_WEB_SERVICE_W}
+  IIS_CLASS_WEB_SERVER_W       = WideString('IIsWebServer');
+  {$EXTERNALSYM IIS_CLASS_WEB_SERVER_W}
+  IIS_CLASS_WEB_INFO_W         = WideString('IIsWebInfo');
+  {$EXTERNALSYM IIS_CLASS_WEB_INFO_W}
+  IIS_CLASS_WEB_DIR_W          = WideString('IIsWebDirectory');
+  {$EXTERNALSYM IIS_CLASS_WEB_DIR_W}
+  IIS_CLASS_WEB_VDIR_W         = WideString('IIsWebVirtualDir');
+  {$EXTERNALSYM IIS_CLASS_WEB_VDIR_W}
+  IIS_CLASS_WEB_FILE_W         = WideString('IIsWebFile');
+  {$EXTERNALSYM IIS_CLASS_WEB_FILE_W}
+  IIS_CLASS_FTP_SERVICE_W      = WideString('IIsFtpService');
+  {$EXTERNALSYM IIS_CLASS_FTP_SERVICE_W}
+  IIS_CLASS_FTP_SERVER_W       = WideString('IIsFtpServer');
+  {$EXTERNALSYM IIS_CLASS_FTP_SERVER_W}
+  IIS_CLASS_FTP_INFO_W         = WideString('IIsFtpInfo');
+  {$EXTERNALSYM IIS_CLASS_FTP_INFO_W}
+  IIS_CLASS_FTP_VDIR_W         = WideString('IIsFtpVirtualDir');
+  {$EXTERNALSYM IIS_CLASS_FTP_VDIR_W}
+  IIS_CLASS_FILTERS_W          = WideString('IIsFilters');
+  {$EXTERNALSYM IIS_CLASS_FILTERS_W}
+  IIS_CLASS_FILTER_W           = WideString('IIsFilter');
+  {$EXTERNALSYM IIS_CLASS_FILTER_W}
+  IIS_CLASS_LOG_MODULES_W      = WideString('IIsLogModules');
+  {$EXTERNALSYM IIS_CLASS_LOG_MODULES_W}
+  IIS_CLASS_LOG_MODULE_W       = WideString('IIsLogModule');
+  {$EXTERNALSYM IIS_CLASS_LOG_MODULE_W}
+  IIS_CLASS_MIMEMAP_W          = WideString('IIsMimeMap');
+  {$EXTERNALSYM IIS_CLASS_MIMEMAP_W}
+  IIS_CLASS_CERTMAPPER_W       = WideString('IIsCertMapper');
+  {$EXTERNALSYM IIS_CLASS_CERTMAPPER_W}
+  IIS_CLASS_COMPRESS_SCHEMES_W = WideString('IIsCompressionSchemes');
+  {$EXTERNALSYM IIS_CLASS_COMPRESS_SCHEMES_W}
+  IIS_CLASS_COMPRESS_SCHEME_W  = WideString('IIsCompressionScheme');
+  {$EXTERNALSYM IIS_CLASS_COMPRESS_SCHEME_W}
+
+implementation
+
+{TODO structure declaration is in generated file
+procedure MD_SET_DATA_RECORD(_pMDR: Pointer; _id, _attr, _utype, _dtype, _dlen: DWORD; _pData: Pointer);
+begin
+  _pMDR^.dwMDIdentifier := _id;
+  _pMDR^.dwMDAttributes := _attr;
+  _pMDR^.dwMDUserType   := _utype;
+  _pMDR^.dwMDDataType   := _dtype;
+  _pMDR^.dwMDDataLen    := _dlen;
+  _pMDR^.pbMDData       := LPBYTE(_pData);
+end;
+}
+
+end.
+

+ 4402 - 0
packages/extra/winunits/jwaimagehlp.pas

@@ -0,0 +1,4402 @@
+{******************************************************************************}
+{                                                                              }
+{ Image Help API interface Unit for Object Pascal                              }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: imagehlp.h, released August 2001. The original Pascal  }
+{ code is: ImageHelp.pas, released December 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaImageHlp;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "ImageHlp.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  Windows, JwaWinBase, JwaWinNT, JwaWinType;
+
+const
+  IMAGE_SEPARATION = 64*1024;
+  {$EXTERNALSYM IMAGE_SEPARATION}
+
+type
+  PLOADED_IMAGE = ^LOADED_IMAGE;
+  {$EXTERNALSYM PLOADED_IMAGE}
+  _LOADED_IMAGE = record
+    ModuleName: PSTR;
+    hFile: HANDLE;
+    MappedAddress: PUCHAR;
+    FileHeader: PIMAGE_NT_HEADERS32;
+    LastRvaSection: PIMAGE_SECTION_HEADER;
+    NumberOfSections: ULONG;
+    Sections: PIMAGE_SECTION_HEADER;
+    Characteristics: ULONG;
+    fSystemImage: ByteBool;
+    fDOSImage: ByteBool;
+    Links: LIST_ENTRY;
+    SizeOfImage: ULONG;
+  end;
+  {$EXTERNALSYM _LOADED_IMAGE}
+  LOADED_IMAGE = _LOADED_IMAGE;
+  {$EXTERNALSYM LOADED_IMAGE}
+  TLoadedImage = LOADED_IMAGE;
+  PLoadedImage = PLOADED_IMAGE;
+
+const
+  MAX_SYM_NAME = 2000;
+  {$EXTERNALSYM MAX_SYM_NAME}
+
+function BindImage(ImageName, DllPath, SymbolPath: PSTR): BOOL; stdcall;
+{$EXTERNALSYM BindImage}
+
+type
+  _IMAGEHLP_STATUS_REASON = (
+    BindOutOfMemory,
+    BindRvaToVaFailed,
+    BindNoRoomInImage,
+    BindImportModuleFailed,
+    BindImportProcedureFailed,
+    BindImportModule,
+    BindImportProcedure,
+    BindForwarder,
+    BindForwarderNOT,
+    BindImageModified,
+    BindExpandFileHeaders,
+    BindImageComplete,
+    BindMismatchedSymbols,
+    BindSymbolsNotUpdated,
+    BindImportProcedure32,
+    BindImportProcedure64,
+    BindForwarder32,
+    BindForwarder64,
+    BindForwarderNOT32,
+    BindForwarderNOT64);
+  {$EXTERNALSYM _IMAGEHLP_STATUS_REASON}
+  IMAGEHLP_STATUS_REASON = _IMAGEHLP_STATUS_REASON;
+  {$EXTERNALSYM IMAGEHLP_STATUS_REASON}
+  TImageHlpStatusReason = IMAGEHLP_STATUS_REASON;
+
+  PIMAGEHLP_STATUS_ROUTINE = function(Reason: IMAGEHLP_STATUS_REASON;
+    ImageName, DllName: PSTR; Va, Parameter: ULONG_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PIMAGEHLP_STATUS_ROUTINE}
+  PImageHlpStatusRoutine = PIMAGEHLP_STATUS_ROUTINE;
+
+  PIMAGEHLP_STATUS_ROUTINE32 = function(Reason: IMAGEHLP_STATUS_REASON; ImageName, DllName: PSTR;
+    Va: ULONG; Parameter: ULONG_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PIMAGEHLP_STATUS_ROUTINE32}
+  PImageHlpStatusRoutine23 = PIMAGEHLP_STATUS_ROUTINE32;
+
+  PIMAGEHLP_STATUS_ROUTINE64 = function(Reason: IMAGEHLP_STATUS_REASON; ImageName, DllName: PSTR;
+    Va: ULONG64; Parameter: ULONG_PTR): BOOL; stdcall;
+  {$EXTERNALSYM PIMAGEHLP_STATUS_ROUTINE64}
+  PImageHlpStatusRoutine64 = PIMAGEHLP_STATUS_ROUTINE64;
+
+function BindImageEx(Flags: DWORD; ImageName, DllPath, SymbolPath: PSTR;
+  StatusRoutine: PIMAGEHLP_STATUS_ROUTINE): BOOL; stdcall;
+{$EXTERNALSYM BindImageEx}
+
+const
+  BIND_NO_BOUND_IMPORTS  = $00000001;
+  {$EXTERNALSYM BIND_NO_BOUND_IMPORTS}
+  BIND_NO_UPDATE         = $00000002;
+  {$EXTERNALSYM BIND_NO_UPDATE}
+  BIND_ALL_IMAGES        = $00000004;
+  {$EXTERNALSYM BIND_ALL_IMAGES}
+  BIND_CACHE_IMPORT_DLLS = $00000008; // Cache dll's across calls to BindImageEx (same as NT 3.1->NT 4.0)
+  {$EXTERNALSYM BIND_CACHE_IMPORT_DLLS}
+
+  BIND_REPORT_64BIT_VA   = $00000010;
+  {$EXTERNALSYM BIND_REPORT_64BIT_VA}
+
+function ReBaseImage(CurrentImageName: PSTR; SymbolPath: PSTR; fReBase: BOOL;
+  fRebaseSysfileOk: BOOL; fGoingDown: BOOL; CheckImageSize: ULONG;
+  var OldImageSize: ULONG; var OldImageBase: ULONG_PTR; var NewImageSize: ULONG;
+  var NewImageBase: ULONG_PTR; TimeStamp: ULONG): BOOL; stdcall;
+{$EXTERNALSYM ReBaseImage}
+
+function ReBaseImage64(CurrentImageName: PSTR; SymbolPath: PSTR; fReBase: BOOL;
+  fRebaseSysfileOk: BOOL; fGoingDown: BOOL; CheckImageSize: ULONG;
+  var OldImageSize: ULONG; var OldImageBase: ULONG64; var NewImageSize: ULONG;
+  var NewImageBase: ULONG64; TimeStamp: ULONG): BOOL; stdcall;
+{$EXTERNALSYM ReBaseImage64}
+
+//
+// Define checksum return codes.
+//
+
+const
+  CHECKSUM_SUCCESS         = 0;
+  {$EXTERNALSYM CHECKSUM_SUCCESS}
+  CHECKSUM_OPEN_FAILURE    = 1;
+  {$EXTERNALSYM CHECKSUM_OPEN_FAILURE}
+  CHECKSUM_MAP_FAILURE     = 2;
+  {$EXTERNALSYM CHECKSUM_MAP_FAILURE}
+  CHECKSUM_MAPVIEW_FAILURE = 3;
+  {$EXTERNALSYM CHECKSUM_MAPVIEW_FAILURE}
+  CHECKSUM_UNICODE_FAILURE = 4;
+  {$EXTERNALSYM CHECKSUM_UNICODE_FAILURE}
+
+// Define Splitsym flags.
+
+  SPLITSYM_REMOVE_PRIVATE = $00000001; // Remove CV types/symbols and Fixup debug
+  {$EXTERNALSYM SPLITSYM_REMOVE_PRIVATE}
+                                                    //  Used for creating .dbg files that ship
+                                                    //  as part of the product.
+
+  SPLITSYM_EXTRACT_ALL = $00000002; // Extract all debug info from image.
+  {$EXTERNALSYM SPLITSYM_EXTRACT_ALL}
+                                                    //  Normally, FPO is left in the image
+                                                    //  to allow stack traces through the code.
+                                                    //  Using this switch is similar to linking
+                                                    //  with -debug:none except the .dbg file
+                                                    //  exists...
+
+  SPLITSYM_SYMBOLPATH_IS_SRC = $00000004; // The SymbolFilePath contains an alternate
+  {$EXTERNALSYM SPLITSYM_SYMBOLPATH_IS_SRC}
+                                                    //  path to locate the pdb.
+
+//
+// Define checksum function prototypes.
+//
+
+function CheckSumMappedFile(BaseAddress: PVOID; FileLength: DWORD;
+  var HeaderSum, CheckSum: DWORD): PIMAGE_NT_HEADERS; stdcall;
+{$EXTERNALSYM CheckSumMappedFile}
+
+function MapFileAndCheckSumA(Filename: PSTR; var HeaderSum, CheckSum: DWORD): DWORD; stdcall;
+{$EXTERNALSYM MapFileAndCheckSumA}
+function MapFileAndCheckSumW(Filename: PWSTR; var HeaderSum, CheckSum: DWORD): DWORD; stdcall;
+{$EXTERNALSYM MapFileAndCheckSumW}
+function MapFileAndCheckSum(Filename: PTSTR; var HeaderSum, CheckSum: DWORD): DWORD; stdcall;
+{$EXTERNALSYM MapFileAndCheckSum}
+
+function GetImageConfigInformation(const LoadedImage: LOADED_IMAGE;
+  var ImageConfigInformation: IMAGE_LOAD_CONFIG_DIRECTORY): BOOL; stdcall;
+{$EXTERNALSYM GetImageConfigInformation}
+
+function GetImageUnusedHeaderBytes(const LoadedImage: LOADED_IMAGE;
+  var SizeUnusedHeaderBytes: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetImageUnusedHeaderBytes}
+
+function SetImageConfigInformation(const LoadedImage: LOADED_IMAGE;
+  const ImageConfigInformation: IMAGE_LOAD_CONFIG_DIRECTORY): BOOL; stdcall;
+{$EXTERNALSYM SetImageConfigInformation}
+
+// Image Integrity API's
+
+const
+  CERT_PE_IMAGE_DIGEST_DEBUG_INFO      = $01;
+  {$EXTERNALSYM CERT_PE_IMAGE_DIGEST_DEBUG_INFO}
+  CERT_PE_IMAGE_DIGEST_RESOURCES       = $02;
+  {$EXTERNALSYM CERT_PE_IMAGE_DIGEST_RESOURCES}
+  CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO = $04;
+  {$EXTERNALSYM CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO}
+  CERT_PE_IMAGE_DIGEST_NON_PE_INFO     = $08; // include data outside the PE image
+  {$EXTERNALSYM CERT_PE_IMAGE_DIGEST_NON_PE_INFO}
+
+  CERT_SECTION_TYPE_ANY = $FF; // Any Certificate type
+  {$EXTERNALSYM CERT_SECTION_TYPE_ANY}
+
+type
+  DIGEST_HANDLE = PVOID;
+  {$EXTERNALSYM DIGEST_HANDLE}
+  TDigestHandle = DIGEST_HANDLE;
+
+  DIGEST_FUNCTION = function(refdata: DIGEST_HANDLE; pData: PBYTE; dwLength: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM DIGEST_FUNCTION}
+  TDigestFunction = DIGEST_FUNCTION;
+
+function ImageGetDigestStream(FileHandle: HANDLE; DigestLevel: DWORD;
+  DigestFunction: DIGEST_FUNCTION; DigestHandle: DIGEST_HANDLE): BOOL; stdcall;
+{$EXTERNALSYM ImageGetDigestStream}
+
+function ImageAddCertificate(FileHandle: HANDLE; Certificate: PWinCertificate;
+  var Index: DWORD): BOOL; stdcall;
+{$EXTERNALSYM ImageAddCertificate}
+
+function ImageRemoveCertificate(FileHandle: HANDLE; Index: DWORD): BOOL; stdcall;
+{$EXTERNALSYM ImageRemoveCertificate}
+
+function ImageEnumerateCertificates(FileHandle: HANDLE; TypeFilter: WORD;
+  var CertificateCount: DWORD; Indices: PDWORD; IndexCount: DWORD): BOOL; stdcall;
+{$EXTERNALSYM ImageEnumerateCertificates}
+
+function ImageGetCertificateData(FileHandle: HANDLE; CertificateIndex: DWORD;
+  Certificate: PWinCertificate; var RequiredLength: DWORD): BOOL; stdcall;
+{$EXTERNALSYM ImageGetCertificateData}
+
+function ImageGetCertificateHeader(FileHandle: HANDLE; CertificateIndex: DWORD;
+  Certificateheader: PWinCertificate): BOOL; stdcall;
+{$EXTERNALSYM ImageGetCertificateHeader}
+
+function ImageLoad(DllName: PSTR; DllPath: PSTR): PLOADED_IMAGE; stdcall;
+{$EXTERNALSYM ImageLoad}
+
+function ImageUnload(const LoadedImage: LOADED_IMAGE): BOOL; stdcall;
+{$EXTERNALSYM ImageUnload}
+
+function MapAndLoad(ImageName, DllPath: PSTR; var LoadedImage: LOADED_IMAGE;
+  DotDll: BOOL; ReadOnly: BOOL): BOOL; stdcall;
+{$EXTERNALSYM MapAndLoad}
+
+function UnMapAndLoad(const LoadedImage: LOADED_IMAGE): BOOL; stdcall;
+{$EXTERNALSYM UnMapAndLoad}
+
+function TouchFileTimes(FileHandle: HANDLE; pSystemTime: PSYSTEMTIME): BOOL; stdcall;
+{$EXTERNALSYM TouchFileTimes}
+
+function SplitSymbols(ImageName, SymbolsPath, SymbolFilePath: PSTR; Flags: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SplitSymbols}
+
+function UpdateDebugInfoFile(ImageFileName, SymbolPath, DebugFilePath: PSTR;
+  const NtHeaders: IMAGE_NT_HEADERS32): BOOL; stdcall;
+{$EXTERNALSYM UpdateDebugInfoFile}
+
+function UpdateDebugInfoFileEx(ImageFileName, SymbolPath, DebugFilePath: PSTR;
+  const NtHeaders: IMAGE_NT_HEADERS32; OldChecksum: DWORD): BOOL; stdcall;
+{$EXTERNALSYM UpdateDebugInfoFileEx}
+
+function FindDebugInfoFile(FileName, SymbolPath, DebugFilePath: PSTR): HANDLE; stdcall;
+{$EXTERNALSYM FindDebugInfoFile}
+
+type
+  PFIND_DEBUG_FILE_CALLBACK = function(FileHandle: HANDLE; FileName: PSTR;
+    CallerData: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PFIND_DEBUG_FILE_CALLBACK}
+  PFindDebugFileCallback = PFIND_DEBUG_FILE_CALLBACK;
+
+function FindDebugInfoFileEx(FileName, SymbolPath, DebugFilePath: PSTR;
+  Callback: PFIND_DEBUG_FILE_CALLBACK; CallerData: PVOID): HANDLE; stdcall;
+{$EXTERNALSYM FindDebugInfoFileEx}
+
+type
+  PFINDFILEINPATHCALLBACK = function(filename: PSTR; context: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PFINDFILEINPATHCALLBACK}
+
+function SymFindFileInPath(hprocess: HANDLE; SearchPath, FileName: LPSTR; id: PVOID; two, three, flags: DWORD;
+  FoundFile: LPSTR; callback: PFINDFILEINPATHCALLBACK; context: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymFindFileInPath}
+
+function FindExecutableImage(FileName, SymbolPath, ImageFilePath: PSTR): HANDLE; stdcall;
+{$EXTERNALSYM FindExecutableImage}
+
+type
+  PFIND_EXE_FILE_CALLBACK = function(FileHandle: HANDLE; FileName: PSTR;
+    CallerData: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PFIND_EXE_FILE_CALLBACK}
+  PFindExeFileCallback = PFIND_EXE_FILE_CALLBACK;
+
+function FindExecutableImageEx(FileName, SymbolPath, ImageFilePath: PSTR;
+  Callback: PFIND_EXE_FILE_CALLBACK; CallerData: PVOID): HANDLE; stdcall;
+{$EXTERNALSYM FindExecutableImageEx}
+
+function ImageNtHeader(Base: PVOID): PIMAGE_NT_HEADERS; stdcall;
+{$EXTERNALSYM ImageNtHeader}
+
+function ImageDirectoryEntryToDataEx(Base: PVOID; MappedAsImage: ByteBool;
+  DirectoryEntry: USHORT; var Size: ULONG; var FoundHeader: PIMAGE_SECTION_HEADER): PVOID; stdcall;
+{$EXTERNALSYM ImageDirectoryEntryToDataEx}
+
+function ImageDirectoryEntryToData(Base: PVOID; MappedAsImage: ByteBool;
+  DirectoryEntry: USHORT; var Size: ULONG): PVOID; stdcall;
+{$EXTERNALSYM ImageDirectoryEntryToData}
+
+function ImageRvaToSection(NtHeaders: PIMAGE_NT_HEADERS; Base: PVOID; Rva: ULONG): PIMAGE_SECTION_HEADER; stdcall;
+{$EXTERNALSYM ImageRvaToSection}
+
+function ImageRvaToVa(NtHeaders: PIMAGE_NT_HEADERS; Base: PVOID; Rva: ULONG;
+  var LastRvaSection: PIMAGE_SECTION_HEADER): PVOID; stdcall;
+{$EXTERNALSYM ImageRvaToVa}
+
+// Symbol server exports
+
+type
+  PSYMBOLSERVERPROC = function(a1, a2: LPCSTR; a3: PVOID; a4, a5: DWORD; a6: LPSTR): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERPROC}
+  PSYMBOLSERVEROPENPROC = function: BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVEROPENPROC}
+  PSYMBOLSERVERCLOSEPROC = function: BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERCLOSEPROC}
+  PSYMBOLSERVERSETOPTIONSPROC = function(a1: UINT_PTR; a2: ULONG64): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERSETOPTIONSPROC}
+  PSYMBOLSERVERCALLBACKPROC = function(action: UINT_PTR; data: ULONG64; context: ULONG64): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERCALLBACKPROC}
+  PSYMBOLSERVERGETOPTIONSPROC = function: UINT_PTR; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERGETOPTIONSPROC}
+  PSYMBOLSERVERPINGPROC = function(a1: LPCSTR): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOLSERVERPINGPROC}
+
+const
+  SSRVOPT_CALLBACK   = $01;
+  {$EXTERNALSYM SSRVOPT_CALLBACK}
+  SSRVOPT_DWORD      = $02;
+  {$EXTERNALSYM SSRVOPT_DWORD}
+  SSRVOPT_DWORDPTR   = $04;
+  {$EXTERNALSYM SSRVOPT_DWORDPTR}
+  SSRVOPT_GUIDPTR    = $08;
+  {$EXTERNALSYM SSRVOPT_GUIDPTR}
+  SSRVOPT_OLDGUIDPTR = $10;
+  {$EXTERNALSYM SSRVOPT_OLDGUIDPTR}
+  SSRVOPT_UNATTENDED = $20;
+  {$EXTERNALSYM SSRVOPT_UNATTENDED}
+  SSRVOPT_RESET      = ULONG_PTR(-1);
+  {$EXTERNALSYM SSRVOPT_RESET}
+
+  SSRVACTION_TRACE   = 1;
+  {$EXTERNALSYM SSRVACTION_TRACE}
+
+// This api won't be ported to Win64 - Fix your code.
+
+type
+  PIMAGE_DEBUG_INFORMATION = ^IMAGE_DEBUG_INFORMATION;
+  {$EXTERNALSYM PIMAGE_DEBUG_INFORMATION}
+  _IMAGE_DEBUG_INFORMATION = record
+    List: LIST_ENTRY;
+    ReservedSize: DWORD;
+    ReservedMappedBase: PVOID;
+    ReservedMachine: USHORT;
+    ReservedCharacteristics: USHORT;
+    ReservedCheckSum: DWORD;
+    ImageBase: DWORD;
+    SizeOfImage: DWORD;
+    ReservedNumberOfSections: DWORD;
+    ReservedSections: PIMAGE_SECTION_HEADER;
+    ReservedExportedNamesSize: DWORD;
+    ReservedExportedNames: PSTR;
+    ReservedNumberOfFunctionTableEntries: DWORD;
+    ReservedFunctionTableEntries: PIMAGE_FUNCTION_ENTRY;
+    ReservedLowestFunctionStartingAddress: DWORD;
+    ReservedHighestFunctionEndingAddress: DWORD;
+    ReservedNumberOfFpoTableEntries: DWORD;
+    ReservedFpoTableEntries: PFPO_DATA;
+    SizeOfCoffSymbols: DWORD;
+    CoffSymbols: PIMAGE_COFF_SYMBOLS_HEADER;
+    ReservedSizeOfCodeViewSymbols: DWORD;
+    ReservedCodeViewSymbols: PVOID;
+    ImageFilePath: PSTR;
+    ImageFileName: PSTR;
+    ReservedDebugFilePath: PSTR;
+    ReservedTimeDateStamp: DWORD;
+    ReservedRomImage: BOOL;
+    ReservedDebugDirectory: PIMAGE_DEBUG_DIRECTORY;
+    ReservedNumberOfDebugDirectories: DWORD;
+    ReservedOriginalFunctionTableBaseAddress: DWORD;
+    Reserved: array [0..1] of DWORD;
+  end;
+  {$EXTERNALSYM _IMAGE_DEBUG_INFORMATION}
+  IMAGE_DEBUG_INFORMATION = _IMAGE_DEBUG_INFORMATION;
+  {$EXTERNALSYM IMAGE_DEBUG_INFORMATION}
+  TImageDebugInformation = IMAGE_DEBUG_INFORMATION;
+  PImageDebugInformation = PIMAGE_DEBUG_INFORMATION;
+
+function MapDebugInformation(FileHandle: HANDLE; FileName, SymbolPath: PSTR;
+  ImageBase: DWORD): PIMAGE_DEBUG_INFORMATION; stdcall;
+{$EXTERNALSYM MapDebugInformation}
+
+function UnmapDebugInformation(DebugInfo: PIMAGE_DEBUG_INFORMATION): BOOL; stdcall;
+{$EXTERNALSYM UnmapDebugInformation}
+
+function SearchTreeForFile(RootPath, InputPathName, OutputPathBuffer: PSTR): BOOL; stdcall;
+{$EXTERNALSYM SearchTreeForFile}
+
+type
+  PENUMDIRTREE_CALLBACK = function(FilePath: LPCSTR; CallerData: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PENUMDIRTREE_CALLBACK}
+  PEnumDirTreeCallback = PENUMDIRTREE_CALLBACK;
+
+function EnumDirTree(hProcess: HANDLE; RootPath, InputPathName, OutputPathBuffer: PSTR;
+  Callback: PENUMDIRTREE_CALLBACK; CallbackData: PVOID): BOOL; stdcall;
+{$EXTERNALSYM EnumDirTree}
+
+function MakeSureDirectoryPathExists(DirPath: PCSTR): BOOL; stdcall;
+{$EXTERNALSYM MakeSureDirectoryPathExists}
+
+//
+// UnDecorateSymbolName Flags
+//
+
+const
+  UNDNAME_COMPLETE               = $0000; // Enable full undecoration
+  {$EXTERNALSYM UNDNAME_COMPLETE}
+  UNDNAME_NO_LEADING_UNDERSCORES = $0001; // Remove leading underscores from MS extended keywords
+  {$EXTERNALSYM UNDNAME_NO_LEADING_UNDERSCORES}
+  UNDNAME_NO_MS_KEYWORDS         = $0002; // Disable expansion of MS extended keywords
+  {$EXTERNALSYM UNDNAME_NO_MS_KEYWORDS}
+  UNDNAME_NO_FUNCTION_RETURNS    = $0004; // Disable expansion of return type for primary declaration
+  {$EXTERNALSYM UNDNAME_NO_FUNCTION_RETURNS}
+  UNDNAME_NO_ALLOCATION_MODEL    = $0008; // Disable expansion of the declaration model
+  {$EXTERNALSYM UNDNAME_NO_ALLOCATION_MODEL}
+  UNDNAME_NO_ALLOCATION_LANGUAGE = $0010; // Disable expansion of the declaration language specifier
+  {$EXTERNALSYM UNDNAME_NO_ALLOCATION_LANGUAGE}
+  UNDNAME_NO_MS_THISTYPE         = $0020; // NYI Disable expansion of MS keywords on the 'this' type for primary declaration
+  {$EXTERNALSYM UNDNAME_NO_MS_THISTYPE}
+  UNDNAME_NO_CV_THISTYPE         = $0040; // NYI Disable expansion of CV modifiers on the 'this' type for primary declaration
+  {$EXTERNALSYM UNDNAME_NO_CV_THISTYPE}
+  UNDNAME_NO_THISTYPE            = $0060; // Disable all modifiers on the 'this' type
+  {$EXTERNALSYM UNDNAME_NO_THISTYPE}
+  UNDNAME_NO_ACCESS_SPECIFIERS   = $0080; // Disable expansion of access specifiers for members
+  {$EXTERNALSYM UNDNAME_NO_ACCESS_SPECIFIERS}
+  UNDNAME_NO_THROW_SIGNATURES    = $0100; // Disable expansion of 'throw-signatures' for functions and pointers to functions
+  {$EXTERNALSYM UNDNAME_NO_THROW_SIGNATURES}
+  UNDNAME_NO_MEMBER_TYPE         = $0200; // Disable expansion of 'static' or 'virtual'ness of members
+  {$EXTERNALSYM UNDNAME_NO_MEMBER_TYPE}
+  UNDNAME_NO_RETURN_UDT_MODEL    = $0400; // Disable expansion of MS model for UDT returns
+  {$EXTERNALSYM UNDNAME_NO_RETURN_UDT_MODEL}
+  UNDNAME_32_BIT_DECODE          = $0800; // Undecorate 32-bit decorated names
+  {$EXTERNALSYM UNDNAME_32_BIT_DECODE}
+  UNDNAME_NAME_ONLY              = $1000; // Crack only the name for primary declaration;
+  {$EXTERNALSYM UNDNAME_NAME_ONLY}
+                                                                                                   //  return just [scope::]name.  Does expand template params
+  UNDNAME_NO_ARGUMENTS    = $2000; // Don't undecorate arguments to function
+  {$EXTERNALSYM UNDNAME_NO_ARGUMENTS}
+  UNDNAME_NO_SPECIAL_SYMS = $4000; // Don't undecorate special names (v-table, vcall, vector xxx, metatype, etc)
+  {$EXTERNALSYM UNDNAME_NO_SPECIAL_SYMS}
+
+function UnDecorateSymbolName(DecoratedName: PCSTR; UnDecoratedName: PSTR;
+  UndecoratedLength: DWORD; Flags: DWORD): DWORD; stdcall;
+{$EXTERNALSYM UnDecorateSymbolName}
+
+//
+// these values are used for synthesized file types
+// that can be passed in as image headers instead of
+// the standard ones from ntimage.h
+//
+
+const
+  DBHHEADER_DEBUGDIRS    = $1;
+  {$EXTERNALSYM DBHHEADER_DEBUGDIRS}
+
+type
+  _MODLOAD_DATA = record
+    ssize: DWORD;                  // size of this struct
+    ssig: DWORD;                   // signature identifying the passed data
+    data: PVOID;                   // pointer to passed data
+    size: DWORD;                   // size of passed data
+    flags: DWORD;                  // options
+  end;
+  {$EXTERNALSYM _MODLOAD_DATA}
+  MODLOAD_DATA = _MODLOAD_DATA;
+  {$EXTERNALSYM MODLOAD_DATA}
+  PMODLOAD_DATA = ^MODLOAD_DATA;
+  {$EXTERNALSYM PMODLOAD_DATA}
+  TModLoadData = MODLOAD_DATA;
+  PModLoadData = PMODLOAD_DATA;
+
+//
+// StackWalking API
+//
+
+type
+  ADDRESS_MODE = (
+    AddrMode1616,
+    AddrMode1632,
+    AddrModeReal,
+    AddrModeFlat);
+  {$EXTERNALSYM ADDRESS_MODE}
+  TAddressMode = ADDRESS_MODE;
+
+  LPADDRESS64 = ^ADDRESS64;
+  {$EXTERNALSYM PADDRESS64}
+  _tagADDRESS64 = record
+    Offset: DWORD64;
+    Segment: WORD;
+    Mode: ADDRESS_MODE;
+  end;
+  {$EXTERNALSYM _tagADDRESS64}
+  ADDRESS64 = _tagADDRESS64;
+  {$EXTERNALSYM ADDRESS64}
+  TAddress64 = ADDRESS64;
+  PAddress64 = LPADDRESS64;
+
+  LPADDRESS = ^ADDRESS;
+  {$EXTERNALSYM PADDRESS}
+  _tagADDRESS = record
+    Offset: DWORD;
+    Segment: WORD;
+    Mode: ADDRESS_MODE;
+  end;
+  {$EXTERNALSYM _tagADDRESS}
+  ADDRESS = _tagADDRESS;
+  {$EXTERNALSYM ADDRESS}
+  TAddress = ADDRESS;
+  PAddress = LPADDRESS;
+
+procedure Address32To64(a32: LPADDRESS; a64: LPADDRESS64);
+{$EXTERNALSYM Address32To64}
+
+procedure Address64To32(a64: LPADDRESS64; a32: LPADDRESS);
+{$EXTERNALSYM Address64To32}
+
+//
+// This structure is included in the STACKFRAME structure,
+// and is used to trace through usermode callbacks in a thread's
+// kernel stack.  The values must be copied by the kernel debugger
+// from the DBGKD_GET_VERSION and WAIT_STATE_CHANGE packets.
+//
+
+//
+// New KDHELP structure for 64 bit system support.
+// This structure is preferred in new code.
+//
+
+type
+  PKDHELP64 = ^KDHELP64;
+  {$EXTERNALSYM PKDHELP64}
+  _KDHELP64 = record
+    //
+    // address of kernel thread object, as provided in the
+    // WAIT_STATE_CHANGE packet.
+    //
+    Thread: DWORD64;
+    //
+    // offset in thread object to pointer to the current callback frame
+    // in kernel stack.
+    //
+    ThCallbackStack: DWORD;
+    //
+    // offset in thread object to pointer to the current callback backing
+    // store frame in kernel stack.
+    //
+    ThCallbackBStore: DWORD;
+    //
+    // offsets to values in frame:
+    //
+    // address of next callback frame
+    NextCallback: DWORD;
+    // address of saved frame pointer (if applicable)
+    FramePointer: DWORD;
+    //
+    // Address of the kernel function that calls out to user mode
+    //
+    KiCallUserMode: DWORD64;
+    //
+    // Address of the user mode dispatcher function
+    //
+    KeUserCallbackDispatcher: DWORD64;
+    //
+    // Lowest kernel mode address
+    //
+    SystemRangeStart: DWORD64;
+    Reserved: array [0..7] of DWORD64;
+  end;
+  {$EXTERNALSYM _KDHELP64}
+  KDHELP64 = _KDHELP64;
+  {$EXTERNALSYM KDHELP64}
+  TKdHelp64 = KDHELP64;
+  //PKdHelp64 = PKDHELP64;
+
+  PKDHELP = ^KDHELP;
+  {$EXTERNALSYM PKDHELP}
+  _KDHELP = record
+    //
+    // address of kernel thread object, as provided in the
+    // WAIT_STATE_CHANGE packet.
+    //
+    Thread: DWORD;
+    //
+    // offset in thread object to pointer to the current callback frame
+    // in kernel stack.
+    //
+    ThCallbackStack: DWORD;
+    //
+    // offsets to values in frame:
+    //
+    // address of next callback frame
+    NextCallback: DWORD;
+    // address of saved frame pointer (if applicable)
+    FramePointer: DWORD;
+    //
+    // Address of the kernel function that calls out to user mode
+    //
+    KiCallUserMode: DWORD;
+    //
+    // Address of the user mode dispatcher function
+    //
+    KeUserCallbackDispatcher: DWORD;
+    //
+    // Lowest kernel mode address
+    //
+    SystemRangeStart: DWORD;
+    //
+    // offset in thread object to pointer to the current callback backing
+    // store frame in kernel stack.
+    //
+    ThCallbackBStore: DWORD;
+    Reserved: array [0..7] of DWORD;
+  end;
+  {$EXTERNALSYM _KDHELP}
+  KDHELP = _KDHELP;
+  {$EXTERNALSYM KDHELP}
+  TKdHelp = KDHELP;
+  //PKdHelp = PKDHELP;
+
+procedure KdHelp32To64(p32: PKDHELP; p64: PKDHELP64);
+{$EXTERNALSYM KdHelp32To64}
+
+type
+  LPSTACKFRAME64 = ^STACKFRAME64;
+  {$EXTERNALSYM LPSTACKFRAME64}
+  _tagSTACKFRAME64 = record
+    AddrPC: ADDRESS64; // program counter
+    AddrReturn: ADDRESS64; // return address
+    AddrFrame: ADDRESS64; // frame pointer
+    AddrStack: ADDRESS64; // stack pointer
+    AddrBStore: ADDRESS64; // backing store pointer
+    FuncTableEntry: PVOID; // pointer to pdata/fpo or NULL
+    Params: array [0..3] of DWORD64; // possible arguments to the function
+    Far: BOOL; // WOW far call
+    Virtual: BOOL; // is this a virtual frame?
+    Reserved: array [0..2] of DWORD64;
+    KdHelp: KDHELP64;
+  end;
+  {$EXTERNALSYM _tagSTACKFRAME64}
+  STACKFRAME64 = _tagSTACKFRAME64;
+  {$EXTERNALSYM STACKFRAME64}
+  TStackFrame64 = STACKFRAME64;
+  PStackFrame64 = LPSTACKFRAME64;
+
+  LPSTACKFRAME = ^STACKFRAME;
+  {$EXTERNALSYM LPSTACKFRAME}
+  _tagSTACKFRAME = record
+    AddrPC: ADDRESS; // program counter
+    AddrReturn: ADDRESS; // return address
+    AddrFrame: ADDRESS; // frame pointer
+    AddrStack: ADDRESS; // stack pointer
+    FuncTableEntry: PVOID; // pointer to pdata/fpo or NULL
+    Params: array [0..3] of DWORD; // possible arguments to the function
+    Far: BOOL; // WOW far call
+    Virtual: BOOL; // is this a virtual frame?
+    Reserved: array [0..2] of DWORD;
+    KdHelp: KDHELP;
+    AddrBStore: ADDRESS; // backing store pointer
+  end;
+  {$EXTERNALSYM _tagSTACKFRAME}
+  STACKFRAME = _tagSTACKFRAME;
+  {$EXTERNALSYM STACKFRAME}
+  TStackFrame = STACKFRAME;
+  PStackFrame = LPSTACKFRAME;
+
+  PREAD_PROCESS_MEMORY_ROUTINE64 = function(hProcess: HANDLE; qwBaseAddress: DWORD64;
+    lpBuffer: PVOID; nSize: DWORD; var lpNumberOfBytesRead: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PREAD_PROCESS_MEMORY_ROUTINE64}
+  PReadProcessMemoryRoutine64 = PREAD_PROCESS_MEMORY_ROUTINE64;
+
+  PFUNCTION_TABLE_ACCESS_ROUTINE64 = function(hProcess: HANDLE;
+    AddrBase: DWORD64): PVOID; stdcall;
+  {$EXTERNALSYM PFUNCTION_TABLE_ACCESS_ROUTINE64}
+  PFunctionTableAccessRoutine64 = PFUNCTION_TABLE_ACCESS_ROUTINE64;
+
+  PGET_MODULE_BASE_ROUTINE64 = function(hProcess: HANDLE;
+    Address: DWORD64): DWORD64; stdcall;
+  {$EXTERNALSYM PGET_MODULE_BASE_ROUTINE64}
+  PGetModuleBaseRoutine64 = PGET_MODULE_BASE_ROUTINE64;
+
+  PTRANSLATE_ADDRESS_ROUTINE64 = function(hProcess: HANDLE; hThread: HANDLE;
+    const lpaddr: ADDRESS64): DWORD64; stdcall;
+  {$EXTERNALSYM PTRANSLATE_ADDRESS_ROUTINE64}
+  PTranslateAddressRoutine64 = PTRANSLATE_ADDRESS_ROUTINE64;
+
+function StackWalk64(MachineType: DWORD; hProcess: HANDLE; hThread: HANDLE;
+  var StackFrame: STACKFRAME64; ContextRecord: PVOID;
+  ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE64;
+  FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE64;
+  GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE64;
+  TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE64): BOOL; stdcall;
+{$EXTERNALSYM StackWalk64}
+
+type
+  PREAD_PROCESS_MEMORY_ROUTINE = function(hProcess: HANDLE;
+    lpBaseAddress: DWORD; lpBuffer: PVOID; nSize: DWORD;
+    var lpNumberOfBytesRead: DWORD): BOOL; stdcall;
+  {$EXTERNALSYM PREAD_PROCESS_MEMORY_ROUTINE}
+  PreadProcessMemoryRoutine = PREAD_PROCESS_MEMORY_ROUTINE;
+
+  PFUNCTION_TABLE_ACCESS_ROUTINE = function(hProcess: HANDLE; AddrBase: DWORD): PVOID; stdcall;
+  {$EXTERNALSYM PFUNCTION_TABLE_ACCESS_ROUTINE}
+  PFunctionTableAccessRoutine = PFUNCTION_TABLE_ACCESS_ROUTINE;
+
+  PGET_MODULE_BASE_ROUTINE = function(hProcess: HANDLE; Address: DWORD): DWORD; stdcall;
+  {$EXTERNALSYM PGET_MODULE_BASE_ROUTINE}
+  PGetModuleBaseRoutine = PGET_MODULE_BASE_ROUTINE;
+
+  PTRANSLATE_ADDRESS_ROUTINE = function(hProcess: HANDLE; hThread: HANDLE;
+    const lpaddr: ADDRESS): DWORD; stdcall;
+  {$EXTERNALSYM PTRANSLATE_ADDRESS_ROUTINE}
+  PTranslateAddressRoutine = PTRANSLATE_ADDRESS_ROUTINE;
+
+function StackWalk(MachineType: DWORD; hProcess: HANDLE; hThread: HANDLE;
+  var StackFrame: STACKFRAME; ContextRecord: PVOID;
+  ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE;
+  FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE;
+  GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE;
+  TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE): BOOL; stdcall;
+{$EXTERNALSYM StackWalk}
+
+const
+  API_VERSION_NUMBER = 9;
+  {$EXTERNALSYM API_VERSION_NUMBER}
+
+type
+  LPAPI_VERSION = ^API_VERSION;
+  {$EXTERNALSYM LPAPI_VERSION}
+  API_VERSION = record
+    MajorVersion: USHORT;
+    MinorVersion: USHORT;
+    Revision: USHORT;
+    Reserved: USHORT;
+  end;
+  {$EXTERNALSYM API_VERSION}
+  TApiVersion = API_VERSION;
+  PApiVersion = LPAPI_VERSION;
+
+function ImagehlpApiVersion: LPAPI_VERSION; stdcall;
+{$EXTERNALSYM ImagehlpApiVersion}
+
+function ImagehlpApiVersionEx(const AppVersion: API_VERSION): LPAPI_VERSION; stdcall;
+{$EXTERNALSYM ImagehlpApiVersionEx}
+
+function GetTimestampForLoadedLibrary(Module: HMODULE): DWORD; stdcall;
+{$EXTERNALSYM GetTimestampForLoadedLibrary}
+
+//
+// typedefs for function pointers
+//
+
+type
+  PSYM_ENUMMODULES_CALLBACK64 = function(ModuleName: PSTR; BaseOfDll: DWORD64;
+    UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMMODULES_CALLBACK64}
+  PSymEnummodulesCallback64 = PSYM_ENUMMODULES_CALLBACK64;
+
+  PSYM_ENUMSYMBOLS_CALLBACK64 = function(SymbolName: PSTR; SymbolAddress: DWORD64;
+    SymbolSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMSYMBOLS_CALLBACK64}
+  PSymEnumsymbolsCallback64 = PSYM_ENUMSYMBOLS_CALLBACK64;
+
+  PSYM_ENUMSYMBOLS_CALLBACK64W = function(SymbolName: PWSTR;
+    SymbolAddress: DWORD64; SymbolSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMSYMBOLS_CALLBACK64W}
+  PSymEnumsymbolsCallback64w = PSYM_ENUMSYMBOLS_CALLBACK64W;
+
+  PENUMLOADED_MODULES_CALLBACK64 = function(ModuleName: PSTR;
+    ModuleBase: DWORD64; ModuleSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PENUMLOADED_MODULES_CALLBACK64}
+  PSnumloadedModulesCallback64 = PENUMLOADED_MODULES_CALLBACK64;
+
+  PSYMBOL_REGISTERED_CALLBACK64 = function(hProcess: HANDLE; ActionCode: ULONG;
+    CallbackData: ULONG64; UserContext: ULONG64): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOL_REGISTERED_CALLBACK64}
+  PSymbolRegisteredCallback64 = PSYMBOL_REGISTERED_CALLBACK64;
+
+  PSYMBOL_FUNCENTRY_CALLBACK = function(hProcess: HANDLE; AddrBase: DWORD;
+    UserContext: PVOID): PVOID; stdcall;
+  {$EXTERNALSYM PSYMBOL_FUNCENTRY_CALLBACK}
+  PSymbolFuncentryCallback = PSYMBOL_FUNCENTRY_CALLBACK;
+
+  PSYMBOL_FUNCENTRY_CALLBACK64 = function(hProcess: HANDLE; AddrBase: ULONG64;
+    UserContext: ULONG64): PVOID; stdcall;
+  {$EXTERNALSYM PSYMBOL_FUNCENTRY_CALLBACK64}
+  PSymbolFuncentryCallback64 = PSYMBOL_FUNCENTRY_CALLBACK64;
+
+  PSYM_ENUMMODULES_CALLBACK = function(ModuleName: PSTR; BaseOfDll: ULONG;
+    UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMMODULES_CALLBACK}
+  PSymEnummodulesCallback = PSYM_ENUMMODULES_CALLBACK;
+
+  PSYM_ENUMSYMBOLS_CALLBACK = function(SymbolName: PSTR; SymbolAddress: ULONG;
+    SymbolSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMSYMBOLS_CALLBACK}
+  PSymEnumsymbolsCallback = PSYM_ENUMSYMBOLS_CALLBACK;
+
+  PSYM_ENUMSYMBOLS_CALLBACKW = function(SymbolName: PWSTR; SymbolAddress: ULONG;
+    SymbolSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMSYMBOLS_CALLBACKW}
+  PSymEnumsymbolsCallbackw = PSYM_ENUMSYMBOLS_CALLBACKW;
+
+  PENUMLOADED_MODULES_CALLBACK = function(ModuleName: PSTR; ModuleBase: ULONG;
+    ModuleSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PENUMLOADED_MODULES_CALLBACK}
+  PEnumloadedModulesCallback = PENUMLOADED_MODULES_CALLBACK;
+
+  PSYMBOL_REGISTERED_CALLBACK = function(hProcess: HANDLE; ActionCode: ULONG;
+    CallbackData: PVOID; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYMBOL_REGISTERED_CALLBACK}
+  PSymbolRegisteredCallback = PSYMBOL_REGISTERED_CALLBACK;
+
+//
+// flags found in SYMBOL_INFO.Flags
+//
+
+const
+  SYMFLAG_VALUEPRESENT   = $00000001;
+  {$EXTERNALSYM SYMFLAG_VALUEPRESENT}
+  SYMFLAG_REGISTER       = $00000008;
+  {$EXTERNALSYM SYMFLAG_REGISTER}
+  SYMFLAG_REGREL         = $00000010;
+  {$EXTERNALSYM SYMFLAG_REGREL}
+  SYMFLAG_FRAMEREL       = $00000020;
+  {$EXTERNALSYM SYMFLAG_FRAMEREL}
+  SYMFLAG_PARAMETER      = $00000040;
+  {$EXTERNALSYM SYMFLAG_PARAMETER}
+  SYMFLAG_LOCAL          = $00000080;
+  {$EXTERNALSYM SYMFLAG_LOCAL}
+  SYMFLAG_CONSTANT       = $00000100;
+  {$EXTERNALSYM SYMFLAG_CONSTANT}
+  SYMFLAG_EXPORT         = $00000200;
+  {$EXTERNALSYM SYMFLAG_EXPORT}
+  SYMFLAG_FORWARDER      = $00000400;
+  {$EXTERNALSYM SYMFLAG_FORWARDER}
+  SYMFLAG_FUNCTION       = $00000800;
+  {$EXTERNALSYM SYMFLAG_FUNCTION}
+  SYMFLAG_VIRTUAL        = $00001000;
+  {$EXTERNALSYM SYMFLAG_VIRTUAL}
+  SYMFLAG_THUNK          = $00002000;
+  {$EXTERNALSYM SYMFLAG_THUNK}
+  SYMFLAG_TLSREL         = $00004000;
+  {$EXTERNALSYM SYMFLAG_TLSREL}
+
+//
+// symbol type enumeration
+//
+
+type
+  SYM_TYPE = (
+    SymNone,
+    SymCoff,
+    SymCv,
+    SymPdb,
+    SymExport,
+    SymDeferred,
+    SymSym,                   // .sym file
+    SymDia,
+    SymVirtual,
+    NumSymTypes);
+  {$EXTERNALSYM SYM_TYPE}
+  TSymType = SYM_TYPE;
+
+//
+// symbol data structure
+//
+
+  PIMAGEHLP_SYMBOL64 = ^IMAGEHLP_SYMBOL64;
+  {$EXTERNALSYM PIMAGEHLP_SYMBOL64}
+  _IMAGEHLP_SYMBOL64 = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_SYMBOL64)
+    Address: DWORD64; // virtual address including dll base address
+    Size: DWORD; // estimated size of symbol, can be zero
+    Flags: DWORD; // info about the symbols, see the SYMF defines
+    MaxNameLength: DWORD; // maximum size of symbol name in 'Name'
+    Name: array [0..0] of CHAR; // symbol name (null terminated string)
+  end;
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL64}
+  IMAGEHLP_SYMBOL64 = _IMAGEHLP_SYMBOL64;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL64}
+  TImageHlpSymbol64 = IMAGEHLP_SYMBOL64;
+  PImageHlpSymbol64 = PIMAGEHLP_SYMBOL64;
+
+  _IMAGEHLP_SYMBOL64_PACKAGE = record
+    sym: IMAGEHLP_SYMBOL64;
+    name: array [0..MAX_SYM_NAME] of CHAR;
+  end;
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL64_PACKAGE}
+  IMAGEHLP_SYMBOL64_PACKAGE = _IMAGEHLP_SYMBOL64_PACKAGE;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL64_PACKAGE}
+  PIMAGEHLP_SYMBOL64_PACKAGE = ^IMAGEHLP_SYMBOL64_PACKAGE;
+  {$EXTERNALSYM PIMAGEHLP_SYMBOL64_PACKAGE}
+  TImageHlpSymbol64Package = IMAGEHLP_SYMBOL64_PACKAGE;
+  PImageHlpSymbol64Package = PIMAGEHLP_SYMBOL64_PACKAGE;  
+
+//#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
+//
+//#define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
+//#define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
+//#define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE
+//#define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE
+//
+//#else
+
+  PIMAGEHLP_SYMBOL = ^IMAGEHLP_SYMBOL;
+  {$EXTERNALSYM PIMAGEHLP_SYMBOL}
+  _IMAGEHLP_SYMBOL = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_SYMBOL)
+    Address: DWORD; // virtual address including dll base address
+    Size: DWORD; // estimated size of symbol, can be zero
+    Flags: DWORD; // info about the symbols, see the SYMF defines
+    MaxNameLength: DWORD; // maximum size of symbol name in 'Name'
+    Name: array [0..0] of CHAR; // symbol name (null terminated string)
+  end;
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL}
+  IMAGEHLP_SYMBOL = _IMAGEHLP_SYMBOL;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL}
+  TImageHlpSymbol = IMAGEHLP_SYMBOL;
+  PImageHlpSymbol = PIMAGEHLP_SYMBOL;
+
+  _IMAGEHLP_SYMBOL_PACKAGE = record
+    sym: IMAGEHLP_SYMBOL;
+    name: array [0..MAX_SYM_NAME] of CHAR;
+  end;
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL_PACKAGE}
+  IMAGEHLP_SYMBOL_PACKAGE = _IMAGEHLP_SYMBOL_PACKAGE;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL_PACKAGE}
+  PIMAGEHLP_SYMBOL_PACKAGE = ^IMAGEHLP_SYMBOL_PACKAGE;
+  {$EXTERNALSYM PIMAGEHLP_SYMBOL_PACKAGE}
+  TImageHlpSymbolPackage = IMAGEHLP_SYMBOL_PACKAGE;
+  PImageHlpSymbolPackage = PIMAGEHLP_SYMBOL_PACKAGE;
+
+//#endif
+
+//
+// module data structure
+//
+
+  PIMAGEHLP_MODULE64 = ^IMAGEHLP_MODULE64;
+  {$EXTERNALSYM PIMAGEHLP_MODULE64}
+  _IMAGEHLP_MODULE64 = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_MODULE64)
+    BaseOfImage: DWORD64; // base load address of module
+    ImageSize: DWORD; // virtual size of the loaded module
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    CheckSum: DWORD; // checksum from the pe header
+    NumSyms: DWORD; // number of symbols in the symbol table
+    SymType: SYM_TYPE; // type of symbols loaded
+    ModuleName: array [0..3] of CHAR; // module name
+    ImageName: array [0..255] of CHAR; // image name
+    LoadedImageName: array [0..255] of CHAR; // symbol file name
+  end;
+  {$EXTERNALSYM _IMAGEHLP_MODULE64}
+  IMAGEHLP_MODULE64 = _IMAGEHLP_MODULE64;
+  {$EXTERNALSYM IMAGEHLP_MODULE64}
+  TImageHlpModule64 = IMAGEHLP_MODULE64;
+  PImageHlpModule64 = PIMAGEHLP_MODULE64;
+
+  PIMAGEHLP_MODULEW64 = ^IMAGEHLP_MODULEW64;
+  {$EXTERNALSYM PIMAGEHLP_MODULEW64}
+  _IMAGEHLP_MODULE64W = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_MODULE64)
+    BaseOfImage: DWORD64; // base load address of module
+    ImageSize: DWORD; // virtual size of the loaded module
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    CheckSum: DWORD; // checksum from the pe header
+    NumSyms: DWORD; // number of symbols in the symbol table
+    SymType: SYM_TYPE; // type of symbols loaded
+    ModuleName: array [0..31] of WCHAR; // module name
+    ImageName: array [0..255] of WCHAR; // image name
+    LoadedImageName: array [0..255] of WCHAR; // symbol file name
+  end;
+  {$EXTERNALSYM _IMAGEHLP_MODULE64W}
+  IMAGEHLP_MODULEW64 = _IMAGEHLP_MODULE64W;
+  {$EXTERNALSYM IMAGEHLP_MODULEW64}
+  TImageHlpModuleW64 = IMAGEHLP_MODULEW64;
+  PImageHlpModuleW64 = PIMAGEHLP_MODULEW64;
+
+  PIMAGEHLP_MODULE = ^IMAGEHLP_MODULE;
+  {$EXTERNALSYM PIMAGEHLP_MODULE}
+  _IMAGEHLP_MODULE = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_MODULE)
+    BaseOfImage: DWORD; // base load address of module
+    ImageSize: DWORD; // virtual size of the loaded module
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    CheckSum: DWORD; // checksum from the pe header
+    NumSyms: DWORD; // number of symbols in the symbol table
+    SymType: SYM_TYPE; // type of symbols loaded
+    ModuleName: array [0..31] of CHAR; // module name
+    ImageName: array [0..255] of CHAR; // image name
+    LoadedImageName: array [0..255] of CHAR; // symbol file name
+  end;
+  {$EXTERNALSYM _IMAGEHLP_MODULE}
+  IMAGEHLP_MODULE = _IMAGEHLP_MODULE;
+  {$EXTERNALSYM IMAGEHLP_MODULE}
+  TImageHlpModule = IMAGEHLP_MODULE;
+  PImageHlpModule = PIMAGEHLP_MODULE;
+
+  PIMAGEHLP_MODULEW = ^IMAGEHLP_MODULEW;
+  {$EXTERNALSYM PIMAGEHLP_MODULEW}
+  _IMAGEHLP_MODULEW = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_MODULE)
+    BaseOfImage: DWORD; // base load address of module
+    ImageSize: DWORD; // virtual size of the loaded module
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    CheckSum: DWORD; // checksum from the pe header
+    NumSyms: DWORD; // number of symbols in the symbol table
+    SymType: SYM_TYPE; // type of symbols loaded
+    ModuleName: array [0..31] of WCHAR; // module name
+    ImageName: array [0..255] of WCHAR; // image name
+    LoadedImageName: array [0..255] of WCHAR; // symbol file name
+  end;
+  {$EXTERNALSYM _IMAGEHLP_MODULEW}
+  IMAGEHLP_MODULEW = _IMAGEHLP_MODULEW;
+  {$EXTERNALSYM IMAGEHLP_MODULEW}
+  TImageHlpModuleW = IMAGEHLP_MODULEW;
+  PImageHlpModuleW = PIMAGEHLP_MODULEW;
+
+//
+// source file line data structure
+//
+
+  PIMAGEHLP_LINE64 = ^IMAGEHLP_LINE64;
+  {$EXTERNALSYM PIMAGEHLP_LINE64}
+  _IMAGEHLP_LINE64 = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_LINE64)
+    Key: PVOID; // internal
+    LineNumber: DWORD; // line number in file
+    FileName: PCHAR; // full filename
+    Address: DWORD64; // first instruction of line
+  end;
+  {$EXTERNALSYM _IMAGEHLP_LINE64}
+  IMAGEHLP_LINE64 = _IMAGEHLP_LINE64;
+  {$EXTERNALSYM IMAGEHLP_LINE64}
+  TImageHlpLine64 = IMAGEHLP_LINE64;
+  PImageHlpLine64 = PIMAGEHLP_LINE64;
+
+  PIMAGEHLP_LINE = ^IMAGEHLP_LINE;
+  {$EXTERNALSYM PIMAGEHLP_LINE}
+  _IMAGEHLP_LINE = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_LINE)
+    Key: PVOID; // internal
+    LineNumber: DWORD; // line number in file
+    FileName: PCHAR; // full filename
+    Address: DWORD; // first instruction of line
+  end;
+  {$EXTERNALSYM _IMAGEHLP_LINE}
+  IMAGEHLP_LINE = _IMAGEHLP_LINE;
+  {$EXTERNALSYM IMAGEHLP_LINE}
+  TImageHlpLine = IMAGEHLP_LINE;
+  PImageHlpLine = PIMAGEHLP_LINE;
+
+//
+// source file structure
+//
+
+type
+  _SOURCEFILE = record
+    ModBase: DWORD64;                // base address of loaded module
+    FileName: PCHAR;                 // full filename of source
+  end;
+  {$EXTERNALSYM _SOURCEFILE}
+  SOURCEFILE = _SOURCEFILE;
+  {$EXTERNALSYM SOURCEFILE}
+  PSOURCEFILE = ^SOURCEFILE;
+  {$EXTERNALSYM PSOURCEFILE}
+  TSourceFile = SOURCEFILE;
+
+//
+// data structures used for registered symbol callbacks
+//
+
+const
+  CBA_DEFERRED_SYMBOL_LOAD_START    = $00000001;
+  {$EXTERNALSYM CBA_DEFERRED_SYMBOL_LOAD_START}
+  CBA_DEFERRED_SYMBOL_LOAD_COMPLETE = $00000002;
+  {$EXTERNALSYM CBA_DEFERRED_SYMBOL_LOAD_COMPLETE}
+  CBA_DEFERRED_SYMBOL_LOAD_FAILURE  = $00000003;
+  {$EXTERNALSYM CBA_DEFERRED_SYMBOL_LOAD_FAILURE}
+  CBA_SYMBOLS_UNLOADED              = $00000004;
+  {$EXTERNALSYM CBA_SYMBOLS_UNLOADED}
+  CBA_DUPLICATE_SYMBOL              = $00000005;
+  {$EXTERNALSYM CBA_DUPLICATE_SYMBOL}
+  CBA_READ_MEMORY                   = $00000006;
+  {$EXTERNALSYM CBA_READ_MEMORY}
+  CBA_DEFERRED_SYMBOL_LOAD_CANCEL   = $00000007;
+  {$EXTERNALSYM CBA_DEFERRED_SYMBOL_LOAD_CANCEL}
+  CBA_SET_OPTIONS                   = $00000008;
+  {$EXTERNALSYM CBA_SET_OPTIONS}
+  CBA_EVENT                         = $00000010;
+  {$EXTERNALSYM CBA_EVENT}
+  CBA_DEFERRED_SYMBOL_LOAD_PARTIAL  = $00000020;
+  {$EXTERNALSYM CBA_DEFERRED_SYMBOL_LOAD_PARTIAL}
+  CBA_DEBUG_INFO                    = $10000000;
+  {$EXTERNALSYM CBA_DEBUG_INFO}
+
+type
+  PIMAGEHLP_CBA_READ_MEMORY = ^IMAGEHLP_CBA_READ_MEMORY;
+  {$EXTERNALSYM PIMAGEHLP_CBA_READ_MEMORY}
+  _IMAGEHLP_CBA_READ_MEMORY = record
+    addr: DWORD64; // address to read from
+    buf: PVOID; // buffer to read to
+    bytes: DWORD; // amount of bytes to read
+    bytesread: LPDWORD; // pointer to store amount of bytes read
+  end;
+  {$EXTERNALSYM _IMAGEHLP_CBA_READ_MEMORY}
+  IMAGEHLP_CBA_READ_MEMORY = _IMAGEHLP_CBA_READ_MEMORY;
+  {$EXTERNALSYM IMAGEHLP_CBA_READ_MEMORY}
+  TImageHlpCbaReadMemory = IMAGEHLP_CBA_READ_MEMORY;
+  PImageHlpCbaReadMemory = PIMAGEHLP_CBA_READ_MEMORY;
+
+const
+  sevInfo    = 0;
+  {$EXTERNALSYM sevInfo}
+  sevProblem = 1;
+  {$EXTERNALSYM sevProblem}
+  sevAttn    = 2;
+  {$EXTERNALSYM sevAttn}
+  sevFatal   = 3;
+  {$EXTERNALSYM sevFatal}
+  sevMax     = 4; // unused
+  {$EXTERNALSYM sevMax}
+
+type
+  _IMAGEHLP_CBA_EVENT = record
+    severity: DWORD;                                     // values from sevInfo to sevFatal
+    code: DWORD;                                         // numerical code IDs the error
+    desc: PCHAR;                                         // may contain a text description of the error
+    object_: PVOID;                                      // value dependant upon the error code
+  end;
+  {$EXTERNALSYM _IMAGEHLP_CBA_EVENT}
+  IMAGEHLP_CBA_EVENT = _IMAGEHLP_CBA_EVENT;
+  {$EXTERNALSYM IMAGEHLP_CBA_EVENT}
+  PIMAGEHLP_CBA_EVENT = ^IMAGEHLP_CBA_EVENT;
+  {$EXTERNALSYM PIMAGEHLP_CBA_EVENT}
+  TImageHlpCbaEvent = IMAGEHLP_CBA_EVENT;
+  PImageHlpCbaEvent = PIMAGEHLP_CBA_EVENT;
+
+  PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 = ^IMAGEHLP_DEFERRED_SYMBOL_LOAD64;
+  {$EXTERNALSYM PIMAGEHLP_DEFERRED_SYMBOL_LOAD64}
+  _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_DEFERRED_SYMBOL_LOAD64)
+    BaseOfImage: DWORD64; // base load address of module
+    CheckSum: DWORD; // checksum from the pe header
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    FileName: array [0..MAX_PATH - 1] of CHAR; // symbols file or image name
+    Reparse: ByteBool; // load failure reparse
+    hFile: HANDLE; // file handle, if passed
+    Flags: DWORD; //
+  end;
+  {$EXTERNALSYM _IMAGEHLP_DEFERRED_SYMBOL_LOAD64}
+  IMAGEHLP_DEFERRED_SYMBOL_LOAD64 = _IMAGEHLP_DEFERRED_SYMBOL_LOAD64;
+  {$EXTERNALSYM IMAGEHLP_DEFERRED_SYMBOL_LOAD64}
+  TImageHlpDeferredSymbolLoad64 = IMAGEHLP_DEFERRED_SYMBOL_LOAD64;
+  PImageHlpDeferredSymbolLoad64 = PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
+
+const
+  DSLFLAG_MISMATCHED_PDB = $1;
+  {$EXTERNALSYM DSLFLAG_MISMATCHED_PDB}
+  DSLFLAG_MISMATCHED_DBG = $2;
+  {$EXTERNALSYM DSLFLAG_MISMATCHED_DBG}
+
+type
+  PIMAGEHLP_DEFERRED_SYMBOL_LOAD = ^IMAGEHLP_DEFERRED_SYMBOL_LOAD;
+  {$EXTERNALSYM PIMAGEHLP_DEFERRED_SYMBOL_LOAD}
+  _IMAGEHLP_DEFERRED_SYMBOL_LOAD = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_DEFERRED_SYMBOL_LOAD)
+    BaseOfImage: DWORD; // base load address of module
+    CheckSum: DWORD; // checksum from the pe header
+    TimeDateStamp: DWORD; // date/time stamp from pe header
+    FileName: array [0..MAX_PATH - 1] of CHAR; // symbols file or image name
+    Reparse: ByteBool; // load failure reparse
+    hFile: HANDLE; // file handle, if passed    
+  end;
+  {$EXTERNALSYM _IMAGEHLP_DEFERRED_SYMBOL_LOAD}
+  IMAGEHLP_DEFERRED_SYMBOL_LOAD = _IMAGEHLP_DEFERRED_SYMBOL_LOAD;
+  {$EXTERNALSYM IMAGEHLP_DEFERRED_SYMBOL_LOAD}
+  TImageHlpDeferredSymbolLoad = IMAGEHLP_DEFERRED_SYMBOL_LOAD;
+  PImageHlpDeferredSymbolLoad = PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
+
+  PIMAGEHLP_DUPLICATE_SYMBOL64 = ^IMAGEHLP_DUPLICATE_SYMBOL64;
+  {$EXTERNALSYM PIMAGEHLP_DUPLICATE_SYMBOL64}
+  _IMAGEHLP_DUPLICATE_SYMBOL64 = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_DUPLICATE_SYMBOL64)
+    NumberOfDups: DWORD; // number of duplicates in the Symbol array
+    Symbol: PIMAGEHLP_SYMBOL64; // array of duplicate symbols
+    SelectedSymbol: DWORD; // symbol selected (-1 to start)
+  end;
+  {$EXTERNALSYM _IMAGEHLP_DUPLICATE_SYMBOL64}
+  IMAGEHLP_DUPLICATE_SYMBOL64 = _IMAGEHLP_DUPLICATE_SYMBOL64;
+  {$EXTERNALSYM IMAGEHLP_DUPLICATE_SYMBOL64}
+  TImageHlpDuplicateSymbol64 = IMAGEHLP_DUPLICATE_SYMBOL64;
+  PImageHlpDuplicateSymbol64 = PIMAGEHLP_DUPLICATE_SYMBOL64;
+
+  PIMAGEHLP_DUPLICATE_SYMBOL = ^IMAGEHLP_DUPLICATE_SYMBOL;
+  {$EXTERNALSYM PIMAGEHLP_DUPLICATE_SYMBOL}
+  _IMAGEHLP_DUPLICATE_SYMBOL = record
+    SizeOfStruct: DWORD; // set to sizeof(IMAGEHLP_DUPLICATE_SYMBOL)
+    NumberOfDups: DWORD; // number of duplicates in the Symbol array
+    Symbol: PIMAGEHLP_SYMBOL; // array of duplicate symbols
+    SelectedSymbol: DWORD; // symbol selected (-1 to start)
+  end;
+  {$EXTERNALSYM _IMAGEHLP_DUPLICATE_SYMBOL}
+  IMAGEHLP_DUPLICATE_SYMBOL = _IMAGEHLP_DUPLICATE_SYMBOL;
+  {$EXTERNALSYM IMAGEHLP_DUPLICATE_SYMBOL}
+  TImageHlpDuplicateSymbol = IMAGEHLP_DUPLICATE_SYMBOL;
+  PImageHlpDuplicateSymbol = PIMAGEHLP_DUPLICATE_SYMBOL;
+
+// If dbghelp ever needs to display graphical UI, it will use this as the parent window.
+
+//BOOL
+//SymSetParentWindow(
+//    HWND hwnd
+//    );
+
+//
+// options that are set/returned by SymSetOptions() & SymGetOptions()
+// these are used as a mask
+//
+
+const
+  SYMOPT_CASE_INSENSITIVE  = $00000001;
+  {$EXTERNALSYM SYMOPT_CASE_INSENSITIVE}
+  SYMOPT_UNDNAME           = $00000002;
+  {$EXTERNALSYM SYMOPT_UNDNAME}
+  SYMOPT_DEFERRED_LOADS    = $00000004;
+  {$EXTERNALSYM SYMOPT_DEFERRED_LOADS}
+  SYMOPT_NO_CPP            = $00000008;
+  {$EXTERNALSYM SYMOPT_NO_CPP}
+  SYMOPT_LOAD_LINES        = $00000010;
+  {$EXTERNALSYM SYMOPT_LOAD_LINES}
+  SYMOPT_OMAP_FIND_NEAREST = $00000020;
+  {$EXTERNALSYM SYMOPT_OMAP_FIND_NEAREST}
+  SYMOPT_LOAD_ANYTHING         = $00000040;
+  {$EXTERNALSYM SYMOPT_LOAD_ANYTHING}
+  SYMOPT_IGNORE_CVREC          = $00000080;
+  {$EXTERNALSYM SYMOPT_IGNORE_CVREC}
+  SYMOPT_NO_UNQUALIFIED_LOADS  = $00000100;
+  {$EXTERNALSYM SYMOPT_NO_UNQUALIFIED_LOADS}
+  SYMOPT_FAIL_CRITICAL_ERRORS  = $00000200;
+  {$EXTERNALSYM SYMOPT_FAIL_CRITICAL_ERRORS}
+  SYMOPT_EXACT_SYMBOLS         = $00000400;
+  {$EXTERNALSYM SYMOPT_EXACT_SYMBOLS}
+  SYMOPT_ALLOW_ABSOLUTE_SYMBOLS = $00000800;
+  {$EXTERNALSYM SYMOPT_ALLOW_ABSOLUTE_SYMBOLS}
+  SYMOPT_IGNORE_NT_SYMPATH      = $00001000;
+  {$EXTERNALSYM SYMOPT_IGNORE_NT_SYMPATH}
+  SYMOPT_INCLUDE_32BIT_MODULES = $00002000;
+  {$EXTERNALSYM SYMOPT_INCLUDE_32BIT_MODULES}
+  SYMOPT_PUBLICS_ONLY          = $00004000;
+  {$EXTERNALSYM SYMOPT_PUBLICS_ONLY}
+  SYMOPT_NO_PUBLICS            = $00008000;
+  {$EXTERNALSYM SYMOPT_NO_PUBLICS}
+  SYMOPT_AUTO_PUBLICS          = $00010000;
+  {$EXTERNALSYM SYMOPT_AUTO_PUBLICS}
+  SYMOPT_NO_IMAGE_SEARCH       = $00020000;
+  {$EXTERNALSYM SYMOPT_NO_IMAGE_SEARCH}
+  SYMOPT_SECURE                = $00040000;
+  {$EXTERNALSYM SYMOPT_SECURE}
+
+  SYMOPT_DEBUG             = DWORD($80000000);
+  {$EXTERNALSYM SYMOPT_DEBUG}
+
+function SymSetOptions(SymOptions: DWORD): DWORD; stdcall;
+{$EXTERNALSYM SymSetOptions}
+
+function SymGetOptions: DWORD; stdcall;
+{$EXTERNALSYM SymGetOptions}
+
+function SymCleanup(hProcess: HANDLE): BOOL; stdcall;
+{$EXTERNALSYM SymCleanup}
+
+function SymMatchString(string_, expression: LPSTR; fCase: BOOL): BOOL; stdcall;
+{$EXTERNALSYM SymMatchString}
+
+type
+  PSYM_ENUMSOURCFILES_CALLBACK = function(pSourceFile: PSOURCEFILE; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMSOURCFILES_CALLBACK}
+  PSymEnumSourceFilesCallback = PSYM_ENUMSOURCFILES_CALLBACK;
+
+function SymEnumSourceFiles(hProcess: HANDLE; ModBase: ULONG64; Mask: LPSTR;
+  cbSrcFiles: PSYM_ENUMSOURCFILES_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumSourceFiles}
+
+function SymEnumerateModules64(hProcess: HANDLE; EnumModulesCallback: PSYM_ENUMMODULES_CALLBACK64;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateModules64}
+
+function SymEnumerateModules(hProcess: HANDLE; EnumModulesCallback: PSYM_ENUMMODULES_CALLBACK;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateModules}
+
+function SymEnumerateSymbols64(hProcess: HANDLE; BaseOfDll: DWORD64;
+  EnumSymbolsCallback: PSYM_ENUMSYMBOLS_CALLBACK64; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateSymbols64}
+
+function SymEnumerateSymbolsW64(hProcess: HANDLE; BaseOfDll: DWORD64;
+  EnumSymbolsCallback: PSYM_ENUMSYMBOLS_CALLBACK64W; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateSymbolsW64}
+
+function SymEnumerateSymbols(hProcess: HANDLE; BaseOfDll: DWORD;
+  EnumSymbolsCallback: PSYM_ENUMSYMBOLS_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateSymbols}
+
+function SymEnumerateSymbolsW(hProcess: HANDLE; BaseOfDll: DWORD;
+  EnumSymbolsCallback: PSYM_ENUMSYMBOLS_CALLBACKW; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumerateSymbolsW}
+
+function EnumerateLoadedModules64(hProcess: HANDLE; EnumLoadedModulesCallback: PENUMLOADED_MODULES_CALLBACK64;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM EnumerateLoadedModules64}
+
+function EnumerateLoadedModules(hProcess: HANDLE; EnumLoadedModulesCallback: PENUMLOADED_MODULES_CALLBACK;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM EnumerateLoadedModules}
+
+function SymFunctionTableAccess64(hProcess: HANDLE; AddrBase: DWORD64): PVOID; stdcall;
+{$EXTERNALSYM SymFunctionTableAccess64}
+
+function SymFunctionTableAccess(hProcess: HANDLE; AddrBase: DWORD): PVOID; stdcall;
+{$EXTERNALSYM SymFunctionTableAccess}
+
+function SymGetModuleInfo64(hProcess: HANDLE; qwAddr: DWORD64;
+  var ModuleInfo: IMAGEHLP_MODULE64): BOOL; stdcall;
+{$EXTERNALSYM SymGetModuleInfo64}
+
+function SymGetModuleInfoW64(hProcess: HANDLE; qwAddr: DWORD64;
+  var ModuleInfo: IMAGEHLP_MODULEW64): BOOL; stdcall;
+{$EXTERNALSYM SymGetModuleInfoW64}
+
+function SymGetModuleInfo(hProcess: HANDLE; dwAddr: DWORD;
+  var ModuleInfo: IMAGEHLP_MODULE): BOOL; stdcall;
+{$EXTERNALSYM SymGetModuleInfo}
+
+function SymGetModuleInfoW(hProcess: HANDLE; dwAddr: DWORD;
+  var ModuleInfo: IMAGEHLP_MODULEW): BOOL; stdcall;
+{$EXTERNALSYM SymGetModuleInfoW}
+
+function SymGetModuleBase64(hProcess: HANDLE; qwAddr: DWORD64): DWORD64; stdcall;
+{$EXTERNALSYM SymGetModuleBase64}
+
+function SymGetModuleBase(hProcess: HANDLE; dwAddr: DWORD): DWORD; stdcall;
+{$EXTERNALSYM SymGetModuleBase}
+
+function SymGetSymNext64(hProcess: HANDLE; var Symbol: IMAGEHLP_SYMBOL64): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymNext64}
+
+function SymGetSymNext(hProcess: HANDLE; var Symbol: IMAGEHLP_SYMBOL): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymNext}
+
+function SymGetSymPrev64(hProcess: HANDLE; var Symbol: IMAGEHLP_SYMBOL64): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymPrev64}
+
+function SymGetSymPrev(hProcess: HANDLE; var Symbol: IMAGEHLP_SYMBOL): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymPrev}
+
+function SymGetLineFromAddr64(hProcess: HANDLE; qwAddr: DWORD64;
+  var pdwDisplacement: DWORD; var Line64: IMAGEHLP_LINE64): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineFromAddr64}
+
+function SymGetLineFromAddr(hProcess: HANDLE; dwAddr: DWORD;
+  var pdwDisplacement: DWORD; var Line: IMAGEHLP_LINE): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineFromAddr}
+
+function SymGetLineFromName64(hProcess: HANDLE; ModuleName: PSTR; FileName: PSTR;
+  dwLineNumber: DWORD; var plDisplacement: LONG; var Line: IMAGEHLP_LINE64): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineFromName64}
+
+function SymGetLineFromName(hProcess: HANDLE; ModuleName: PSTR; FileName: PSTR;
+  dwLineNumber: DWORD; var plDisplacement: LONG; var Line: IMAGEHLP_LINE): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineFromName}
+
+function SymGetLineNext64(hProcess: HANDLE; var Line: IMAGEHLP_LINE64): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineNext64}
+
+function SymGetLineNext(hProcess: HANDLE; var Line: IMAGEHLP_LINE): BOOL; stdcall;
+{$EXTERNALSYM SymGetLineNext}
+
+function SymGetLinePrev64(hProcess: HANDLE; var Line: IMAGEHLP_LINE64): BOOL; stdcall;
+{$EXTERNALSYM SymGetLinePrev64}
+
+function SymGetLinePrev(hProcess: HANDLE; var Line: IMAGEHLP_LINE): BOOL; stdcall;
+{$EXTERNALSYM SymGetLinePrev}
+
+function SymMatchFileName(FileName, Match: PSTR; var FileNameStop, MatchStop: PSTR): BOOL; stdcall;
+{$EXTERNALSYM SymMatchFileName}
+
+function SymInitialize(hProcess: HANDLE; UserSearchPath: PSTR; fInvadeProcess: BOOL): BOOL; stdcall;
+{$EXTERNALSYM SymInitialize}
+
+function SymGetSearchPath(hProcess: HANDLE; SearchPath: PSTR; SearchPathLength: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymGetSearchPath}
+
+function SymSetSearchPath(hProcess: HANDLE; SearchPath: PSTR): BOOL; stdcall;
+{$EXTERNALSYM SymSetSearchPath}
+
+function SymLoadModule64(hProcess, hFile: HANDLE; ImageName, ModuleName: PSTR;
+  BaseOfDll: DWORD64; SizeOfDll: DWORD): DWORD64; stdcall;
+{$EXTERNALSYM SymLoadModule64}
+
+const
+  SLMFLAG_VIRTUAL = $1;
+  {$EXTERNALSYM SLMFLAG_VIRTUAL}
+
+function SymLoadModuleEx(hProcess, hFile: HANDLE; ImageName, ModuleName: PSTR; BaseOfDll: DWORD64;
+  DllSize: DWORD; Data: PMODLOAD_DATA; Flag: DWORD): DWORD64; stdcall;
+{$EXTERNALSYM SymLoadModuleEx}
+
+function SymLoadModule(hProcess, hFile: HANDLE; ImageName, ModuleName: PSTR;
+  BaseOfDll: DWORD; SizeOfDll: DWORD): DWORD; stdcall;
+{$EXTERNALSYM SymLoadModule}
+
+function SymUnloadModule64(hProcess: HANDLE; BaseOfDll: DWORD64): BOOL; stdcall;
+{$EXTERNALSYM SymUnloadModule64}
+
+function SymUnloadModule(hProcess: HANDLE; BaseOfDll: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymUnloadModule}
+
+function SymUnDName64(const sym: IMAGEHLP_SYMBOL64; UnDecName: PSTR;
+  UnDecNameLength: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymUnDName64}
+
+function SymUnDName(const sym: IMAGEHLP_SYMBOL; UnDecName: PSTR;
+  UnDecNameLength: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymUnDName}
+
+function SymRegisterCallback64(hProcess: HANDLE; CallbackFunction: PSYMBOL_REGISTERED_CALLBACK64;
+  UserContext: ULONG64): BOOL; stdcall;
+{$EXTERNALSYM SymRegisterCallback64}
+
+function SymRegisterFunctionEntryCallback64(hProcess: HANDLE; CallbackFunction: PSYMBOL_FUNCENTRY_CALLBACK64;
+  UserContext: ULONG64): BOOL; stdcall;
+{$EXTERNALSYM SymRegisterFunctionEntryCallback64}
+
+function SymRegisterCallback(hProcess: HANDLE; CallbackFunction: PSYMBOL_REGISTERED_CALLBACK;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymRegisterCallback}
+
+function SymRegisterFunctionEntryCallback(hProcess: HANDLE; CallbackFunction: PSYMBOL_FUNCENTRY_CALLBACK;
+  UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymRegisterFunctionEntryCallback}
+
+type
+  PIMAGEHLP_SYMBOL_SRC = ^IMAGEHLP_SYMBOL_SRC;
+  {$EXTERNALSYM PIMAGEHLP_SYMBOL_SRC}
+  _IMAGEHLP_SYMBOL_SRC = record
+    sizeofstruct: DWORD;
+    type_: DWORD;
+    file_: array [0..MAX_PATH - 1] of Char;
+  end;
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL_SRC}
+  IMAGEHLP_SYMBOL_SRC = _IMAGEHLP_SYMBOL_SRC;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL_SRC}
+  TImageHlpSymbolSrc = IMAGEHLP_SYMBOL_SRC;
+  PImageHlpSymbolSrc = PIMAGEHLP_SYMBOL_SRC;
+
+  PMODULE_TYPE_INFO = ^MODULE_TYPE_INFO;
+  {$EXTERNALSYM PMODULE_TYPE_INFO}
+  _MODULE_TYPE_INFO = record
+    dataLength: USHORT;
+    leaf: USHORT;
+    data: array [0..0] of BYTE;
+  end;
+  {$EXTERNALSYM _MODULE_TYPE_INFO}
+  MODULE_TYPE_INFO = _MODULE_TYPE_INFO;
+  {$EXTERNALSYM MODULE_TYPE_INFO}
+  TModuleTypeInfo = MODULE_TYPE_INFO;
+  PModuleTypeInfo = PMODULE_TYPE_INFO;
+
+type
+  PSYMBOL_INFO = ^SYMBOL_INFO;
+  {$EXTERNALSYM PSYMBOL_INFO}
+  _SYMBOL_INFO = record
+    SizeOfStruct: ULONG;
+    TypeIndex: ULONG; // Type Index of symbol
+    Reserved: array [0..1] of ULONG64;
+    Info: ULONG;
+    Size: ULONG;
+    ModBase: ULONG64; // Base Address of module comtaining this symbol
+    Flags: ULONG;
+    Value: ULONG64; // Value of symbol, ValuePresent should be 1
+    Address: ULONG64; // Address of symbol including base address of module
+    Register_: ULONG; // register holding value or pointer to value
+    Scope: ULONG; // scope of the symbol
+    Tag: ULONG; // pdb classification
+    NameLen: ULONG; // Actual length of name
+    MaxNameLen: ULONG;
+    Name: array [0..0] of CHAR; // Name of symbol
+  end;
+  {$EXTERNALSYM _SYMBOL_INFO}
+  SYMBOL_INFO = _SYMBOL_INFO;
+  {$EXTERNALSYM SYMBOL_INFO}
+  TSymbolInfo = SYMBOL_INFO;
+  PSymbolInfo = PSYMBOL_INFO;
+
+  _SYMBOL_INFO_PACKAGE = record
+    si: SYMBOL_INFO;
+    name: array [0..MAX_SYM_NAME] of CHAR;
+  end;
+  {$EXTERNALSYM _SYMBOL_INFO_PACKAGE}
+  SYMBOL_INFO_PACKAGE = _SYMBOL_INFO_PACKAGE;
+  {$EXTERNALSYM SYMBOL_INFO_PACKAGE}
+  PSYMBOL_INFO_PACKAGE = ^SYMBOL_INFO_PACKAGE;
+  {$EXTERNALSYM PSYMBOL_INFO_PACKAGE}
+  TSymbolInfoPackage = SYMBOL_INFO_PACKAGE;
+  PSymbolInfoPackage = PSYMBOL_INFO_PACKAGE;
+
+  PIMAGEHLP_STACK_FRAME = ^IMAGEHLP_STACK_FRAME;
+  {$EXTERNALSYM PIMAGEHLP_STACK_FRAME}
+  _IMAGEHLP_STACK_FRAME = record
+    InstructionOffset: ULONG64;
+    ReturnOffset: ULONG64;
+    FrameOffset: ULONG64;
+    StackOffset: ULONG64;
+    BackingStoreOffset: ULONG64;
+    FuncTableEntry: ULONG64;
+    Params: array [0..3] of ULONG64;
+    Reserved: array [0..4] of ULONG64;
+    Virtual_: BOOL;
+    Reserved2: ULONG;
+  end;
+  {$EXTERNALSYM _IMAGEHLP_STACK_FRAME}
+  IMAGEHLP_STACK_FRAME = _IMAGEHLP_STACK_FRAME;
+  {$EXTERNALSYM IMAGEHLP_STACK_FRAME}
+  TImageHlpStackFrame = IMAGEHLP_STACK_FRAME;
+  PImageHlpStackFrame = PIMAGEHLP_STACK_FRAME;
+
+  IMAGEHLP_CONTEXT = LPVOID;
+  {$EXTERNALSYM IMAGEHLP_CONTEXT}
+  PIMAGEHLP_CONTEXT = ^IMAGEHLP_CONTEXT;
+  {$EXTERNALSYM PIMAGEHLP_CONTEXT}
+  TImageHlpContext = IMAGEHLP_CONTEXT;
+  PImageHlpContext = PIMAGEHLP_CONTEXT;
+
+function SymSetContext(hProcess: HANDLE; StackFrame: PIMAGEHLP_STACK_FRAME; Context: PIMAGEHLP_CONTEXT): BOOL; stdcall;
+{$EXTERNALSYM SymSetContext}
+
+function SymFromAddr(hProcess: HANDLE; Address: DWORD64; Displacement: PDWORD64; Symbol: PSYMBOL_INFO): BOOL; stdcall;
+{$EXTERNALSYM SymFromAddr}
+
+// While SymFromName will provide a symbol from a name,
+// SymEnumSymbols can provide the same matching information
+// for ALL symbols with a matching name, even regular
+// expressions.  That way you can search across modules
+// and differentiate between identically named symbols.
+
+function SymFromName(hProcess: HANDLE; Name: LPSTR; Symbol: PSYMBOL_INFO): BOOL; stdcall;
+{$EXTERNALSYM SymFromName}
+
+type
+  PSYM_ENUMERATESYMBOLS_CALLBACK = function(pSymInfo: PSYMBOL_INFO; SymbolSize: ULONG; UserContext: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PSYM_ENUMERATESYMBOLS_CALLBACK}
+  PSymEnumerateSymbolsCallback = PSYM_ENUMERATESYMBOLS_CALLBACK;
+
+function SymEnumSymbols(hProcess: HANDLE; BaseOfDll: ULONG64; Mask: PCSTR; EnumSymbolsCallback: PSYM_ENUMERATESYMBOLS_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumSymbols}
+
+function SymEnumSymbolsForAddr(hProcess: HANDLE; Address: DWORD64;
+  EnumSymbolsCallback: PSYM_ENUMERATESYMBOLS_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumSymbolsForAddr}
+
+type
+  _IMAGEHLP_SYMBOL_TYPE_INFO = (
+    TI_GET_SYMTAG,
+    TI_GET_SYMNAME,
+    TI_GET_LENGTH,
+    TI_GET_TYPE,
+    TI_GET_TYPEID,
+    TI_GET_BASETYPE,
+    TI_GET_ARRAYINDEXTYPEID,
+    TI_FINDCHILDREN,
+    TI_GET_DATAKIND,
+    TI_GET_ADDRESSOFFSET,
+    TI_GET_OFFSET,
+    TI_GET_VALUE,
+    TI_GET_COUNT,
+    TI_GET_CHILDRENCOUNT,
+    TI_GET_BITPOSITION,
+    TI_GET_VIRTUALBASECLASS,
+    TI_GET_VIRTUALTABLESHAPEID,
+    TI_GET_VIRTUALBASEPOINTEROFFSET,
+    TI_GET_CLASSPARENTID,
+    TI_GET_NESTED,
+    TI_GET_SYMINDEX,
+    TI_GET_LEXICALPARENT,
+    TI_GET_ADDRESS,
+    TI_GET_THISADJUST,
+    TI_GET_UDTKIND,
+    TI_IS_EQUIV_TO,
+    TI_GET_CALLING_CONVENTION);
+  {$EXTERNALSYM _IMAGEHLP_SYMBOL_TYPE_INFO}
+  IMAGEHLP_SYMBOL_TYPE_INFO = _IMAGEHLP_SYMBOL_TYPE_INFO;
+  {$EXTERNALSYM IMAGEHLP_SYMBOL_TYPE_INFO}
+  TImageHlpSymbolTypeInfo = IMAGEHLP_SYMBOL_TYPE_INFO;
+
+  PTI_FINDCHILDREN_PARAMS = ^TI_FINDCHILDREN_PARAMS;
+  {$EXTERNALSYM PTI_FINDCHILDREN_PARAMS}
+  _TI_FINDCHILDREN_PARAMS = record
+    Count: ULONG;
+    Start: ULONG;
+    ChildId: array [0..0] of ULONG;
+  end;
+  {$EXTERNALSYM _TI_FINDCHILDREN_PARAMS}
+  TI_FINDCHILDREN_PARAMS = _TI_FINDCHILDREN_PARAMS;
+  {$EXTERNALSYM TI_FINDCHILDREN_PARAMS}
+  TTiFindChildrenParams = TI_FINDCHILDREN_PARAMS;
+  PTiFindChildrenParams = PTI_FINDCHILDREN_PARAMS;
+
+function SymGetTypeInfo(hProcess: HANDLE; ModBase: DWORD64; TypeId: ULONG; GetType: IMAGEHLP_SYMBOL_TYPE_INFO; pInfo: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymGetTypeInfo}
+
+function SymEnumTypes(hProcess: HANDLE; BaseOfDll: ULONG64; EnumSymbolsCallback: PSYM_ENUMERATESYMBOLS_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumTypes}
+
+function SymGetTypeFromName(hProcess: HANDLE; BaseOfDll: ULONG64; Name: LPSTR; Symbol: PSYMBOL_INFO): BOOL; stdcall;
+{$EXTERNALSYM SymGetTypeFromName}
+
+function SymAddSymbol(hProcess: HANDLE; BaseOfDll: ULONG64; Name: PCSTR; Address: DWORD64; Size, Flags: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymAddSymbol}
+
+function SymDeleteSymbol(hProcess: HANDLE; BaseOfDll: ULONG64; Name: PCSTR; Address: DWORD64; Flags: DWORD): BOOL; stdcall;
+{$EXTERNALSYM SymDeleteSymbol}
+
+//
+// Full user-mode dump creation.
+//
+
+type
+  PDBGHELP_CREATE_USER_DUMP_CALLBACK = function(DataType: DWORD; var Data: PVOID; DataLength: LPDWORD; UserData: PVOID): BOOL; stdcall;
+  {$EXTERNALSYM PDBGHELP_CREATE_USER_DUMP_CALLBACK}
+  PDbgHelpCreateUserDumpCallback = PDBGHELP_CREATE_USER_DUMP_CALLBACK;
+
+function DbgHelpCreateUserDump(FileName: LPSTR; Callback: PDBGHELP_CREATE_USER_DUMP_CALLBACK; UserData: PVOID): BOOL; stdcall;
+{$EXTERNALSYM DbgHelpCreateUserDump}
+
+function DbgHelpCreateUserDumpW(FileName: LPWSTR; Callback: PDBGHELP_CREATE_USER_DUMP_CALLBACK; UserData: PVOID): BOOL; stdcall;
+{$EXTERNALSYM DbgHelpCreateUserDumpW}
+
+// -----------------------------------------------------------------
+// The following 4 legacy APIs are fully supported, but newer
+// ones are recommended.  SymFromName and SymFromAddr provide
+// much more detailed info on the returned symbol.
+
+function SymGetSymFromAddr64(hProcess: HANDLE; qwAddr: DWORD64; pdwDisplacement: PDWORD64; Symbol: PIMAGEHLP_SYMBOL64): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymFromAddr64}
+
+function SymGetSymFromAddr(hProcess: HANDLE; dwAddr: DWORD; pdwDisplacement: PDWORD; Symbol: PIMAGEHLP_SYMBOL): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymFromAddr}
+
+// While following two APIs will provide a symbol from a name,
+// SymEnumSymbols can provide the same matching information
+// for ALL symbols with a matching name, even regular
+// expressions.  That way you can search across modules
+// and differentiate between identically named symbols.
+
+function SymGetSymFromName64(hProcess: HANDLE; Name: PSTR; Symbol: PIMAGEHLP_SYMBOL64): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymFromName64}
+
+function SymGetSymFromName(hProcess: HANDLE; Name: PSTR; Symbol: PIMAGEHLP_SYMBOL): BOOL; stdcall;
+{$EXTERNALSYM SymGetSymFromName}
+
+// -----------------------------------------------------------------
+// The following APIs exist only for backwards compatibility
+// with a pre-release version documented in an MSDN release.
+
+// You should use SymFindFileInPath if you want to maintain
+// future compatibility.
+
+function FindFileInPath(hprocess: HANDLE; SearchPath: LPSTR; FileName: LPSTR; id: PVOID; two: DWORD; three: DWORD; flags: DWORD; FilePath: LPSTR): BOOL; stdcall;
+{$EXTERNALSYM FindFileInPath}
+
+// You should use SymFindFileInPath if you want to maintain
+// future compatibility.
+
+function FindFileInSearchPath(hprocess: HANDLE; SearchPath: LPSTR; FileName: LPSTR; one: DWORD; two: DWORD; three: DWORD; FilePath: LPSTR): BOOL; stdcall;
+{$EXTERNALSYM FindFileInSearchPath}
+
+function SymEnumSym(hProcess: HANDLE; BaseOfDll: ULONG64; EnumSymbolsCallback: PSYM_ENUMERATESYMBOLS_CALLBACK; UserContext: PVOID): BOOL; stdcall;
+{$EXTERNALSYM SymEnumSym}
+
+// These values should not be used.
+// They have been replaced by SYMFLAG_ values.
+
+const
+  SYMF_OMAP_GENERATED  = $00000001;
+  SYMF_OMAP_MODIFIED   = $00000002;
+  SYMF_REGISTER        = $00000008;
+  SYMF_REGREL          = $00000010;
+  SYMF_FRAMEREL        = $00000020;
+  SYMF_PARAMETER       = $00000040;
+  SYMF_LOCAL           = $00000080;
+  SYMF_CONSTANT        = $00000100;
+  SYMF_EXPORT          = $00000200;
+  SYMF_FORWARDER       = $00000400;
+  SYMF_FUNCTION        = $00000800;
+  SYMF_VIRTUAL         = $00001000;
+  SYMF_THUNK           = $00002000;
+  SYMF_TLSREL          = $00004000;
+
+// These values should also not be used.
+// They have been replaced by SYMFLAG_ values.
+
+  IMAGEHLP_SYMBOL_INFO_VALUEPRESENT         = 1;
+  IMAGEHLP_SYMBOL_INFO_REGISTER             = SYMF_REGISTER;        // 0x0008
+  IMAGEHLP_SYMBOL_INFO_REGRELATIVE          = SYMF_REGREL;          // 0x0010
+  IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE        = SYMF_FRAMEREL;        // 0x0020
+  IMAGEHLP_SYMBOL_INFO_PARAMETER            = SYMF_PARAMETER;       // 0x0040
+  IMAGEHLP_SYMBOL_INFO_LOCAL                = SYMF_LOCAL;           // 0x0080
+  IMAGEHLP_SYMBOL_INFO_CONSTANT             = SYMF_CONSTANT;        // 0x0100
+  IMAGEHLP_SYMBOL_FUNCTION                  = SYMF_FUNCTION;        // 0x0800
+  IMAGEHLP_SYMBOL_VIRTUAL                   = SYMF_VIRTUAL;         // 0x1000
+  IMAGEHLP_SYMBOL_THUNK                     = SYMF_THUNK;           // 0x2000
+  IMAGEHLP_SYMBOL_INFO_TLSRELATIVE          = SYMF_TLSREL;          // 0x4000
+
+const
+  MINIDUMP_SIGNATURE = 'PMDM';
+  {$EXTERNALSYM MINIDUMP_SIGNATURE}
+  MINIDUMP_VERSION   = 42899;
+  {$EXTERNALSYM MINIDUMP_VERSION}
+
+type
+  RVA = DWORD;
+  {$EXTERNALSYM RVA}
+  RVA64 = ULONG64;
+  {$EXTERNALSYM RVA64}
+
+  _MINIDUMP_LOCATION_DESCRIPTOR = record
+    DataSize: ULONG32;
+    Rva: RVA;
+  end;
+  {$EXTERNALSYM _MINIDUMP_LOCATION_DESCRIPTOR}
+  MINIDUMP_LOCATION_DESCRIPTOR = _MINIDUMP_LOCATION_DESCRIPTOR;
+  {$EXTERNALSYM MINIDUMP_LOCATION_DESCRIPTOR}
+  TMinidumpLocationDescriptor = MINIDUMP_LOCATION_DESCRIPTOR;
+  PMinidumpLocationDescriptor = ^MINIDUMP_LOCATION_DESCRIPTOR;
+
+  _MINIDUMP_LOCATION_DESCRIPTOR64 = record
+    DataSize: ULONG64;
+    Rva: RVA64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_LOCATION_DESCRIPTOR64}
+  MINIDUMP_LOCATION_DESCRIPTOR64 = _MINIDUMP_LOCATION_DESCRIPTOR64;
+  {$EXTERNALSYM MINIDUMP_LOCATION_DESCRIPTOR64}
+  TMinidumpLocationDescriptor64 = MINIDUMP_LOCATION_DESCRIPTOR64;
+  PMinidumpLocationDescriptor64 = ^MINIDUMP_LOCATION_DESCRIPTOR64;
+
+  PMINIDUMP_MEMORY_DESCRIPTOR = ^MINIDUMP_MEMORY_DESCRIPTOR;
+  {$EXTERNALSYM PMINIDUMP_MEMORY_DESCRIPTOR}
+  _MINIDUMP_MEMORY_DESCRIPTOR = record
+    StartOfMemoryRange: ULONG64;
+    Memory: MINIDUMP_LOCATION_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MEMORY_DESCRIPTOR}
+  MINIDUMP_MEMORY_DESCRIPTOR = _MINIDUMP_MEMORY_DESCRIPTOR;
+  {$EXTERNALSYM MINIDUMP_MEMORY_DESCRIPTOR}
+  TMinidumpMemoryDescriptor = MINIDUMP_MEMORY_DESCRIPTOR;
+  PMinidumpMemoryDescriptor = PMINIDUMP_MEMORY_DESCRIPTOR;
+
+// DESCRIPTOR64 is used for full-memory minidumps where
+// all of the raw memory is laid out sequentially at the
+// end of the dump.  There is no need for individual RVAs
+// as the RVA is the base RVA plus the sum of the preceeding
+// data blocks.
+
+  PMINIDUMP_MEMORY_DESCRIPTOR64 = ^MINIDUMP_MEMORY_DESCRIPTOR64;
+  {$EXTERNALSYM PMINIDUMP_MEMORY_DESCRIPTOR64}
+  _MINIDUMP_MEMORY_DESCRIPTOR64 = record
+    StartOfMemoryRange: ULONG64;
+    DataSize: ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MEMORY_DESCRIPTOR64}
+  MINIDUMP_MEMORY_DESCRIPTOR64 = _MINIDUMP_MEMORY_DESCRIPTOR64;
+  {$EXTERNALSYM MINIDUMP_MEMORY_DESCRIPTOR64}
+  TMinidumpMemoryDescriptor64 = MINIDUMP_MEMORY_DESCRIPTOR64;
+  PMinidumpMemoryDescriptor64 = PMINIDUMP_MEMORY_DESCRIPTOR64;
+
+  PMINIDUMP_HEADER = ^MINIDUMP_HEADER;
+  {$EXTERNALSYM PMINIDUMP_HEADER}
+  _MINIDUMP_HEADER = record
+    Signature: ULONG32;
+    Version: ULONG32;
+    NumberOfStreams: ULONG32;
+    StreamDirectoryRva: RVA;
+    CheckSum: ULONG32;
+    U: record
+    case Integer of
+      0: (Reserved: ULONG32);
+      1: (TimeDateStamp: ULONG32);
+    end;
+    Flags: ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_HEADER}
+  MINIDUMP_HEADER = _MINIDUMP_HEADER;
+  {$EXTERNALSYM MINIDUMP_HEADER}
+  TMinidumpHeader = MINIDUMP_HEADER;
+  PMinidumpHeader = PMINIDUMP_HEADER;
+
+//
+// The MINIDUMP_HEADER field StreamDirectoryRva points to 
+// an array of MINIDUMP_DIRECTORY structures.
+//
+
+  PMINIDUMP_DIRECTORY = ^MINIDUMP_DIRECTORY;
+  {$EXTERNALSYM PMINIDUMP_DIRECTORY}
+  _MINIDUMP_DIRECTORY = record
+    StreamType: ULONG32;
+    Location: MINIDUMP_LOCATION_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_DIRECTORY}
+  MINIDUMP_DIRECTORY = _MINIDUMP_DIRECTORY;
+  {$EXTERNALSYM MINIDUMP_DIRECTORY}
+  TMinidumpDirectory = MINIDUMP_DIRECTORY;
+  PMinidumpDirectory = PMINIDUMP_DIRECTORY;
+
+  PMINIDUMP_STRING = ^MINIDUMP_STRING;
+  {$EXTERNALSYM PMINIDUMP_STRING}
+  _MINIDUMP_STRING = record
+    Length: ULONG32; // Length in bytes of the string
+    Buffer: PWCHAR; // Variable size buffer
+  end;
+  {$EXTERNALSYM _MINIDUMP_STRING}
+  MINIDUMP_STRING = _MINIDUMP_STRING;
+  {$EXTERNALSYM MINIDUMP_STRING}
+  TMinidumpString = MINIDUMP_STRING;
+  PMinidumpString = PMINIDUMP_STRING;
+
+//
+// The MINIDUMP_DIRECTORY field StreamType may be one of the following types.
+// Types will be added in the future, so if a program reading the minidump
+// header encounters a stream type it does not understand it should ignore
+// the data altogether. Any tag above LastReservedStream will not be used by
+// the system and is reserved for program-specific information.
+//
+
+const
+  UnusedStream                = 0;
+  {$EXTERNALSYM UnusedStream}
+  ReservedStream0             = 1;
+  {$EXTERNALSYM ReservedStream0}
+  ReservedStream1             = 2;
+  {$EXTERNALSYM ReservedStream1}
+  ThreadListStream            = 3;
+  {$EXTERNALSYM ThreadListStream}
+  ModuleListStream            = 4;
+  {$EXTERNALSYM ModuleListStream}
+  MemoryListStream            = 5;
+  {$EXTERNALSYM MemoryListStream}
+  ExceptionStream             = 6;
+  {$EXTERNALSYM ExceptionStream}
+  SystemInfoStream            = 7;
+  {$EXTERNALSYM SystemInfoStream}
+  ThreadExListStream          = 8;
+  {$EXTERNALSYM ThreadExListStream}
+  Memory64ListStream          = 9;
+  {$EXTERNALSYM Memory64ListStream}
+  CommentStreamA              = 10;
+  {$EXTERNALSYM CommentStreamA}
+  CommentStreamW              = 11;
+  {$EXTERNALSYM CommentStreamW}
+  HandleDataStream            = 12;
+  {$EXTERNALSYM HandleDataStream}
+  FunctionTableStream         = 13;
+  {$EXTERNALSYM FunctionTableStream}
+  UnloadedModuleListStream   = 14;
+  {$EXTERNALSYM UnloadedModuleListStream}
+  MiscInfoStream             = 15;
+  {$EXTERNALSYM MiscInfoStream}
+
+  LastReservedStream          = $ffff;
+  {$EXTERNALSYM LastReservedStream}
+
+type
+  _MINIDUMP_STREAM_TYPE = DWORD;
+  {$EXTERNALSYM MINIDUMP_STREAM_TYPE}
+  MINIDUMP_STREAM_TYPE = _MINIDUMP_STREAM_TYPE;
+  {$EXTERNALSYM _MINIDUMP_STREAM_TYPE}
+  TMinidumpStreamType = MINIDUMP_STREAM_TYPE;
+
+//
+// The minidump system information contains processor and
+// Operating System specific information.
+//
+
+type
+  _CPU_INFORMATION = record
+    case Integer of
+
+        //
+        // X86 platforms use CPUID function to obtain processor information.
+        //
+
+        0: (
+
+          //
+          // CPUID Subfunction 0, register EAX (VendorId [0]),
+          // EBX (VendorId [1]) and ECX (VendorId [2]).
+          //
+
+          VendorId: array [0..2] of ULONG32;
+
+          //
+          // CPUID Subfunction 1, register EAX
+          //
+
+          VersionInformation: ULONG32;
+
+          //
+          // CPUID Subfunction 1, register EDX
+          //
+
+          FeatureInformation: ULONG32;
+
+          //
+          // CPUID, Subfunction 80000001, register EBX. This will only
+          // be obtained if the vendor id is "AuthenticAMD".
+          //
+
+          AMDExtendedCpuFeatures: ULONG32);
+
+        //
+        // Non-x86 platforms use processor feature flags.
+        //
+
+        1: (
+          ProcessorFeatures: array [0..1] of ULONG64);
+    end;
+
+  _MINIDUMP_SYSTEM_INFO = record
+
+    //
+    // ProcessorArchitecture, ProcessorLevel and ProcessorRevision are all
+    // taken from the SYSTEM_INFO structure obtained by GetSystemInfo( ).
+    //
+
+    ProcessorArchitecture: USHORT;
+    ProcessorLevel: USHORT;
+    ProcessorRevision: USHORT;
+
+    U: record
+    case Integer of
+      0: (Reserved0: USHORT);
+      1: (
+        NumberOfProcessors: UCHAR;
+        ProductType: UCHAR);
+    end;
+
+    //
+    // MajorVersion, MinorVersion, BuildNumber, PlatformId and
+    // CSDVersion are all taken from the OSVERSIONINFO structure
+    // returned by GetVersionEx( ).
+    //
+
+    MajorVersion: ULONG32;
+    MinorVersion: ULONG32;
+    BuildNumber: ULONG32;
+    PlatformId: ULONG32;
+
+    //
+    // RVA to a CSDVersion string in the string table.
+    //
+
+    CSDVersionRva: RVA;
+
+    U2: record
+    case Integer of
+      0: (Reserved1: ULONG32);
+      1: (
+        SuiteMask: USHORT;
+        Reserved2: USHORT);
+    end;
+    
+    //
+    // CPU information is obtained from one of two places.
+    //
+    //  1) On x86 computers, CPU_INFORMATION is obtained from the CPUID
+    //     instruction. You must use the X86 portion of the union for X86
+    //     computers.
+    //
+    //  2) On non-x86 architectures, CPU_INFORMATION is obtained by calling
+    //     IsProcessorFeatureSupported().
+    //
+
+    Cpu: _CPU_INFORMATION;
+  end;
+  {$EXTERNALSYM _MINIDUMP_SYSTEM_INFO}
+  MINIDUMP_SYSTEM_INFO = _MINIDUMP_SYSTEM_INFO;
+  {$EXTERNALSYM MINIDUMP_SYSTEM_INFO}
+  PMINIDUMP_SYSTEM_INFO = ^MINIDUMP_SYSTEM_INFO;
+  {$EXTERNALSYM PMINIDUMP_SYSTEM_INFO}
+  TMinidumpSystemInfo = MINIDUMP_SYSTEM_INFO;
+  PMinidumpSystemInfo = PMINIDUMP_SYSTEM_INFO;
+
+  CPU_INFORMATION = _CPU_INFORMATION;
+  {$EXTERNALSYM CPU_INFORMATION}
+  PCPU_INFORMATION = CPU_INFORMATION;
+  {$EXTERNALSYM PCPU_INFORMATION}
+
+//
+// The minidump thread contains standard thread
+// information plus an RVA to the memory for this 
+// thread and an RVA to the CONTEXT structure for
+// this thread.
+//
+
+//
+// ThreadId must be 4 bytes on all architectures.
+//
+
+// C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
+
+type
+  PMINIDUMP_THREAD = ^MINIDUMP_THREAD;
+  {$EXTERNALSYM PMINIDUMP_THREAD}
+  _MINIDUMP_THREAD = record
+    ThreadId: ULONG32;
+    SuspendCount: ULONG32;
+    PriorityClass: ULONG32;
+    Priority: ULONG32;
+    Teb: ULONG64;
+    Stack: MINIDUMP_MEMORY_DESCRIPTOR;
+    ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD}
+  MINIDUMP_THREAD = _MINIDUMP_THREAD;
+  {$EXTERNALSYM MINIDUMP_THREAD}
+  TMinidumpThread = MINIDUMP_THREAD;
+  PMinidumpThread = PMINIDUMP_THREAD;
+
+//
+// The thread list is a container of threads.
+//
+
+  PMINIDUMP_THREAD_LIST = ^MINIDUMP_THREAD_LIST;
+  {$EXTERNALSYM PMINIDUMP_THREAD_LIST}
+  _MINIDUMP_THREAD_LIST = record
+    NumberOfThreads: ULONG32;
+    Threads: array [0..0] of MINIDUMP_THREAD;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD_LIST}
+  MINIDUMP_THREAD_LIST = _MINIDUMP_THREAD_LIST;
+  {$EXTERNALSYM MINIDUMP_THREAD_LIST}
+  TMinidumpThreadList = MINIDUMP_THREAD_LIST;
+  PMinidumpThreadList = PMINIDUMP_THREAD_LIST;
+
+  PMINIDUMP_THREAD_EX = ^MINIDUMP_THREAD_EX;
+  {$EXTERNALSYM PMINIDUMP_THREAD_EX}
+  _MINIDUMP_THREAD_EX = record
+    ThreadId: ULONG32;
+    SuspendCount: ULONG32;
+    PriorityClass: ULONG32;
+    Priority: ULONG32;
+    Teb: ULONG64;
+    Stack: MINIDUMP_MEMORY_DESCRIPTOR;
+    ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR;
+    BackingStore: MINIDUMP_MEMORY_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD_EX}
+  MINIDUMP_THREAD_EX = _MINIDUMP_THREAD_EX;
+  {$EXTERNALSYM MINIDUMP_THREAD_EX}
+  TMinidumpThreadEx = MINIDUMP_THREAD_EX;
+  PMinidumpThreadEx = PMINIDUMP_THREAD_EX;
+
+//
+// The thread list is a container of threads.
+//
+
+  PMINIDUMP_THREAD_EX_LIST = ^MINIDUMP_THREAD_EX_LIST;
+  {$EXTERNALSYM PMINIDUMP_THREAD_EX_LIST}
+  _MINIDUMP_THREAD_EX_LIST = record
+    NumberOfThreads: ULONG32;
+    Threads: array [0..0] of MINIDUMP_THREAD_EX;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD_EX_LIST}
+  MINIDUMP_THREAD_EX_LIST = _MINIDUMP_THREAD_EX_LIST;
+  {$EXTERNALSYM MINIDUMP_THREAD_EX_LIST}
+  TMinidumpThreadExList = MINIDUMP_THREAD_EX_LIST;
+  PMinidumpThreadExList = PMINIDUMP_THREAD_EX_LIST;
+
+//
+// The MINIDUMP_EXCEPTION is the same as EXCEPTION on Win64.
+//
+
+  PMINIDUMP_EXCEPTION = ^MINIDUMP_EXCEPTION;
+  {$EXTERNALSYM PMINIDUMP_EXCEPTION}
+  _MINIDUMP_EXCEPTION = record
+    ExceptionCode: ULONG32;
+    ExceptionFlags: ULONG32;
+    ExceptionRecord: ULONG64;
+    ExceptionAddress: ULONG64;
+    NumberParameters: ULONG32;
+    __unusedAlignment: ULONG32;
+    ExceptionInformation: array [0..EXCEPTION_MAXIMUM_PARAMETERS - 1] of ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_EXCEPTION}
+  MINIDUMP_EXCEPTION = _MINIDUMP_EXCEPTION;
+  {$EXTERNALSYM MINIDUMP_EXCEPTION}
+  TMinidumpException = MINIDUMP_EXCEPTION;
+  PMinidumpException = PMINIDUMP_EXCEPTION;
+
+//
+// The exception information stream contains the id of the thread that caused
+// the exception (ThreadId), the exception record for the exception
+// (ExceptionRecord) and an RVA to the thread context where the exception
+// occured.
+//
+
+  PMINIDUMP_EXCEPTION_STREAM = ^MINIDUMP_EXCEPTION_STREAM;
+  {$EXTERNALSYM PMINIDUMP_EXCEPTION_STREAM}
+  _MINIDUMP_EXCEPTION_STREAM = record
+    ThreadId: ULONG32;
+    __alignment: ULONG32;
+    ExceptionRecord: MINIDUMP_EXCEPTION;
+    ThreadContext: MINIDUMP_LOCATION_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_EXCEPTION_STREAM}
+  MINIDUMP_EXCEPTION_STREAM = _MINIDUMP_EXCEPTION_STREAM;
+  {$EXTERNALSYM MINIDUMP_EXCEPTION_STREAM}
+  TMinidumpExceptionStream = MINIDUMP_EXCEPTION_STREAM;
+  PMinidumpExceptionStream = PMINIDUMP_EXCEPTION_STREAM;
+
+//
+// The MINIDUMP_MODULE contains information about a
+// a specific module. It includes the CheckSum and
+// the TimeDateStamp for the module so the module
+// can be reloaded during the analysis phase.
+//
+
+  PMINIDUMP_MODULE = ^MINIDUMP_MODULE;
+  {$EXTERNALSYM PMINIDUMP_MODULE}
+  _MINIDUMP_MODULE = record
+    BaseOfImage: ULONG64;
+    SizeOfImage: ULONG32;
+    CheckSum: ULONG32;
+    TimeDateStamp: ULONG32;
+    ModuleNameRva: RVA;
+    VersionInfo: VS_FIXEDFILEINFO;
+    CvRecord: MINIDUMP_LOCATION_DESCRIPTOR;
+    MiscRecord: MINIDUMP_LOCATION_DESCRIPTOR;
+    Reserved0: ULONG64; // Reserved for future use.
+    Reserved1: ULONG64; // Reserved for future use.
+  end;
+  {$EXTERNALSYM _MINIDUMP_MODULE}
+  MINIDUMP_MODULE = _MINIDUMP_MODULE;
+  {$EXTERNALSYM MINIDUMP_MODULE}
+  TMinidumpModule = MINIDUMP_MODULE;
+  PMinidumpModule = PMINIDUMP_MODULE;
+
+//
+// The minidump module list is a container for modules.
+//
+
+  PMINIDUMP_MODULE_LIST = ^MINIDUMP_MODULE_LIST;
+  {$EXTERNALSYM PMINIDUMP_MODULE_LIST}
+  _MINIDUMP_MODULE_LIST = record
+    NumberOfModules: ULONG32;
+    Modules: array [0..0] of MINIDUMP_MODULE;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MODULE_LIST}
+  MINIDUMP_MODULE_LIST = _MINIDUMP_MODULE_LIST;
+  {$EXTERNALSYM MINIDUMP_MODULE_LIST}
+  TMinidumpModuleList = MINIDUMP_MODULE_LIST;
+  PMinidumpModuleList = PMINIDUMP_MODULE_LIST;
+
+//
+// Memory Ranges
+//
+
+  PMINIDUMP_MEMORY_LIST = ^MINIDUMP_MEMORY_LIST;
+  {$EXTERNALSYM PMINIDUMP_MEMORY_LIST}
+  _MINIDUMP_MEMORY_LIST = record
+    NumberOfMemoryRanges: ULONG32;
+    MemoryRanges: array [0..0] of MINIDUMP_MEMORY_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MEMORY_LIST}
+  MINIDUMP_MEMORY_LIST = _MINIDUMP_MEMORY_LIST;
+  {$EXTERNALSYM MINIDUMP_MEMORY_LIST}
+  TMinidumpMemoryList = MINIDUMP_MEMORY_LIST;
+  PMinidumpMemoryList = PMINIDUMP_MEMORY_LIST;
+
+  PMINIDUMP_MEMORY64_LIST = ^MINIDUMP_MEMORY64_LIST;
+  {$EXTERNALSYM PMINIDUMP_MEMORY64_LIST}
+  _MINIDUMP_MEMORY64_LIST = record
+    NumberOfMemoryRanges: ULONG64;
+    BaseRva: RVA64;
+    MemoryRanges: array [0..0] of MINIDUMP_MEMORY_DESCRIPTOR64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MEMORY64_LIST}
+  MINIDUMP_MEMORY64_LIST = _MINIDUMP_MEMORY64_LIST;
+  {$EXTERNALSYM MINIDUMP_MEMORY64_LIST}
+  TMinidumpMemory64List = MINIDUMP_MEMORY64_LIST;
+  PMinidumpMemory64List = PMINIDUMP_MEMORY64_LIST;
+
+//
+// Support for user supplied exception information.
+//
+
+  PMINIDUMP_EXCEPTION_INFORMATION = ^MINIDUMP_EXCEPTION_INFORMATION;
+  {$EXTERNALSYM PMINIDUMP_EXCEPTION_INFORMATION}
+  _MINIDUMP_EXCEPTION_INFORMATION = record
+    ThreadId: DWORD;
+    ExceptionPointers: PEXCEPTION_POINTERS;
+    ClientPointers: BOOL;
+  end;
+  {$EXTERNALSYM _MINIDUMP_EXCEPTION_INFORMATION}
+  MINIDUMP_EXCEPTION_INFORMATION = _MINIDUMP_EXCEPTION_INFORMATION;
+  {$EXTERNALSYM MINIDUMP_EXCEPTION_INFORMATION}
+  TMinidumpExceptionInformation = MINIDUMP_EXCEPTION_INFORMATION;
+  PMinidumpExceptionInformation = PMINIDUMP_EXCEPTION_INFORMATION;
+
+//
+// Support for capturing system handle state at the time of the dump.
+//
+
+  PMINIDUMP_HANDLE_DESCRIPTOR = ^MINIDUMP_HANDLE_DESCRIPTOR;
+  {$EXTERNALSYM PMINIDUMP_HANDLE_DESCRIPTOR}
+  _MINIDUMP_HANDLE_DESCRIPTOR = record
+    Handle: ULONG64;
+    TypeNameRva: RVA;
+    ObjectNameRva: RVA;
+    Attributes: ULONG32;
+    GrantedAccess: ULONG32;
+    HandleCount: ULONG32;
+    PointerCount: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_HANDLE_DESCRIPTOR}
+  MINIDUMP_HANDLE_DESCRIPTOR = _MINIDUMP_HANDLE_DESCRIPTOR;
+  {$EXTERNALSYM MINIDUMP_HANDLE_DESCRIPTOR}
+  TMinidumpHandleDescriptor = MINIDUMP_HANDLE_DESCRIPTOR;
+  PMinidumpHandleDescriptor = PMINIDUMP_HANDLE_DESCRIPTOR;
+
+  PMINIDUMP_HANDLE_DATA_STREAM = ^MINIDUMP_HANDLE_DATA_STREAM;
+  {$EXTERNALSYM PMINIDUMP_HANDLE_DATA_STREAM}
+  _MINIDUMP_HANDLE_DATA_STREAM = record
+    SizeOfHeader: ULONG32;
+    SizeOfDescriptor: ULONG32;
+    NumberOfDescriptors: ULONG32;
+    Reserved: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_HANDLE_DATA_STREAM}
+  MINIDUMP_HANDLE_DATA_STREAM = _MINIDUMP_HANDLE_DATA_STREAM;
+  {$EXTERNALSYM MINIDUMP_HANDLE_DATA_STREAM}
+  TMinidumpHandleDataStream = MINIDUMP_HANDLE_DATA_STREAM;
+  PMinidumpHandleDataStream = PMINIDUMP_HANDLE_DATA_STREAM;
+
+//
+// Support for capturing dynamic function table state at the time of the dump.
+//
+
+  PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR = ^MINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
+  {$EXTERNALSYM PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR}
+  _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR = record
+    MinimumAddress: ULONG64;
+    MaximumAddress: ULONG64;
+    BaseAddress: ULONG64;
+    EntryCount: ULONG32;
+    SizeOfAlignPad: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR}
+  MINIDUMP_FUNCTION_TABLE_DESCRIPTOR = _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
+  {$EXTERNALSYM MINIDUMP_FUNCTION_TABLE_DESCRIPTOR}
+  TMinidumpFunctionTableDescriptor = MINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
+  PMinidumpFunctionTableDescriptor = PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR;
+
+  PMINIDUMP_FUNCTION_TABLE_STREAM = ^MINIDUMP_FUNCTION_TABLE_STREAM;
+  {$EXTERNALSYM PMINIDUMP_FUNCTION_TABLE_STREAM}
+  _MINIDUMP_FUNCTION_TABLE_STREAM = record
+    SizeOfHeader: ULONG32;
+    SizeOfDescriptor: ULONG32;
+    SizeOfNativeDescriptor: ULONG32;
+    SizeOfFunctionEntry: ULONG32;
+    NumberOfDescriptors: ULONG32;
+    SizeOfAlignPad: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_FUNCTION_TABLE_STREAM}
+  MINIDUMP_FUNCTION_TABLE_STREAM = _MINIDUMP_FUNCTION_TABLE_STREAM;
+  {$EXTERNALSYM MINIDUMP_FUNCTION_TABLE_STREAM}
+  TMinidumpFunctionTableStream = MINIDUMP_FUNCTION_TABLE_STREAM;
+  PMinidumpFunctionTableStream = PMINIDUMP_FUNCTION_TABLE_STREAM;
+
+//
+// The MINIDUMP_UNLOADED_MODULE contains information about a
+// a specific module that was previously loaded but no
+// longer is.  This can help with diagnosing problems where
+// callers attempt to call code that is no longer loaded.
+//
+
+  _MINIDUMP_UNLOADED_MODULE = record
+    BaseOfImage: ULONG64;
+    SizeOfImage: ULONG32;
+    CheckSum: ULONG32;
+    TimeDateStamp: ULONG32;
+    ModuleNameRva: RVA;
+  end;
+  {$EXTERNALSYM _MINIDUMP_UNLOADED_MODULE}
+  MINIDUMP_UNLOADED_MODULE = _MINIDUMP_UNLOADED_MODULE;
+  {$EXTERNALSYM MINIDUMP_UNLOADED_MODULE}
+  PMINIDUMP_UNLOADED_MODULE = ^MINIDUMP_UNLOADED_MODULE;
+  {$EXTERNALSYM PMINIDUMP_UNLOADED_MODULE}
+  TMiniDumpUnloadedModule = MINIDUMP_UNLOADED_MODULE;
+  PMiniDumpUnloadedModule = PMINIDUMP_UNLOADED_MODULE;
+
+//
+// The minidump unloaded module list is a container for unloaded modules.
+//
+
+  _MINIDUMP_UNLOADED_MODULE_LIST = record
+    SizeOfHeader: ULONG32;
+    SizeOfEntry: ULONG32;
+    NumberOfEntries: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_UNLOADED_MODULE_LIST}
+  MINIDUMP_UNLOADED_MODULE_LIST = _MINIDUMP_UNLOADED_MODULE_LIST;
+  {$EXTERNALSYM MINIDUMP_UNLOADED_MODULE_LIST}
+  PMINIDUMP_UNLOADED_MODULE_LIST = ^MINIDUMP_UNLOADED_MODULE_LIST;
+  {$EXTERNALSYM PMINIDUMP_UNLOADED_MODULE_LIST}
+  TMiniDumpUnloadedModuleList = MINIDUMP_UNLOADED_MODULE_LIST;
+  PMiniDumpUnloadedModuleList = PMINIDUMP_UNLOADED_MODULE_LIST;
+
+//
+// The miscellaneous information stream contains a variety
+// of small pieces of information.  A member is valid if
+// it's within the available size and its corresponding
+// bit is set.
+//
+
+const
+  MINIDUMP_MISC1_PROCESS_ID    = $00000001;
+  {$EXTERNALSYM MINIDUMP_MISC1_PROCESS_ID}
+  MINIDUMP_MISC1_PROCESS_TIMES = $00000002;
+  {$EXTERNALSYM MINIDUMP_MISC1_PROCESS_TIMES}
+
+type
+  _MINIDUMP_MISC_INFO = record
+    SizeOfInfo: ULONG32;
+    Flags1: ULONG32;
+    ProcessId: ULONG32;
+    ProcessCreateTime: ULONG32;
+    ProcessUserTime: ULONG32;
+    ProcessKernelTime: ULONG32;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MISC_INFO}
+  MINIDUMP_MISC_INFO = _MINIDUMP_MISC_INFO;
+  {$EXTERNALSYM MINIDUMP_MISC_INFO}
+  PMINIDUMP_MISC_INFO = ^MINIDUMP_MISC_INFO;
+  {$EXTERNALSYM PMINIDUMP_MISC_INFO}
+  TMiniDumpMiscInfo = MINIDUMP_MISC_INFO;
+  PMiniDumpMiscInfo = PMINIDUMP_MISC_INFO;
+
+//
+// Support for arbitrary user-defined information.
+//
+
+  PMINIDUMP_USER_RECORD = ^MINIDUMP_USER_RECORD;
+  {$EXTERNALSYM PMINIDUMP_USER_RECORD}
+  _MINIDUMP_USER_RECORD = record
+    Type_: ULONG32;
+    Memory: MINIDUMP_LOCATION_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _MINIDUMP_USER_RECORD}
+  MINIDUMP_USER_RECORD = _MINIDUMP_USER_RECORD;
+  {$EXTERNALSYM MINIDUMP_USER_RECORD}
+  TMinidumpUserRecord = MINIDUMP_USER_RECORD;
+  PMinidumpUserRecord = PMINIDUMP_USER_RECORD;
+
+  PMINIDUMP_USER_STREAM = ^MINIDUMP_USER_STREAM;
+  {$EXTERNALSYM PMINIDUMP_USER_STREAM}
+  _MINIDUMP_USER_STREAM = record
+    Type_: ULONG32;
+    BufferSize: ULONG;
+    Buffer: PVOID;
+  end;
+  {$EXTERNALSYM _MINIDUMP_USER_STREAM}
+  MINIDUMP_USER_STREAM = _MINIDUMP_USER_STREAM;
+  {$EXTERNALSYM MINIDUMP_USER_STREAM}
+  TMinidumpUserStream = MINIDUMP_USER_STREAM;
+  PMinidumpUserStream = PMINIDUMP_USER_STREAM;
+
+  PMINIDUMP_USER_STREAM_INFORMATION = ^MINIDUMP_USER_STREAM_INFORMATION;
+  {$EXTERNALSYM PMINIDUMP_USER_STREAM_INFORMATION}
+  _MINIDUMP_USER_STREAM_INFORMATION = record
+    UserStreamCount: ULONG;
+    UserStreamArray: PMINIDUMP_USER_STREAM;
+  end;
+  {$EXTERNALSYM _MINIDUMP_USER_STREAM_INFORMATION}
+  MINIDUMP_USER_STREAM_INFORMATION = _MINIDUMP_USER_STREAM_INFORMATION;
+  {$EXTERNALSYM MINIDUMP_USER_STREAM_INFORMATION}
+  TMinidumpUserStreamInformation = MINIDUMP_USER_STREAM_INFORMATION;
+  PMinidumpUserStreamInformation = PMINIDUMP_USER_STREAM_INFORMATION;
+
+//
+// Callback support.
+//
+
+  _MINIDUMP_CALLBACK_TYPE = (
+    ModuleCallback,
+    ThreadCallback,
+    ThreadExCallback,
+    IncludeThreadCallback,
+    IncludeModuleCallback);
+  {$EXTERNALSYM _MINIDUMP_CALLBACK_TYPE}
+  MINIDUMP_CALLBACK_TYPE = _MINIDUMP_CALLBACK_TYPE;
+  {$EXTERNALSYM MINIDUMP_CALLBACK_TYPE}
+  TMinidumpCallbackType = MINIDUMP_CALLBACK_TYPE;
+
+  PMINIDUMP_THREAD_CALLBACK = ^MINIDUMP_THREAD_CALLBACK;
+  {$EXTERNALSYM PMINIDUMP_THREAD_CALLBACK}
+  _MINIDUMP_THREAD_CALLBACK = record
+    ThreadId: ULONG;
+    ThreadHandle: HANDLE;
+    Context: CONTEXT;
+    SizeOfContext: ULONG;
+    StackBase: ULONG64;
+    StackEnd: ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD_CALLBACK}
+  MINIDUMP_THREAD_CALLBACK = _MINIDUMP_THREAD_CALLBACK;
+  {$EXTERNALSYM MINIDUMP_THREAD_CALLBACK}
+  TMinidumpThreadCallback = MINIDUMP_THREAD_CALLBACK;
+  PMinidumpThreadCallback = PMINIDUMP_THREAD_CALLBACK;
+
+  PMINIDUMP_THREAD_EX_CALLBACK = ^MINIDUMP_THREAD_EX_CALLBACK;
+  {$EXTERNALSYM PMINIDUMP_THREAD_EX_CALLBACK}
+  _MINIDUMP_THREAD_EX_CALLBACK = record
+    ThreadId: ULONG;
+    ThreadHandle: HANDLE;
+    Context: CONTEXT;
+    SizeOfContext: ULONG;
+    StackBase: ULONG64;
+    StackEnd: ULONG64;
+    BackingStoreBase: ULONG64;
+    BackingStoreEnd: ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_THREAD_EX_CALLBACK}
+  MINIDUMP_THREAD_EX_CALLBACK = _MINIDUMP_THREAD_EX_CALLBACK;
+  {$EXTERNALSYM MINIDUMP_THREAD_EX_CALLBACK}
+  TMinidumpThreadExCallback = MINIDUMP_THREAD_EX_CALLBACK;
+  PMinidumpThreadExCallback = PMINIDUMP_THREAD_EX_CALLBACK;
+
+  PMINIDUMP_INCLUDE_THREAD_CALLBACK = ^MINIDUMP_INCLUDE_THREAD_CALLBACK;
+  {$EXTERNALSYM PMINIDUMP_INCLUDE_THREAD_CALLBACK}
+  _MINIDUMP_INCLUDE_THREAD_CALLBACK = record
+    ThreadId: ULONG;
+  end;
+  {$EXTERNALSYM _MINIDUMP_INCLUDE_THREAD_CALLBACK}
+  MINIDUMP_INCLUDE_THREAD_CALLBACK = _MINIDUMP_INCLUDE_THREAD_CALLBACK;
+  {$EXTERNALSYM MINIDUMP_INCLUDE_THREAD_CALLBACK}
+  TMinidumpIncludeThreadCallback = MINIDUMP_INCLUDE_THREAD_CALLBACK;
+  PMinidumpIncludeThreadCallback = PMINIDUMP_INCLUDE_THREAD_CALLBACK;
+
+const
+  ThreadWriteThread            = $0001;
+  {$EXTERNALSYM ThreadWriteThread}
+  ThreadWriteStack             = $0002;
+  {$EXTERNALSYM ThreadWriteStack}
+  ThreadWriteContext           = $0004;
+  {$EXTERNALSYM ThreadWriteContext}
+  ThreadWriteBackingStore      = $0008;
+  {$EXTERNALSYM ThreadWriteBackingStore}
+  ThreadWriteInstructionWindow = $0010;
+  {$EXTERNALSYM ThreadWriteInstructionWindow}
+  ThreadWriteThreadData        = $0020;
+  {$EXTERNALSYM ThreadWriteThreadData}
+
+type
+  _THREAD_WRITE_FLAGS = DWORD;
+  {$EXTERNALSYM _THREAD_WRITE_FLAGS}
+  THREAD_WRITE_FLAGS = _THREAD_WRITE_FLAGS;
+  {$EXTERNALSYM THREAD_WRITE_FLAGS}
+  TThreadWriteFlags = THREAD_WRITE_FLAGS;
+
+type
+  PMINIDUMP_MODULE_CALLBACK = ^MINIDUMP_MODULE_CALLBACK;
+  {$EXTERNALSYM PMINIDUMP_MODULE_CALLBACK}
+  _MINIDUMP_MODULE_CALLBACK = record
+    FullPath: PWCHAR;
+    BaseOfImage: ULONG64;
+    SizeOfImage: ULONG;
+    CheckSum: ULONG;
+    TimeDateStamp: ULONG;
+    VersionInfo: VS_FIXEDFILEINFO;
+    CvRecord: PVOID;
+    SizeOfCvRecord: ULONG;
+    MiscRecord: PVOID;
+    SizeOfMiscRecord: ULONG;
+  end;
+  {$EXTERNALSYM _MINIDUMP_MODULE_CALLBACK}
+  MINIDUMP_MODULE_CALLBACK = _MINIDUMP_MODULE_CALLBACK;
+  {$EXTERNALSYM MINIDUMP_MODULE_CALLBACK}
+  TMinidumpModuleCallback = MINIDUMP_MODULE_CALLBACK;
+  PMinidumpModuleCallback = PMINIDUMP_MODULE_CALLBACK;
+
+  PMINIDUMP_INCLUDE_MODULE_CALLBACK = ^MINIDUMP_INCLUDE_MODULE_CALLBACK;
+  {$EXTERNALSYM PMINIDUMP_INCLUDE_MODULE_CALLBACK}
+  _MINIDUMP_INCLUDE_MODULE_CALLBACK = record
+    BaseOfImage: ULONG64;
+  end;
+  {$EXTERNALSYM _MINIDUMP_INCLUDE_MODULE_CALLBACK}
+  MINIDUMP_INCLUDE_MODULE_CALLBACK = _MINIDUMP_INCLUDE_MODULE_CALLBACK;
+  {$EXTERNALSYM MINIDUMP_INCLUDE_MODULE_CALLBACK}
+  TMinidumpIncludeModuleCallback = MINIDUMP_INCLUDE_MODULE_CALLBACK;
+  PMinidumpIncludeModuleCallback = PMINIDUMP_INCLUDE_MODULE_CALLBACK;
+
+const
+  ModuleWriteModule        = $0001;
+  {$EXTERNALSYM ModuleWriteModule}
+  ModuleWriteDataSeg       = $0002;
+  {$EXTERNALSYM ModuleWriteDataSeg}
+  ModuleWriteMiscRecord    = $0004;
+  {$EXTERNALSYM ModuleWriteMiscRecord}
+  ModuleWriteCvRecord      = $0008;
+  {$EXTERNALSYM ModuleWriteCvRecord}
+  ModuleReferencedByMemory = $0010;
+  {$EXTERNALSYM ModuleReferencedByMemory}
+
+type
+  _MODULE_WRITE_FLAGS = DWORD;
+  {$EXTERNALSYM _MODULE_WRITE_FLAGS}
+  MODULE_WRITE_FLAGS = _MODULE_WRITE_FLAGS;
+  {$EXTERNALSYM MODULE_WRITE_FLAGS}
+  TModuleWriteFlags = MODULE_WRITE_FLAGS;
+
+  _MINIDUMP_CALLBACK_INPUT = record
+    ProcessId: ULONG;
+    ProcessHandle: HANDLE;
+    CallbackType: ULONG;
+    case Integer of
+      0: (Thread: MINIDUMP_THREAD_CALLBACK);
+      1: (ThreadEx: MINIDUMP_THREAD_EX_CALLBACK);
+      2: (Module: MINIDUMP_MODULE_CALLBACK);
+      3: (IncludeThread: MINIDUMP_INCLUDE_THREAD_CALLBACK);
+      4: (IncludeModule: MINIDUMP_INCLUDE_MODULE_CALLBACK);
+  end;
+  {$EXTERNALSYM _MINIDUMP_CALLBACK_INPUT}
+  MINIDUMP_CALLBACK_INPUT = _MINIDUMP_CALLBACK_INPUT;
+  {$EXTERNALSYM MINIDUMP_CALLBACK_INPUT}
+  PMINIDUMP_CALLBACK_INPUT = ^MINIDUMP_CALLBACK_INPUT;
+  {$EXTERNALSYM PMINIDUMP_CALLBACK_INPUT}
+  TminidumpCallbackInput = MINIDUMP_CALLBACK_INPUT;
+
+  PMINIDUMP_CALLBACK_OUTPUT = ^MINIDUMP_CALLBACK_OUTPUT;
+  {$EXTERNALSYM PMINIDUMP_CALLBACK_OUTPUT}
+  _MINIDUMP_CALLBACK_OUTPUT = record
+    case Integer of
+      0: (ModuleWriteFlags: ULONG);
+      1: (ThreadWriteFlags: ULONG);
+  end;
+  {$EXTERNALSYM _MINIDUMP_CALLBACK_OUTPUT}
+  MINIDUMP_CALLBACK_OUTPUT = _MINIDUMP_CALLBACK_OUTPUT;
+  {$EXTERNALSYM MINIDUMP_CALLBACK_OUTPUT}
+  TMinidumpCallbackOutput = MINIDUMP_CALLBACK_OUTPUT;
+  PMinidumpCallbackOutput = PMINIDUMP_CALLBACK_OUTPUT;
+
+//
+// A normal minidump contains just the information
+// necessary to capture stack traces for all of the
+// existing threads in a process.
+//
+// A minidump with data segments includes all of the data
+// sections from loaded modules in order to capture
+// global variable contents.  This can make the dump much
+// larger if many modules have global data.
+//
+// A minidump with full memory includes all of the accessible
+// memory in the process and can be very large.  A minidump
+// with full memory always has the raw memory data at the end
+// of the dump so that the initial structures in the dump can
+// be mapped directly without having to include the raw
+// memory information.
+//
+// Stack and backing store memory can be filtered to remove
+// data unnecessary for stack walking.  This can improve
+// compression of stacks and also deletes data that may
+// be private and should not be stored in a dump.
+// Memory can also be scanned to see what modules are
+// referenced by stack and backing store memory to allow
+// omission of other modules to reduce dump size.
+// In either of these modes the ModuleReferencedByMemory flag
+// is set for all modules referenced before the base
+// module callbacks occur.
+//
+// On some operating systems a list of modules that were
+// recently unloaded is kept in addition to the currently
+// loaded module list.  This information can be saved in
+// the dump if desired.
+//
+// Stack and backing store memory can be scanned for referenced
+// pages in order to pick up data referenced by locals or other
+// stack memory.  This can increase the size of a dump significantly.
+//
+// Module paths may contain undesired information such as user names
+// or other important directory names so they can be stripped.  This
+// option reduces the ability to locate the proper image later
+// and should only be used in certain situations.
+//
+// Complete operating system per-process and per-thread information can
+// be gathered and stored in the dump.
+//
+// The virtual address space can be scanned for various types
+// of memory to be included in the dump.
+//
+
+const
+  MiniDumpNormal         = $0000;
+  {$EXTERNALSYM MiniDumpNormal}
+  MiniDumpWithDataSegs   = $0001;
+  {$EXTERNALSYM MiniDumpWithDataSegs}
+  MiniDumpWithFullMemory = $0002;
+  {$EXTERNALSYM MiniDumpWithFullMemory}
+  MiniDumpWithHandleData = $0004;
+  {$EXTERNALSYM MiniDumpWithHandleData}
+  MiniDumpFilterMemory   = $0008;
+  {$EXTERNALSYM MiniDumpFilterMemory}
+  MiniDumpScanMemory     = $0010;
+  {$EXTERNALSYM MiniDumpScanMemory}
+  MiniDumpWithUnloadedModules            = $0020;
+  {$EXTERNALSYM MiniDumpWithUnloadedModules}
+  MiniDumpWithIndirectlyReferencedMemory = $0040;
+  {$EXTERNALSYM MiniDumpWithIndirectlyReferencedMemory}
+  MiniDumpFilterModulePaths              = $0080;
+  {$EXTERNALSYM MiniDumpFilterModulePaths}
+  MiniDumpWithProcessThreadData          = $0100;
+  {$EXTERNALSYM MiniDumpWithProcessThreadData}
+  MiniDumpWithPrivateReadWriteMemory     = $0200;
+  {$EXTERNALSYM MiniDumpWithPrivateReadWriteMemory}
+
+type
+  _MINIDUMP_TYPE = DWORD;
+  {$EXTERNALSYM _MINIDUMP_TYPE}
+  MINIDUMP_TYPE = _MINIDUMP_TYPE;
+  {$EXTERNALSYM MINIDUMP_TYPE}
+  TMinidumpType = MINIDUMP_TYPE;
+
+//
+// The minidump callback should modify the FieldsToWrite parameter to reflect
+// what portions of the specified thread or module should be written to the
+// file.
+//
+
+  MINIDUMP_CALLBACK_ROUTINE = function(CallbackParam: PVOID; CallbackInput: PMINIDUMP_CALLBACK_INPUT;
+    CallbackOutput: PMINIDUMP_CALLBACK_OUTPUT): BOOL; stdcall;
+  {$EXTERNALSYM MINIDUMP_CALLBACK_ROUTINE}
+  TMinidumpCallbackRoutine = MINIDUMP_CALLBACK_ROUTINE;
+
+  PMINIDUMP_CALLBACK_INFORMATION = ^MINIDUMP_CALLBACK_INFORMATION;
+  {$EXTERNALSYM PMINIDUMP_CALLBACK_INFORMATION}
+  _MINIDUMP_CALLBACK_INFORMATION = record
+    CallbackRoutine: MINIDUMP_CALLBACK_ROUTINE;
+    CallbackParam: PVOID;
+  end;
+  {$EXTERNALSYM _MINIDUMP_CALLBACK_INFORMATION}
+  MINIDUMP_CALLBACK_INFORMATION = _MINIDUMP_CALLBACK_INFORMATION;
+  {$EXTERNALSYM MINIDUMP_CALLBACK_INFORMATION}
+  TMinidumpCallbackInformation = MINIDUMP_CALLBACK_INFORMATION;
+  PMinidumpCallbackInformation = PMINIDUMP_CALLBACK_INFORMATION;
+
+//++
+//
+// PVOID
+// RVA_TO_ADDR(
+//     PVOID Mapping,
+//     ULONG Rva
+//     )
+//
+// Routine Description:
+//
+//     Map an RVA that is contained within a mapped file to it's associated
+//     flat address.
+//
+// Arguments:
+//
+//     Mapping - Base address of mapped file containing the RVA.
+//
+//     Rva - An Rva to fixup.
+//
+// Return Values:
+//
+//     A pointer to the desired data.
+//
+//--
+
+function RVA_TO_ADDR(Mapping, Rva: Pointer): Pointer;
+{$EXTERNALSYM RVA_TO_ADDR}
+
+function MiniDumpWriteDump(hProcess: HANDLE; ProcessId: DWORD; hFile: HANDLE; DumpType: MINIDUMP_TYPE; ExceptionParam: PMINIDUMP_EXCEPTION_INFORMATION; UserStreamParam: PMINIDUMP_USER_STREAM_INFORMATION; CallbackParam: PMINIDUMP_CALLBACK_INFORMATION): BOOL; stdcall;
+{$EXTERNALSYM MiniDumpWriteDump}
+
+function MiniDumpReadDumpStream(BaseOfDump: PVOID; StreamNumber: ULONG; var Dir: PMINIDUMP_DIRECTORY; var StreamPointer: PVOID; var StreamSize: ULONG): BOOL; stdcall;
+{$EXTERNALSYM MiniDumpReadDumpStream}
+
+implementation
+
+const
+  ImageHlpLib = 'imagehlp.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+procedure Address32To64(a32: LPADDRESS; a64: LPADDRESS64);
+begin
+  a64^.Offset := {ULONG64(LONG64(LONG(}a32^.Offset{)))};
+  a64^.Segment := a32^.Segment;
+  a64^.Mode := a32^.Mode;
+end;
+
+procedure Address64To32(a64: LPADDRESS64; a32: LPADDRESS);
+begin
+  a32^.Offset := ULONG(a64^.Offset);
+  a32^.Segment := a64^.Segment;
+  a32^.Mode := a64^.Mode;
+end;
+
+procedure KdHelp32To64(p32: PKDHELP; p64: PKDHELP64);
+begin
+  p64^.Thread := p32^.Thread;
+  p64^.ThCallbackStack := p32^.ThCallbackStack;
+  p64^.NextCallback := p32^.NextCallback;
+  p64^.FramePointer := p32^.FramePointer;
+  p64^.KiCallUserMode := p32^.KiCallUserMode;
+  p64^.KeUserCallbackDispatcher := p32^.KeUserCallbackDispatcher;
+  p64^.SystemRangeStart := p32^.SystemRangeStart;
+end;
+
+function RVA_TO_ADDR(Mapping, Rva: Pointer): Pointer;
+begin
+  Result := Pointer(Cardinal(Mapping) + Cardinal(Rva));
+end;
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _BindImage: Pointer;
+
+function BindImage;
+begin
+  GetProcedureAddress(_BindImage, ImageHlpLib, 'BindImage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BindImage]
+  end;
+end;
+
+var
+  _BindImageEx: Pointer;
+
+function BindImageEx;
+begin
+  GetProcedureAddress(_BindImageEx, ImageHlpLib, 'BindImageEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BindImageEx]
+  end;
+end;
+
+var
+  _ReBaseImage: Pointer;
+
+function ReBaseImage;
+begin
+  GetProcedureAddress(_ReBaseImage, ImageHlpLib, 'ReBaseImage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReBaseImage]
+  end;
+end;
+
+var
+  _ReBaseImage64: Pointer;
+
+function ReBaseImage64;
+begin
+  GetProcedureAddress(_ReBaseImage64, ImageHlpLib, 'ReBaseImage64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ReBaseImage64]
+  end;
+end;
+
+var
+  _CheckSumMappedFile: Pointer;
+
+function CheckSumMappedFile;
+begin
+  GetProcedureAddress(_CheckSumMappedFile, ImageHlpLib, 'CheckSumMappedFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CheckSumMappedFile]
+  end;
+end;
+
+var
+  _MapFileAndCheckSumA: Pointer;
+
+function MapFileAndCheckSumA;
+begin
+  GetProcedureAddress(_MapFileAndCheckSumA, ImageHlpLib, 'MapFileAndCheckSumA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MapFileAndCheckSumA]
+  end;
+end;
+
+var
+  _MapFileAndCheckSumW: Pointer;
+
+function MapFileAndCheckSumW;
+begin
+  GetProcedureAddress(_MapFileAndCheckSumW, ImageHlpLib, 'MapFileAndCheckSumW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MapFileAndCheckSumW]
+  end;
+end;
+
+var
+  _MapFileAndCheckSum: Pointer;
+
+function MapFileAndCheckSum;
+begin
+  GetProcedureAddress(_MapFileAndCheckSum, ImageHlpLib, 'MapFileAndCheckSum' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MapFileAndCheckSum]
+  end;
+end;
+
+var
+  _GetImageConfigInformation: Pointer;
+
+function GetImageConfigInformation;
+begin
+  GetProcedureAddress(_GetImageConfigInformation, ImageHlpLib, 'GetImageConfigInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetImageConfigInformation]
+  end;
+end;
+
+var
+  _GetImageUnusedHeaderBytes: Pointer;
+
+function GetImageUnusedHeaderBytes;
+begin
+  GetProcedureAddress(_GetImageUnusedHeaderBytes, ImageHlpLib, 'GetImageUnusedHeaderBytes');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetImageUnusedHeaderBytes]
+  end;
+end;
+
+var
+  _SetImageConfigInformation: Pointer;
+
+function SetImageConfigInformation;
+begin
+  GetProcedureAddress(_SetImageConfigInformation, ImageHlpLib, 'SetImageConfigInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetImageConfigInformation]
+  end;
+end;
+
+var
+  _ImageGetDigestStream: Pointer;
+
+function ImageGetDigestStream;
+begin
+  GetProcedureAddress(_ImageGetDigestStream, ImageHlpLib, 'ImageGetDigestStream');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageGetDigestStream]
+  end;
+end;
+
+var
+  _ImageAddCertificate: Pointer;
+
+function ImageAddCertificate;
+begin
+  GetProcedureAddress(_ImageAddCertificate, ImageHlpLib, 'ImageAddCertificate');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageAddCertificate]
+  end;
+end;
+
+var
+  _ImageRemoveCertificate: Pointer;
+
+function ImageRemoveCertificate;
+begin
+  GetProcedureAddress(_ImageRemoveCertificate, ImageHlpLib, 'ImageRemoveCertificate');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageRemoveCertificate]
+  end;
+end;
+
+var
+  _ImageEnumerateCertificates: Pointer;
+
+function ImageEnumerateCertificates;
+begin
+  GetProcedureAddress(_ImageEnumerateCertificates, ImageHlpLib, 'ImageEnumerateCertificates');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageEnumerateCertificates]
+  end;
+end;
+
+var
+  _ImageGetCertificateData: Pointer;
+
+function ImageGetCertificateData;
+begin
+  GetProcedureAddress(_ImageGetCertificateData, ImageHlpLib, 'ImageGetCertificateData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageGetCertificateData]
+  end;
+end;
+
+var
+  _ImageGetCertificateHeader: Pointer;
+
+function ImageGetCertificateHeader;
+begin
+  GetProcedureAddress(_ImageGetCertificateHeader, ImageHlpLib, 'ImageGetCertificateHeader');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageGetCertificateHeader]
+  end;
+end;
+
+var
+  _ImageLoad: Pointer;
+
+function ImageLoad;
+begin
+  GetProcedureAddress(_ImageLoad, ImageHlpLib, 'ImageLoad');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageLoad]
+  end;
+end;
+
+var
+  _ImageUnload: Pointer;
+
+function ImageUnload;
+begin
+  GetProcedureAddress(_ImageUnload, ImageHlpLib, 'ImageUnload');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageUnload]
+  end;
+end;
+
+var
+  _MapAndLoad: Pointer;
+
+function MapAndLoad;
+begin
+  GetProcedureAddress(_MapAndLoad, ImageHlpLib, 'MapAndLoad');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MapAndLoad]
+  end;
+end;
+
+var
+  _UnMapAndLoad: Pointer;
+
+function UnMapAndLoad;
+begin
+  GetProcedureAddress(_UnMapAndLoad, ImageHlpLib, 'UnMapAndLoad');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnMapAndLoad]
+  end;
+end;
+
+var
+  _TouchFileTimes: Pointer;
+
+function TouchFileTimes;
+begin
+  GetProcedureAddress(_TouchFileTimes, ImageHlpLib, 'TouchFileTimes');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_TouchFileTimes]
+  end;
+end;
+
+var
+  _SplitSymbols: Pointer;
+
+function SplitSymbols;
+begin
+  GetProcedureAddress(_SplitSymbols, ImageHlpLib, 'SplitSymbols');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SplitSymbols]
+  end;
+end;
+
+var
+  _UpdateDebugInfoFile: Pointer;
+
+function UpdateDebugInfoFile;
+begin
+  GetProcedureAddress(_UpdateDebugInfoFile, ImageHlpLib, 'UpdateDebugInfoFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UpdateDebugInfoFile]
+  end;
+end;
+
+var
+  _UpdateDebugInfoFileEx: Pointer;
+
+function UpdateDebugInfoFileEx;
+begin
+  GetProcedureAddress(_UpdateDebugInfoFileEx, ImageHlpLib, 'UpdateDebugInfoFileEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UpdateDebugInfoFileEx]
+  end;
+end;
+
+var
+  _FindDebugInfoFile: Pointer;
+
+function FindDebugInfoFile;
+begin
+  GetProcedureAddress(_FindDebugInfoFile, ImageHlpLib, 'FindDebugInfoFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindDebugInfoFile]
+  end;
+end;
+
+var
+  _FindDebugInfoFileEx: Pointer;
+
+function FindDebugInfoFileEx;
+begin
+  GetProcedureAddress(_FindDebugInfoFileEx, ImageHlpLib, 'FindDebugInfoFileEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindDebugInfoFileEx]
+  end;
+end;
+
+var
+  _SymFindFileInPath: Pointer;
+
+function SymFindFileInPath;
+begin
+  GetProcedureAddress(_SymFindFileInPath, ImageHlpLib, 'SymFindFileInPath');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymFindFileInPath]
+  end;
+end;
+
+var
+  _FindExecutableImage: Pointer;
+
+function FindExecutableImage;
+begin
+  GetProcedureAddress(_FindExecutableImage, ImageHlpLib, 'FindExecutableImage');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindExecutableImage]
+  end;
+end;
+
+var
+  _FindExecutableImageEx: Pointer;
+
+function FindExecutableImageEx;
+begin
+  GetProcedureAddress(_FindExecutableImageEx, ImageHlpLib, 'FindExecutableImageEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindExecutableImageEx]
+  end;
+end;
+
+var
+  _ImageNtHeader: Pointer;
+
+function ImageNtHeader;
+begin
+  GetProcedureAddress(_ImageNtHeader, ImageHlpLib, 'ImageNtHeader');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageNtHeader]
+  end;
+end;
+
+var
+  _ImageDirectoryEntryToDataEx: Pointer;
+
+function ImageDirectoryEntryToDataEx;
+begin
+  GetProcedureAddress(_ImageDirectoryEntryToDataEx, ImageHlpLib, 'ImageDirectoryEntryToDataEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageDirectoryEntryToDataEx]
+  end;
+end;
+
+var
+  _ImageDirectoryEntryToData: Pointer;
+
+function ImageDirectoryEntryToData;
+begin
+  GetProcedureAddress(_ImageDirectoryEntryToData, ImageHlpLib, 'ImageDirectoryEntryToData');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageDirectoryEntryToData]
+  end;
+end;
+
+var
+  _ImageRvaToSection: Pointer;
+
+function ImageRvaToSection;
+begin
+  GetProcedureAddress(_ImageRvaToSection, ImageHlpLib, 'ImageRvaToSection');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageRvaToSection]
+  end;
+end;
+
+var
+  _ImageRvaToVa: Pointer;
+
+function ImageRvaToVa;
+begin
+  GetProcedureAddress(_ImageRvaToVa, ImageHlpLib, 'ImageRvaToVa');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImageRvaToVa]
+  end;
+end;
+
+var
+  _MapDebugInformation: Pointer;
+
+function MapDebugInformation;
+begin
+  GetProcedureAddress(_MapDebugInformation, ImageHlpLib, 'MapDebugInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MapDebugInformation]
+  end;
+end;
+
+var
+  _UnmapDebugInformation: Pointer;
+
+function UnmapDebugInformation;
+begin
+  GetProcedureAddress(_UnmapDebugInformation, ImageHlpLib, 'UnmapDebugInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnmapDebugInformation]
+  end;
+end;
+
+var
+  _SearchTreeForFile: Pointer;
+
+function SearchTreeForFile;
+begin
+  GetProcedureAddress(_SearchTreeForFile, ImageHlpLib, 'SearchTreeForFile');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SearchTreeForFile]
+  end;
+end;
+
+var
+  _EnumDirTree: Pointer;
+
+function EnumDirTree;
+begin
+  GetProcedureAddress(_EnumDirTree, ImageHlpLib, 'EnumDirTree');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_EnumDirTree]
+  end;
+end;
+
+var
+  _MakeSureDirectoryPathExists: Pointer;
+
+function MakeSureDirectoryPathExists;
+begin
+  GetProcedureAddress(_MakeSureDirectoryPathExists, ImageHlpLib, 'MakeSureDirectoryPathExists');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MakeSureDirectoryPathExists]
+  end;
+end;
+
+var
+  _UnDecorateSymbolName: Pointer;
+
+function UnDecorateSymbolName;
+begin
+  GetProcedureAddress(_UnDecorateSymbolName, ImageHlpLib, 'UnDecorateSymbolName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnDecorateSymbolName]
+  end;
+end;
+
+var
+  _StackWalk64: Pointer;
+
+function StackWalk64;
+begin
+  GetProcedureAddress(_StackWalk64, ImageHlpLib, 'StackWalk64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_StackWalk64]
+  end;
+end;
+
+var
+  _StackWalk: Pointer;
+
+function StackWalk;
+begin
+  GetProcedureAddress(_StackWalk, ImageHlpLib, 'StackWalk');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_StackWalk]
+  end;
+end;
+
+var
+  _ImagehlpApiVersion: Pointer;
+
+function ImagehlpApiVersion;
+begin
+  GetProcedureAddress(_ImagehlpApiVersion, ImageHlpLib, 'ImagehlpApiVersion');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImagehlpApiVersion]
+  end;
+end;
+
+var
+  _ImagehlpApiVersionEx: Pointer;
+
+function ImagehlpApiVersionEx;
+begin
+  GetProcedureAddress(_ImagehlpApiVersionEx, ImageHlpLib, 'ImagehlpApiVersionEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_ImagehlpApiVersionEx]
+  end;
+end;
+
+var
+  _GetTimestampForLoadedLibrary: Pointer;
+
+function GetTimestampForLoadedLibrary;
+begin
+  GetProcedureAddress(_GetTimestampForLoadedLibrary, ImageHlpLib, 'GetTimestampForLoadedLibrary');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTimestampForLoadedLibrary]
+  end;
+end;
+
+var
+  _SymSetOptions: Pointer;
+
+function SymSetOptions;
+begin
+  GetProcedureAddress(_SymSetOptions, ImageHlpLib, 'SymSetOptions');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymSetOptions]
+  end;
+end;
+
+var
+  _SymGetOptions: Pointer;
+
+function SymGetOptions;
+begin
+  GetProcedureAddress(_SymGetOptions, ImageHlpLib, 'SymGetOptions');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetOptions]
+  end;
+end;
+
+var
+  _SymCleanup: Pointer;
+
+function SymCleanup;
+begin
+  GetProcedureAddress(_SymCleanup, ImageHlpLib, 'SymCleanup');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymCleanup]
+  end;
+end;
+
+var
+  _SymMatchString: Pointer;
+
+function SymMatchString;
+begin
+  GetProcedureAddress(_SymMatchString, ImageHlpLib, 'SymMatchString');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymMatchString]
+  end;
+end;
+
+var
+  _SymEnumSourceFiles: Pointer;
+
+function SymEnumSourceFiles;
+begin
+  GetProcedureAddress(_SymEnumSourceFiles, ImageHlpLib, 'SymEnumSourceFiles');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumSourceFiles]
+  end;
+end;
+
+var
+  _SymEnumerateModules64: Pointer;
+
+function SymEnumerateModules64;
+begin
+  GetProcedureAddress(_SymEnumerateModules64, ImageHlpLib, 'SymEnumerateModules64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateModules64]
+  end;
+end;
+
+var
+  _SymEnumerateModules: Pointer;
+
+function SymEnumerateModules;
+begin
+  GetProcedureAddress(_SymEnumerateModules, ImageHlpLib, 'SymEnumerateModules');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateModules]
+  end;
+end;
+
+var
+  _SymEnumerateSymbols64: Pointer;
+
+function SymEnumerateSymbols64;
+begin
+  GetProcedureAddress(_SymEnumerateSymbols64, ImageHlpLib, 'SymEnumerateSymbols64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateSymbols64]
+  end;
+end;
+
+var
+  _SymEnumerateSymbolsW64: Pointer;
+
+function SymEnumerateSymbolsW64;
+begin
+  GetProcedureAddress(_SymEnumerateSymbolsW64, ImageHlpLib, 'SymEnumerateSymbolsW64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateSymbolsW64]
+  end;
+end;
+
+var
+  _SymEnumerateSymbols: Pointer;
+
+function SymEnumerateSymbols;
+begin
+  GetProcedureAddress(_SymEnumerateSymbols, ImageHlpLib, 'SymEnumerateSymbols');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateSymbols]
+  end;
+end;
+
+var
+  _SymEnumerateSymbolsW: Pointer;
+
+function SymEnumerateSymbolsW;
+begin
+  GetProcedureAddress(_SymEnumerateSymbolsW, ImageHlpLib, 'SymEnumerateSymbolsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumerateSymbolsW]
+  end;
+end;
+
+var
+  _EnumerateLoadedModules64: Pointer;
+
+function EnumerateLoadedModules64;
+begin
+  GetProcedureAddress(_EnumerateLoadedModules64, ImageHlpLib, 'EnumerateLoadedModules64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_EnumerateLoadedModules64]
+  end;
+end;
+
+var
+  _EnumerateLoadedModules: Pointer;
+
+function EnumerateLoadedModules;
+begin
+  GetProcedureAddress(_EnumerateLoadedModules, ImageHlpLib, 'EnumerateLoadedModules');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_EnumerateLoadedModules]
+  end;
+end;
+
+var
+  _SymFunctionTableAccess64: Pointer;
+
+function SymFunctionTableAccess64;
+begin
+  GetProcedureAddress(_SymFunctionTableAccess64, ImageHlpLib, 'SymFunctionTableAccess64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymFunctionTableAccess64]
+  end;
+end;
+
+var
+  _SymFunctionTableAccess: Pointer;
+
+function SymFunctionTableAccess;
+begin
+  GetProcedureAddress(_SymFunctionTableAccess, ImageHlpLib, 'SymFunctionTableAccess');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymFunctionTableAccess]
+  end;
+end;
+
+var
+  _SymGetModuleInfo64: Pointer;
+
+function SymGetModuleInfo64;
+begin
+  GetProcedureAddress(_SymGetModuleInfo64, ImageHlpLib, 'SymGetModuleInfo64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleInfo64]
+  end;
+end;
+
+var
+  _SymGetModuleInfoW64: Pointer;
+
+function SymGetModuleInfoW64;
+begin
+  GetProcedureAddress(_SymGetModuleInfoW64, ImageHlpLib, 'SymGetModuleInfoW64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleInfoW64]
+  end;
+end;
+
+var
+  _SymGetModuleInfo: Pointer;
+
+function SymGetModuleInfo;
+begin
+  GetProcedureAddress(_SymGetModuleInfo, ImageHlpLib, 'SymGetModuleInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleInfo]
+  end;
+end;
+
+var
+  _SymGetModuleInfoW: Pointer;
+
+function SymGetModuleInfoW;
+begin
+  GetProcedureAddress(_SymGetModuleInfoW, ImageHlpLib, 'SymGetModuleInfoW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleInfoW]
+  end;
+end;
+
+var
+  _SymGetModuleBase64: Pointer;
+
+function SymGetModuleBase64;
+begin
+  GetProcedureAddress(_SymGetModuleBase64, ImageHlpLib, 'SymGetModuleBase64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleBase64]
+  end;
+end;
+
+var
+  _SymGetModuleBase: Pointer;
+
+function SymGetModuleBase;
+begin
+  GetProcedureAddress(_SymGetModuleBase, ImageHlpLib, 'SymGetModuleBase');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetModuleBase]
+  end;
+end;
+
+var
+  _SymGetSymNext64: Pointer;
+
+function SymGetSymNext64;
+begin
+  GetProcedureAddress(_SymGetSymNext64, ImageHlpLib, 'SymGetSymNext64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymNext64]
+  end;
+end;
+
+var
+  _SymGetSymNext: Pointer;
+
+function SymGetSymNext;
+begin
+  GetProcedureAddress(_SymGetSymNext, ImageHlpLib, 'SymGetSymNext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymNext]
+  end;
+end;
+
+var
+  _SymGetSymPrev64: Pointer;
+
+function SymGetSymPrev64;
+begin
+  GetProcedureAddress(_SymGetSymPrev64, ImageHlpLib, 'SymGetSymPrev64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymPrev64]
+  end;
+end;
+
+var
+  _SymGetSymPrev: Pointer;
+
+function SymGetSymPrev;
+begin
+  GetProcedureAddress(_SymGetSymPrev, ImageHlpLib, 'SymGetSymPrev');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymPrev]
+  end;
+end;
+
+var
+  _SymGetLineFromAddr64: Pointer;
+
+function SymGetLineFromAddr64;
+begin
+  GetProcedureAddress(_SymGetLineFromAddr64, ImageHlpLib, 'SymGetLineFromAddr64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineFromAddr64]
+  end;
+end;
+
+var
+  _SymGetLineFromAddr: Pointer;
+
+function SymGetLineFromAddr;
+begin
+  GetProcedureAddress(_SymGetLineFromAddr, ImageHlpLib, 'SymGetLineFromAddr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineFromAddr]
+  end;
+end;
+
+var
+  _SymGetLineFromName64: Pointer;
+
+function SymGetLineFromName64;
+begin
+  GetProcedureAddress(_SymGetLineFromName64, ImageHlpLib, 'SymGetLineFromName64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineFromName64]
+  end;
+end;
+
+var
+  _SymGetLineFromName: Pointer;
+
+function SymGetLineFromName;
+begin
+  GetProcedureAddress(_SymGetLineFromName, ImageHlpLib, 'SymGetLineFromName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineFromName]
+  end;
+end;
+
+var
+  _SymGetLineNext64: Pointer;
+
+function SymGetLineNext64;
+begin
+  GetProcedureAddress(_SymGetLineNext64, ImageHlpLib, 'SymGetLineNext64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineNext64]
+  end;
+end;
+
+var
+  _SymGetLineNext: Pointer;
+
+function SymGetLineNext;
+begin
+  GetProcedureAddress(_SymGetLineNext, ImageHlpLib, 'SymGetLineNext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLineNext]
+  end;
+end;
+
+var
+  _SymGetLinePrev64: Pointer;
+
+function SymGetLinePrev64;
+begin
+  GetProcedureAddress(_SymGetLinePrev64, ImageHlpLib, 'SymGetLinePrev64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLinePrev64]
+  end;
+end;
+
+var
+  _SymGetLinePrev: Pointer;
+
+function SymGetLinePrev;
+begin
+  GetProcedureAddress(_SymGetLinePrev, ImageHlpLib, 'SymGetLinePrev');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetLinePrev]
+  end;
+end;
+
+var
+  _SymMatchFileName: Pointer;
+
+function SymMatchFileName;
+begin
+  GetProcedureAddress(_SymMatchFileName, ImageHlpLib, 'SymMatchFileName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymMatchFileName]
+  end;
+end;
+
+var
+  _SymInitialize: Pointer;
+
+function SymInitialize;
+begin
+  GetProcedureAddress(_SymInitialize, ImageHlpLib, 'SymInitialize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymInitialize]
+  end;
+end;
+
+var
+  _SymGetSearchPath: Pointer;
+
+function SymGetSearchPath;
+begin
+  GetProcedureAddress(_SymGetSearchPath, ImageHlpLib, 'SymGetSearchPath');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSearchPath]
+  end;
+end;
+
+var
+  _SymSetSearchPath: Pointer;
+
+function SymSetSearchPath;
+begin
+  GetProcedureAddress(_SymSetSearchPath, ImageHlpLib, 'SymSetSearchPath');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymSetSearchPath]
+  end;
+end;
+
+var
+  _SymLoadModuleEx: Pointer;
+
+function SymLoadModuleEx;
+begin
+  GetProcedureAddress(_SymLoadModuleEx, ImageHlpLib, 'SymLoadModuleEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymLoadModuleEx]
+  end;
+end;
+
+var
+  _SymLoadModule64: Pointer;
+
+function SymLoadModule64;
+begin
+  GetProcedureAddress(_SymLoadModule64, ImageHlpLib, 'SymLoadModule64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymLoadModule64]
+  end;
+end;
+
+var
+  _SymLoadModule: Pointer;
+
+function SymLoadModule;
+begin
+  GetProcedureAddress(_SymLoadModule, ImageHlpLib, 'SymLoadModule');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymLoadModule]
+  end;
+end;
+
+var
+  _SymUnloadModule64: Pointer;
+
+function SymUnloadModule64;
+begin
+  GetProcedureAddress(_SymUnloadModule64, ImageHlpLib, 'SymUnloadModule64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymUnloadModule64]
+  end;
+end;
+
+var
+  _SymUnloadModule: Pointer;
+
+function SymUnloadModule;
+begin
+  GetProcedureAddress(_SymUnloadModule, ImageHlpLib, 'SymUnloadModule');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymUnloadModule]
+  end;
+end;
+
+var
+  _SymUnDName64: Pointer;
+
+function SymUnDName64;
+begin
+  GetProcedureAddress(_SymUnDName64, ImageHlpLib, 'SymUnDName64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymUnDName64]
+  end;
+end;
+
+var
+  _SymUnDName: Pointer;
+
+function SymUnDName;
+begin
+  GetProcedureAddress(_SymUnDName, ImageHlpLib, 'SymUnDName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymUnDName]
+  end;
+end;
+
+var
+  _SymRegisterCallback64: Pointer;
+
+function SymRegisterCallback64;
+begin
+  GetProcedureAddress(_SymRegisterCallback64, ImageHlpLib, 'SymRegisterCallback64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymRegisterCallback64]
+  end;
+end;
+
+var
+  _SymRegFuncEntryCallback64: Pointer;
+
+function SymRegisterFunctionEntryCallback64;
+begin
+  GetProcedureAddress(_SymRegFuncEntryCallback64, ImageHlpLib, 'SymRegisterFunctionEntryCallback64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymRegFuncEntryCallback64]
+  end;
+end;
+
+var
+  _SymRegisterCallback: Pointer;
+
+function SymRegisterCallback;
+begin
+  GetProcedureAddress(_SymRegisterCallback, ImageHlpLib, 'SymRegisterCallback');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymRegisterCallback]
+  end;
+end;
+
+var
+  _SymRegisterFuncEntryCallback: Pointer;
+
+function SymRegisterFunctionEntryCallback;
+begin
+  GetProcedureAddress(_SymRegisterFuncEntryCallback, ImageHlpLib, 'SymRegisterFunctionEntryCallback');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymRegisterFuncEntryCallback]
+  end;
+end;
+
+var
+  _SymSetContext: Pointer;
+
+function SymSetContext;
+begin
+  GetProcedureAddress(_SymSetContext, ImageHlpLib, 'SymSetContext');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymSetContext]
+  end;
+end;
+
+var
+  _SymFromAddr: Pointer;
+
+function SymFromAddr;
+begin
+  GetProcedureAddress(_SymFromAddr, ImageHlpLib, 'SymFromAddr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymFromAddr]
+  end;
+end;
+
+var
+  _SymFromName: Pointer;
+
+function SymFromName;
+begin
+  GetProcedureAddress(_SymFromName, ImageHlpLib, 'SymFromName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymFromName]
+  end;
+end;
+
+var
+  _SymEnumSymbolsForAddr: Pointer;
+
+function SymEnumSymbolsForAddr;
+begin
+  GetProcedureAddress(_SymEnumSymbolsForAddr, ImageHlpLib, 'SymEnumSymbolsForAddr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumSymbolsForAddr]
+  end;
+end;
+
+var
+  _SymEnumSymbols: Pointer;
+
+function SymEnumSymbols;
+begin
+  GetProcedureAddress(_SymEnumSymbols, ImageHlpLib, 'SymEnumSymbols');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumSymbols]
+  end;
+end;
+
+var
+  _SymGetTypeInfo: Pointer;
+
+function SymGetTypeInfo;
+begin
+  GetProcedureAddress(_SymGetTypeInfo, ImageHlpLib, 'SymGetTypeInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetTypeInfo]
+  end;
+end;
+
+var
+  _SymEnumTypes: Pointer;
+
+function SymEnumTypes;
+begin
+  GetProcedureAddress(_SymEnumTypes, ImageHlpLib, 'SymEnumTypes');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumTypes]
+  end;
+end;
+
+var
+  _SymGetTypeFromName: Pointer;
+
+function SymGetTypeFromName;
+begin
+  GetProcedureAddress(_SymGetTypeFromName, ImageHlpLib, 'SymGetTypeFromName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetTypeFromName]
+  end;
+end;
+
+var
+  _SymAddSymbol: Pointer;
+
+function SymAddSymbol;
+begin
+  GetProcedureAddress(_SymAddSymbol, ImageHlpLib, 'SymAddSymbol');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymAddSymbol]
+  end;
+end;
+
+var
+  _SymDeleteSymbol: Pointer;
+
+function SymDeleteSymbol;
+begin
+  GetProcedureAddress(_SymDeleteSymbol, ImageHlpLib, 'SymDeleteSymbol');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymDeleteSymbol]
+  end;
+end;
+
+var
+  _DbgHelpCreateUserDump: Pointer;
+
+function DbgHelpCreateUserDump;
+begin
+  GetProcedureAddress(_DbgHelpCreateUserDump, ImageHlpLib, 'DbgHelpCreateUserDump');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DbgHelpCreateUserDump]
+  end;
+end;
+
+var
+  _DbgHelpCreateUserDumpW: Pointer;
+
+function DbgHelpCreateUserDumpW;
+begin
+  GetProcedureAddress(_DbgHelpCreateUserDumpW, ImageHlpLib, 'DbgHelpCreateUserDumpW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DbgHelpCreateUserDumpW]
+  end;
+end;
+
+var
+  _SymGetSymFromAddr64: Pointer;
+
+function SymGetSymFromAddr64;
+begin
+  GetProcedureAddress(_SymGetSymFromAddr64, ImageHlpLib, 'SymGetSymFromAddr64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymFromAddr64]
+  end;
+end;
+
+var
+  _SymGetSymFromAddr: Pointer;
+
+function SymGetSymFromAddr;
+begin
+  GetProcedureAddress(_SymGetSymFromAddr, ImageHlpLib, 'SymGetSymFromAddr');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymFromAddr]
+  end;
+end;
+
+var
+  _SymGetSymFromName64: Pointer;
+
+function SymGetSymFromName64;
+begin
+  GetProcedureAddress(_SymGetSymFromName64, ImageHlpLib, 'SymGetSymFromName64');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymFromName64]
+  end;
+end;
+
+var
+  _SymGetSymFromName: Pointer;
+
+function SymGetSymFromName;
+begin
+  GetProcedureAddress(_SymGetSymFromName, ImageHlpLib, 'SymGetSymFromName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymGetSymFromName]
+  end;
+end;
+
+var
+  _FindFileInPath: Pointer;
+
+function FindFileInPath;
+begin
+  GetProcedureAddress(_FindFileInPath, ImageHlpLib, 'FindFileInPath');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindFileInPath]
+  end;
+end;
+
+var
+  _FindFileInSearchPath: Pointer;
+
+function FindFileInSearchPath;
+begin
+  GetProcedureAddress(_FindFileInSearchPath, ImageHlpLib, 'FindFileInSearchPath');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FindFileInSearchPath]
+  end;
+end;
+
+var
+  _SymEnumSym: Pointer;
+
+function SymEnumSym;
+begin
+  GetProcedureAddress(_SymEnumSym, ImageHlpLib, 'SymEnumSym');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SymEnumSym]
+  end;
+end;
+
+var
+  _MiniDumpWriteDump: Pointer;
+
+function MiniDumpWriteDump;
+begin
+  GetProcedureAddress(_MiniDumpWriteDump, ImageHlpLib, 'MiniDumpWriteDump');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MiniDumpWriteDump]
+  end;
+end;
+
+var
+  _MiniDumpReadDumpStream: Pointer;
+
+function MiniDumpReadDumpStream;
+begin
+  GetProcedureAddress(_MiniDumpReadDumpStream, ImageHlpLib, 'MiniDumpReadDumpStream');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_MiniDumpReadDumpStream]
+  end;
+end;
+
+{$ELSE}
+
+function BindImage; external ImageHlpLib name 'BindImage';
+function BindImageEx; external ImageHlpLib name 'BindImageEx';
+function ReBaseImage; external ImageHlpLib name 'ReBaseImage';
+function ReBaseImage64; external ImageHlpLib name 'ReBaseImage64';
+function CheckSumMappedFile; external ImageHlpLib name 'CheckSumMappedFile';
+function MapFileAndCheckSumA; external ImageHlpLib name 'MapFileAndCheckSumA';
+function MapFileAndCheckSumW; external ImageHlpLib name 'MapFileAndCheckSumW';
+function MapFileAndCheckSum; external ImageHlpLib name 'MapFileAndCheckSum' + AWSuffix;
+function GetImageConfigInformation; external ImageHlpLib name 'GetImageConfigInformation';
+function GetImageUnusedHeaderBytes; external ImageHlpLib name 'GetImageUnusedHeaderBytes';
+function SetImageConfigInformation; external ImageHlpLib name 'SetImageConfigInformation';
+function ImageGetDigestStream; external ImageHlpLib name 'ImageGetDigestStream';
+function ImageAddCertificate; external ImageHlpLib name 'ImageAddCertificate';
+function ImageRemoveCertificate; external ImageHlpLib name 'ImageRemoveCertificate';
+function ImageEnumerateCertificates; external ImageHlpLib name 'ImageEnumerateCertificates';
+function ImageGetCertificateData; external ImageHlpLib name 'ImageGetCertificateData';
+function ImageGetCertificateHeader; external ImageHlpLib name 'ImageGetCertificateHeader';
+function ImageLoad; external ImageHlpLib name 'ImageLoad';
+function ImageUnload; external ImageHlpLib name 'ImageUnload';
+function MapAndLoad; external ImageHlpLib name 'MapAndLoad';
+function UnMapAndLoad; external ImageHlpLib name 'UnMapAndLoad';
+function TouchFileTimes; external ImageHlpLib name 'TouchFileTimes';
+function SplitSymbols; external ImageHlpLib name 'SplitSymbols';
+function UpdateDebugInfoFile; external ImageHlpLib name 'UpdateDebugInfoFile';
+function UpdateDebugInfoFileEx; external ImageHlpLib name 'UpdateDebugInfoFileEx';
+function FindDebugInfoFile; external ImageHlpLib name 'FindDebugInfoFile';
+function FindDebugInfoFileEx; external ImageHlpLib name 'FindDebugInfoFileEx';
+function SymFindFileInPath; external ImageHlpLib name 'SymFindFileInPath';
+function FindExecutableImage; external ImageHlpLib name 'FindExecutableImage';
+function FindExecutableImageEx; external ImageHlpLib name 'FindExecutableImageEx';
+function ImageNtHeader; external ImageHlpLib name 'ImageNtHeader';
+function ImageDirectoryEntryToDataEx; external ImageHlpLib name 'ImageDirectoryEntryToDataEx';
+function ImageDirectoryEntryToData; external ImageHlpLib name 'ImageDirectoryEntryToData';
+function ImageRvaToSection; external ImageHlpLib name 'ImageRvaToSection';
+function ImageRvaToVa; external ImageHlpLib name 'ImageRvaToVa';
+function MapDebugInformation; external ImageHlpLib name 'MapDebugInformation';
+function UnmapDebugInformation; external ImageHlpLib name 'UnmapDebugInformation';
+function SearchTreeForFile; external ImageHlpLib name 'SearchTreeForFile';
+function EnumDirTree; external ImageHlpLib name 'EnumDirTree';
+function MakeSureDirectoryPathExists; external ImageHlpLib name 'MakeSureDirectoryPathExists';
+function UnDecorateSymbolName; external ImageHlpLib name 'UnDecorateSymbolName';
+function StackWalk64; external ImageHlpLib name 'StackWalk64';
+function StackWalk; external ImageHlpLib name 'StackWalk';
+function ImagehlpApiVersion; external ImageHlpLib name 'ImagehlpApiVersion';
+function ImagehlpApiVersionEx; external ImageHlpLib name 'ImagehlpApiVersionEx';
+function GetTimestampForLoadedLibrary; external ImageHlpLib name 'GetTimestampForLoadedLibrary';
+function SymSetOptions; external ImageHlpLib name 'SymSetOptions';
+function SymGetOptions; external ImageHlpLib name 'SymGetOptions';
+function SymCleanup; external ImageHlpLib name 'SymCleanup';
+function SymMatchString; external ImageHlpLib name 'SymMatchString';
+function SymEnumSourceFiles; external ImageHlpLib name 'SymEnumSourceFiles';
+function SymEnumerateModules64; external ImageHlpLib name 'SymEnumerateModules64';
+function SymEnumerateModules; external ImageHlpLib name 'SymEnumerateModules';
+function SymEnumerateSymbols64; external ImageHlpLib name 'SymEnumerateSymbols64';
+function SymEnumerateSymbolsW64; external ImageHlpLib name 'SymEnumerateSymbolsW64';
+function SymEnumerateSymbols; external ImageHlpLib name 'SymEnumerateSymbols';
+function SymEnumerateSymbolsW; external ImageHlpLib name 'SymEnumerateSymbolsW';
+function EnumerateLoadedModules64; external ImageHlpLib name 'EnumerateLoadedModules64';
+function EnumerateLoadedModules; external ImageHlpLib name 'EnumerateLoadedModules';
+function SymFunctionTableAccess64; external ImageHlpLib name 'SymFunctionTableAccess64';
+function SymFunctionTableAccess; external ImageHlpLib name 'SymFunctionTableAccess';
+function SymGetModuleInfo64; external ImageHlpLib name 'SymGetModuleInfo64';
+function SymGetModuleInfoW64; external ImageHlpLib name 'SymGetModuleInfoW64';
+function SymGetModuleInfo; external ImageHlpLib name 'SymGetModuleInfo';
+function SymGetModuleInfoW; external ImageHlpLib name 'SymGetModuleInfoW';
+function SymGetModuleBase64; external ImageHlpLib name 'SymGetModuleBase64';
+function SymGetModuleBase; external ImageHlpLib name 'SymGetModuleBase';
+function SymGetSymNext64; external ImageHlpLib name 'SymGetSymNext64';
+function SymGetSymNext; external ImageHlpLib name 'SymGetSymNext';
+function SymGetSymPrev64; external ImageHlpLib name 'SymGetSymPrev64';
+function SymGetSymPrev; external ImageHlpLib name 'SymGetSymPrev';
+function SymGetLineFromAddr64; external ImageHlpLib name 'SymGetLineFromAddr64';
+function SymGetLineFromAddr; external ImageHlpLib name 'SymGetLineFromAddr';
+function SymGetLineFromName64; external ImageHlpLib name 'SymGetLineFromName64';
+function SymGetLineFromName; external ImageHlpLib name 'SymGetLineFromName';
+function SymGetLineNext64; external ImageHlpLib name 'SymGetLineNext64';
+function SymGetLineNext; external ImageHlpLib name 'SymGetLineNext';
+function SymGetLinePrev64; external ImageHlpLib name 'SymGetLinePrev64';
+function SymGetLinePrev; external ImageHlpLib name 'SymGetLinePrev';
+function SymMatchFileName; external ImageHlpLib name 'SymMatchFileName';
+function SymInitialize; external ImageHlpLib name 'SymInitialize';
+function SymGetSearchPath; external ImageHlpLib name 'SymGetSearchPath';
+function SymSetSearchPath; external ImageHlpLib name 'SymSetSearchPath';
+function SymLoadModuleEx; external ImageHlpLib name 'SymLoadModuleEx';
+function SymLoadModule64; external ImageHlpLib name 'SymLoadModule64';
+function SymLoadModule; external ImageHlpLib name 'SymLoadModule';
+function SymUnloadModule64; external ImageHlpLib name 'SymUnloadModule64';
+function SymUnloadModule; external ImageHlpLib name 'SymUnloadModule';
+function SymUnDName64; external ImageHlpLib name 'SymUnDName64';
+function SymUnDName; external ImageHlpLib name 'SymUnDName';
+function SymRegisterCallback64; external ImageHlpLib name 'SymRegisterCallback64';
+function SymRegisterFunctionEntryCallback64; external ImageHlpLib name 'SymRegisterFunctionEntryCallback64';
+function SymRegisterCallback; external ImageHlpLib name 'SymRegisterCallback';
+function SymRegisterFunctionEntryCallback; external ImageHlpLib name 'SymRegisterFunctionEntryCallback';
+function SymSetContext; external ImageHlpLib name 'SymSetContext';
+function SymFromAddr; external ImageHlpLib name 'SymFromAddr';
+function SymFromName; external ImageHlpLib name 'SymFromName';
+function SymEnumSymbolsForAddr; external ImageHlpLib name 'SymEnumSymbolsForAddr';
+function SymEnumSymbols; external ImageHlpLib name 'SymEnumSymbols';
+function SymGetTypeInfo; external ImageHlpLib name 'SymGetTypeInfo';
+function SymEnumTypes; external ImageHlpLib name 'SymEnumTypes';
+function SymGetTypeFromName; external ImageHlpLib name 'SymGetTypeFromName';
+function SymAddSymbol; external ImageHlpLib name 'SymAddSymbol';
+function SymDeleteSymbol; external ImageHlpLib name 'SymDeleteSymbol';
+function DbgHelpCreateUserDump; external ImageHlpLib name 'DbgHelpCreateUserDump';
+function DbgHelpCreateUserDumpW; external ImageHlpLib name 'DbgHelpCreateUserDumpW';
+function SymGetSymFromAddr64; external ImageHlpLib name 'SymGetSymFromAddr64';
+function SymGetSymFromAddr; external ImageHlpLib name 'SymGetSymFromAddr';
+function SymGetSymFromName64; external ImageHlpLib name 'SymGetSymFromName64';
+function SymGetSymFromName; external ImageHlpLib name 'SymGetSymFromName';
+function FindFileInPath; external ImageHlpLib name 'FindFileInPath';
+function FindFileInSearchPath; external ImageHlpLib name 'FindFileInSearchPath';
+function SymEnumSym; external ImageHlpLib name 'SymEnumSym';
+function MiniDumpWriteDump; external ImageHlpLib name 'MiniDumpWriteDump';
+function MiniDumpReadDumpStream; external ImageHlpLib name 'MiniDumpReadDumpStream';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 301 - 0
packages/extra/winunits/jwaimapi.pas

@@ -0,0 +1,301 @@
+{******************************************************************************}
+{                                                                              }
+{ Image Mastering API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: imapi.h, released Aug 2002. The original Pascal        }
+{ code is: Imapi.pas, released November 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaImapi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "imapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  ActiveX {todo},
+  JwaWinType;
+
+{$IFDEF FPC}
+Type
+  IPropertyStorage = interface end;
+{$ENDIF}
+//
+// interface IDiscRecorder
+//
+
+type
+  MEDIA_TYPES = DWORD;
+  {$EXTERNALSYM MEDIA_TYPES}
+  TMediaTypes = MEDIA_TYPES;
+
+const
+  MEDIA_CDDA_CDROM = 1;
+  {$EXTERNALSYM MEDIA_CDDA_CDROM}
+  MEDIA_CD_ROM_XA  = MEDIA_CDDA_CDROM + 1;
+  {$EXTERNALSYM MEDIA_CD_ROM_XA}
+  MEDIA_CD_I       = MEDIA_CD_ROM_XA + 1;
+  {$EXTERNALSYM MEDIA_CD_I}
+  MEDIA_CD_EXTRA   = MEDIA_CD_I + 1;
+  {$EXTERNALSYM MEDIA_CD_EXTRA}
+  MEDIA_CD_OTHER   = MEDIA_CD_EXTRA + 1;
+  {$EXTERNALSYM MEDIA_CD_OTHER}
+  MEDIA_SPECIAL    = MEDIA_CD_OTHER + 1;
+  {$EXTERNALSYM MEDIA_SPECIAL}
+
+type
+  MEDIA_FLAGS = DWORD;
+  {$EXTERNALSYM MEDIA_FLAGS}
+  TMediaFlags = MEDIA_FLAGS;
+
+const
+  MEDIA_BLANK                    = $1;
+  {$EXTERNALSYM MEDIA_BLANK}
+  MEDIA_RW                       = $2;
+  {$EXTERNALSYM MEDIA_RW}
+  MEDIA_WRITABLE                 = $4;
+  {$EXTERNALSYM MEDIA_WRITABLE}
+  MEDIA_FORMAT_UNUSABLE_BY_IMAPI = $8;
+  {$EXTERNALSYM MEDIA_FORMAT_UNUSABLE_BY_IMAPI}
+
+type
+  RECORDER_TYPES = DWORD;
+  {$EXTERNALSYM RECORDER_TYPES}
+  TRecorderTypes = RECORDER_TYPES;
+
+const
+  RECORDER_CDR  = $1;
+  {$EXTERNALSYM RECORDER_CDR}
+  RECORDER_CDRW = $2;
+  {$EXTERNALSYM RECORDER_CDRW}
+
+  RECORDER_DOING_NOTHING = 0;
+  {$EXTERNALSYM RECORDER_DOING_NOTHING}
+
+  RECORDER_OPENED = $1;
+  {$EXTERNALSYM RECORDER_OPENED}
+
+  RECORDER_BURNING = $2;
+  {$EXTERNALSYM RECORDER_BURNING}
+
+  IID_IDiscRecorder: TGUID = '{85AC9776-CA88-4cf2-894E-09598C078A41}';
+  {$EXTERNALSYM IID_IDiscRecorder}
+
+
+type
+  IDiscRecorder = interface(IUnknown)
+  ['{85AC9776-CA88-4cf2-894E-09598C078A41}']
+    function Init(pbyUniqueID: PByte; nulIDSize, nulDriveNumber: ULONG): HRESULT; stdcall;
+    function GetRecorderGUID(pbyUniqueID: PByte; ulBufferSize: ULONG; out pulReturnSizeRequired: ULONG): HRESULT; stdcall;
+    function GetRecorderType(out fTypeCode: Longint): HRESULT; stdcall;
+    function GetDisplayNames(var pbstrVendorID, pbstrProductID, pbstrRevision: PWideChar): HRESULT; stdcall;
+    function GetBasePnPID(out pbstrBasePnPID: PWideChar): HRESULT; stdcall;
+    function GetPath(out pbstrPath: PWideChar): HRESULT; stdcall;
+    function GetRecorderProperties(out ppPropStg: IPropertyStorage): HRESULT; stdcall;
+    function SetRecorderProperties(pPropStg: IPropertyStorage): HRESULT; stdcall;
+    function GetRecorderState(out pulDevStateFlags: ULONG): HRESULT; stdcall;
+    function OpenExclusive: HRESULT; stdcall;
+    function QueryMediaType(out fMediaType, fMediaFlags: Longint): HRESULT; stdcall;
+    function QueryMediaInfo(out pbSessions, pbLastTrack: Byte; out ulStartAddress, ulNextWritable, ulFreeBlocks: ULONG): HRESULT; stdcall;
+    function Eject: HRESULT; stdcall;
+    function Erase(bFullErase: BOOL): HRESULT; stdcall;
+    function Close: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiscRecorder}
+
+//
+// interface IEnumDiscRecorders
+//
+
+const
+  IID_IEnumDiscRecorders: TGUID = '{9B1921E1-54AC-11d3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IEnumDiscRecorders}
+
+
+type
+  IEnumDiscRecorders = interface(IUnknown)
+  ['{9B1921E1-54AC-11d3-9144-00104BA11C5E}']
+    function Next(cRecorders: ULONG; out ppRecorder: IDiscRecorder; out pcFetched: ULONG): HRESULT; stdcall;
+    function Skip(cRecorders: ULONG): HRESULT; stdcall;
+    function Reset: HRESULT; stdcall;
+    function Clone(out ppEnum: IEnumDiscRecorders): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEnumDiscRecorders}
+
+//
+// interface IEnumDiscMasterFormats
+//
+
+const
+  IID_IEnumDiscMasterFormats: TGUID = '{DDF445E1-54BA-11d3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IEnumDiscMasterFormats}
+
+type
+  IEnumDiscMasterFormats = interface(IUnknown)
+  ['{DDF445E1-54BA-11d3-9144-00104BA11C5E}']
+    function Next(cFormats: ULONG; out lpiidFormatID: TGUID; out pcFetched: ULONG): HRESULT; stdcall;
+    function Skip(cFormats: ULONG): HRESULT; stdcall;
+    function Reset: HRESULT; stdcall;
+    function Clone(out ppEnum: IEnumDiscMasterFormats): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IEnumDiscMasterFormats}
+
+//
+// interface IRedbookDiscMaster
+//
+
+const
+  IID_IRedbookDiscMaster: TGUID = '{E3BC42CD-4E5C-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IRedbookDiscMaster}
+
+type
+  IRedbookDiscMaster = interface(IUnknown)
+  ['{E3BC42CD-4E5C-11D3-9144-00104BA11C5E}']
+    function GetTotalAudioTracks(out pnTracks: Longint): HRESULT; stdcall;
+    function GetTotalAudioBlocks(out pnBlocks: Longint): HRESULT; stdcall;
+    function GetUsedAudioBlocks(out pnBlocks: Longint): HRESULT; stdcall;
+    function GetAvailableAudioTrackBlocks(out pnBlocks: Longint): HRESULT; stdcall;
+    function GetAudioBlockSize(out pnBlockBytes: Longint): HRESULT; stdcall;
+    function CreateAudioTrack(nBlocks: Longint): HRESULT; stdcall;
+    function AddAudioTrackBlocks(pby: PByte; cb: Longint): HRESULT; stdcall;
+    function CloseAudioTrack: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IRedbookDiscMaster}
+
+//
+// interface IJolietDiscMaster
+//
+
+const
+  IID_IJolietDiscMaster: TGUID = '{E3BC42CE-4E5C-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IJolietDiscMaster}
+
+
+type
+  IJolietDiscMaster = interface(IUnknown)
+  ['{E3BC42CE-4E5C-11D3-9144-00104BA11C5E}']
+    function GetTotalDataBlocks(out pnBlocks: Longint): HRESULT; stdcall;
+    function GetUsedDataBlocks(out pnBlocks: Longint): HRESULT; stdcall;
+    function GetDataBlockSize(out pnBlockBytes: Longint): HRESULT; stdcall;
+    function AddData(pStorage: IStorage; lFileOverwrite: Longint): HRESULT; stdcall;
+    function GetJolietProperties(out ppPropStg: IPropertyStorage): HRESULT; stdcall;
+    function SetJolietProperties(pPropStg: IPropertyStorage): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IJolietDiscMaster}
+
+//
+// interface IDiscMasterProgressEvents
+//
+
+const
+  IID_IDiscMasterProgressEvents: TGUID = '{EC9E51C1-4E5D-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IDiscMasterProgressEvents}
+
+type
+  IDiscMasterProgressEvents = interface(IUnknown)
+  ['{EC9E51C1-4E5D-11D3-9144-00104BA11C5E}']
+    function QueryCancel(out pbCancel: BOOL): HRESULT; stdcall;
+    function NotifyPnPActivity: HRESULT; stdcall;
+    function NotifyAddProgress(nCompletedSteps, nTotalSteps: Longint): HRESULT; stdcall;
+    function NotifyBlockProgress(nCompleted, nTotal: Longint): HRESULT; stdcall;
+    function NotifyTrackProgress(nCurrentTrack, nTotalTracks: Longint): HRESULT; stdcall;
+    function NotifyPreparingBurn(nEstimatedSeconds: Longint): HRESULT; stdcall;
+    function NotifyClosingDisc(nEstimatedSeconds: Longint): HRESULT; stdcall;
+    function NotifyBurnComplete(status: HRESULT): HRESULT; stdcall;
+    function NotifyEraseComplete(status: HRESULT): HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiscMasterProgressEvents}
+
+//
+// interface IDiscMaster
+//
+
+const
+  IID_IDiscMaster: TGUID = '{520CCA62-51A5-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM IID_IDiscMaster}
+
+type
+  IDiscMaster = interface(IUnknown)
+  ['{520CCA62-51A5-11D3-9144-00104BA11C5E}']
+    function Open: HRESULT; stdcall;
+    function EnumDiscMasterFormats(out ppEnum: IEnumDiscMasterFormats): HRESULT; stdcall;
+    function GetActiveDiscMasterFormat(out lpiid: TGUID): HRESULT; stdcall;
+    function SetActiveDiscMasterFormat(const riid: TGUID; out ppUnk: IUnknown): HRESULT; stdcall;
+    function EnumDiscRecorders(out ppEnum: IEnumDiscRecorders): HRESULT; stdcall;
+    function GetActiveDiscRecorder(out ppRecorder: IDiscRecorder): HRESULT; stdcall;
+    function SetActiveDiscRecorder(pRecorder: IDiscRecorder): HRESULT; stdcall;
+    function ClearFormatContent: HRESULT; stdcall;
+    function ProgressAdvise(pEvents: IDiscMasterProgressEvents; out pvCookie: UINT): HRESULT; stdcall;
+    function ProgressUnadvise(vCookie: UINT): HRESULT; stdcall;
+    function RecordDisc(bSimulate, bEjectAfterBurn: BOOL): HRESULT; stdcall;
+    function Close: HRESULT; stdcall;
+  end;
+  {$EXTERNALSYM IDiscMaster}
+
+//
+// library IMAPILib
+//
+
+const
+  //EXTERN_C const IID LIBID_IMAPILib;
+
+  CLSID_MSDiscRecorderObj: TGUID = '{520CCA61-51A5-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM CLSID_MSDiscRecorderObj}
+  MSDiscRecorderObj: TGUID = '{520CCA61-51A5-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM MSDiscRecorderObj}
+
+  CLSID_MSDiscMasterObj: TGUID = '{520CCA63-51A5-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM CLSID_MSDiscMasterObj}
+  MSDiscMasterObj: TGUID = '{520CCA63-51A5-11D3-9144-00104BA11C5E}';
+  {$EXTERNALSYM MSDiscMasterObj}
+
+  CLSID_MSEnumDiscRecordersObj: TGUID = '{8A03567A-63CB-4BA8-BAF6-52119816D1EF}';
+  {$EXTERNALSYM CLSID_MSEnumDiscRecordersObj}
+  MSEnumDiscRecordersObj: TGUID = '{8A03567A-63CB-4BA8-BAF6-52119816D1EF}';
+  {$EXTERNALSYM MSEnumDiscRecordersObj}
+
+implementation
+
+end.

+ 140 - 0
packages/extra/winunits/jwaimapierror.pas

@@ -0,0 +1,140 @@
+{******************************************************************************}
+{                                                                              }
+{ Image Mastering API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: imapierror.h, released Aug 2002. The original Pascal   }
+{ code is: ImapiError.pas, released November 2002. The initial developer of the}
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaImapiError;
+
+interface
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "imapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+uses
+  JwaWinError, JwaWinType;
+
+const
+  IMAPI_S_PROPERTIESIGNORED     = HRESULT((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or $200);
+  {$EXTERNALSYM IMAPI_S_PROPERTIESIGNORED}
+  IMAPI_S_BUFFER_TO_SMALL       = HRESULT((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or $201);
+  {$EXTERNALSYM IMAPI_S_BUFFER_TO_SMALL}
+  IMAPI_E_NOTOPENED             = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 11);
+  {$EXTERNALSYM IMAPI_E_NOTOPENED}
+  IMAPI_E_NOTINITIALIZED        = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 12);
+  {$EXTERNALSYM IMAPI_E_NOTINITIALIZED}
+  IMAPI_E_USERABORT             = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 13);
+  {$EXTERNALSYM IMAPI_E_USERABORT}
+  IMAPI_E_GENERIC               = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 14);
+  {$EXTERNALSYM IMAPI_E_GENERIC}
+  IMAPI_E_MEDIUM_NOTPRESENT     = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 15);
+  {$EXTERNALSYM IMAPI_E_MEDIUM_NOTPRESENT}
+  IMAPI_E_MEDIUM_INVALIDTYPE    = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 16);
+  {$EXTERNALSYM IMAPI_E_MEDIUM_INVALIDTYPE}
+  IMAPI_E_DEVICE_NOPROPERTIES   = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 17);
+  {$EXTERNALSYM IMAPI_E_DEVICE_NOPROPERTIES}
+  IMAPI_E_DEVICE_NOTACCESSIBLE  = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 18);
+  {$EXTERNALSYM IMAPI_E_DEVICE_NOTACCESSIBLE}
+  IMAPI_E_DEVICE_NOTPRESENT     = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 19);
+  {$EXTERNALSYM IMAPI_E_DEVICE_NOTPRESENT}
+  IMAPI_E_DEVICE_INVALIDTYPE    = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 20);
+  {$EXTERNALSYM IMAPI_E_DEVICE_INVALIDTYPE}
+  IMAPI_E_INITIALIZE_WRITE      = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 21);
+  {$EXTERNALSYM IMAPI_E_INITIALIZE_WRITE}
+  IMAPI_E_INITIALIZE_ENDWRITE   = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 22);
+  {$EXTERNALSYM IMAPI_E_INITIALIZE_ENDWRITE}
+  IMAPI_E_FILESYSTEM            = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 23);
+  {$EXTERNALSYM IMAPI_E_FILESYSTEM}
+  IMAPI_E_FILEACCESS            = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 24);
+  {$EXTERNALSYM IMAPI_E_FILEACCESS}
+  IMAPI_E_DISCINFO              = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 25);
+  {$EXTERNALSYM IMAPI_E_DISCINFO}
+  IMAPI_E_TRACKNOTOPEN          = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 26);
+  {$EXTERNALSYM IMAPI_E_TRACKNOTOPEN}
+  IMAPI_E_TRACKOPEN             = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 27);
+  {$EXTERNALSYM IMAPI_E_TRACKOPEN}
+  IMAPI_E_DISCFULL              = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 28);
+  {$EXTERNALSYM IMAPI_E_DISCFULL}
+  IMAPI_E_BADJOLIETNAME         = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 29);
+  {$EXTERNALSYM IMAPI_E_BADJOLIETNAME}
+  IMAPI_E_INVALIDIMAGE          = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 30);
+  {$EXTERNALSYM IMAPI_E_INVALIDIMAGE}
+  IMAPI_E_NOACTIVEFORMAT        = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 31);
+  {$EXTERNALSYM IMAPI_E_NOACTIVEFORMAT}
+  IMAPI_E_NOACTIVERECORDER      = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 32);
+  {$EXTERNALSYM IMAPI_E_NOACTIVERECORDER}
+  IMAPI_E_WRONGFORMAT           = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 33);
+  {$EXTERNALSYM IMAPI_E_WRONGFORMAT}
+  IMAPI_E_ALREADYOPEN           = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 34);
+  {$EXTERNALSYM IMAPI_E_ALREADYOPEN}
+  IMAPI_E_WRONGDISC             = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 35);
+  {$EXTERNALSYM IMAPI_E_WRONGDISC}
+  IMAPI_E_FILEEXISTS            = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 36);
+  {$EXTERNALSYM IMAPI_E_FILEEXISTS}
+  IMAPI_E_STASHINUSE            = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 37);
+  {$EXTERNALSYM IMAPI_E_STASHINUSE}
+  IMAPI_E_DEVICE_STILL_IN_USE   = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 38);
+  {$EXTERNALSYM IMAPI_E_DEVICE_STILL_IN_USE}
+  IMAPI_E_LOSS_OF_STREAMING     = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 39);
+  {$EXTERNALSYM IMAPI_E_LOSS_OF_STREAMING}
+  IMAPI_E_COMPRESSEDSTASH       = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 40);
+  {$EXTERNALSYM IMAPI_E_COMPRESSEDSTASH}
+  IMAPI_E_ENCRYPTEDSTASH        = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 41);
+  {$EXTERNALSYM IMAPI_E_ENCRYPTEDSTASH}
+  IMAPI_E_NOTENOUGHDISKFORSTASH = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 42);
+  {$EXTERNALSYM IMAPI_E_NOTENOUGHDISKFORSTASH}
+  IMAPI_E_REMOVABLESTASH        = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 43);
+  {$EXTERNALSYM IMAPI_E_REMOVABLESTASH}
+  IMAPI_E_CANNOT_WRITE_TO_MEDIA = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 44);
+  {$EXTERNALSYM IMAPI_E_CANNOT_WRITE_TO_MEDIA}
+  IMAPI_E_TRACK_NOT_BIG_ENOUGH  = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 45);
+  {$EXTERNALSYM IMAPI_E_TRACK_NOT_BIG_ENOUGH}
+  IMAPI_E_BOOTIMAGE_AND_NONBLANK_DISC = HRESULT((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or $200 + 46);
+  {$EXTERNALSYM IMAPI_E_BOOTIMAGE_AND_NONBLANK_DISC}
+
+implementation
+
+end.

+ 453 - 0
packages/extra/winunits/jwaime.pas

@@ -0,0 +1,453 @@
+{******************************************************************************}
+{                                                                              }
+{ IME Component API interface Unit for Object Pascal                           }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: ime.h, released June 2000. The original Pascal         }
+{ code is: Ime.pas, released December 2000. The initial developer of the       }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIme;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "Ime.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+const
+  IME_MAXPROCESS = 32;
+  {$EXTERNALSYM IME_MAXPROCESS}
+
+function SendIMEMessageExA(hWnd: HWND; lParam: LPARAM): LRESULT; stdcall;
+{$EXTERNALSYM SendIMEMessageExA}
+function SendIMEMessageExW(hWnd: HWND; lParam: LPARAM): LRESULT; stdcall;
+{$EXTERNALSYM SendIMEMessageExW}
+function SendIMEMessageEx(hWnd: HWND; lParam: LPARAM): LRESULT; stdcall;
+{$EXTERNALSYM SendIMEMessageEx}
+
+//
+// IMESTRUCT structure for SendIMEMessageEx
+//
+
+type
+  tagIMESTRUCT = record
+    fnc: UINT;       // function code
+    wParam: WPARAM;  // word parameter
+    wCount: UINT;    // word counter
+    dchSource: UINT; // offset to Source from top of memory object
+    dchDest: UINT;   // offset to Desrination from top of memory object
+    lParam1: LPARAM;
+    lParam2: LPARAM;
+    lParam3: LPARAM;
+  end;
+  {$EXTERNALSYM tagIMESTRUCT}
+  IMESTRUCT = tagIMESTRUCT;
+  {$EXTERNALSYM IMESTRUCT}
+  LPIMESTRUCT = ^IMESTRUCT;
+  {$EXTERNALSYM LPIMESTRUCT}
+  PIMESTRUCT = ^IMESTRUCT;
+  {$EXTERNALSYM PIMESTRUCT}
+  NPIMESTRUCT = ^IMESTRUCT;
+  {$EXTERNALSYM NPIMESTRUCT}
+  TImeStruct = IMESTRUCT;
+
+const
+  CP_HWND   = 0;
+  {$EXTERNALSYM CP_HWND}
+  CP_OPEN   = 1;
+  {$EXTERNALSYM CP_OPEN}
+  CP_DIRECT = 2;
+  {$EXTERNALSYM CP_DIRECT}
+  CP_LEVEL  = 3;
+  {$EXTERNALSYM CP_LEVEL}
+
+//
+//      Virtual Keys
+//
+
+  VK_DBE_ALPHANUMERIC           = $0f0;
+  {$EXTERNALSYM VK_DBE_ALPHANUMERIC}
+  VK_DBE_KATAKANA               = $0f1;
+  {$EXTERNALSYM VK_DBE_KATAKANA}
+  VK_DBE_HIRAGANA               = $0f2;
+  {$EXTERNALSYM VK_DBE_HIRAGANA}
+  VK_DBE_SBCSCHAR               = $0f3;
+  {$EXTERNALSYM VK_DBE_SBCSCHAR}
+  VK_DBE_DBCSCHAR               = $0f4;
+  {$EXTERNALSYM VK_DBE_DBCSCHAR}
+  VK_DBE_ROMAN                  = $0f5;
+  {$EXTERNALSYM VK_DBE_ROMAN}
+  VK_DBE_NOROMAN                = $0f6;
+  {$EXTERNALSYM VK_DBE_NOROMAN}
+  VK_DBE_ENTERWORDREGISTERMODE  = $0f7;
+  {$EXTERNALSYM VK_DBE_ENTERWORDREGISTERMODE}
+  VK_DBE_ENTERIMECONFIGMODE     = $0f8;
+  {$EXTERNALSYM VK_DBE_ENTERIMECONFIGMODE}
+  VK_DBE_FLUSHSTRING            = $0f9;
+  {$EXTERNALSYM VK_DBE_FLUSHSTRING}
+  VK_DBE_CODEINPUT              = $0fa;
+  {$EXTERNALSYM VK_DBE_CODEINPUT}
+  VK_DBE_NOCODEINPUT            = $0fb;
+  {$EXTERNALSYM VK_DBE_NOCODEINPUT}
+  VK_DBE_DETERMINESTRING        = $0fc;
+  {$EXTERNALSYM VK_DBE_DETERMINESTRING}
+  VK_DBE_ENTERDLGCONVERSIONMODE = $0fd;
+  {$EXTERNALSYM VK_DBE_ENTERDLGCONVERSIONMODE}
+
+//
+//     switch for wParam of IME_SETCONVERSIONWINDOW
+//
+
+  MCW_DEFAULT  = $00;
+  {$EXTERNALSYM MCW_DEFAULT}
+  MCW_RECT     = $01;
+  {$EXTERNALSYM MCW_RECT}
+  MCW_WINDOW   = $02;
+  {$EXTERNALSYM MCW_WINDOW}
+  MCW_SCREEN   = $04;
+  {$EXTERNALSYM MCW_SCREEN}
+  MCW_VERTICAL = $08;
+  {$EXTERNALSYM MCW_VERTICAL}
+  MCW_HIDDEN   = $10;
+  {$EXTERNALSYM MCW_HIDDEN}
+
+//
+//    switch for wParam of IME_SETCONVERSIONMODE
+//       and IME_GETCONVERSIONMODE
+//
+
+  IME_MODE_ALPHANUMERIC = $0001;
+  {$EXTERNALSYM IME_MODE_ALPHANUMERIC}
+
+  {$IFDEF KOREA}    // BeomOh - 9/29/92
+  IME_MODE_SBCSCHAR = $0002;
+  {$EXTERNALSYM IME_MODE_SBCSCHAR}
+  {$ELSE}
+  IME_MODE_SBCSCHAR = $0008;
+  {$EXTERNALSYM IME_MODE_SBCSCHAR}
+  {$ENDIF KOREA}
+
+  IME_MODE_KATAKANA     = $0002;
+  {$EXTERNALSYM IME_MODE_KATAKANA}
+  IME_MODE_HIRAGANA     = $0004;
+  {$EXTERNALSYM IME_MODE_HIRAGANA}
+  IME_MODE_HANJACONVERT = $0004;
+  {$EXTERNALSYM IME_MODE_HANJACONVERT}
+  IME_MODE_DBCSCHAR     = $0010;
+  {$EXTERNALSYM IME_MODE_DBCSCHAR}
+  IME_MODE_ROMAN        = $0020;
+  {$EXTERNALSYM IME_MODE_ROMAN}
+  IME_MODE_NOROMAN      = $0040;
+  {$EXTERNALSYM IME_MODE_NOROMAN}
+  IME_MODE_CODEINPUT    = $0080;
+  {$EXTERNALSYM IME_MODE_CODEINPUT}
+  IME_MODE_NOCODEINPUT  = $0100;
+  {$EXTERNALSYM IME_MODE_NOCODEINPUT}
+
+//
+//
+
+//
+//     IME APIs
+//
+
+  IME_GETIMECAPS          = $03;
+  {$EXTERNALSYM IME_GETIMECAPS}
+  IME_SETOPEN             = $04;
+  {$EXTERNALSYM IME_SETOPEN}
+  IME_GETOPEN             = $05;
+  {$EXTERNALSYM IME_GETOPEN}
+  IME_GETVERSION          = $07;
+  {$EXTERNALSYM IME_GETVERSION}
+  IME_SETCONVERSIONWINDOW = $08;
+  {$EXTERNALSYM IME_SETCONVERSIONWINDOW}
+  IME_MOVEIMEWINDOW       = IME_SETCONVERSIONWINDOW; // KOREA only
+  {$EXTERNALSYM IME_MOVEIMEWINDOW}
+  IME_SETCONVERSIONMODE   = $10;
+  {$EXTERNALSYM IME_SETCONVERSIONMODE}
+
+  IME_GETCONVERSIONMODE     = $11;
+  {$EXTERNALSYM IME_GETCONVERSIONMODE}
+  IME_SET_MODE              = $12; // KOREA only
+  {$EXTERNALSYM IME_SET_MODE}
+  IME_SENDVKEY              = $13;
+  {$EXTERNALSYM IME_SENDVKEY}
+  IME_ENTERWORDREGISTERMODE = $18;
+  {$EXTERNALSYM IME_ENTERWORDREGISTERMODE}
+  IME_SETCONVERSIONFONTEX   = $19;
+  {$EXTERNALSYM IME_SETCONVERSIONFONTEX}
+
+//
+// IME_CODECONVERT subfunctions
+//
+
+  IME_BANJAtoJUNJA = $13; // KOREA only
+  {$EXTERNALSYM IME_BANJAtoJUNJA}
+  IME_JUNJAtoBANJA = $14; // KOREA only
+  {$EXTERNALSYM IME_JUNJAtoBANJA}
+  IME_JOHABtoKS    = $15; // KOREA only
+  {$EXTERNALSYM IME_JOHABtoKS}
+  IME_KStoJOHAB    = $16; // KOREA only
+  {$EXTERNALSYM IME_KStoJOHAB}
+
+//
+// IME_AUTOMATA subfunctions
+//
+
+  IMEA_INIT = $01; // KOREA only
+  {$EXTERNALSYM IMEA_INIT}
+  IMEA_NEXT = $02; // KOREA only
+  {$EXTERNALSYM IMEA_NEXT}
+  IMEA_PREV = $03; // KOREA only
+  {$EXTERNALSYM IMEA_PREV}
+
+//
+// IME_HANJAMODE subfunctions
+//
+
+  IME_REQUEST_CONVERT = $01; // KOREA only
+  {$EXTERNALSYM IME_REQUEST_CONVERT}
+  IME_ENABLE_CONVERT  = $02; // KOREA only
+  {$EXTERNALSYM IME_ENABLE_CONVERT}
+
+//
+// IME_MOVEIMEWINDOW subfunctions
+//
+
+  INTERIM_WINDOW = $00; // KOREA only
+  {$EXTERNALSYM INTERIM_WINDOW}
+  MODE_WINDOW    = $01; // KOREA only
+  {$EXTERNALSYM MODE_WINDOW}
+  HANJA_WINDOW   = $02; // KOREA only
+  {$EXTERNALSYM HANJA_WINDOW}
+
+//
+//    error code
+//
+
+  IME_RS_ERROR       = $01; // genetal error
+  {$EXTERNALSYM IME_RS_ERROR}
+  IME_RS_NOIME       = $02; // IME is not installed
+  {$EXTERNALSYM IME_RS_NOIME}
+  IME_RS_TOOLONG     = $05; // given string is too long
+  {$EXTERNALSYM IME_RS_TOOLONG}
+  IME_RS_ILLEGAL     = $06; // illegal charactor(s) is string
+  {$EXTERNALSYM IME_RS_ILLEGAL}
+  IME_RS_NOTFOUND    = $07; // no (more) candidate
+  {$EXTERNALSYM IME_RS_NOTFOUND}
+  IME_RS_NOROOM      = $0a; // no disk/memory space
+  {$EXTERNALSYM IME_RS_NOROOM}
+  IME_RS_DISKERROR   = $0e; // disk I/O error
+  {$EXTERNALSYM IME_RS_DISKERROR}
+  IME_RS_INVALID     = $11; // Win3.1/NT
+  {$EXTERNALSYM IME_RS_INVALID}
+  IME_RS_NEST        = $12; // called nested
+  {$EXTERNALSYM IME_RS_NEST}
+  IME_RS_SYSTEMMODAL = $13; // called when system mode
+  {$EXTERNALSYM IME_RS_SYSTEMMODAL}
+
+//
+//   report messge from IME to WinApps
+//
+
+  WM_IME_REPORT = $0280;
+  {$EXTERNALSYM WM_IME_REPORT}
+
+//
+//   report message parameter for WM_IME_REPORT
+//
+
+  IR_STRINGSTART   = $100;
+  {$EXTERNALSYM IR_STRINGSTART}
+  IR_STRINGEND     = $101;
+  {$EXTERNALSYM IR_STRINGEND}
+  IR_OPENCONVERT   = $120;
+  {$EXTERNALSYM IR_OPENCONVERT}
+  IR_CHANGECONVERT = $121;
+  {$EXTERNALSYM IR_CHANGECONVERT}
+  IR_CLOSECONVERT  = $122;
+  {$EXTERNALSYM IR_CLOSECONVERT}
+  IR_FULLCONVERT   = $123;
+  {$EXTERNALSYM IR_FULLCONVERT}
+  IR_IMESELECT     = $130;
+  {$EXTERNALSYM IR_IMESELECT}
+  IR_STRING        = $140;
+  {$EXTERNALSYM IR_STRING}
+  IR_DBCSCHAR      = $160;
+  {$EXTERNALSYM IR_DBCSCHAR}
+  IR_UNDETERMINE   = $170;
+  {$EXTERNALSYM IR_UNDETERMINE}
+  IR_STRINGEX      = $180; // New for 3.1
+  {$EXTERNALSYM IR_STRINGEX}
+  IR_MODEINFO      = $190;
+  {$EXTERNALSYM IR_MODEINFO}
+
+//#define WM_CONVERTREQUESTEX     0x0109
+
+  WM_WNT_CONVERTREQUESTEX = $0109; // WM_CONVERTREQUESTEX: 109 for NT, 108 for OT
+  {$EXTERNALSYM WM_WNT_CONVERTREQUESTEX}
+  WM_CONVERTREQUEST       = $010A;
+  {$EXTERNALSYM WM_CONVERTREQUEST}
+  WM_CONVERTRESULT        = $010B;
+  {$EXTERNALSYM WM_CONVERTRESULT}
+  WM_INTERIM              = $010C;
+  {$EXTERNALSYM WM_INTERIM}
+
+  WM_IMEKEYDOWN = $290;
+  {$EXTERNALSYM WM_IMEKEYDOWN}
+  WM_IMEKEYUP   = $291;
+  {$EXTERNALSYM WM_IMEKEYUP}
+
+//
+// UNDETERMINESTRING structure for IR_UNDETERMINE
+//
+
+type
+  tagUNDETERMINESTRUCT = record
+    dwSize: DWORD;
+    uDefIMESize: UINT;
+    uDefIMEPos: UINT;
+    uUndetTextLen: UINT;
+    uUndetTextPos: UINT;
+    uUndetAttrPos: UINT;
+    uCursorPos: UINT;
+    uDeltaStart: UINT;
+    uDetermineTextLen: UINT;
+    uDetermineTextPos: UINT;
+    uDetermineDelimPos: UINT;
+    uYomiTextLen: UINT;
+    uYomiTextPos: UINT;
+    uYomiDelimPos: UINT;
+  end;
+  {$EXTERNALSYM tagUNDETERMINESTRUCT}
+  UNDETERMINESTRUCT = tagUNDETERMINESTRUCT;
+  {$EXTERNALSYM UNDETERMINESTRUCT}
+  LPUNDETERMINESTRUCT = ^UNDETERMINESTRUCT;
+  {$EXTERNALSYM LPUNDETERMINESTRUCT}
+  PUNDETERMINESTRUCT = ^UNDETERMINESTRUCT;
+  {$EXTERNALSYM PUNDETERMINESTRUCT}
+  NPUNDETERMINESTRUCT = ^UNDETERMINESTRUCT;
+  {$EXTERNALSYM NPUNDETERMINESTRUCT}
+  TUndetermineStruct = UNDETERMINESTRUCT;
+
+  tagSTRINGEXSTRUCT = record
+    dwSize: DWORD;
+    uDeterminePos: UINT;
+    uDetermineDelimPos: UINT;
+    uYomiPos: UINT;
+    uYomiDelimPos: UINT;
+  end;
+  {$EXTERNALSYM tagSTRINGEXSTRUCT}
+  STRINGEXSTRUCT = tagSTRINGEXSTRUCT;
+  {$EXTERNALSYM STRINGEXSTRUCT}
+  LPSTRINGEXSTRUCT = ^STRINGEXSTRUCT;
+  {$EXTERNALSYM LPSTRINGEXSTRUCT}
+  PSTRINGEXSTRUCT = ^STRINGEXSTRUCT;
+  {$EXTERNALSYM PSTRINGEXSTRUCT}
+  NPSTRINGEXSTRUCT = ^STRINGEXSTRUCT;
+  {$EXTERNALSYM NPSTRINGEXSTRUCT}
+  TStringexStruct = STRINGEXSTRUCT;
+
+implementation
+
+const
+  imelib = 'user32.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _SendIMEMessageExA: Pointer;
+
+function SendIMEMessageExA;
+begin
+  GetProcedureAddress(_SendIMEMessageExA, imelib, 'SendIMEMessageExA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SendIMEMessageExA]
+  end;
+end;
+
+var
+  _SendIMEMessageExW: Pointer;
+
+function SendIMEMessageExW;
+begin
+  GetProcedureAddress(_SendIMEMessageExW, imelib, 'SendIMEMessageExW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SendIMEMessageExW]
+  end;
+end;
+
+var
+  _SendIMEMessageEx: Pointer;
+
+function SendIMEMessageEx;
+begin
+  GetProcedureAddress(_SendIMEMessageEx, imelib, 'SendIMEMessageEx' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SendIMEMessageEx]
+  end;
+end;
+
+{$ELSE}
+
+function SendIMEMessageExA; external imelib name 'SendIMEMessageExA';
+function SendIMEMessageExW; external imelib name 'SendIMEMessageExW';
+function SendIMEMessageEx; external imelib name 'SendIMEMessageEx' + AWSuffix;
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 290 - 0
packages/extra/winunits/jwaioevent.pas

@@ -0,0 +1,290 @@
+{******************************************************************************}
+{                                                                              }
+{ IO Events API interface Unit for Object Pascal                               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: Ioevent.h, released June 2000. The original Pascal     }
+{ code is: IoEvent.pas, released December 2000. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIoEvent;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "Ioevent.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+//  Label change event.  This event is signalled upon successful completion
+//  of a label change.  There is no additional data.
+//
+
+const
+  GUID_IO_VOLUME_CHANGE: TGUID = (D1:$7373654a; D2:$812a; D3:$11d0; D4:($be, $c7, $08, $00, $2b, $e2, $09, $2f));
+  {$EXTERNALSYM  GUID_IO_VOLUME_CHANGE}
+
+//
+//  Volume dismount event.  This event is signalled when an attempt is made to
+//  dismount a volume.  There is no additional data.  Note that this will not
+//  necessarily be preceded by a GUID_IO_VOLUME_LOCK notification.
+//
+
+  GUID_IO_VOLUME_DISMOUNT: TGUID = (D1:$d16a55e8; D2:$1059; D3:$11d2; D4:($8f, $fd, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_DISMOUNT}
+
+//
+//  Volume dismount failed event.  This event is signalled when a volume dismount fails.
+//  There is no additional data.
+//
+
+  GUID_IO_VOLUME_DISMOUNT_FAILED: TGUID = (D1:$e3c5b178; D2:$105d; D3:$11d2; D4:($8f, $fd, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_DISMOUNT_FAILED}
+
+//
+//  Volume mount event.  This event is signalled when a volume mount occurs.
+//  There is no additional data.
+//
+
+  GUID_IO_VOLUME_MOUNT: TGUID = (D1:$b5804878; D2:$1a96; D3:$11d2; D4:($8f, $fd, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_MOUNT}
+
+//
+//  Volume lock event.  This event is signalled when an attempt is made to
+//  lock a volume.  There is no additional data.
+//
+
+  GUID_IO_VOLUME_LOCK: TGUID = (D1:$50708874; D2:$c9af; D3:$11d1; D4:($8f, $ef, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_LOCK}
+
+//
+//  Volume lock failed event.  This event is signalled when an attempt is made to
+//  lock a volume, but it fails.  There is no additional data.
+//
+
+  GUID_IO_VOLUME_LOCK_FAILED: TGUID = (D1:$ae2eed10; D2:$0ba8; D3:$11d2; D4:($8f, $fb, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_LOCK_FAILED}
+
+//
+//  Volume unlock event.  This event is signalled when an attempt is made to
+//  unlock a volume.  There is no additional data.
+//
+
+  GUID_IO_VOLUME_UNLOCK: TGUID = (D1:$9a8c3d68; D2:$d0cb; D3:$11d1; D4:($8f, $ef, $00, $a0, $c9, $a0, $6d, $32));
+  {$EXTERNALSYM GUID_IO_VOLUME_UNLOCK}
+
+//
+//  Volume name change.  This event is signalled when the list of persistent
+//  names (like drive letters) for a volume changes.  There is no additional
+//  data.
+//
+
+  GUID_IO_VOLUME_NAME_CHANGE: TGUID = (D1:$2de97f83; D2:$4c06; D3:$11d2; D4:($a5, $32, $0, $60, $97, $13, $5, $5a));
+  {$EXTERNALSYM GUID_IO_VOLUME_NAME_CHANGE}
+
+//
+//  Volume physical configuration change.  This event is signalled when the
+//  physical makeup or current physical state of the volume changes.
+//
+
+  GUID_IO_VOLUME_PHYSICAL_CONFIGURATION_CHANGE: TGUID = (D1:$2de97f84; D2:$4c06; D3:$11d2; D4:($a5, $32, $0, $60, $97, $13, $5, $5a));
+  {$EXTERNALSYM GUID_IO_VOLUME_PHYSICAL_CONFIGURATION_CHANGE}
+
+//
+//  Volume device interface.  This is a device interface GUID that appears
+//  when the device object associated with a volume is created and disappears
+//  when the device object associated with the volume is destroyed.
+//
+
+  GUID_IO_VOLUME_DEVICE_INTERFACE: TGUID = (D1:$53f5630d; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
+  {$EXTERNALSYM GUID_IO_VOLUME_DEVICE_INTERFACE}
+
+//
+//  Sent when the removable media is changed (added, removed) from a device
+//  (such as a CDROM, tape, changer, etc).
+//
+//  The additional data is a DWORD representing the data event.
+//
+
+  GUID_IO_MEDIA_ARRIVAL: TGUID = (D1:$d07433c0; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_IO_MEDIA_ARRIVAL}
+  GUID_IO_MEDIA_REMOVAL: TGUID = (D1:$d07433c1; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_IO_MEDIA_REMOVAL}
+
+//
+// Sent when the media is returning that it is not ready right now, but will
+// be ready soon. This can be because the drive has spun down to save power
+// or because new media has been inserted but is not ready for access yet.
+//
+
+  GUID_IO_DEVICE_BECOMING_READY: TGUID = (D1:$d07433f0; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_IO_DEVICE_BECOMING_READY}
+
+type
+  _DEVICE_EVENT_BECOMING_READY = record
+    Version: ULONG;
+    Reason: ULONG;
+    Estimated100msToReady: ULONG;
+  end;
+  {$EXTERNALSYM _DEVICE_EVENT_BECOMING_READY}
+  DEVICE_EVENT_BECOMING_READY = _DEVICE_EVENT_BECOMING_READY;
+  {$EXTERNALSYM DEVICE_EVENT_BECOMING_READY}
+  PDEVICE_EVENT_BECOMING_READY = ^DEVICE_EVENT_BECOMING_READY;
+  {$EXTERNALSYM PDEVICE_EVENT_BECOMING_READY}
+  TDeviceEventBecomingReady = DEVICE_EVENT_BECOMING_READY;
+  PDeviceEventBecomingReady = PDEVICE_EVENT_BECOMING_READY;
+
+//
+// Sent when the user presses the eject button on the front of the drive,
+// or when other buttons on the front are pressed via GESN command polling
+// (GESN support to be added)
+//
+
+const
+  GUID_IO_DEVICE_EXTERNAL_REQUEST: TGUID = (D1:$d07433d0; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_IO_DEVICE_EXTERNAL_REQUEST}
+  GUID_IO_MEDIA_EJECT_REQUEST: TGUID = (D1:$d07433d1; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_IO_MEDIA_EJECT_REQUEST}
+
+type
+  PDEVICE_EVENT_EXTERNAL_REQUEST = ^DEVICE_EVENT_EXTERNAL_REQUEST;
+  {$EXTERNALSYM PDEVICE_EVENT_EXTERNAL_REQUEST}
+  _DEVICE_EVENT_EXTERNAL_REQUEST = record
+    Version: ULONG;
+    DeviceClass: ULONG; // 0 == MMC Storage Devices
+    ButtonStatus: USHORT; // 1 == down, 2 == up
+    Request: USHORT;
+    SystemTime: LARGE_INTEGER; // for time-related info
+  end;
+  {$EXTERNALSYM _DEVICE_EVENT_EXTERNAL_REQUEST}
+  DEVICE_EVENT_EXTERNAL_REQUEST = _DEVICE_EVENT_EXTERNAL_REQUEST;
+  {$EXTERNALSYM DEVICE_EVENT_EXTERNAL_REQUEST}
+  TDeviceEventExternalRequest = DEVICE_EVENT_EXTERNAL_REQUEST;
+  PDeviceEventExternalRequest = PDEVICE_EVENT_EXTERNAL_REQUEST;
+
+//
+// Sent when a tape drive requires cleaning
+//
+
+const
+  GUID_IO_DRIVE_REQUIRES_CLEANING: TGUID = (D1:$7207877c; D2:$90ed; D3:$44e5; D4:($a0, $0, $81, $42, $8d, $4c, $79, $bb));
+  {$EXTERNALSYM GUID_IO_DRIVE_REQUIRES_CLEANING}
+
+//
+// Sent when a tape is erased
+//
+
+  GUID_IO_TAPE_ERASE: TGUID = (D1:$852d11eb; D2:$4bb8; D3:$4507; D4:($9d, $9b, $41, $7c, $c2, $b1, $b4, $38));
+  {$EXTERNALSYM GUID_IO_TAPE_ERASE}
+
+type
+  _DEVICE_EVENT_GENERIC_DATA = record
+    EventNumber: ULONG;
+  end;
+  {$EXTERNALSYM _DEVICE_EVENT_GENERIC_DATA}
+  DEVICE_EVENT_GENERIC_DATA = _DEVICE_EVENT_GENERIC_DATA;
+  {$EXTERNALSYM DEVICE_EVENT_GENERIC_DATA}
+  PDEVICE_EVENT_GENERIC_DATA = ^DEVICE_EVENT_GENERIC_DATA;
+  {$EXTERNALSYM PDEVICE_EVENT_GENERIC_DATA}
+  TDeviceEventGenericData = DEVICE_EVENT_GENERIC_DATA;
+  PDeviceEventGenericData = PDEVICE_EVENT_GENERIC_DATA;
+
+//
+//  Represents any asynchronous notification coming from a device driver whose
+//  notification protocol is RBC
+//  Additional data is provided
+
+const
+  GUID_DEVICE_EVENT_RBC: TGUID = (D1:$d0744792; D2:$a98e; D3:$11d2; D4:($91, $7a, $00, $a0, $c9, $06, $8f, $f3));
+  {$EXTERNALSYM GUID_DEVICE_EVENT_RBC}
+
+type
+  _DEVICE_EVENT_RBC_DATA = record
+    EventNumber: ULONG;
+    SenseQualifier: UCHAR;
+    SenseCode: UCHAR;
+    SenseKey: UCHAR;
+    Reserved: UCHAR;
+    Information: ULONG;
+  end;
+  {$EXTERNALSYM _DEVICE_EVENT_RBC_DATA}
+  DEVICE_EVENT_RBC_DATA = _DEVICE_EVENT_RBC_DATA;
+  {$EXTERNALSYM DEVICE_EVENT_RBC_DATA}
+  PDEVICE_EVENT_RBC_DATA = ^DEVICE_EVENT_RBC_DATA;
+  {$EXTERNALSYM PDEVICE_EVENT_RBC_DATA}
+  TDeviceEventRbcData = DEVICE_EVENT_RBC_DATA;
+  PDeviceEventRbcData = PDEVICE_EVENT_RBC_DATA;
+
+//
+//  A clone of this disk has just arrived in the system.
+//
+
+const
+  GUID_IO_DISK_CLONE_ARRIVAL: TGUID = (D1:$6a61885b; D2:$7c39; D3:$43dd; D4:($9b, $56, $b8, $ac, $22, $a5, $49, $aa));
+  {$EXTERNALSYM GUID_IO_DISK_CLONE_ARRIVAL}
+
+type
+  _GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION = record
+    DiskNumber: ULONG; // The disk number of the new disk arriving in the system.
+  end;
+  {$EXTERNALSYM _GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION}
+  GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION = _GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION;
+  {$EXTERNALSYM GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION}
+  PGUID_IO_DISK_CLONE_ARRIVAL_INFORMATION = ^GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION;
+  {$EXTERNALSYM PGUID_IO_DISK_CLONE_ARRIVAL_INFORMATION}
+  TGuidIoDiskCloneArrivalInformation = GUID_IO_DISK_CLONE_ARRIVAL_INFORMATION;
+  PGuidIoDiskCloneArrivalInformation = PGUID_IO_DISK_CLONE_ARRIVAL_INFORMATION;
+
+//
+// The disk layout has changed
+//
+
+const
+  GUID_IO_DISK_LAYOUT_CHANGE: TGUID = (D1:$11dff54c; D2:$8469; D3:$41f9; D4:($b3, $de, $ef, $83, $64, $87, $c5, $4a));
+  {$EXTERNALSYM GUID_IO_DISK_LAYOUT_CHANGE}
+
+implementation
+
+end.

+ 441 - 0
packages/extra/winunits/jwaipexport.pas

@@ -0,0 +1,441 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Protocol Helper API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: ipexport.h, released August 2001. The original Pascal  }
+{ code is: IpExport.pas, released September 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): John C. Penman (jcp att craiglockhart dott com)              }
+{                 Vladimir Vassiliev (voldemarv att hotpop dott com)           }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpExport;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "ipexport.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaWS2tcpip;
+
+//
+// IP type definitions.
+//
+
+type
+  IPAddr = ULONG;     // An IP address.
+  {$EXTERNALSYM IPAddr}
+  IPMask = ULONG;     // An IP subnet mask.
+  {$EXTERNALSYM IPMask}
+  IP_STATUS = ULONG;  // Status code returned from IP APIs.
+  {$EXTERNALSYM IP_STATUS}
+
+(* (rom) deactivated  kernel mode is irrelevant for Delphi
+//
+// Duplicate these definitions here so that this file can be included by
+// kernel-mode components which cannot include ws2tcpip.h, as well as
+// by user-mode components which do.
+//
+
+type
+  IN6_ADDR = record
+    case Integer of
+      0: (Byte: array [0..15] of UCHAR);
+      1: (Word: array [0..7] of USHORT);
+  end;
+  {$EXTERNALSYM IN6_ADDR}
+  TIn6Addr = IN6_ADDR;
+  PIn6Addr = ^IN6_ADDR;
+
+  in_addr6 = in6_addr;
+  {$EXTERNALSYM in_addr6}
+  TInAddr6 = in_addr6;
+  PInAddr6 = ^in_addr6;
+*)
+
+type
+  IPv6Addr = in6_addr;
+  {$EXTERNALSYM IPv6Addr}
+  TIPv6Addr = IPv6Addr;
+  PIPv6Addr = ^IPv6Addr;
+
+//#ifndef s_addr
+
+  in_addr = record
+    case Integer of
+      0: (
+        s_b1, s_b2, s_b3, s_b4: UCHAR;
+        );
+      1: (
+        s_w1, s_w2: USHORT
+        );
+      2: (
+        S_addr: ULONG
+        );
+  end;
+  {$EXTERNALSYM in_addr}
+
+//#define s_addr  S_un.S_addr /* can be used for most tcp & ip code */
+
+//#endif
+
+//
+// The ip_option_information structure describes the options to be
+// included in the header of an IP packet. The TTL, TOS, and Flags
+// values are carried in specific fields in the header. The OptionsData
+// bytes are carried in the options area following the standard IP header.
+// With the exception of source route options, this data must be in the
+// format to be transmitted on the wire as specified in RFC 791. A source
+// route option should contain the full route - first hop thru final
+// destination - in the route data. The first hop will be pulled out of the
+// data and the option will be reformatted accordingly. Otherwise, the route
+// option should be formatted as specified in RFC 791.
+//
+
+type
+  IP_OPTION_INFORMATION = record
+    Ttl: UCHAR;          // Time To Live
+    Tos: UCHAR;          // Type Of Service
+    Flags: UCHAR;        // IP header flags
+    OptionsSize: UCHAR;  // Size in bytes of options data
+    OptionsData: PUCHAR; // Pointer to options data
+  end;
+  {$EXTERNALSYM IP_OPTION_INFORMATION}
+  PIP_OPTION_INFORMATION = ^IP_OPTION_INFORMATION;
+  {$EXTERNALSYM PIP_OPTION_INFORMATION}
+  TIpOptionInformation = IP_OPTION_INFORMATION;
+  PIpOptionInformation = PIP_OPTION_INFORMATION;
+
+//
+// The icmp_echo_reply structure describes the data returned in response
+// to an echo request.
+//
+
+  ICMP_ECHO_REPLY = record
+    Address: IPAddr;      // Replying address
+    Status: ULONG;        // Reply IP_STATUS
+    RoundTripTime: ULONG; // RTT in milliseconds
+    DataSize: USHORT;     // Reply data size in bytes
+    Reserved: USHORT;     // Reserved for system use
+    Data: LPVOID;         // Pointer to the reply data
+    Options: ip_option_information; // Reply options
+  end;
+  {$EXTERNALSYM ICMP_ECHO_REPLY}
+  PICMP_ECHO_REPLY = ^ICMP_ECHO_REPLY;
+  {$EXTERNALSYM PICMP_ECHO_REPLY}
+  TIcmpEchoReply = ICMP_ECHO_REPLY;
+  PIcmpEchoReply = PICMP_ECHO_REPLY;
+
+  ARP_SEND_REPLY = record
+    DestAddress: IPAddr;
+    SrcAddress: IPAddr;
+  end;
+  {$EXTERNALSYM ARP_SEND_REPLY}
+  PARP_SEND_REPLY = ^ARP_SEND_REPLY;
+  {$EXTERNALSYM PARP_SEND_REPLY}
+  TArpSendReply = ARP_SEND_REPLY;
+  PArpSendReply = PARP_SEND_REPLY;
+
+  TCP_RESERVE_PORT_RANGE = record
+    UpperRange: USHORT;
+    LowerRange: USHORT;
+  end;
+  {$EXTERNALSYM TCP_RESERVE_PORT_RANGE}
+  PTCP_RESERVE_PORT_RANGE = ^TCP_RESERVE_PORT_RANGE;
+  {$EXTERNALSYM PTCP_RESERVE_PORT_RANGE}
+  TTcpReservePortRange = TCP_RESERVE_PORT_RANGE;
+  PTcpReservePortRange = PTCP_RESERVE_PORT_RANGE;
+  
+const
+  MAX_ADAPTER_NAME = 128;
+  {$EXTERNALSYM MAX_ADAPTER_NAME}
+
+type
+  PIP_ADAPTER_INDEX_MAP = ^IP_ADAPTER_INDEX_MAP;
+  {$EXTERNALSYM PIP_ADAPTER_INDEX_MAP}
+  _IP_ADAPTER_INDEX_MAP = record
+    Index: ULONG;
+    Name: array [0..MAX_ADAPTER_NAME - 1] of WCHAR;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_INDEX_MAP}
+  IP_ADAPTER_INDEX_MAP = _IP_ADAPTER_INDEX_MAP;
+  {$EXTERNALSYM IP_ADAPTER_INDEX_MAP}
+  TIpAdapterIndexMap = IP_ADAPTER_INDEX_MAP;
+  PIpAdapterIndexMap = PIP_ADAPTER_INDEX_MAP;
+
+  PIP_INTERFACE_INFO = ^IP_INTERFACE_INFO;
+  {$EXTERNALSYM PIP_INTERFACE_INFO}
+  _IP_INTERFACE_INFO = record
+    NumAdapters: Longint;
+    Adapter: array [0..0] of IP_ADAPTER_INDEX_MAP;
+  end;
+  {$EXTERNALSYM _IP_INTERFACE_INFO}
+  IP_INTERFACE_INFO = _IP_INTERFACE_INFO;
+  {$EXTERNALSYM IP_INTERFACE_INFO}
+  TIpInterfaceInfo = IP_INTERFACE_INFO;
+  PIpInterfaceInfo = PIP_INTERFACE_INFO;
+
+  PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS = ^IP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
+  {$EXTERNALSYM PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS}
+  _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS = record
+    NumAdapters: ULONG;
+    Address: array [0..0] of IPAddr;
+  end;
+  {$EXTERNALSYM _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS}
+  IP_UNIDIRECTIONAL_ADAPTER_ADDRESS = _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
+  {$EXTERNALSYM IP_UNIDIRECTIONAL_ADAPTER_ADDRESS}
+  TIpUnidirectionalAdapterAddress = IP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
+  PIpUnidirectionalAdapterAddress = PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
+
+  PIP_ADAPTER_ORDER_MAP = ^IP_ADAPTER_ORDER_MAP;
+  {$EXTERNALSYM PIP_ADAPTER_ORDER_MAP}
+  _IP_ADAPTER_ORDER_MAP = record
+    NumAdapters: ULONG;
+    AdapterOrder: array [0..0] of ULONG;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_ORDER_MAP}
+  IP_ADAPTER_ORDER_MAP = _IP_ADAPTER_ORDER_MAP;
+  {$EXTERNALSYM IP_ADAPTER_ORDER_MAP}
+  TIpAdapterOrderMap = IP_ADAPTER_ORDER_MAP;
+  PIpAdapterOrderMap = PIP_ADAPTER_ORDER_MAP;
+
+  _IP_MCAST_COUNTER_INFO = record
+    InMcastOctets: ULONG64;
+    OutMcastOctets: ULONG64;
+    InMcastPkts: ULONG64;
+    OutMcastPkts: ULONG64;
+  end;
+  {$EXTERNALSYM _IP_MCAST_COUNTER_INFO}
+  IP_MCAST_COUNTER_INFO = _IP_MCAST_COUNTER_INFO;
+  {$EXTERNALSYM IP_MCAST_COUNTER_INFO}
+  PIP_MCAST_COUNTER_INFO = ^IP_MCAST_COUNTER_INFO;
+  {$EXTERNALSYM PIP_MCAST_COUNTER_INFO}
+  TIpMCastCounterInfo = IP_MCAST_COUNTER_INFO;
+  PIpMCastCounterInfo = PIP_MCAST_COUNTER_INFO;
+
+//
+// IP_STATUS codes returned from IP APIs
+//
+
+const
+  IP_STATUS_BASE = 11000;
+  {$EXTERNALSYM IP_STATUS_BASE}
+
+  IP_SUCCESS               = 0;
+  {$EXTERNALSYM IP_SUCCESS}
+  IP_BUF_TOO_SMALL         = IP_STATUS_BASE + 1;
+  {$EXTERNALSYM IP_BUF_TOO_SMALL}
+  IP_DEST_NET_UNREACHABLE  = IP_STATUS_BASE + 2;
+  {$EXTERNALSYM IP_DEST_NET_UNREACHABLE}
+  IP_DEST_HOST_UNREACHABLE = IP_STATUS_BASE + 3;
+  {$EXTERNALSYM IP_DEST_HOST_UNREACHABLE}
+  IP_DEST_PROT_UNREACHABLE = IP_STATUS_BASE + 4;
+  {$EXTERNALSYM IP_DEST_PROT_UNREACHABLE}
+  IP_DEST_PORT_UNREACHABLE = IP_STATUS_BASE + 5;
+  {$EXTERNALSYM IP_DEST_PORT_UNREACHABLE}
+  IP_NO_RESOURCES          = IP_STATUS_BASE + 6;
+  {$EXTERNALSYM IP_NO_RESOURCES}
+  IP_BAD_OPTION            = IP_STATUS_BASE + 7;
+  {$EXTERNALSYM IP_BAD_OPTION}
+  IP_HW_ERROR              = IP_STATUS_BASE + 8;
+  {$EXTERNALSYM IP_HW_ERROR}
+  IP_PACKET_TOO_BIG        = IP_STATUS_BASE + 9;
+  {$EXTERNALSYM IP_PACKET_TOO_BIG}
+  IP_REQ_TIMED_OUT         = IP_STATUS_BASE + 10;
+  {$EXTERNALSYM IP_REQ_TIMED_OUT}
+  IP_BAD_REQ               = IP_STATUS_BASE + 11;
+  {$EXTERNALSYM IP_BAD_REQ}
+  IP_BAD_ROUTE             = IP_STATUS_BASE + 12;
+  {$EXTERNALSYM IP_BAD_ROUTE}
+  IP_TTL_EXPIRED_TRANSIT   = IP_STATUS_BASE + 13;
+  {$EXTERNALSYM IP_TTL_EXPIRED_TRANSIT}
+  IP_TTL_EXPIRED_REASSEM   = IP_STATUS_BASE + 14;
+  {$EXTERNALSYM IP_TTL_EXPIRED_REASSEM}
+  IP_PARAM_PROBLEM         = IP_STATUS_BASE + 15;
+  {$EXTERNALSYM IP_PARAM_PROBLEM}
+  IP_SOURCE_QUENCH         = IP_STATUS_BASE + 16;
+  {$EXTERNALSYM IP_SOURCE_QUENCH}
+  IP_OPTION_TOO_BIG        = IP_STATUS_BASE + 17;
+  {$EXTERNALSYM IP_OPTION_TOO_BIG}
+  IP_BAD_DESTINATION       = IP_STATUS_BASE + 18;
+  {$EXTERNALSYM IP_BAD_DESTINATION}
+
+//
+// Variants of the above using IPv6 terminology, where different
+//
+
+  IP_DEST_NO_ROUTE            = IP_STATUS_BASE + 2;
+  {$EXTERNALSYM IP_DEST_NO_ROUTE}
+  IP_DEST_ADDR_UNREACHABLE    = IP_STATUS_BASE + 3;
+  {$EXTERNALSYM IP_DEST_ADDR_UNREACHABLE}
+  IP_DEST_PROHIBITED          = IP_STATUS_BASE + 4;
+  {$EXTERNALSYM IP_DEST_PROHIBITED}
+  //IP_DEST_PORT_UNREACHABLE    = IP_STATUS_BASE + 5;
+  //{$EXTERNALSYM IP_DEST_PORT_UNREACHABLE}
+  IP_HOP_LIMIT_EXCEEDED       = IP_STATUS_BASE + 13;
+  {$EXTERNALSYM IP_HOP_LIMIT_EXCEEDED}
+  IP_REASSEMBLY_TIME_EXCEEDED = IP_STATUS_BASE + 14;
+  {$EXTERNALSYM IP_REASSEMBLY_TIME_EXCEEDED}
+  IP_PARAMETER_PROBLEM        = IP_STATUS_BASE + 15;
+  {$EXTERNALSYM IP_PARAMETER_PROBLEM}
+
+//
+// IPv6-only status codes
+//
+
+  IP_DEST_UNREACHABLE         = IP_STATUS_BASE + 40;
+  {$EXTERNALSYM IP_DEST_UNREACHABLE}
+  IP_TIME_EXCEEDED            = IP_STATUS_BASE + 41;
+  {$EXTERNALSYM IP_TIME_EXCEEDED}
+  IP_BAD_HEADER               = IP_STATUS_BASE + 42;
+  {$EXTERNALSYM IP_BAD_HEADER}
+  IP_UNRECOGNIZED_NEXT_HEADER = IP_STATUS_BASE + 43;
+  {$EXTERNALSYM IP_UNRECOGNIZED_NEXT_HEADER}
+  IP_ICMP_ERROR               = IP_STATUS_BASE + 44;
+  {$EXTERNALSYM IP_ICMP_ERROR}
+  IP_DEST_SCOPE_MISMATCH      = IP_STATUS_BASE + 45;
+  {$EXTERNALSYM IP_DEST_SCOPE_MISMATCH}
+
+//
+// The next group are status codes passed up on status indications to
+// transport layer protocols.
+//
+
+  IP_ADDR_DELETED                    = IP_STATUS_BASE + 19;
+  {$EXTERNALSYM IP_ADDR_DELETED}
+  IP_SPEC_MTU_CHANGE                 = IP_STATUS_BASE + 20;
+  {$EXTERNALSYM IP_SPEC_MTU_CHANGE}
+  IP_MTU_CHANGE                      = IP_STATUS_BASE + 21;
+  {$EXTERNALSYM IP_MTU_CHANGE}
+  IP_UNLOAD                          = IP_STATUS_BASE + 22;
+  {$EXTERNALSYM IP_UNLOAD}
+  IP_ADDR_ADDED                      = IP_STATUS_BASE + 23;
+  {$EXTERNALSYM IP_ADDR_ADDED}
+  IP_MEDIA_CONNECT                   = IP_STATUS_BASE + 24;
+  {$EXTERNALSYM IP_MEDIA_CONNECT}
+  IP_MEDIA_DISCONNECT                = IP_STATUS_BASE + 25;
+  {$EXTERNALSYM IP_MEDIA_DISCONNECT}
+  IP_BIND_ADAPTER                    = IP_STATUS_BASE + 26;
+  {$EXTERNALSYM IP_BIND_ADAPTER}
+  IP_UNBIND_ADAPTER                  = IP_STATUS_BASE + 27;
+  {$EXTERNALSYM IP_UNBIND_ADAPTER}
+  IP_DEVICE_DOES_NOT_EXIST           = IP_STATUS_BASE + 28;
+  {$EXTERNALSYM IP_DEVICE_DOES_NOT_EXIST}
+  IP_DUPLICATE_ADDRESS               = IP_STATUS_BASE + 29;
+  {$EXTERNALSYM IP_DUPLICATE_ADDRESS}
+  IP_INTERFACE_METRIC_CHANGE         = IP_STATUS_BASE + 30;
+  {$EXTERNALSYM IP_INTERFACE_METRIC_CHANGE}
+  IP_RECONFIG_SECFLTR                = IP_STATUS_BASE + 31;
+  {$EXTERNALSYM IP_RECONFIG_SECFLTR}
+  IP_NEGOTIATING_IPSEC               = IP_STATUS_BASE + 32;
+  {$EXTERNALSYM IP_NEGOTIATING_IPSEC}
+  IP_INTERFACE_WOL_CAPABILITY_CHANGE = IP_STATUS_BASE + 33;
+  {$EXTERNALSYM IP_INTERFACE_WOL_CAPABILITY_CHANGE}
+  IP_DUPLICATE_IPADD                 = IP_STATUS_BASE + 34;
+  {$EXTERNALSYM IP_DUPLICATE_IPADD}
+
+  IP_GENERAL_FAILURE = IP_STATUS_BASE + 50;
+  {$EXTERNALSYM IP_GENERAL_FAILURE}
+  MAX_IP_STATUS      = IP_GENERAL_FAILURE;
+  {$EXTERNALSYM MAX_IP_STATUS}
+  IP_PENDING         = IP_STATUS_BASE + 255;
+  {$EXTERNALSYM IP_PENDING}
+
+//
+// Values used in the IP header Flags field.
+//
+
+  IP_FLAG_DF = $2; // Don't fragment this packet.
+  {$EXTERNALSYM IP_FLAG_DF}
+
+//
+// Supported IP Option Types.
+//
+// These types define the options which may be used in the OptionsData field
+// of the ip_option_information structure.  See RFC 791 for a complete
+// description of each.
+//
+
+  IP_OPT_EOL          = 0; // End of list option
+  {$EXTERNALSYM IP_OPT_EOL}
+  IP_OPT_NOP          = 1; // No operation
+  {$EXTERNALSYM IP_OPT_NOP}
+  IP_OPT_SECURITY     = $82; // Security option
+  {$EXTERNALSYM IP_OPT_SECURITY}
+  IP_OPT_LSRR         = $83; // Loose source route
+  {$EXTERNALSYM IP_OPT_LSRR}
+  IP_OPT_SSRR         = $89; // Strict source route
+  {$EXTERNALSYM IP_OPT_SSRR}
+  IP_OPT_RR           = $7; // Record route
+  {$EXTERNALSYM IP_OPT_RR}
+  IP_OPT_TS           = $44; // Timestamp
+  {$EXTERNALSYM IP_OPT_TS}
+  IP_OPT_SID          = $88; // Stream ID (obsolete)
+  {$EXTERNALSYM IP_OPT_SID}
+  IP_OPT_ROUTER_ALERT = $94; // Router Alert Option
+  {$EXTERNALSYM IP_OPT_ROUTER_ALERT}
+
+  MAX_OPT_SIZE = 40; // Maximum length of IP options in bytes
+  {$EXTERNALSYM MAX_OPT_SIZE}
+
+// Ioctls code exposed by Memphis tcpip stack.
+// For NT these ioctls are define in ntddip.h  (private\inc)
+
+  IOCTL_IP_RTCHANGE_NOTIFY_REQUEST        = 101;
+  {$EXTERNALSYM IOCTL_IP_RTCHANGE_NOTIFY_REQUEST}
+  IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST       = 102;
+  {$EXTERNALSYM IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST}
+  IOCTL_ARP_SEND_REQUEST                  = 103;
+  {$EXTERNALSYM IOCTL_ARP_SEND_REQUEST}
+  IOCTL_IP_INTERFACE_INFO                 = 104;
+  {$EXTERNALSYM IOCTL_IP_INTERFACE_INFO}
+  IOCTL_IP_GET_BEST_INTERFACE             = 105;
+  {$EXTERNALSYM IOCTL_IP_GET_BEST_INTERFACE}
+  IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS = 106;
+  {$EXTERNALSYM IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS}
+
+implementation
+
+end.

+ 1185 - 0
packages/extra/winunits/jwaiphlpapi.pas

@@ -0,0 +1,1185 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Protocol Helper API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iphlpapi.h, released August 2000. The original Pascal  }
+{ code is: IpHlpApi.pas, released September 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): John C. Penman (jcp att craiglockhart dott com)              }
+{                 Vladimir Vassiliev (voldemarv att hotpop dott com)           }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpHlpApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iphlpapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaIpExport, JwaIpRtrMib, JwaIpTypes, JwaWinType, JwaWinBase, JwaWinSock;
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// IPRTRMIB.H has the definitions of the strcutures used to set and get     //
+// information                                                              //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+// #include <iprtrmib.h>
+// #include <ipexport.h>
+// #include <iptypes.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// The GetXXXTable APIs take a buffer and a size of buffer.  If the buffer  //
+// is not large enough, the APIs return ERROR_INSUFFICIENT_BUFFER  and      //
+// *pdwSize is the required buffer size                                     //
+// The bOrder is a BOOLEAN, which if TRUE sorts the table according to      //
+// MIB-II (RFC XXXX)                                                        //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Retrieves the number of interfaces in the system. These include LAN and  //
+// WAN interfaces                                                           //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetNumberOfInterfaces(var pdwNumIf: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetNumberOfInterfaces}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the MIB-II ifEntry                                                  //
+// The dwIndex field of the MIB_IFROW should be set to the index of the     //
+// interface being queried                                                  //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIfEntry(pIfRow: PMIB_IFROW): DWORD; stdcall;
+{$EXTERNALSYM GetIfEntry}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the MIB-II IfTable                                                  //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIfTable(pIfTable: PMIB_IFTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetIfTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the Interface to IP Address mapping                                 //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIpAddrTable(pIpAddrTable: PMIB_IPADDRTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetIpAddrTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the current IP Address to Physical Address (ARP) mapping            //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIpNetTable(pIpNetTable: PMIB_IPNETTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetIpNetTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the IP Routing Table  (RFX XXXX)                                    //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIpForwardTable(pIpForwardTable: PMIB_IPFORWARDTABLE; var pdwSize: ULONG;
+  bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetIpForwardTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets TCP Connection/UDP Listener Table                                   //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetTcpTable(pTcpTable: PMIB_TCPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetTcpTable}
+
+function GetUdpTable(pUdpTable: PMIB_UDPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
+{$EXTERNALSYM GetUdpTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets IP/ICMP/TCP/UDP Statistics                                          //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetIpStatistics(var pStats: MIB_IPSTATS): DWORD; stdcall;
+{$EXTERNALSYM GetIpStatistics}
+
+function GetIpStatisticsEx(pStats: PMIB_IPSTATS; dwFamily: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetIpStatisticsEx}
+
+function GetIcmpStatistics(var pStats: MIB_ICMP): DWORD; stdcall;
+{$EXTERNALSYM GetIcmpStatistics}
+
+function GetIcmpStatisticsEx(pStats: PMIB_ICMP_EX; dwFamily: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetIcmpStatisticsEx}
+
+function GetTcpStatistics(var pStats: MIB_TCPSTATS): DWORD; stdcall;
+{$EXTERNALSYM GetTcpStatistics}
+
+function GetTcpStatisticsEx(pStats: PMIB_TCPSTATS; dwFamily: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetTcpStatisticsEx}
+
+function GetUdpStatistics(var pStats: MIB_UDPSTATS): DWORD; stdcall;
+{$EXTERNALSYM GetUdpStatistics}
+
+function GetUdpStatisticsEx(pStats: PMIB_UDPSTATS; dwFamily: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetUdpStatisticsEx}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to set the ifAdminStatus on an interface.  The only fields of the   //
+// MIB_IFROW that are relevant are the dwIndex (index of the interface      //
+// whose status needs to be set) and the dwAdminStatus which can be either  //
+// MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN                       //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function SetIfEntry(const pIfRow: MIB_IFROW): DWORD; stdcall;
+{$EXTERNALSYM SetIfEntry}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to create, modify or delete a route.  In all cases the              //
+// dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop and     //
+// dwForwardPolicy MUST BE SPECIFIED. Currently dwForwardPolicy is unused   //
+// and MUST BE 0.                                                           //
+// For a set, the complete MIB_IPFORWARDROW structure must be specified     //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function CreateIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
+{$EXTERNALSYM CreateIpForwardEntry}
+
+function SetIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
+{$EXTERNALSYM SetIpForwardEntry}
+
+function DeleteIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
+{$EXTERNALSYM DeleteIpForwardEntry}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to set the ipForwarding to ON or OFF (currently only ON->OFF is     //
+// allowed) and to set the defaultTTL.  If only one of the fields needs to  //
+// be modified and the other needs to be the same as before the other field //
+// needs to be set to MIB_USE_CURRENT_TTL or MIB_USE_CURRENT_FORWARDING as  //
+// the case may be                                                          //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function SetIpStatistics(const pIpStats: MIB_IPSTATS): DWORD; stdcall;
+{$EXTERNALSYM SetIpStatistics}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to set the defaultTTL.                                              //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function SetIpTTL(nTTL: UINT): DWORD; stdcall;
+{$EXTERNALSYM SetIpTTL}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to create, modify or delete an ARP entry.  In all cases the dwIndex //
+// dwAddr field MUST BE SPECIFIED.                                          //
+// For a set, the complete MIB_IPNETROW structure must be specified         //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function CreateIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
+{$EXTERNALSYM CreateIpNetEntry}
+
+function SetIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
+{$EXTERNALSYM SetIpNetEntry}
+
+function DeleteIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
+{$EXTERNALSYM DeleteIpNetEntry}
+
+function FlushIpNetTable(dwIfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM FlushIpNetTable}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to create or delete a Proxy ARP entry. The dwIndex is the index of  //
+// the interface on which to PARP for the dwAddress.  If the interface is   //
+// of a type that doesnt support ARP, e.g. PPP, then the call will fail     //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function CreateProxyArpEntry(dwAddress, dwMask, dwIfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM CreateProxyArpEntry}
+
+function DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM DeleteProxyArpEntry}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Used to set the state of a TCP Connection. The only state that it can be //
+// set to is MIB_TCP_STATE_DELETE_TCB.  The complete MIB_TCPROW structure   //
+// MUST BE SPECIFIED                                                        //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function SetTcpEntry(const pTcpRow: MIB_TCPROW): DWORD; stdcall;
+{$EXTERNALSYM SetTcpEntry}
+
+function GetInterfaceInfo(pIfTable: PIP_INTERFACE_INFO; var dwOutBufLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetInterfaceInfo}
+
+function GetUniDirectionalAdapterInfo(pIPIfInfo: PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
+  var dwOutBufLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetUniDirectionalAdapterInfo(OUT PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo}
+
+function NhpAllocateAndGetInterfaceInfoFromStack(out ppTable: PIP_INTERFACE_NAME_INFO;
+  pdwCount: PDWORD; bOrder: BOOL; hHeap: HANDLE; dwFlags: DWORD): DWORD; stdcall;
+{$EXTERNALSYM NhpAllocateAndGetInterfaceInfoFromStack}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the "best" outgoing interface for the specified destination address //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetBestInterface(dwDestAddr: IPAddr; var pdwBestIfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetBestInterface}
+
+function GetBestInterfaceEx(pDestAddr: PSockAddr; var pdwBestIfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetBestInterfaceEx}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Gets the best (longest matching prefix) route for the given destination  //
+// If the source address is also specified (i.e. is not 0x00000000), and    //
+// there are multiple "best" routes to the given destination, the returned  //
+// route will be one that goes out over the interface which has an address  //
+// that matches the source address                                          //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+function GetBestRoute(dwDestAddr, dwSourceAddr: DWORD; pBestRoute: PMIB_IPFORWARDROW): DWORD; stdcall;
+{$EXTERNALSYM GetBestRoute}
+
+function NotifyAddrChange(var Handle: THandle; overlapped: POVERLAPPED): DWORD; stdcall;
+{$EXTERNALSYM NotifyAddrChange}
+
+function NotifyRouteChange(var Handle: THandle; overlapped: POVERLAPPED): DWORD; stdcall;
+{$EXTERNALSYM NotifyRouteChange}
+
+function CancelIPChangeNotify(notifyOverlapped: LPOVERLAPPED): BOOL; stdcall;
+{$EXTERNALSYM CancelIPChangeNotify}
+
+function GetAdapterIndex(AdapterName: LPWSTR; var IfIndex: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetAdapterIndex}
+
+function AddIPAddress(Address: IPAddr; IpMask: IPMask; IfIndex: DWORD;
+  var NTEContext, NTEInstance: ULONG): DWORD; stdcall;
+{$EXTERNALSYM AddIPAddress}
+
+function DeleteIPAddress(NTEContext: ULONG): DWORD; stdcall;
+{$EXTERNALSYM DeleteIPAddress}
+
+function GetNetworkParams(pFixedInfo: PFIXED_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetNetworkParams}
+
+function GetAdaptersInfo(pAdapterInfo: PIP_ADAPTER_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetAdaptersInfo}
+
+function GetAdapterOrderMap: PIP_ADAPTER_ORDER_MAP; stdcall;
+{$EXTERNALSYM GetAdapterOrderMap}
+
+//
+// The following functions require Winsock2.
+//
+
+function GetAdaptersAddresses(Family: ULONG; Flags: DWORD; Reserved: PVOID;
+  pAdapterAddresses: PIP_ADAPTER_ADDRESSES; pOutBufLen: PULONG): DWORD; stdcall;
+{$EXTERNALSYM GetAdaptersAddresses}
+
+function GetPerAdapterInfo(IfIndex: ULONG; pPerAdapterInfo: PIP_PER_ADAPTER_INFO;
+  var pOutBufLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM GetPerAdapterInfo}
+
+function IpReleaseAddress(const AdapterInfo: IP_ADAPTER_INDEX_MAP): DWORD; stdcall;
+{$EXTERNALSYM IpReleaseAddress}
+
+function IpRenewAddress(const AdapterInfo: IP_ADAPTER_INDEX_MAP): DWORD; stdcall;
+{$EXTERNALSYM IpRenewAddress}
+
+function SendARP(const DestIP, SrcIP: IPAddr; pMacAddr: PULONG; var PhyAddrLen: ULONG): DWORD; stdcall;
+{$EXTERNALSYM SendARP}
+
+function GetRTTAndHopCount(DestIpAddress: IPAddr; var HopCount: ULONG;
+  MaxHops: ULONG; var RTT: ULONG): BOOL; stdcall;
+{$EXTERNALSYM GetRTTAndHopCount}
+
+function GetFriendlyIfIndex(IfIndex: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetFriendlyIfIndex}
+
+function EnableRouter(var pHandle: THandle; pOverlapped: POVERLAPPED): DWORD; stdcall;
+{$EXTERNALSYM EnableRouter}
+
+function UnenableRouter(pOverlapped: POVERLAPPED; lpdwEnableCount: LPDWORD): DWORD; stdcall;
+{$EXTERNALSYM UnenableRouter}
+
+function DisableMediaSense(var pHandle: HANDLE; pOverLapped: POVERLAPPED): DWORD; stdcall;
+{$EXTERNALSYM DisableMediaSense}
+
+function RestoreMediaSense(pOverlapped: POVERLAPPED; lpdwEnableCount: LPDWORD): DWORD; stdcall;
+{$EXTERNALSYM RestoreMediaSense}
+
+function GetIpErrorString(ErrorCode: IP_STATUS; Buffer: PWCHAR; var Size: DWORD): DWORD; stdcall;
+{$EXTERNALSYM GetIpErrorString}
+
+implementation
+
+const
+  iphlpapilib = 'iphlpapi.dll';
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _GetNumberOfInterfaces: Pointer;
+
+function GetNumberOfInterfaces;
+begin
+  GetProcedureAddress(_GetNumberOfInterfaces, iphlpapilib, 'GetNumberOfInterfaces');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetNumberOfInterfaces]
+  end;
+end;
+
+var
+  _GetIfEntry: Pointer;
+
+function GetIfEntry;
+begin
+  GetProcedureAddress(_GetIfEntry, iphlpapilib, 'GetIfEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIfEntry]
+  end;
+end;
+
+var
+  _GetIfTable: Pointer;
+
+function GetIfTable;
+begin
+  GetProcedureAddress(_GetIfTable, iphlpapilib, 'GetIfTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIfTable]
+  end;
+end;
+
+var
+  _GetIpAddrTable: Pointer;
+
+function GetIpAddrTable;
+begin
+  GetProcedureAddress(_GetIpAddrTable, iphlpapilib, 'GetIpAddrTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpAddrTable]
+  end;
+end;
+
+var
+  _GetIpNetTable: Pointer;
+
+function GetIpNetTable;
+begin
+  GetProcedureAddress(_GetIpNetTable, iphlpapilib, 'GetIpNetTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpNetTable]
+  end;
+end;
+
+var
+  _GetIpForwardTable: Pointer;
+
+function GetIpForwardTable;
+begin
+  GetProcedureAddress(_GetIpForwardTable, iphlpapilib, 'GetIpForwardTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpForwardTable]
+  end;
+end;
+
+var
+  _GetTcpTable: Pointer;
+
+function GetTcpTable;
+begin
+  GetProcedureAddress(_GetTcpTable, iphlpapilib, 'GetTcpTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTcpTable]
+  end;
+end;
+
+var
+  _GetUdpTable: Pointer;
+
+function GetUdpTable;
+begin
+  GetProcedureAddress(_GetUdpTable, iphlpapilib, 'GetUdpTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetUdpTable]
+  end;
+end;
+
+var
+  _GetIpStatistics: Pointer;
+
+function GetIpStatistics;
+begin
+  GetProcedureAddress(_GetIpStatistics, iphlpapilib, 'GetIpStatistics');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpStatistics]
+  end;
+end;
+
+var
+  _GetIpStatisticsEx: Pointer;
+
+function GetIpStatisticsEx;
+begin
+  GetProcedureAddress(_GetIpStatisticsEx, iphlpapilib, 'GetIpStatisticsEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpStatisticsEx]
+  end;
+end;
+
+var
+  _GetIcmpStatistics: Pointer;
+
+function GetIcmpStatistics;
+begin
+  GetProcedureAddress(_GetIcmpStatistics, iphlpapilib, 'GetIcmpStatistics');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIcmpStatistics]
+  end;
+end;
+
+var
+  _GetIcmpStatisticsEx: Pointer;
+
+function GetIcmpStatisticsEx;
+begin
+  GetProcedureAddress(_GetIcmpStatisticsEx, iphlpapilib, 'GetIcmpStatisticsEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIcmpStatisticsEx]
+  end;
+end;
+
+var
+  _GetTcpStatistics: Pointer;
+
+function GetTcpStatistics;
+begin
+  GetProcedureAddress(_GetTcpStatistics, iphlpapilib, 'GetTcpStatistics');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTcpStatistics]
+  end;
+end;
+
+var
+  _GetTcpStatisticsEx: Pointer;
+
+function GetTcpStatisticsEx;
+begin
+  GetProcedureAddress(_GetTcpStatisticsEx, iphlpapilib, 'GetTcpStatisticsEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetTcpStatisticsEx]
+  end;
+end;
+
+var
+  _GetUdpStatistics: Pointer;
+
+function GetUdpStatistics;
+begin
+  GetProcedureAddress(_GetUdpStatistics, iphlpapilib, 'GetUdpStatistics');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetUdpStatistics]
+  end;
+end;
+
+var
+  _GetUdpStatisticsEx: Pointer;
+
+function GetUdpStatisticsEx;
+begin
+  GetProcedureAddress(_GetUdpStatisticsEx, iphlpapilib, 'GetUdpStatisticsEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetUdpStatisticsEx]
+  end;
+end;
+
+var
+  _SetIfEntry: Pointer;
+
+function SetIfEntry;
+begin
+  GetProcedureAddress(_SetIfEntry, iphlpapilib, 'SetIfEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetIfEntry]
+  end;
+end;
+
+var
+  _CreateIpForwardEntry: Pointer;
+
+function CreateIpForwardEntry;
+begin
+  GetProcedureAddress(_CreateIpForwardEntry, iphlpapilib, 'CreateIpForwardEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CreateIpForwardEntry]
+  end;
+end;
+
+var
+  _SetIpForwardEntry: Pointer;
+
+function SetIpForwardEntry;
+begin
+  GetProcedureAddress(_SetIpForwardEntry, iphlpapilib, 'SetIpForwardEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetIpForwardEntry]
+  end;
+end;
+
+var
+  _DeleteIpForwardEntry: Pointer;
+
+function DeleteIpForwardEntry;
+begin
+  GetProcedureAddress(_DeleteIpForwardEntry, iphlpapilib, 'DeleteIpForwardEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteIpForwardEntry]
+  end;
+end;
+
+var
+  _SetIpStatistics: Pointer;
+
+function SetIpStatistics;
+begin
+  GetProcedureAddress(_SetIpStatistics, iphlpapilib, 'SetIpStatistics');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetIpStatistics]
+  end;
+end;
+
+var
+  _SetIpTTL: Pointer;
+
+function SetIpTTL;
+begin
+  GetProcedureAddress(_SetIpTTL, iphlpapilib, 'SetIpTTL');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetIpTTL]
+  end;
+end;
+
+var
+  _CreateIpNetEntry: Pointer;
+
+function CreateIpNetEntry;
+begin
+  GetProcedureAddress(_CreateIpNetEntry, iphlpapilib, 'CreateIpNetEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CreateIpNetEntry]
+  end;
+end;
+
+var
+  _SetIpNetEntry: Pointer;
+
+function SetIpNetEntry;
+begin
+  GetProcedureAddress(_SetIpNetEntry, iphlpapilib, 'SetIpNetEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetIpNetEntry]
+  end;
+end;
+
+var
+  _DeleteIpNetEntry: Pointer;
+
+function DeleteIpNetEntry;
+begin
+  GetProcedureAddress(_DeleteIpNetEntry, iphlpapilib, 'DeleteIpNetEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteIpNetEntry]
+  end;
+end;
+
+var
+  _FlushIpNetTable: Pointer;
+
+function FlushIpNetTable;
+begin
+  GetProcedureAddress(_FlushIpNetTable, iphlpapilib, 'FlushIpNetTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_FlushIpNetTable]
+  end;
+end;
+
+var
+  _CreateProxyArpEntry: Pointer;
+
+function CreateProxyArpEntry;
+begin
+  GetProcedureAddress(_CreateProxyArpEntry, iphlpapilib, 'CreateProxyArpEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CreateProxyArpEntry]
+  end;
+end;
+
+var
+  _DeleteProxyArpEntry: Pointer;
+
+function DeleteProxyArpEntry;
+begin
+  GetProcedureAddress(_DeleteProxyArpEntry, iphlpapilib, 'DeleteProxyArpEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteProxyArpEntry]
+  end;
+end;
+
+var
+  _SetTcpEntry: Pointer;
+
+function SetTcpEntry;
+begin
+  GetProcedureAddress(_SetTcpEntry, iphlpapilib, 'SetTcpEntry');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetTcpEntry]
+  end;
+end;
+
+var
+  _GetInterfaceInfo: Pointer;
+
+function GetInterfaceInfo;
+begin
+  GetProcedureAddress(_GetInterfaceInfo, iphlpapilib, 'GetInterfaceInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetInterfaceInfo]
+  end;
+end;
+
+var
+  _GetUniDirectionalAdapterInfo: Pointer;
+
+function GetUniDirectionalAdapterInfo;
+begin
+  GetProcedureAddress(_GetUniDirectionalAdapterInfo, iphlpapilib, 'GetUniDirectionalAdapterInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetUniDirectionalAdapterInfo]
+  end;
+end;
+
+var
+  _NhpAllocateAndGetInterfaceInfoFromStack: Pointer;
+
+function NhpAllocateAndGetInterfaceInfoFromStack;
+begin
+  GetProcedureAddress(_NhpAllocateAndGetInterfaceInfoFromStack, iphlpapilib, 'NhpAllocateAndGetInterfaceInfoFromStack');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NhpAllocateAndGetInterfaceInfoFromStack]
+  end;
+end;
+
+var
+  _GetBestInterface: Pointer;
+
+function GetBestInterface;
+begin
+  GetProcedureAddress(_GetBestInterface, iphlpapilib, 'GetBestInterface');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetBestInterface]
+  end;
+end;
+
+var
+  _GetBestInterfaceEx: Pointer;
+
+function GetBestInterfaceEx;
+begin
+  GetProcedureAddress(_GetBestInterfaceEx, iphlpapilib, 'GetBestInterfaceEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetBestInterfaceEx]
+  end;
+end;
+
+var
+  _GetBestRoute: Pointer;
+
+function GetBestRoute;
+begin
+  GetProcedureAddress(_GetBestRoute, iphlpapilib, 'GetBestRoute');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetBestRoute]
+  end;
+end;
+
+var
+  _NotifyAddrChange: Pointer;
+
+function NotifyAddrChange;
+begin
+  GetProcedureAddress(_NotifyAddrChange, iphlpapilib, 'NotifyAddrChange');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NotifyAddrChange]
+  end;
+end;
+
+var
+  _NotifyRouteChange: Pointer;
+
+function NotifyRouteChange;
+begin
+  GetProcedureAddress(_NotifyRouteChange, iphlpapilib, 'NotifyRouteChange');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NotifyRouteChange]
+  end;
+end;
+
+var
+  _CancelIPChangeNotify: Pointer;
+
+function CancelIPChangeNotify;
+begin
+  GetProcedureAddress(_CancelIPChangeNotify, iphlpapilib, 'CancelIPChangeNotify');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_CancelIPChangeNotify]
+  end;
+end;
+
+var
+  _GetAdapterIndex: Pointer;
+
+function GetAdapterIndex;
+begin
+  GetProcedureAddress(_GetAdapterIndex, iphlpapilib, 'GetAdapterIndex');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAdapterIndex]
+  end;
+end;
+
+var
+  _AddIPAddress: Pointer;
+
+function AddIPAddress;
+begin
+  GetProcedureAddress(_AddIPAddress, iphlpapilib, 'AddIPAddress');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_AddIPAddress]
+  end;
+end;
+
+var
+  _DeleteIPAddress: Pointer;
+
+function DeleteIPAddress;
+begin
+  GetProcedureAddress(_DeleteIPAddress, iphlpapilib, 'DeleteIPAddress');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DeleteIPAddress]
+  end;
+end;
+
+var
+  _GetNetworkParams: Pointer;
+
+function GetNetworkParams;
+begin
+  GetProcedureAddress(_GetNetworkParams, iphlpapilib, 'GetNetworkParams');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetNetworkParams]
+  end;
+end;
+
+var
+  _GetAdaptersInfo: Pointer;
+
+function GetAdaptersInfo;
+begin
+  GetProcedureAddress(_GetAdaptersInfo, iphlpapilib, 'GetAdaptersInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAdaptersInfo]
+  end;
+end;
+
+var
+  _GetAdapterOrderMap: Pointer;
+
+function GetAdapterOrderMap;
+begin
+  GetProcedureAddress(_GetAdapterOrderMap, iphlpapilib, 'GetAdapterOrderMap');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAdapterOrderMap]
+  end;
+end;
+
+var
+  _GetAdaptersAddresses: Pointer;
+
+function GetAdaptersAddresses;
+begin
+  GetProcedureAddress(_GetAdaptersAddresses, iphlpapilib, 'GetAdaptersAddresses');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetAdaptersAddresses]
+  end;
+end;
+
+var
+  _GetPerAdapterInfo: Pointer;
+
+function GetPerAdapterInfo;
+begin
+  GetProcedureAddress(_GetPerAdapterInfo, iphlpapilib, 'GetPerAdapterInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetPerAdapterInfo]
+  end;
+end;
+
+var
+  _IpReleaseAddress: Pointer;
+
+function IpReleaseAddress;
+begin
+  GetProcedureAddress(_IpReleaseAddress, iphlpapilib, 'IpReleaseAddress');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IpReleaseAddress]
+  end;
+end;
+
+var
+  _IpRenewAddress: Pointer;
+
+function IpRenewAddress;
+begin
+  GetProcedureAddress(_IpRenewAddress, iphlpapilib, 'IpRenewAddress');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_IpRenewAddress]
+  end;
+end;
+
+var
+  _SendARP: Pointer;
+
+function SendARP;
+begin
+  GetProcedureAddress(_SendARP, iphlpapilib, 'SendARP');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SendARP]
+  end;
+end;
+
+var
+  _GetRTTAndHopCount: Pointer;
+
+function GetRTTAndHopCount;
+begin
+  GetProcedureAddress(_GetRTTAndHopCount, iphlpapilib, 'GetRTTAndHopCount');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetRTTAndHopCount]
+  end;
+end;
+
+var
+  _GetFriendlyIfIndex: Pointer;
+
+function GetFriendlyIfIndex;
+begin
+  GetProcedureAddress(_GetFriendlyIfIndex, iphlpapilib, 'GetFriendlyIfIndex');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetFriendlyIfIndex]
+  end;
+end;
+
+var
+  _EnableRouter: Pointer;
+
+function EnableRouter;
+begin
+  GetProcedureAddress(_EnableRouter, iphlpapilib, 'EnableRouter');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_EnableRouter]
+  end;
+end;
+
+var
+  _UnenableRouter: Pointer;
+
+function UnenableRouter;
+begin
+  GetProcedureAddress(_UnenableRouter, iphlpapilib, 'UnenableRouter');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnenableRouter]
+  end;
+end;
+
+var
+  _DisableMediaSense: Pointer;
+
+function DisableMediaSense;
+begin
+  GetProcedureAddress(_DisableMediaSense, iphlpapilib, 'DisableMediaSense');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_DisableMediaSense]
+  end;
+end;
+
+var
+  _RestoreMediaSense: Pointer;
+
+function RestoreMediaSense;
+begin
+  GetProcedureAddress(_RestoreMediaSense, iphlpapilib, 'RestoreMediaSense');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_RestoreMediaSense]
+  end;
+end;
+
+var
+  _GetIpErrorString: Pointer;
+
+function GetIpErrorString;
+begin
+  GetProcedureAddress(_GetIpErrorString, iphlpapilib, 'GetIpErrorString');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_GetIpErrorString]
+  end;
+end;
+
+{$ELSE}
+
+function GetNumberOfInterfaces; external iphlpapilib name 'GetNumberOfInterfaces';
+function GetIfEntry; external iphlpapilib name 'GetIfEntry';
+function GetIfTable; external iphlpapilib name 'GetIfTable';
+function GetIpAddrTable; external iphlpapilib name 'GetIpAddrTable';
+function GetIpNetTable; external iphlpapilib name 'GetIpNetTable';
+function GetIpForwardTable; external iphlpapilib name 'GetIpForwardTable';
+function GetTcpTable; external iphlpapilib name 'GetTcpTable';
+function GetUdpTable; external iphlpapilib name 'GetUdpTable';
+function GetIpStatistics; external iphlpapilib name 'GetIpStatistics';
+function GetIpStatisticsEx; external iphlpapilib name 'GetIpStatisticsEx';
+function GetIcmpStatistics; external iphlpapilib name 'GetIcmpStatistics';
+function GetIcmpStatisticsEx; external iphlpapilib name 'GetIcmpStatisticsEx';
+function GetTcpStatistics; external iphlpapilib name 'GetTcpStatistics';
+function GetTcpStatisticsEx; external iphlpapilib name 'GetTcpStatisticsEx';
+function GetUdpStatistics; external iphlpapilib name 'GetUdpStatistics';
+function GetUdpStatisticsEx; external iphlpapilib name 'GetUdpStatisticsEx';
+function SetIfEntry; external iphlpapilib name 'SetIfEntry';
+function CreateIpForwardEntry; external iphlpapilib name 'CreateIpForwardEntry';
+function SetIpForwardEntry; external iphlpapilib name 'SetIpForwardEntry';
+function DeleteIpForwardEntry; external iphlpapilib name 'DeleteIpForwardEntry';
+function SetIpStatistics; external iphlpapilib name 'SetIpStatistics';
+function SetIpTTL; external iphlpapilib name 'SetIpTTL';
+function CreateIpNetEntry; external iphlpapilib name 'CreateIpNetEntry';
+function SetIpNetEntry; external iphlpapilib name 'SetIpNetEntry';
+function DeleteIpNetEntry; external iphlpapilib name 'DeleteIpNetEntry';
+function FlushIpNetTable; external iphlpapilib name 'FlushIpNetTable';
+function CreateProxyArpEntry; external iphlpapilib name 'CreateProxyArpEntry';
+function DeleteProxyArpEntry; external iphlpapilib name 'DeleteProxyArpEntry';
+function SetTcpEntry; external iphlpapilib name 'SetTcpEntry';
+function GetInterfaceInfo; external iphlpapilib name 'GetInterfaceInfo';
+function GetUniDirectionalAdapterInfo; external iphlpapilib name 'GetUniDirectionalAdapterInfo';
+function NhpAllocateAndGetInterfaceInfoFromStack; external iphlpapilib name 'NhpAllocateAndGetInterfaceInfoFromStack';
+function GetBestInterface; external iphlpapilib name 'GetBestInterface';
+function GetBestInterfaceEx; external iphlpapilib name 'GetBestInterfaceEx';
+function GetBestRoute; external iphlpapilib name 'GetBestRoute';
+function NotifyAddrChange; external iphlpapilib name 'NotifyAddrChange';
+function NotifyRouteChange; external iphlpapilib name 'NotifyRouteChange';
+function CancelIPChangeNotify; external iphlpapilib name 'CancelIPChangeNotify';
+function GetAdapterIndex; external iphlpapilib name 'GetAdapterIndex';
+function AddIPAddress; external iphlpapilib name 'AddIPAddress';
+function DeleteIPAddress; external iphlpapilib name 'DeleteIPAddress';
+function GetNetworkParams; external iphlpapilib name 'GetNetworkParams';
+function GetAdaptersInfo; external iphlpapilib name 'GetAdaptersInfo';
+function GetAdapterOrderMap; external iphlpapilib name 'GetAdapterOrderMap';
+function GetAdaptersAddresses; external iphlpapilib name 'GetAdaptersAddresses';
+function GetPerAdapterInfo; external iphlpapilib name 'GetPerAdapterInfo';
+function IpReleaseAddress; external iphlpapilib name 'IpReleaseAddress';
+function IpRenewAddress; external iphlpapilib name 'IpRenewAddress';
+function SendARP; external iphlpapilib name 'SendARP';
+function GetRTTAndHopCount; external iphlpapilib name 'GetRTTAndHopCount';
+function GetFriendlyIfIndex; external iphlpapilib name 'GetFriendlyIfIndex';
+function EnableRouter; external iphlpapilib name 'EnableRouter';
+function UnenableRouter; external iphlpapilib name 'UnenableRouter';
+function DisableMediaSense; external iphlpapilib name 'DisableMediaSense';
+function RestoreMediaSense; external iphlpapilib name 'RestoreMediaSense';
+function GetIpErrorString; external iphlpapilib name 'GetIpErrorString';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 490 - 0
packages/extra/winunits/jwaipifcons.pas

@@ -0,0 +1,490 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Protocol Helper API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: ipifcons.h, released August 2001. The original Pascal  }
+{ code is: IpIfCons.pas, released September 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): John C. Penman (jcp att craiglockhart dott com)              }
+{                 Vladimir Vassiliev (voldemarv att hotpop dott com)           }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpIfCons;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "ipifcons.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Media types                                                              //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+const
+  MIN_IF_TYPE = 1;
+  {$EXTERNALSYM MIN_IF_TYPE}
+
+  IF_TYPE_OTHER                   = 1; // None of the below
+  {$EXTERNALSYM IF_TYPE_OTHER}
+  IF_TYPE_REGULAR_1822            = 2;
+  {$EXTERNALSYM IF_TYPE_REGULAR_1822}
+  IF_TYPE_HDH_1822                = 3;
+  {$EXTERNALSYM IF_TYPE_HDH_1822}
+  IF_TYPE_DDN_X25                 = 4;
+  {$EXTERNALSYM IF_TYPE_DDN_X25}
+  IF_TYPE_RFC877_X25              = 5;
+  {$EXTERNALSYM IF_TYPE_RFC877_X25}
+  IF_TYPE_ETHERNET_CSMACD         = 6;
+  {$EXTERNALSYM IF_TYPE_ETHERNET_CSMACD}
+  IF_TYPE_IS088023_CSMACD         = 7;
+  {$EXTERNALSYM IF_TYPE_IS088023_CSMACD}
+  IF_TYPE_ISO88024_TOKENBUS       = 8;
+  {$EXTERNALSYM IF_TYPE_ISO88024_TOKENBUS}
+  IF_TYPE_ISO88025_TOKENRING      = 9;
+  {$EXTERNALSYM IF_TYPE_ISO88025_TOKENRING}
+  IF_TYPE_ISO88026_MAN            = 10;
+  {$EXTERNALSYM IF_TYPE_ISO88026_MAN}
+  IF_TYPE_STARLAN                 = 11;
+  {$EXTERNALSYM IF_TYPE_STARLAN}
+  IF_TYPE_PROTEON_10MBIT          = 12;
+  {$EXTERNALSYM IF_TYPE_PROTEON_10MBIT}
+  IF_TYPE_PROTEON_80MBIT          = 13;
+  {$EXTERNALSYM IF_TYPE_PROTEON_80MBIT}
+  IF_TYPE_HYPERCHANNEL            = 14;
+  {$EXTERNALSYM IF_TYPE_HYPERCHANNEL}
+  IF_TYPE_FDDI                    = 15;
+  {$EXTERNALSYM IF_TYPE_FDDI}
+  IF_TYPE_LAP_B                   = 16;
+  {$EXTERNALSYM IF_TYPE_LAP_B}
+  IF_TYPE_SDLC                    = 17;
+  {$EXTERNALSYM IF_TYPE_SDLC}
+  IF_TYPE_DS1                     = 18; // DS1-MIB
+  {$EXTERNALSYM IF_TYPE_DS1}
+  IF_TYPE_E1                      = 19; // Obsolete; see DS1-MIB
+  {$EXTERNALSYM IF_TYPE_E1}
+  IF_TYPE_BASIC_ISDN              = 20;
+  {$EXTERNALSYM IF_TYPE_BASIC_ISDN}
+  IF_TYPE_PRIMARY_ISDN            = 21;
+  {$EXTERNALSYM IF_TYPE_PRIMARY_ISDN}
+  IF_TYPE_PROP_POINT2POINT_SERIAL = 22; // proprietary serial
+  {$EXTERNALSYM IF_TYPE_PROP_POINT2POINT_SERIAL}
+  IF_TYPE_PPP                     = 23;
+  {$EXTERNALSYM IF_TYPE_PPP}
+  IF_TYPE_SOFTWARE_LOOPBACK       = 24;
+  {$EXTERNALSYM IF_TYPE_SOFTWARE_LOOPBACK}
+  IF_TYPE_EON                     = 25; // CLNP over IP
+  {$EXTERNALSYM IF_TYPE_EON}
+  IF_TYPE_ETHERNET_3MBIT          = 26;
+  {$EXTERNALSYM IF_TYPE_ETHERNET_3MBIT}
+  IF_TYPE_NSIP                    = 27; // XNS over IP
+  {$EXTERNALSYM IF_TYPE_NSIP}
+  IF_TYPE_SLIP                    = 28; // Generic Slip
+  {$EXTERNALSYM IF_TYPE_SLIP}
+  IF_TYPE_ULTRA                   = 29; // ULTRA Technologies
+  {$EXTERNALSYM IF_TYPE_ULTRA}
+  IF_TYPE_DS3                     = 30; // DS3-MIB
+  {$EXTERNALSYM IF_TYPE_DS3}
+  IF_TYPE_SIP                     = 31; // SMDS, coffee
+  {$EXTERNALSYM IF_TYPE_SIP}
+  IF_TYPE_FRAMERELAY              = 32; // DTE only
+  {$EXTERNALSYM IF_TYPE_FRAMERELAY}
+  IF_TYPE_RS232                   = 33;
+  {$EXTERNALSYM IF_TYPE_RS232}
+  IF_TYPE_PARA                    = 34; // Parallel port
+  {$EXTERNALSYM IF_TYPE_PARA}
+  IF_TYPE_ARCNET                  = 35;
+  {$EXTERNALSYM IF_TYPE_ARCNET}
+  IF_TYPE_ARCNET_PLUS             = 36;
+  {$EXTERNALSYM IF_TYPE_ARCNET_PLUS}
+  IF_TYPE_ATM                     = 37; // ATM cells
+  {$EXTERNALSYM IF_TYPE_ATM}
+  IF_TYPE_MIO_X25                 = 38;
+  {$EXTERNALSYM IF_TYPE_MIO_X25}
+  IF_TYPE_SONET                   = 39; // SONET or SDH
+  {$EXTERNALSYM IF_TYPE_SONET}
+  IF_TYPE_X25_PLE                 = 40;
+  {$EXTERNALSYM IF_TYPE_X25_PLE}
+  IF_TYPE_ISO88022_LLC            = 41;
+  {$EXTERNALSYM IF_TYPE_ISO88022_LLC}
+  IF_TYPE_LOCALTALK               = 42;
+  {$EXTERNALSYM IF_TYPE_LOCALTALK}
+  IF_TYPE_SMDS_DXI                = 43;
+  {$EXTERNALSYM IF_TYPE_SMDS_DXI}
+  IF_TYPE_FRAMERELAY_SERVICE      = 44; // FRNETSERV-MIB
+  {$EXTERNALSYM IF_TYPE_FRAMERELAY_SERVICE}
+  IF_TYPE_V35                     = 45;
+  {$EXTERNALSYM IF_TYPE_V35}
+  IF_TYPE_HSSI                    = 46;
+  {$EXTERNALSYM IF_TYPE_HSSI}
+  IF_TYPE_HIPPI                   = 47;
+  {$EXTERNALSYM IF_TYPE_HIPPI}
+  IF_TYPE_MODEM                   = 48; // Generic Modem
+  {$EXTERNALSYM IF_TYPE_MODEM}
+  IF_TYPE_AAL5                    = 49; // AAL5 over ATM
+  {$EXTERNALSYM IF_TYPE_AAL5}
+  IF_TYPE_SONET_PATH              = 50;
+  {$EXTERNALSYM IF_TYPE_SONET_PATH}
+  IF_TYPE_SONET_VT                = 51;
+  {$EXTERNALSYM IF_TYPE_SONET_VT}
+  IF_TYPE_SMDS_ICIP               = 52; // SMDS InterCarrier Interface
+  {$EXTERNALSYM IF_TYPE_SMDS_ICIP}
+  IF_TYPE_PROP_VIRTUAL            = 53; // Proprietary virtual/internal
+  {$EXTERNALSYM IF_TYPE_PROP_VIRTUAL}
+  IF_TYPE_PROP_MULTIPLEXOR        = 54; // Proprietary multiplexing
+  {$EXTERNALSYM IF_TYPE_PROP_MULTIPLEXOR}
+  IF_TYPE_IEEE80212               = 55; // 100BaseVG
+  {$EXTERNALSYM IF_TYPE_IEEE80212}
+  IF_TYPE_FIBRECHANNEL            = 56;
+  {$EXTERNALSYM IF_TYPE_FIBRECHANNEL}
+  IF_TYPE_HIPPIINTERFACE          = 57;
+  {$EXTERNALSYM IF_TYPE_HIPPIINTERFACE}
+  IF_TYPE_FRAMERELAY_INTERCONNECT = 58; // Obsolete, use 32 or 44
+  {$EXTERNALSYM IF_TYPE_FRAMERELAY_INTERCONNECT}
+  IF_TYPE_AFLANE_8023             = 59; // ATM Emulated LAN for 802.3
+  {$EXTERNALSYM IF_TYPE_AFLANE_8023}
+  IF_TYPE_AFLANE_8025             = 60; // ATM Emulated LAN for 802.5
+  {$EXTERNALSYM IF_TYPE_AFLANE_8025}
+  IF_TYPE_CCTEMUL                 = 61; // ATM Emulated circuit
+  {$EXTERNALSYM IF_TYPE_CCTEMUL}
+  IF_TYPE_FASTETHER               = 62; // Fast Ethernet (100BaseT)
+  {$EXTERNALSYM IF_TYPE_FASTETHER}
+  IF_TYPE_ISDN                    = 63; // ISDN and X.25
+  {$EXTERNALSYM IF_TYPE_ISDN}
+  IF_TYPE_V11                     = 64; // CCITT V.11/X.21
+  {$EXTERNALSYM IF_TYPE_V11}
+  IF_TYPE_V36                     = 65; // CCITT V.36
+  {$EXTERNALSYM IF_TYPE_V36}
+  IF_TYPE_G703_64K                = 66; // CCITT G703 at 64Kbps
+  {$EXTERNALSYM IF_TYPE_G703_64K}
+  IF_TYPE_G703_2MB                = 67; // Obsolete; see DS1-MIB
+  {$EXTERNALSYM IF_TYPE_G703_2MB}
+  IF_TYPE_QLLC                    = 68; // SNA QLLC
+  {$EXTERNALSYM IF_TYPE_QLLC}
+  IF_TYPE_FASTETHER_FX            = 69; // Fast Ethernet (100BaseFX)
+  {$EXTERNALSYM IF_TYPE_FASTETHER_FX}
+  IF_TYPE_CHANNEL                 = 70;
+  {$EXTERNALSYM IF_TYPE_CHANNEL}
+  IF_TYPE_IEEE80211               = 71; // Radio spread spectrum
+  {$EXTERNALSYM IF_TYPE_IEEE80211}
+  IF_TYPE_IBM370PARCHAN           = 72; // IBM System 360/370 OEMI Channel
+  {$EXTERNALSYM IF_TYPE_IBM370PARCHAN}
+  IF_TYPE_ESCON                   = 73; // IBM Enterprise Systems Connection
+  {$EXTERNALSYM IF_TYPE_ESCON}
+  IF_TYPE_DLSW                    = 74; // Data Link Switching
+  {$EXTERNALSYM IF_TYPE_DLSW}
+  IF_TYPE_ISDN_S                  = 75; // ISDN S/T interface
+  {$EXTERNALSYM IF_TYPE_ISDN_S}
+  IF_TYPE_ISDN_U                  = 76; // ISDN U interface
+  {$EXTERNALSYM IF_TYPE_ISDN_U}
+  IF_TYPE_LAP_D                   = 77; // Link Access Protocol D
+  {$EXTERNALSYM IF_TYPE_LAP_D}
+  IF_TYPE_IPSWITCH                = 78; // IP Switching Objects
+  {$EXTERNALSYM IF_TYPE_IPSWITCH}
+  IF_TYPE_RSRB                    = 79; // Remote Source Route Bridging
+  {$EXTERNALSYM IF_TYPE_RSRB}
+  IF_TYPE_ATM_LOGICAL             = 80; // ATM Logical Port
+  {$EXTERNALSYM IF_TYPE_ATM_LOGICAL}
+  IF_TYPE_DS0                     = 81; // Digital Signal Level 0
+  {$EXTERNALSYM IF_TYPE_DS0}
+  IF_TYPE_DS0_BUNDLE              = 82; // Group of ds0s on the same ds1
+  {$EXTERNALSYM IF_TYPE_DS0_BUNDLE}
+  IF_TYPE_BSC                     = 83; // Bisynchronous Protocol
+  {$EXTERNALSYM IF_TYPE_BSC}
+  IF_TYPE_ASYNC                   = 84; // Asynchronous Protocol
+  {$EXTERNALSYM IF_TYPE_ASYNC}
+  IF_TYPE_CNR                     = 85; // Combat Net Radio
+  {$EXTERNALSYM IF_TYPE_CNR}
+  IF_TYPE_ISO88025R_DTR           = 86; // ISO 802.5r DTR
+  {$EXTERNALSYM IF_TYPE_ISO88025R_DTR}
+  IF_TYPE_EPLRS                   = 87; // Ext Pos Loc Report Sys
+  {$EXTERNALSYM IF_TYPE_EPLRS}
+  IF_TYPE_ARAP                    = 88; // Appletalk Remote Access Protocol
+  {$EXTERNALSYM IF_TYPE_ARAP}
+  IF_TYPE_PROP_CNLS               = 89; // Proprietary Connectionless Proto
+  {$EXTERNALSYM IF_TYPE_PROP_CNLS}
+  IF_TYPE_HOSTPAD                 = 90; // CCITT-ITU X.29 PAD Protocol
+  {$EXTERNALSYM IF_TYPE_HOSTPAD}
+  IF_TYPE_TERMPAD                 = 91; // CCITT-ITU X.3 PAD Facility
+  {$EXTERNALSYM IF_TYPE_TERMPAD}
+  IF_TYPE_FRAMERELAY_MPI          = 92; // Multiproto Interconnect over FR
+  {$EXTERNALSYM IF_TYPE_FRAMERELAY_MPI}
+  IF_TYPE_X213                    = 93; // CCITT-ITU X213
+  {$EXTERNALSYM IF_TYPE_X213}
+  IF_TYPE_ADSL                    = 94; // Asymmetric Digital Subscrbr Loop
+  {$EXTERNALSYM IF_TYPE_ADSL}
+  IF_TYPE_RADSL                   = 95; // Rate-Adapt Digital Subscrbr Loop
+  {$EXTERNALSYM IF_TYPE_RADSL}
+  IF_TYPE_SDSL                    = 96; // Symmetric Digital Subscriber Loop
+  {$EXTERNALSYM IF_TYPE_SDSL}
+  IF_TYPE_VDSL                    = 97; // Very H-Speed Digital Subscrb Loop
+  {$EXTERNALSYM IF_TYPE_VDSL}
+  IF_TYPE_ISO88025_CRFPRINT       = 98; // ISO 802.5 CRFP
+  {$EXTERNALSYM IF_TYPE_ISO88025_CRFPRINT}
+  IF_TYPE_MYRINET                 = 99; // Myricom Myrinet
+  {$EXTERNALSYM IF_TYPE_MYRINET}
+  IF_TYPE_VOICE_EM                = 100; // Voice recEive and transMit
+  {$EXTERNALSYM IF_TYPE_VOICE_EM}
+  IF_TYPE_VOICE_FXO               = 101; // Voice Foreign Exchange Office
+  {$EXTERNALSYM IF_TYPE_VOICE_FXO}
+  IF_TYPE_VOICE_FXS               = 102; // Voice Foreign Exchange Station
+  {$EXTERNALSYM IF_TYPE_VOICE_FXS}
+  IF_TYPE_VOICE_ENCAP             = 103; // Voice encapsulation
+  {$EXTERNALSYM IF_TYPE_VOICE_ENCAP}
+  IF_TYPE_VOICE_OVERIP            = 104; // Voice over IP encapsulation
+  {$EXTERNALSYM IF_TYPE_VOICE_OVERIP}
+  IF_TYPE_ATM_DXI                 = 105; // ATM DXI
+  {$EXTERNALSYM IF_TYPE_ATM_DXI}
+  IF_TYPE_ATM_FUNI                = 106; // ATM FUNI
+  {$EXTERNALSYM IF_TYPE_ATM_FUNI}
+  IF_TYPE_ATM_IMA                 = 107; // ATM IMA
+  {$EXTERNALSYM IF_TYPE_ATM_IMA}
+  IF_TYPE_PPPMULTILINKBUNDLE      = 108; // PPP Multilink Bundle
+  {$EXTERNALSYM IF_TYPE_PPPMULTILINKBUNDLE}
+  IF_TYPE_IPOVER_CDLC             = 109; // IBM ipOverCdlc
+  {$EXTERNALSYM IF_TYPE_IPOVER_CDLC}
+  IF_TYPE_IPOVER_CLAW             = 110; // IBM Common Link Access to Workstn
+  {$EXTERNALSYM IF_TYPE_IPOVER_CLAW}
+  IF_TYPE_STACKTOSTACK            = 111; // IBM stackToStack
+  {$EXTERNALSYM IF_TYPE_STACKTOSTACK}
+  IF_TYPE_VIRTUALIPADDRESS        = 112; // IBM VIPA
+  {$EXTERNALSYM IF_TYPE_VIRTUALIPADDRESS}
+  IF_TYPE_MPC                     = 113; // IBM multi-proto channel support
+  {$EXTERNALSYM IF_TYPE_MPC}
+  IF_TYPE_IPOVER_ATM              = 114; // IBM ipOverAtm
+  {$EXTERNALSYM IF_TYPE_IPOVER_ATM}
+  IF_TYPE_ISO88025_FIBER          = 115; // ISO 802.5j Fiber Token Ring
+  {$EXTERNALSYM IF_TYPE_ISO88025_FIBER}
+  IF_TYPE_TDLC                    = 116; // IBM twinaxial data link control
+  {$EXTERNALSYM IF_TYPE_TDLC}
+  IF_TYPE_GIGABITETHERNET         = 117;
+  {$EXTERNALSYM IF_TYPE_GIGABITETHERNET}
+  IF_TYPE_HDLC                    = 118;
+  {$EXTERNALSYM IF_TYPE_HDLC}
+  IF_TYPE_LAP_F                   = 119;
+  {$EXTERNALSYM IF_TYPE_LAP_F}
+  IF_TYPE_V37                     = 120;
+  {$EXTERNALSYM IF_TYPE_V37}
+  IF_TYPE_X25_MLP                 = 121; // Multi-Link Protocol
+  {$EXTERNALSYM IF_TYPE_X25_MLP}
+  IF_TYPE_X25_HUNTGROUP           = 122; // X.25 Hunt Group
+  {$EXTERNALSYM IF_TYPE_X25_HUNTGROUP}
+  IF_TYPE_TRANSPHDLC              = 123;
+  {$EXTERNALSYM IF_TYPE_TRANSPHDLC}
+  IF_TYPE_INTERLEAVE              = 124; // Interleave channel
+  {$EXTERNALSYM IF_TYPE_INTERLEAVE}
+  IF_TYPE_FAST                    = 125; // Fast channel
+  {$EXTERNALSYM IF_TYPE_FAST}
+  IF_TYPE_IP                      = 126; // IP (for APPN HPR in IP networks)
+  {$EXTERNALSYM IF_TYPE_IP}
+  IF_TYPE_DOCSCABLE_MACLAYER      = 127; // CATV Mac Layer
+  {$EXTERNALSYM IF_TYPE_DOCSCABLE_MACLAYER}
+  IF_TYPE_DOCSCABLE_DOWNSTREAM    = 128; // CATV Downstream interface
+  {$EXTERNALSYM IF_TYPE_DOCSCABLE_DOWNSTREAM}
+  IF_TYPE_DOCSCABLE_UPSTREAM      = 129; // CATV Upstream interface
+  {$EXTERNALSYM IF_TYPE_DOCSCABLE_UPSTREAM}
+  IF_TYPE_A12MPPSWITCH            = 130; // Avalon Parallel Processor
+  {$EXTERNALSYM IF_TYPE_A12MPPSWITCH}
+  IF_TYPE_TUNNEL                  = 131; // Encapsulation interface
+  {$EXTERNALSYM IF_TYPE_TUNNEL}
+  IF_TYPE_COFFEE                  = 132; // Coffee pot
+  {$EXTERNALSYM IF_TYPE_COFFEE}
+  IF_TYPE_CES                     = 133; // Circuit Emulation Service
+  {$EXTERNALSYM IF_TYPE_CES}
+  IF_TYPE_ATM_SUBINTERFACE        = 134; // ATM Sub Interface
+  {$EXTERNALSYM IF_TYPE_ATM_SUBINTERFACE}
+  IF_TYPE_L2_VLAN                 = 135; // Layer 2 Virtual LAN using 802.1Q
+  {$EXTERNALSYM IF_TYPE_L2_VLAN}
+  IF_TYPE_L3_IPVLAN               = 136; // Layer 3 Virtual LAN using IP
+  {$EXTERNALSYM IF_TYPE_L3_IPVLAN}
+  IF_TYPE_L3_IPXVLAN              = 137; // Layer 3 Virtual LAN using IPX
+  {$EXTERNALSYM IF_TYPE_L3_IPXVLAN}
+  IF_TYPE_DIGITALPOWERLINE        = 138; // IP over Power Lines
+  {$EXTERNALSYM IF_TYPE_DIGITALPOWERLINE}
+  IF_TYPE_MEDIAMAILOVERIP         = 139; // Multimedia Mail over IP
+  {$EXTERNALSYM IF_TYPE_MEDIAMAILOVERIP}
+  IF_TYPE_DTM                     = 140; // Dynamic syncronous Transfer Mode
+  {$EXTERNALSYM IF_TYPE_DTM}
+  IF_TYPE_DCN                     = 141; // Data Communications Network
+  {$EXTERNALSYM IF_TYPE_DCN}
+  IF_TYPE_IPFORWARD               = 142; // IP Forwarding Interface
+  {$EXTERNALSYM IF_TYPE_IPFORWARD}
+  IF_TYPE_MSDSL                   = 143; // Multi-rate Symmetric DSL
+  {$EXTERNALSYM IF_TYPE_MSDSL}
+  IF_TYPE_IEEE1394                = 144; // IEEE1394 High Perf Serial Bus
+  {$EXTERNALSYM IF_TYPE_IEEE1394}
+  IF_TYPE_RECEIVE_ONLY            = 145; // TV adapter type
+  {$EXTERNALSYM IF_TYPE_RECEIVE_ONLY}
+
+  MAX_IF_TYPE = 145;
+  {$EXTERNALSYM MAX_IF_TYPE}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Access types                                                             //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IF_ACCESS_LOOPBACK          = 1;
+  {$EXTERNALSYM IF_ACCESS_LOOPBACK}
+  IF_ACCESS_BROADCAST         = 2;
+  {$EXTERNALSYM IF_ACCESS_BROADCAST}
+  IF_ACCESS_POINTTOPOINT      = 3;
+  {$EXTERNALSYM IF_ACCESS_POINTTOPOINT}
+  IF_ACCESS_POINTTOMULTIPOINT = 4;
+  {$EXTERNALSYM IF_ACCESS_POINTTOMULTIPOINT}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Interface Capabilities (bit flags)                                       //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IF_CHECK_NONE                  = $00;
+  {$EXTERNALSYM IF_CHECK_NONE}
+  IF_CHECK_MCAST                 = $01;
+  {$EXTERNALSYM IF_CHECK_MCAST}
+  IF_CHECK_SEND                  = $02;
+  {$EXTERNALSYM IF_CHECK_SEND}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Connection Types                                                         //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IF_CONNECTION_DEDICATED = 1;
+  {$EXTERNALSYM IF_CONNECTION_DEDICATED}
+  IF_CONNECTION_PASSIVE   = 2;
+  {$EXTERNALSYM IF_CONNECTION_PASSIVE}
+  IF_CONNECTION_DEMAND    = 3;
+  {$EXTERNALSYM IF_CONNECTION_DEMAND}
+
+  IF_ADMIN_STATUS_UP      = 1;
+  {$EXTERNALSYM IF_ADMIN_STATUS_UP}
+  IF_ADMIN_STATUS_DOWN    = 2;
+  {$EXTERNALSYM IF_ADMIN_STATUS_DOWN}
+  IF_ADMIN_STATUS_TESTING = 3;
+  {$EXTERNALSYM IF_ADMIN_STATUS_TESTING}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// The following are the the operational states for WAN and LAN interfaces. //
+// The order of the states seems weird, but is done for a purpose. All      //
+// states >= CONNECTED can transmit data right away. States >= DISCONNECTED //
+// can tx data but some set up might be needed. States < DISCONNECTED can   //
+// not transmit data.                                                       //
+// A card is marked UNREACHABLE if DIM calls InterfaceUnreachable for       //
+// reasons other than failure to connect.                                   //
+//                                                                          //
+// NON_OPERATIONAL -- Valid for LAN Interfaces. Means the card is not       //
+//                      working or not plugged in or has no address.        //
+// UNREACHABLE     -- Valid for WAN Interfaces. Means the remote site is    //
+//                      not reachable at this time.                         //
+// DISCONNECTED    -- Valid for WAN Interfaces. Means the remote site is    //
+//                      not connected at this time.                         //
+// CONNECTING      -- Valid for WAN Interfaces. Means a connection attempt  //
+//                      has been initiated to the remote site.              //
+// CONNECTED       -- Valid for WAN Interfaces. Means the remote site is    //
+//                      connected.                                          //
+// OPERATIONAL     -- Valid for LAN Interfaces. Means the card is plugged   //
+//                      in and working.                                     //
+//                                                                          //
+// It is the users duty to convert these values to MIB-II values if they    //
+// are to be used by a subagent                                             //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IF_OPER_STATUS_NON_OPERATIONAL = 0;
+  {$EXTERNALSYM IF_OPER_STATUS_NON_OPERATIONAL}
+  IF_OPER_STATUS_UNREACHABLE     = 1;
+  {$EXTERNALSYM IF_OPER_STATUS_UNREACHABLE}
+  IF_OPER_STATUS_DISCONNECTED    = 2;
+  {$EXTERNALSYM IF_OPER_STATUS_DISCONNECTED}
+  IF_OPER_STATUS_CONNECTING      = 3;
+  {$EXTERNALSYM IF_OPER_STATUS_CONNECTING}
+  IF_OPER_STATUS_CONNECTED       = 4;
+  {$EXTERNALSYM IF_OPER_STATUS_CONNECTED}
+  IF_OPER_STATUS_OPERATIONAL     = 5;
+  {$EXTERNALSYM IF_OPER_STATUS_OPERATIONAL}
+
+  MIB_IF_TYPE_OTHER     = 1;
+  {$EXTERNALSYM MIB_IF_TYPE_OTHER}
+  MIB_IF_TYPE_ETHERNET  = 6;
+  {$EXTERNALSYM MIB_IF_TYPE_ETHERNET}
+  MIB_IF_TYPE_TOKENRING = 9;
+  {$EXTERNALSYM MIB_IF_TYPE_TOKENRING}
+  MIB_IF_TYPE_FDDI      = 15;
+  {$EXTERNALSYM MIB_IF_TYPE_FDDI}
+  MIB_IF_TYPE_PPP       = 23;
+  {$EXTERNALSYM MIB_IF_TYPE_PPP}
+  MIB_IF_TYPE_LOOPBACK  = 24;
+  {$EXTERNALSYM MIB_IF_TYPE_LOOPBACK}
+  MIB_IF_TYPE_SLIP      = 28;
+  {$EXTERNALSYM MIB_IF_TYPE_SLIP}
+
+  MIB_IF_ADMIN_STATUS_UP      = 1;
+  {$EXTERNALSYM MIB_IF_ADMIN_STATUS_UP}
+  MIB_IF_ADMIN_STATUS_DOWN    = 2;
+  {$EXTERNALSYM MIB_IF_ADMIN_STATUS_DOWN}
+  MIB_IF_ADMIN_STATUS_TESTING = 3;
+  {$EXTERNALSYM MIB_IF_ADMIN_STATUS_TESTING}
+
+  MIB_IF_OPER_STATUS_NON_OPERATIONAL = 0;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_NON_OPERATIONAL}
+  MIB_IF_OPER_STATUS_UNREACHABLE     = 1;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_UNREACHABLE}
+  MIB_IF_OPER_STATUS_DISCONNECTED    = 2;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_DISCONNECTED}
+  MIB_IF_OPER_STATUS_CONNECTING      = 3;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_CONNECTING}
+  MIB_IF_OPER_STATUS_CONNECTED       = 4;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_CONNECTED}
+  MIB_IF_OPER_STATUS_OPERATIONAL     = 5;
+  {$EXTERNALSYM MIB_IF_OPER_STATUS_OPERATIONAL}
+
+implementation
+
+end.

+ 133 - 0
packages/extra/winunits/jwaipinfoid.pas

@@ -0,0 +1,133 @@
+{******************************************************************************}
+{                                                                              }
+{ Router Manager Protocol IDs API interface Unit for Object Pascal             }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: ipinfoid.h, released November 2002. The original Pascal}
+{ code is: IpInfoId.pas, released March 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpInfoId;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "ipinfoid.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+const
+  IP_ROUTER_MANAGER_VERSION = 1;
+  {$EXTERNALSYM IP_ROUTER_MANAGER_VERSION}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// These are the ids used for different information types supported by      //
+// IP Router Manager. These ids live in the same space as the IP Routing    //
+// Protocol IDs, so any addition to them must be done with care             //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IP_GENERAL_INFO_BASE = DWORD($ffff0000);
+  {$EXTERNALSYM IP_GENERAL_INFO_BASE}
+
+  IP_IN_FILTER_INFO        = IP_GENERAL_INFO_BASE + 1;
+  {$EXTERNALSYM IP_IN_FILTER_INFO}
+  IP_OUT_FILTER_INFO       = IP_GENERAL_INFO_BASE + 2;
+  {$EXTERNALSYM IP_OUT_FILTER_INFO}
+  IP_GLOBAL_INFO           = IP_GENERAL_INFO_BASE + 3;
+  {$EXTERNALSYM IP_GLOBAL_INFO}
+  IP_INTERFACE_STATUS_INFO = IP_GENERAL_INFO_BASE + 4;
+  {$EXTERNALSYM IP_INTERFACE_STATUS_INFO}
+  IP_ROUTE_INFO            = IP_GENERAL_INFO_BASE + 5;
+  {$EXTERNALSYM IP_ROUTE_INFO}
+  IP_PROT_PRIORITY_INFO    = IP_GENERAL_INFO_BASE + 6;
+  {$EXTERNALSYM IP_PROT_PRIORITY_INFO}
+  IP_ROUTER_DISC_INFO      = IP_GENERAL_INFO_BASE + 7;
+  {$EXTERNALSYM IP_ROUTER_DISC_INFO}
+
+// N.B. Unused ID available at IP_GENERAL_INFO_BASE + 8.
+
+  IP_DEMAND_DIAL_FILTER_INFO = IP_GENERAL_INFO_BASE + 9;
+  {$EXTERNALSYM IP_DEMAND_DIAL_FILTER_INFO}
+  IP_MCAST_HEARBEAT_INFO     = IP_GENERAL_INFO_BASE + 10;
+  {$EXTERNALSYM IP_MCAST_HEARBEAT_INFO}
+  IP_MCAST_BOUNDARY_INFO     = IP_GENERAL_INFO_BASE + 11;
+  {$EXTERNALSYM IP_MCAST_BOUNDARY_INFO}
+  IP_IPINIP_CFG_INFO         = IP_GENERAL_INFO_BASE + 12;
+  {$EXTERNALSYM IP_IPINIP_CFG_INFO}
+  IP_IFFILTER_INFO           = IP_GENERAL_INFO_BASE + 13;
+  {$EXTERNALSYM IP_IFFILTER_INFO}
+  IP_MCAST_LIMIT_INFO        = IP_GENERAL_INFO_BASE + 14;
+  {$EXTERNALSYM IP_MCAST_LIMIT_INFO}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// The following IDS are defined in routprot.h and given here for           //
+// informational purposes only                                              //
+//                                                                          //
+// #define IP_OTHER         1                                               //
+// #define IP_LOCAL         2                                               //
+// #define IP_NETMGMT       3                                               //
+// #define IP_ICMP          4                                               //
+// #define IP_EGP           5                                               //
+// #define IP_GGP           6                                               //
+// #define IP_HELLO         7                                               //
+// #define IP_RIP           8                                               //
+// #define IP_IS_IS         9                                               //
+// #define IP_ES_IS         10                                              //
+// #define IP_CISCO         11                                              //
+// #define IP_BBN           12                                              //
+// #define IP_OSPF          13                                              //
+// #define IP_BGP           14                                              //
+//                                                                          //
+// #define IP_BOOTP         9999                                            //
+// #define IPRTRMGR_PID     10000                                           //
+// #define IP_NT_AUTOSTATIC 10002                                           //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+implementation
+
+end.

+ 1244 - 0
packages/extra/winunits/jwaiprtrmib.pas

@@ -0,0 +1,1244 @@
+{******************************************************************************}
+{                                                                              }
+{ Management Information Base API interface Unit for Object Pascal             }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iprtrmib.h, released August 2001. The original Pascal  }
+{ code is: IpRtrMib.pas, released September 2000. The initial developer of the }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): John C. Penman (jcp att craiglockhart dott com)              }
+{                 Vladimir Vassiliev (voldemarv att hotpop dott com)           }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpRtrMib;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iprtrmib.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Included to get the value of MAX_INTERFACE_NAME_LEN                      //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+// #include <mprapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Included to get the necessary constants                                  //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+// #include <ipifcons.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// This is the Id for IP Router Manager.  The Router Manager handles        //
+// MIB-II, Forwarding MIB and some enterprise specific information.         //
+// Calls made with any other ID are passed on to the corresponding protocol //
+// For example, an MprAdminMIBXXX call with a protocol ID of PID_IP and    //
+// a routing Id of 0xD will be sent to the IP Router Manager and then       //
+// forwarded to OSPF                                                        //
+// This lives in the same number space as the protocol Ids of RIP, OSPF     //
+// etc, so any change made to it should be done keeping this in mind        //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+const
+  MAX_INTERFACE_NAME_LEN = 256; // MPRAPI.H
+  {$EXTERNALSYM MAX_INTERFACE_NAME_LEN}
+  
+  IPRTRMGR_PID = 10000;
+  {$EXTERNALSYM IPRTRMGR_PID}
+
+  ANY_SIZE = 1;
+  {$EXTERNALSYM ANY_SIZE}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// The following #defines are the Ids of the MIB variables made accessible  //
+// to the user via MprAdminMIBXXX Apis.  It will be noticed that these are  //
+// not the same as RFC 1213, since the MprAdminMIBXXX APIs work on rows and //
+// groups instead of scalar variables                                       //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+  IF_NUMBER        = 0;
+  {$EXTERNALSYM IF_NUMBER}
+  IF_TABLE         = IF_NUMBER + 1;
+  {$EXTERNALSYM IF_TABLE}
+  IF_ROW           = IF_TABLE + 1;
+  {$EXTERNALSYM IF_ROW}
+  IP_STATS         = IF_ROW + 1;
+  {$EXTERNALSYM IP_STATS}
+  IP_ADDRTABLE     = IP_STATS + 1;
+  {$EXTERNALSYM IP_ADDRTABLE}
+  IP_ADDRROW       = IP_ADDRTABLE + 1;
+  {$EXTERNALSYM IP_ADDRROW}
+  IP_FORWARDNUMBER = IP_ADDRROW + 1;
+  {$EXTERNALSYM IP_FORWARDNUMBER}
+  IP_FORWARDTABLE  = IP_FORWARDNUMBER + 1;
+  {$EXTERNALSYM IP_FORWARDTABLE}
+  IP_FORWARDROW    = IP_FORWARDTABLE + 1;
+  {$EXTERNALSYM IP_FORWARDROW}
+  IP_NETTABLE      = IP_FORWARDROW + 1;
+  {$EXTERNALSYM IP_NETTABLE}
+  IP_NETROW        = IP_NETTABLE + 1;
+  {$EXTERNALSYM IP_NETROW}
+  ICMP_STATS       = IP_NETROW + 1;
+  {$EXTERNALSYM ICMP_STATS}
+  TCP_STATS        = ICMP_STATS + 1;
+  {$EXTERNALSYM TCP_STATS}
+  TCP_TABLE        = TCP_STATS + 1;
+  {$EXTERNALSYM TCP_TABLE}
+  TCP_ROW          = TCP_TABLE + 1;
+  {$EXTERNALSYM TCP_ROW}
+  UDP_STATS        = TCP_ROW + 1;
+  {$EXTERNALSYM UDP_STATS}
+  UDP_TABLE        = UDP_STATS + 1;
+  {$EXTERNALSYM UDP_TABLE}
+  UDP_ROW          = UDP_TABLE + 1;
+  {$EXTERNALSYM UDP_ROW}
+  MCAST_MFE        = UDP_ROW + 1;
+  {$EXTERNALSYM MCAST_MFE}
+  MCAST_MFE_STATS  = MCAST_MFE + 1;
+  {$EXTERNALSYM MCAST_MFE_STATS}
+  BEST_IF          = MCAST_MFE_STATS + 1;
+  {$EXTERNALSYM BEST_IF}
+  BEST_ROUTE       = BEST_IF + 1;
+  {$EXTERNALSYM BEST_ROUTE}
+  PROXY_ARP        = BEST_ROUTE + 1;
+  {$EXTERNALSYM PROXY_ARP}
+  MCAST_IF_ENTRY   = PROXY_ARP + 1;
+  {$EXTERNALSYM MCAST_IF_ENTRY}
+  MCAST_GLOBAL     = MCAST_IF_ENTRY + 1;
+  {$EXTERNALSYM MCAST_GLOBAL}
+  IF_STATUS        = MCAST_GLOBAL + 1;
+  {$EXTERNALSYM IF_STATUS}
+  MCAST_BOUNDARY   = IF_STATUS + 1;
+  {$EXTERNALSYM MCAST_BOUNDARY}
+  MCAST_SCOPE      = MCAST_BOUNDARY + 1;
+  {$EXTERNALSYM MCAST_SCOPE}
+  DEST_MATCHING    = MCAST_SCOPE + 1;
+  {$EXTERNALSYM DEST_MATCHING}
+  DEST_LONGER      = DEST_MATCHING + 1;
+  {$EXTERNALSYM DEST_LONGER}
+  DEST_SHORTER     = DEST_LONGER + 1;
+  {$EXTERNALSYM DEST_SHORTER}
+  ROUTE_MATCHING   = DEST_SHORTER + 1;
+  {$EXTERNALSYM ROUTE_MATCHING}
+  ROUTE_LONGER     = ROUTE_MATCHING + 1;
+  {$EXTERNALSYM ROUTE_LONGER}
+  ROUTE_SHORTER    = ROUTE_LONGER + 1;
+  {$EXTERNALSYM ROUTE_SHORTER}
+  ROUTE_STATE      = ROUTE_SHORTER + 1;
+  {$EXTERNALSYM ROUTE_STATE}
+  MCAST_MFE_STATS_EX = ROUTE_STATE + 1;
+  {$EXTERNALSYM MCAST_MFE_STATS_EX}
+  IP6_STATS          = MCAST_MFE_STATS_EX + 1;
+  {$EXTERNALSYM IP6_STATS}
+  UDP6_STATS         = IP6_STATS + 1;
+  {$EXTERNALSYM UDP6_STATS}
+  TCP6_STATS         = UDP6_STATS + 1;
+  {$EXTERNALSYM TCP6_STATS}
+
+  NUMBER_OF_EXPORTED_VARIABLES = TCP6_STATS + 1;
+  {$EXTERNALSYM NUMBER_OF_EXPORTED_VARIABLES}
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// MIB_OPAQUE_QUERY is the structure filled in by the user to identify a    //
+// MIB variable                                                             //
+//                                                                          //
+//  dwVarId     ID of MIB Variable (One of the Ids #defined above)          //
+//  dwVarIndex  Variable sized array containing the indices needed to       //
+//              identify a variable. NOTE: Unlike SNMP we dont require that //
+//              a scalar variable be indexed by 0                           //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+type
+  PMIB_OPAQUE_QUERY = ^MIB_OPAQUE_QUERY;
+  {$EXTERNALSYM PMIB_OPAQUE_QUERY}
+  _MIB_OPAQUE_QUERY = record
+    dwVarId: DWORD;
+    rgdwVarIndex: array [0..ANY_SIZE - 1] of DWORD;
+  end;
+  {$EXTERNALSYM _MIB_OPAQUE_QUERY}
+  MIB_OPAQUE_QUERY = _MIB_OPAQUE_QUERY;
+  {$EXTERNALSYM MIB_OPAQUE_QUERY}
+  TMibOpaqueQuery = MIB_OPAQUE_QUERY;
+  PMibOpaqueQuery = PMIB_OPAQUE_QUERY;
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// The following are the structures which are filled in and returned to the //
+// user when a query is made, OR  are filled in BY THE USER when a set is   //
+// done                                                                     //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+type
+  PMIB_IFNUMBER = ^MIB_IFNUMBER;
+  {$EXTERNALSYM PMIB_IFNUMBER}
+  _MIB_IFNUMBER = record
+    dwValue: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IFNUMBER}
+  MIB_IFNUMBER = _MIB_IFNUMBER;
+  {$EXTERNALSYM MIB_IFNUMBER}
+  TMibIfnumber = MIB_IFNUMBER;
+  PMibIfnumber = PMIB_IFNUMBER;
+
+const
+  MAXLEN_IFDESCR  = 256;
+  {$EXTERNALSYM MAXLEN_IFDESCR}
+  MAXLEN_PHYSADDR = 8;
+  {$EXTERNALSYM MAXLEN_PHYSADDR}
+
+type
+  PMIB_IFROW = ^MIB_IFROW;
+  {$EXTERNALSYM PMIB_IFROW}
+  _MIB_IFROW = record
+    wszName: array [0..MAX_INTERFACE_NAME_LEN - 1] of WCHAR;
+    dwIndex: DWORD;
+    dwType: DWORD;
+    dwMtu: DWORD;
+    dwSpeed: DWORD;
+    dwPhysAddrLen: DWORD;
+    bPhysAddr: array [0..MAXLEN_PHYSADDR - 1] of BYTE;
+    dwAdminStatus: DWORD;
+    dwOperStatus: DWORD;
+    dwLastChange: DWORD;
+    dwInOctets: DWORD;
+    dwInUcastPkts: DWORD;
+    dwInNUcastPkts: DWORD;
+    dwInDiscards: DWORD;
+    dwInErrors: DWORD;
+    dwInUnknownProtos: DWORD;
+    dwOutOctets: DWORD;
+    dwOutUcastPkts: DWORD;
+    dwOutNUcastPkts: DWORD;
+    dwOutDiscards: DWORD;
+    dwOutErrors: DWORD;
+    dwOutQLen: DWORD;
+    dwDescrLen: DWORD;
+    bDescr: array[0..MAXLEN_IFDESCR - 1] of BYTE;
+  end;
+  {$EXTERNALSYM _MIB_IFROW}
+  MIB_IFROW = _MIB_IFROW;
+  {$EXTERNALSYM MIB_IFROW}
+  TMibIfRow = MIB_IFROW;
+  PMibIfRow = PMIB_IFROW;
+
+  PMIB_IFTABLE = ^MIB_IFTABLE;
+  {$EXTERNALSYM PMIB_IFTABLE}
+  _MIB_IFTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IFROW;
+  end;
+  {$EXTERNALSYM _MIB_IFTABLE}
+  MIB_IFTABLE = _MIB_IFTABLE;
+  {$EXTERNALSYM MIB_IFTABLE}
+  TMibIftable = MIB_IFTABLE;
+  PMibIftable = PMIB_IFTABLE;
+
+// #define SIZEOF_IFTABLE(X) (FIELD_OFFSET(MIB_IFTABLE,table[0]) + ((X) * sizeof(MIB_IFROW)) + ALIGN_SIZE)
+
+type
+  PMibIcmpStats = ^TMibIcmpStats;
+  _MIBICMPSTATS = record
+    dwMsgs: DWORD;
+    dwErrors: DWORD;
+    dwDestUnreachs: DWORD;
+    dwTimeExcds: DWORD;
+    dwParmProbs: DWORD;
+    dwSrcQuenchs: DWORD;
+    dwRedirects: DWORD;
+    dwEchos: DWORD;
+    dwEchoReps: DWORD;
+    dwTimestamps: DWORD;
+    dwTimestampReps: DWORD;
+    dwAddrMasks: DWORD;
+    dwAddrMaskReps: DWORD;
+  end;
+  {$EXTERNALSYM _MIBICMPSTATS}
+  MIBICMPSTATS = _MIBICMPSTATS;
+  {$EXTERNALSYM MIBICMPSTATS}
+  TMibIcmpStats = _MIBICMPSTATS;
+
+  _MIBICMPINFO = record
+    icmpInStats: MIBICMPSTATS;
+    icmpOutStats: MIBICMPSTATS;
+  end;
+  {$EXTERNALSYM _MIBICMPINFO}
+  MIBICMPINFO = _MIBICMPINFO;
+  {$EXTERNALSYM MIBICMPINFO}
+  PMIBICMPINFO = ^MIBICMPINFO;
+  {$EXTERNALSYM PMIBICMPINFO}
+  TMibIcmpInfo = MIBICMPINFO;
+
+  PMIB_ICMP = ^MIB_ICMP;
+  {$EXTERNALSYM PMIB_ICMP}
+  _MIB_ICMP = record
+    stats: MIBICMPINFO;
+  end;
+  {$EXTERNALSYM _MIB_ICMP}
+  MIB_ICMP = _MIB_ICMP;
+  {$EXTERNALSYM MIB_ICMP}
+  TMibIcmp = MIB_ICMP;
+  PMibIcmp = PMIB_ICMP;
+
+//
+// ICMPv6 Type Values from RFC 2292.
+//
+
+const
+  ICMP6_DST_UNREACH          = 1;
+  {$EXTERNALSYM ICMP6_DST_UNREACH}
+  ICMP6_PACKET_TOO_BIG       = 2;
+  {$EXTERNALSYM ICMP6_PACKET_TOO_BIG}
+  ICMP6_TIME_EXCEEDED        = 3;
+  {$EXTERNALSYM ICMP6_TIME_EXCEEDED}
+  ICMP6_PARAM_PROB           = 4;
+  {$EXTERNALSYM ICMP6_PARAM_PROB}
+  ICMP6_ECHO_REQUEST         = 128;
+  {$EXTERNALSYM ICMP6_ECHO_REQUEST}
+  ICMP6_ECHO_REPLY           = 129;
+  {$EXTERNALSYM ICMP6_ECHO_REPLY}
+  ICMP6_MEMBERSHIP_QUERY     = 130;
+  {$EXTERNALSYM ICMP6_MEMBERSHIP_QUERY}
+  ICMP6_MEMBERSHIP_REPORT    = 131;
+  {$EXTERNALSYM ICMP6_MEMBERSHIP_REPORT}
+  ICMP6_MEMBERSHIP_REDUCTION = 132;
+  {$EXTERNALSYM ICMP6_MEMBERSHIP_REDUCTION}
+  ND_ROUTER_SOLICIT          = 133;
+  {$EXTERNALSYM ND_ROUTER_SOLICIT}
+  ND_ROUTER_ADVERT           = 134;
+  {$EXTERNALSYM ND_ROUTER_ADVERT}
+  ND_NEIGHBOR_SOLICIT        = 135;
+  {$EXTERNALSYM ND_NEIGHBOR_SOLICIT}
+  ND_NEIGHBOR_ADVERT         = 136;
+  {$EXTERNALSYM ND_NEIGHBOR_ADVERT}
+  ND_REDIRECT                = 137;
+  {$EXTERNALSYM ND_REDIRECT}
+
+type
+  ICMP6_TYPE = DWORD;
+  {$EXTERNALSYM ICMP6_TYPE}
+  PICMP6_TYPE = ^ICMP6_TYPE;
+  {$EXTERNALSYM PICMP6_TYPE}
+  TIcmp6Type = ICMP6_TYPE;
+  PIcmp6Type = PICMP6_TYPE;
+
+//
+// There are no RFC-specified defines for ICMPv4 message types, so we try to
+// use the ICMP6 values from RFC 2292 modified to be prefixed with ICMP4.
+//
+
+const
+  ICMP4_ECHO_REPLY        = 0;  // Echo Reply
+  {$EXTERNALSYM ICMP4_ECHO_REPLY}
+  ICMP4_DST_UNREACH       = 3;  // Destination Unreachable
+  {$EXTERNALSYM ICMP4_DST_UNREACH}
+  ICMP4_SOURCE_QUENCH     = 4;  // Source Quench
+  {$EXTERNALSYM ICMP4_SOURCE_QUENCH}
+  ICMP4_REDIRECT          = 5;  // Redirect
+  {$EXTERNALSYM ICMP4_REDIRECT}
+  ICMP4_ECHO_REQUEST      = 8;  // Echo Request
+  {$EXTERNALSYM ICMP4_ECHO_REQUEST}
+  ICMP4_ROUTER_ADVERT     = 9;  // Router Advertisement
+  {$EXTERNALSYM ICMP4_ROUTER_ADVERT}
+  ICMP4_ROUTER_SOLICIT    = 10; // Router Solicitation
+  {$EXTERNALSYM ICMP4_ROUTER_SOLICIT}
+  ICMP4_TIME_EXCEEDED     = 11; // Time Exceeded
+  {$EXTERNALSYM ICMP4_TIME_EXCEEDED}
+  ICMP4_PARAM_PROB        = 12; // Parameter Problem
+  {$EXTERNALSYM ICMP4_PARAM_PROB}
+  ICMP4_TIMESTAMP_REQUEST = 13; // Timestamp Request
+  {$EXTERNALSYM ICMP4_TIMESTAMP_REQUEST}
+  ICMP4_TIMESTAMP_REPLY   = 14; // Timestamp Reply
+  {$EXTERNALSYM ICMP4_TIMESTAMP_REPLY}
+  ICMP4_MASK_REQUEST      = 17; // Address Mask Request
+  {$EXTERNALSYM ICMP4_MASK_REQUEST}
+  ICMP4_MASK_REPLY        = 18; // Address Mask Reply
+  {$EXTERNALSYM ICMP4_MASK_REPLY}
+
+type
+  ICMP4_TYPE = DWORD;
+  {$EXTERNALSYM ICMP4_TYPE}
+  PICMP4_TYPE = ^ICMP4_TYPE;
+  {$EXTERNALSYM PICMP4_TYPE}
+  TIcmp4Type = ICMP4_TYPE;
+  PIcmp4Type = PICMP4_TYPE;
+
+  _MIBICMPSTATS_EX = record
+    dwMsgs: DWORD;
+    dwErrors: DWORD;
+    rgdwTypeCount: array [0..255] of DWORD;
+  end;
+  {$EXTERNALSYM _MIBICMPSTATS_EX}
+  MIBICMPSTATS_EX = _MIBICMPSTATS_EX;
+  {$EXTERNALSYM MIBICMPSTATS_EX}
+  PMIBICMPSTATS_EX = ^MIBICMPSTATS_EX;
+  {$EXTERNALSYM PMIBICMPSTATS_EX}
+  TMibIcmpStatsEx = MIBICMPSTATS_EX;
+  PMibIcmpStatsEx = PMIBICMPSTATS_EX;
+
+  _MIB_ICMP_EX = record
+    icmpInStats: MIBICMPSTATS_EX;
+    icmpOutStats: MIBICMPSTATS_EX;
+  end;
+  {$EXTERNALSYM _MIB_ICMP_EX}
+  MIB_ICMP_EX = _MIB_ICMP_EX;
+  {$EXTERNALSYM MIB_ICMP_EX}
+  PMIB_ICMP_EX = ^MIB_ICMP_EX;
+  {$EXTERNALSYM PMIB_ICMP_EX}
+  TMibIcmpEx = MIB_ICMP_EX;
+  PMibIcmpEx = PMIB_ICMP_EX;  
+
+  PMIB_UDPSTATS = ^MIB_UDPSTATS;
+  {$EXTERNALSYM PMIB_UDPSTATS}
+  _MIB_UDPSTATS = record
+    dwInDatagrams: DWORD;
+    dwNoPorts: DWORD;
+    dwInErrors: DWORD;
+    dwOutDatagrams: DWORD;
+    dwNumAddrs: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_UDPSTATS}
+  MIB_UDPSTATS = _MIB_UDPSTATS;
+  {$EXTERNALSYM MIB_UDPSTATS}
+  TMibUdpStats = MIB_UDPSTATS;
+  PMibUdpStats = PMIB_UDPSTATS;
+
+  PMIB_UDPROW = ^MIB_UDPROW;
+  {$EXTERNALSYM PMIB_UDPROW}
+  _MIB_UDPROW = record
+    dwLocalAddr: DWORD;
+    dwLocalPort: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_UDPROW}
+  MIB_UDPROW = _MIB_UDPROW;
+  {$EXTERNALSYM MIB_UDPROW}
+  TMibUdpRow = MIB_UDPROW;
+  PMibUdpRow = PMIB_UDPROW;
+
+  PMIB_UDPTABLE = ^MIB_UDPTABLE;
+  {$EXTERNALSYM PMIB_UDPTABLE}
+  _MIB_UDPTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_UDPROW;
+  end;
+  {$EXTERNALSYM _MIB_UDPTABLE}
+  MIB_UDPTABLE = _MIB_UDPTABLE;
+  {$EXTERNALSYM MIB_UDPTABLE}
+  TMibUdpTable = MIB_UDPTABLE;
+  PMibUdpTable = PMIB_UDPTABLE;
+
+// #define SIZEOF_UDPTABLE(X) (FIELD_OFFSET(MIB_UDPTABLE, table[0]) + ((X) * sizeof(MIB_UDPROW)) + ALIGN_SIZE)
+
+  PMIB_TCPSTATS = ^MIB_TCPSTATS;
+  {$EXTERNALSYM PMIB_TCPSTATS}
+  _MIB_TCPSTATS = record
+    dwRtoAlgorithm: DWORD;
+    dwRtoMin: DWORD;
+    dwRtoMax: DWORD;
+    dwMaxConn: DWORD;
+    dwActiveOpens: DWORD;
+    dwPassiveOpens: DWORD;
+    dwAttemptFails: DWORD;
+    dwEstabResets: DWORD;
+    dwCurrEstab: DWORD;
+    dwInSegs: DWORD;
+    dwOutSegs: DWORD;
+    dwRetransSegs: DWORD;
+    dwInErrs: DWORD;
+    dwOutRsts: DWORD;
+    dwNumConns: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_TCPSTATS}
+  MIB_TCPSTATS = _MIB_TCPSTATS;
+  {$EXTERNALSYM MIB_TCPSTATS}
+  TMibTcpStats = MIB_TCPSTATS;
+  PMibTcpStats = PMIB_TCPSTATS;
+
+const
+  MIB_TCP_RTO_OTHER    = 1;
+  {$EXTERNALSYM MIB_TCP_RTO_OTHER}
+  MIB_TCP_RTO_CONSTANT = 2;
+  {$EXTERNALSYM MIB_TCP_RTO_CONSTANT}
+  MIB_TCP_RTO_RSRE     = 3;
+  {$EXTERNALSYM MIB_TCP_RTO_RSRE}
+  MIB_TCP_RTO_VANJ     = 4;
+  {$EXTERNALSYM MIB_TCP_RTO_VANJ}
+
+  MIB_TCP_MAXCONN_DYNAMIC = DWORD(-1);
+  {$EXTERNALSYM MIB_TCP_MAXCONN_DYNAMIC}
+
+type
+  PMIB_TCPROW = ^MIB_TCPROW;
+  {$EXTERNALSYM PMIB_TCPROW}
+  _MIB_TCPROW = record
+    dwState: DWORD;
+    dwLocalAddr: DWORD;
+    dwLocalPort: DWORD;
+    dwRemoteAddr: DWORD;
+    dwRemotePort: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_TCPROW}
+  MIB_TCPROW = _MIB_TCPROW;
+  {$EXTERNALSYM MIB_TCPROW}
+  TMibTcpRow = MIB_TCPROW;
+  PMibTcpRow = PMIB_TCPROW;
+
+const
+  MIB_TCP_STATE_CLOSED     = 1;
+  {$EXTERNALSYM MIB_TCP_STATE_CLOSED}
+  MIB_TCP_STATE_LISTEN     = 2;
+  {$EXTERNALSYM MIB_TCP_STATE_LISTEN}
+  MIB_TCP_STATE_SYN_SENT   = 3;
+  {$EXTERNALSYM MIB_TCP_STATE_SYN_SENT}
+  MIB_TCP_STATE_SYN_RCVD   = 4;
+  {$EXTERNALSYM MIB_TCP_STATE_SYN_RCVD}
+  MIB_TCP_STATE_ESTAB      = 5;
+  {$EXTERNALSYM MIB_TCP_STATE_ESTAB}
+  MIB_TCP_STATE_FIN_WAIT1  = 6;
+  {$EXTERNALSYM MIB_TCP_STATE_FIN_WAIT1}
+  MIB_TCP_STATE_FIN_WAIT2  = 7;
+  {$EXTERNALSYM MIB_TCP_STATE_FIN_WAIT2}
+  MIB_TCP_STATE_CLOSE_WAIT = 8;
+  {$EXTERNALSYM MIB_TCP_STATE_CLOSE_WAIT}
+  MIB_TCP_STATE_CLOSING    = 9;
+  {$EXTERNALSYM MIB_TCP_STATE_CLOSING}
+  MIB_TCP_STATE_LAST_ACK   = 10;
+  {$EXTERNALSYM MIB_TCP_STATE_LAST_ACK}
+  MIB_TCP_STATE_TIME_WAIT  = 11;
+  {$EXTERNALSYM MIB_TCP_STATE_TIME_WAIT}
+  MIB_TCP_STATE_DELETE_TCB = 12;
+  {$EXTERNALSYM MIB_TCP_STATE_DELETE_TCB}
+
+type
+  PMIB_TCPTABLE = ^MIB_TCPTABLE;
+  {$EXTERNALSYM PMIB_TCPTABLE}
+  _MIB_TCPTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_TCPROW;
+  end;
+  {$EXTERNALSYM _MIB_TCPTABLE}
+  MIB_TCPTABLE = _MIB_TCPTABLE;
+  {$EXTERNALSYM MIB_TCPTABLE}
+  TMibTcpTable = MIB_TCPTABLE;
+  PMibTcpTable = PMIB_TCPTABLE;
+
+// #define SIZEOF_TCPTABLE(X) (FIELD_OFFSET(MIB_TCPTABLE,table[0]) + ((X) * sizeof(MIB_TCPROW)) + ALIGN_SIZE)
+
+const
+  MIB_USE_CURRENT_TTL        = DWORD(-1);
+  {$EXTERNALSYM MIB_USE_CURRENT_TTL}
+  MIB_USE_CURRENT_FORWARDING = DWORD(-1);
+  {$EXTERNALSYM MIB_USE_CURRENT_FORWARDING}
+
+type
+  PMIB_IPSTATS = ^MIB_IPSTATS;
+  {$EXTERNALSYM PMIB_IPSTATS}
+  _MIB_IPSTATS = record
+    dwForwarding: DWORD;
+    dwDefaultTTL: DWORD;
+    dwInReceives: DWORD;
+    dwInHdrErrors: DWORD;
+    dwInAddrErrors: DWORD;
+    dwForwDatagrams: DWORD;
+    dwInUnknownProtos: DWORD;
+    dwInDiscards: DWORD;
+    dwInDelivers: DWORD;
+    dwOutRequests: DWORD;
+    dwRoutingDiscards: DWORD;
+    dwOutDiscards: DWORD;
+    dwOutNoRoutes: DWORD;
+    dwReasmTimeout: DWORD;
+    dwReasmReqds: DWORD;
+    dwReasmOks: DWORD;
+    dwReasmFails: DWORD;
+    dwFragOks: DWORD;
+    dwFragFails: DWORD;
+    dwFragCreates: DWORD;
+    dwNumIf: DWORD;
+    dwNumAddr: DWORD;
+    dwNumRoutes: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPSTATS}
+  MIB_IPSTATS = _MIB_IPSTATS;
+  {$EXTERNALSYM MIB_IPSTATS}
+  TMibIpStats = MIB_IPSTATS;
+  PMibIpStats = PMIB_IPSTATS;
+
+const
+  MIB_IP_FORWARDING     = 1;
+  {$EXTERNALSYM MIB_IP_FORWARDING}
+  MIB_IP_NOT_FORWARDING = 2;
+  {$EXTERNALSYM MIB_IP_NOT_FORWARDING}
+
+// Note: These addr types have dependency on ipdef.h
+
+  MIB_IPADDR_PRIMARY      = $0001;  // Primary ipaddr
+  {$EXTERNALSYM MIB_IPADDR_PRIMARY}
+  MIB_IPADDR_DYNAMIC      = $0004;  // Dynamic ipaddr
+  {$EXTERNALSYM MIB_IPADDR_DYNAMIC}
+  MIB_IPADDR_DISCONNECTED = $0008;  // Address is on disconnected interface
+  {$EXTERNALSYM MIB_IPADDR_DISCONNECTED}
+  MIB_IPADDR_DELETED      = $0040;  // Address being deleted
+  {$EXTERNALSYM MIB_IPADDR_DELETED}
+  MIB_IPADDR_TRANSIENT    = $0080;  // Transient address
+  {$EXTERNALSYM MIB_IPADDR_TRANSIENT}
+
+type
+  PMIB_IPADDRROW = ^MIB_IPADDRROW;
+  {$EXTERNALSYM PMIB_IPADDRROW}
+  _MIB_IPADDRROW = record
+    dwAddr: DWORD;
+    dwIndex: DWORD;
+    dwMask: DWORD;
+    dwBCastAddr: DWORD;
+    dwReasmSize: DWORD;
+    unused1: Word;
+    wType: Word;
+  end;
+  {$EXTERNALSYM _MIB_IPADDRROW}
+  MIB_IPADDRROW = _MIB_IPADDRROW;
+  {$EXTERNALSYM MIB_IPADDRROW}
+  TMibIpAddrRow = MIB_IPADDRROW;
+  PMibIpAddrRow = PMIB_IPADDRROW;
+
+  PMIB_IPADDRTABLE = ^MIB_IPADDRTABLE;
+  {$EXTERNALSYM PMIB_IPADDRTABLE}
+  _MIB_IPADDRTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPADDRROW;
+  end;
+  {$EXTERNALSYM _MIB_IPADDRTABLE}
+  MIB_IPADDRTABLE = _MIB_IPADDRTABLE;
+  {$EXTERNALSYM MIB_IPADDRTABLE}
+  TMibIpAddrTable = _MIB_IPADDRTABLE;
+  PMibIpAddrTable = PMIB_IPADDRTABLE;
+
+// #define SIZEOF_IPADDRTABLE(X) (FIELD_OFFSET(MIB_IPADDRTABLE,table[0]) + ((X) * sizeof(MIB_IPADDRROW)) + ALIGN_SIZE)
+
+type
+  PMIB_IPFORWARDNUMBER = ^MIB_IPFORWARDNUMBER;
+  {$EXTERNALSYM PMIB_IPFORWARDNUMBER}
+  _MIB_IPFORWARDNUMBER = record
+    dwValue: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPFORWARDNUMBER}
+  MIB_IPFORWARDNUMBER = _MIB_IPFORWARDNUMBER;
+  {$EXTERNALSYM MIB_IPFORWARDNUMBER}
+  TMibIpForwardNumber = MIB_IPFORWARDNUMBER;
+  PMibIpForwardNumber = PMIB_IPFORWARDNUMBER;
+
+  PMIB_IPFORWARDROW = ^MIB_IPFORWARDROW;
+  {$EXTERNALSYM PMIB_IPFORWARDROW}
+  _MIB_IPFORWARDROW = record
+    dwForwardDest: DWORD;
+    dwForwardMask: DWORD;
+    dwForwardPolicy: DWORD;
+    dwForwardNextHop: DWORD;
+    dwForwardIfIndex: DWORD;
+    dwForwardType: DWORD;
+    dwForwardProto: DWORD;
+    dwForwardAge: DWORD;
+    dwForwardNextHopAS: DWORD;
+    dwForwardMetric1: DWORD;
+    dwForwardMetric2: DWORD;
+    dwForwardMetric3: DWORD;
+    dwForwardMetric4: DWORD;
+    dwForwardMetric5: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPFORWARDROW}
+  MIB_IPFORWARDROW = _MIB_IPFORWARDROW;
+  {$EXTERNALSYM MIB_IPFORWARDROW}
+  TMibIpForwardRow = MIB_IPFORWARDROW;
+  PMibIpForwardRow = PMIB_IPFORWARDROW;
+
+const
+  MIB_IPROUTE_TYPE_OTHER    = 1;
+  {$EXTERNALSYM MIB_IPROUTE_TYPE_OTHER}
+  MIB_IPROUTE_TYPE_INVALID  = 2;
+  {$EXTERNALSYM MIB_IPROUTE_TYPE_INVALID}
+  MIB_IPROUTE_TYPE_DIRECT   = 3;
+  {$EXTERNALSYM MIB_IPROUTE_TYPE_DIRECT}
+  MIB_IPROUTE_TYPE_INDIRECT = 4;
+  {$EXTERNALSYM MIB_IPROUTE_TYPE_INDIRECT}
+
+  MIB_IPROUTE_METRIC_UNUSED = DWORD(-1);
+  {$EXTERNALSYM MIB_IPROUTE_METRIC_UNUSED}
+
+//
+// THESE MUST MATCH the ids in routprot.h
+//
+
+const
+  MIB_IPPROTO_OTHER   = 1;
+  {$EXTERNALSYM MIB_IPPROTO_OTHER}
+  MIB_IPPROTO_LOCAL   = 2;
+  {$EXTERNALSYM MIB_IPPROTO_LOCAL}
+  MIB_IPPROTO_NETMGMT = 3;
+  {$EXTERNALSYM MIB_IPPROTO_NETMGMT}
+  MIB_IPPROTO_ICMP    = 4;
+  {$EXTERNALSYM MIB_IPPROTO_ICMP}
+  MIB_IPPROTO_EGP     = 5;
+  {$EXTERNALSYM MIB_IPPROTO_EGP}
+  MIB_IPPROTO_GGP     = 6;
+  {$EXTERNALSYM MIB_IPPROTO_GGP}
+  MIB_IPPROTO_HELLO   = 7;
+  {$EXTERNALSYM MIB_IPPROTO_HELLO}
+  MIB_IPPROTO_RIP     = 8;
+  {$EXTERNALSYM MIB_IPPROTO_RIP}
+  MIB_IPPROTO_IS_IS   = 9;
+  {$EXTERNALSYM MIB_IPPROTO_IS_IS}
+  MIB_IPPROTO_ES_IS   = 10;
+  {$EXTERNALSYM MIB_IPPROTO_ES_IS}
+  MIB_IPPROTO_CISCO   = 11;
+  {$EXTERNALSYM MIB_IPPROTO_CISCO}
+  MIB_IPPROTO_BBN     = 12;
+  {$EXTERNALSYM MIB_IPPROTO_BBN}
+  MIB_IPPROTO_OSPF    = 13;
+  {$EXTERNALSYM MIB_IPPROTO_OSPF}
+  MIB_IPPROTO_BGP     = 14;
+  {$EXTERNALSYM MIB_IPPROTO_BGP}
+
+  MIB_IPPROTO_NT_AUTOSTATIC     = 10002;
+  {$EXTERNALSYM MIB_IPPROTO_NT_AUTOSTATIC}
+  MIB_IPPROTO_NT_STATIC         = 10006;
+  {$EXTERNALSYM MIB_IPPROTO_NT_STATIC}
+  MIB_IPPROTO_NT_STATIC_NON_DOD = 10007;
+  {$EXTERNALSYM MIB_IPPROTO_NT_STATIC_NON_DOD}
+
+type
+  PMIB_IPFORWARDTABLE = ^MIB_IPFORWARDTABLE;
+  {$EXTERNALSYM PMIB_IPFORWARDTABLE}
+  _MIB_IPFORWARDTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPFORWARDROW;
+  end;
+  {$EXTERNALSYM _MIB_IPFORWARDTABLE}
+  MIB_IPFORWARDTABLE = _MIB_IPFORWARDTABLE;
+  {$EXTERNALSYM MIB_IPFORWARDTABLE}
+  TMibIpForwardTable = MIB_IPFORWARDTABLE;
+  PMibIpForwardTable = PMIB_IPFORWARDTABLE;
+
+// #define SIZEOF_IPFORWARDTABLE(X) (FIELD_OFFSET(MIB_IPFORWARDTABLE,table[0]) + ((X) * sizeof(MIB_IPFORWARDROW)) + ALIGN_SIZE)
+
+type
+  PMIB_IPNETROW = ^MIB_IPNETROW;
+  {$EXTERNALSYM PMIB_IPNETROW}
+  _MIB_IPNETROW = record
+    dwIndex: DWORD;
+    dwPhysAddrLen: DWORD;
+    bPhysAddr: array [0..MAXLEN_PHYSADDR - 1] of BYTE;
+    dwAddr: DWORD;
+    dwType: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPNETROW}
+  MIB_IPNETROW = _MIB_IPNETROW;
+  {$EXTERNALSYM MIB_IPNETROW}
+  TMibIpNetRow = MIB_IPNETROW;
+  PMibIpNetRow = PMIB_IPNETROW;
+
+const
+  MIB_IPNET_TYPE_OTHER   = 1;
+  {$EXTERNALSYM MIB_IPNET_TYPE_OTHER}
+  MIB_IPNET_TYPE_INVALID = 2;
+  {$EXTERNALSYM MIB_IPNET_TYPE_INVALID}
+  MIB_IPNET_TYPE_DYNAMIC = 3;
+  {$EXTERNALSYM MIB_IPNET_TYPE_DYNAMIC}
+  MIB_IPNET_TYPE_STATIC  = 4;
+  {$EXTERNALSYM MIB_IPNET_TYPE_STATIC}
+
+type
+  PMIB_IPNETTABLE = ^MIB_IPNETTABLE;
+  {$EXTERNALSYM PMIB_IPNETTABLE}
+  _MIB_IPNETTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPNETROW;
+  end;
+  {$EXTERNALSYM _MIB_IPNETTABLE}
+  MIB_IPNETTABLE = _MIB_IPNETTABLE;
+  {$EXTERNALSYM MIB_IPNETTABLE}
+  TMibIpNetTable = MIB_IPNETTABLE;
+  PMibIpNetTable = PMIB_IPNETTABLE;
+
+// #define SIZEOF_IPNETTABLE(X) (FIELD_OFFSET(MIB_IPNETTABLE, table[0]) + ((X) * sizeof(MIB_IPNETROW)) + ALIGN_SIZE)
+
+type
+  PMIB_IPMCAST_OIF = ^MIB_IPMCAST_OIF;
+  {$EXTERNALSYM PMIB_IPMCAST_OIF}
+  _MIB_IPMCAST_OIF = record
+    dwOutIfIndex: DWORD;
+    dwNextHopAddr: DWORD;
+    dwReserved: DWORD;
+    dwReserved1: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_OIF}
+  MIB_IPMCAST_OIF = _MIB_IPMCAST_OIF;
+  {$EXTERNALSYM MIB_IPMCAST_OIF}
+  TMibIpmCastOif = MIB_IPMCAST_OIF;
+  PMibIpmCastOif = PMIB_IPMCAST_OIF;
+
+  PMIB_IPMCAST_MFE = ^MIB_IPMCAST_MFE;
+  {$EXTERNALSYM PMIB_IPMCAST_MFE}
+  _MIB_IPMCAST_MFE = record
+    dwGroup: DWORD;
+    dwSource: DWORD;
+    dwSrcMask: DWORD;
+    dwUpStrmNgbr: DWORD;
+    dwInIfIndex: DWORD;
+    dwInIfProtocol: DWORD;
+    dwRouteProtocol: DWORD;
+    dwRouteNetwork: DWORD;
+    dwRouteMask: DWORD;
+    ulUpTime: ULONG;
+    ulExpiryTime: ULONG;
+    ulTimeOut: ULONG;
+    ulNumOutIf: ULONG;
+    fFlags: DWORD;
+    dwReserved: DWORD;
+    rgmioOutInfo: array [0..ANY_SIZE - 1] of MIB_IPMCAST_OIF;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_MFE}
+  MIB_IPMCAST_MFE = _MIB_IPMCAST_MFE;
+  {$EXTERNALSYM MIB_IPMCAST_MFE}
+  TMibIpmCastMfe = MIB_IPMCAST_MFE;
+  PMibIpmCastMfe = PMIB_IPMCAST_MFE;
+
+  PMIB_MFE_TABLE = ^MIB_MFE_TABLE;
+  {$EXTERNALSYM PMIB_MFE_TABLE}
+  _MIB_MFE_TABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPMCAST_MFE;
+  end;
+  {$EXTERNALSYM _MIB_MFE_TABLE}
+  MIB_MFE_TABLE = _MIB_MFE_TABLE;
+  {$EXTERNALSYM MIB_MFE_TABLE}
+  TMibMfeTable = MIB_MFE_TABLE;
+  PMibMfeTable = PMIB_MFE_TABLE;
+
+// #define SIZEOF_BASIC_MIB_MFE          \
+//    (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE, rgmioOutInfo[0]))
+
+// #define SIZEOF_MIB_MFE(X)             \
+//    (SIZEOF_BASIC_MIB_MFE + ((X) * sizeof(MIB_IPMCAST_OIF)))
+
+type
+  PMIB_IPMCAST_OIF_STATS = ^MIB_IPMCAST_OIF_STATS;
+  {$EXTERNALSYM PMIB_IPMCAST_OIF_STATS}
+  _MIB_IPMCAST_OIF_STATS = record
+    dwOutIfIndex: DWORD;
+    dwNextHopAddr: DWORD;
+    dwDialContext: DWORD;
+    ulTtlTooLow: ULONG;
+    ulFragNeeded: ULONG;
+    ulOutPackets: ULONG;
+    ulOutDiscards: ULONG;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_OIF_STATS}
+  MIB_IPMCAST_OIF_STATS = _MIB_IPMCAST_OIF_STATS;
+  {$EXTERNALSYM MIB_IPMCAST_OIF_STATS}
+  TMibIpmCastOifStats = MIB_IPMCAST_OIF_STATS;
+  PMibIpmCastOifStats = PMIB_IPMCAST_OIF_STATS;
+
+  PMIB_IPMCAST_MFE_STATS = ^MIB_IPMCAST_MFE_STATS;
+  {$EXTERNALSYM PMIB_IPMCAST_MFE_STATS}
+  _MIB_IPMCAST_MFE_STATS = record
+    dwGroup: DWORD;
+    dwSource: DWORD;
+    dwSrcMask: DWORD;
+    dwUpStrmNgbr: DWORD;
+    dwInIfIndex: DWORD;
+    dwInIfProtocol: DWORD;
+    dwRouteProtocol: DWORD;
+    dwRouteNetwork: DWORD;
+    dwRouteMask: DWORD;
+    ulUpTime: ULONG;
+    ulExpiryTime: ULONG;
+    ulNumOutIf: ULONG;
+    ulInPkts: ULONG;
+    ulInOctets: ULONG;
+    ulPktsDifferentIf: ULONG;
+    ulQueueOverflow: ULONG;
+    rgmiosOutStats: array [0..ANY_SIZE - 1] of MIB_IPMCAST_OIF_STATS;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_MFE_STATS}
+  MIB_IPMCAST_MFE_STATS = _MIB_IPMCAST_MFE_STATS;
+  {$EXTERNALSYM MIB_IPMCAST_MFE_STATS}
+  TMibIpmCastMfeStats = MIB_IPMCAST_MFE_STATS;
+  PMibIpmCastMfeStats = PMIB_IPMCAST_MFE_STATS;
+
+  PMIB_MFE_STATS_TABLE = ^MIB_MFE_STATS_TABLE;
+  {$EXTERNALSYM PMIB_MFE_STATS_TABLE}
+  _MIB_MFE_STATS_TABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPMCAST_MFE_STATS;
+  end;
+  {$EXTERNALSYM _MIB_MFE_STATS_TABLE}
+  MIB_MFE_STATS_TABLE = _MIB_MFE_STATS_TABLE;
+  {$EXTERNALSYM MIB_MFE_STATS_TABLE}
+  TMibMfeStatsTable = MIB_MFE_STATS_TABLE;
+  PMibMfeStatsTable = PMIB_MFE_STATS_TABLE;
+
+// #define SIZEOF_BASIC_MIB_MFE_STATS    \
+//    (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS, rgmiosOutStats[0]))
+
+// #define SIZEOF_MIB_MFE_STATS(X)       \
+//    (SIZEOF_BASIC_MIB_MFE_STATS + ((X) * sizeof(MIB_IPMCAST_OIF_STATS)))
+
+type
+  _MIB_IPMCAST_MFE_STATS_EX = record
+    dwGroup: DWORD;
+    dwSource: DWORD;
+    dwSrcMask: DWORD;
+    dwUpStrmNgbr: DWORD;
+    dwInIfIndex: DWORD;
+    dwInIfProtocol: DWORD;
+    dwRouteProtocol: DWORD;
+    dwRouteNetwork: DWORD;
+    dwRouteMask: DWORD;
+    ulUpTime: ULONG;
+    ulExpiryTime: ULONG;
+    ulNumOutIf: ULONG;
+    ulInPkts: ULONG;
+    ulInOctets: ULONG;
+    ulPktsDifferentIf: ULONG;
+    ulQueueOverflow: ULONG;
+    ulUninitMfe: ULONG;
+    ulNegativeMfe: ULONG;
+    ulInDiscards: ULONG;
+    ulInHdrErrors: ULONG;
+    ulTotalOutPackets: ULONG;
+
+    rgmiosOutStats: array [0..ANY_SIZE - 1] of MIB_IPMCAST_OIF_STATS;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_MFE_STATS_EX}
+  MIB_IPMCAST_MFE_STATS_EX = _MIB_IPMCAST_MFE_STATS_EX;
+  {$EXTERNALSYM MIB_IPMCAST_MFE_STATS_EX}
+  PMIB_IPMCAST_MFE_STATS_EX = ^MIB_IPMCAST_MFE_STATS_EX;
+  {$EXTERNALSYM PMIB_IPMCAST_MFE_STATS_EX}
+  TMibIpMCastMfeStatsEx = MIB_IPMCAST_MFE_STATS_EX;
+  PMibIpMCastMfeStatsEx = PMIB_IPMCAST_MFE_STATS_EX;  
+
+  _MIB_MFE_STATS_TABLE_EX = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPMCAST_MFE_STATS_EX;
+  end;
+  {$EXTERNALSYM _MIB_MFE_STATS_TABLE_EX}
+  MIB_MFE_STATS_TABLE_EX = _MIB_MFE_STATS_TABLE_EX;
+  {$EXTERNALSYM MIB_MFE_STATS_TABLE_EX}
+  PMIB_MFE_STATS_TABLE_EX = ^MIB_MFE_STATS_TABLE_EX;
+  {$EXTERNALSYM PMIB_MFE_STATS_TABLE_EX}
+  TMibMfeStatsTableEx = MIB_MFE_STATS_TABLE_EX;
+  PMibMfeStatsTableEx = PMIB_MFE_STATS_TABLE_EX;
+
+//#define SIZEOF_BASIC_MIB_MFE_STATS_EX    \
+//    (ULONG)(FIELD_OFFSET(MIB_IPMCAST_MFE_STATS_EX, rgmiosOutStats[0]))
+
+//#define SIZEOF_MIB_MFE_STATS_EX(X)       \
+//    (SIZEOF_BASIC_MIB_MFE_STATS_EX + ((X) * sizeof(MIB_IPMCAST_OIF_STATS)))
+
+type
+  PMIB_IPMCAST_GLOBAL = ^MIB_IPMCAST_GLOBAL;
+  {$EXTERNALSYM PMIB_IPMCAST_GLOBAL}
+  _MIB_IPMCAST_GLOBAL = record
+    dwEnable: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_GLOBAL}
+  MIB_IPMCAST_GLOBAL = _MIB_IPMCAST_GLOBAL;
+  {$EXTERNALSYM MIB_IPMCAST_GLOBAL}
+  TMibIpmCastGlobal = MIB_IPMCAST_GLOBAL;
+  PMibIpmCastGlobal = PMIB_IPMCAST_GLOBAL;
+
+  PMIB_IPMCAST_IF_ENTRY = ^MIB_IPMCAST_IF_ENTRY;
+  {$EXTERNALSYM PMIB_IPMCAST_IF_ENTRY}
+  _MIB_IPMCAST_IF_ENTRY = record
+    dwIfIndex: DWORD;
+    dwTtl: DWORD;
+    dwProtocol: DWORD;
+    dwRateLimit: DWORD;
+    ulInMcastOctets: ULONG;
+    ulOutMcastOctets: ULONG;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_IF_ENTRY}
+  MIB_IPMCAST_IF_ENTRY = _MIB_IPMCAST_IF_ENTRY;
+  {$EXTERNALSYM MIB_IPMCAST_IF_ENTRY}
+  TMibIpmCastIfEntry = MIB_IPMCAST_IF_ENTRY;
+  PMibIpmCastIfEntry = PMIB_IPMCAST_IF_ENTRY;
+
+  PMIB_IPMCAST_IF_TABLE = ^MIB_IPMCAST_IF_TABLE;
+  {$EXTERNALSYM PMIB_IPMCAST_IF_TABLE}
+  _MIB_IPMCAST_IF_TABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPMCAST_IF_ENTRY;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_IF_TABLE}
+  MIB_IPMCAST_IF_TABLE = _MIB_IPMCAST_IF_TABLE;
+  {$EXTERNALSYM MIB_IPMCAST_IF_TABLE}
+  TMibIpmCastIfTable = MIB_IPMCAST_IF_TABLE;
+  PMibIpmCastIfTable = PMIB_IPMCAST_IF_TABLE;
+
+// #define SIZEOF_MCAST_IF_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_IF_TABLE,table[0]) + ((X) * sizeof(MIB_IPMCAST_IF_ENTRY)) + ALIGN_SIZE)
+
+type
+  PMIB_IPMCAST_BOUNDARY = ^MIB_IPMCAST_BOUNDARY;
+  {$EXTERNALSYM PMIB_IPMCAST_BOUNDARY}
+  _MIB_IPMCAST_BOUNDARY = record
+    dwIfIndex: DWORD;
+    dwGroupAddress: DWORD;
+    dwGroupMask: DWORD;
+    dwStatus: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_BOUNDARY}
+  MIB_IPMCAST_BOUNDARY = _MIB_IPMCAST_BOUNDARY;
+  {$EXTERNALSYM MIB_IPMCAST_BOUNDARY}
+  TMibIpmCastBoundary = MIB_IPMCAST_BOUNDARY;
+  PMibIpmCastBoundary = PMIB_IPMCAST_BOUNDARY;
+
+  PMIB_IPMCAST_BOUNDARY_TABLE = ^MIB_IPMCAST_BOUNDARY_TABLE;
+  {$EXTERNALSYM PMIB_IPMCAST_BOUNDARY_TABLE}
+  _MIB_IPMCAST_BOUNDARY_TABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPMCAST_BOUNDARY;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_BOUNDARY_TABLE}
+  MIB_IPMCAST_BOUNDARY_TABLE = _MIB_IPMCAST_BOUNDARY_TABLE;
+  {$EXTERNALSYM MIB_IPMCAST_BOUNDARY_TABLE}
+  TMibIpmCastBoundaryTable = MIB_IPMCAST_BOUNDARY_TABLE;
+  PMibIpmCastBoundaryTable = PMIB_IPMCAST_BOUNDARY_TABLE;
+
+// #define SIZEOF_BOUNDARY_TABLE(X) (FIELD_OFFSET(MIB_IPMCAST_BOUNDARY_TABLE,table[0]) + ((X) * sizeof(MIB_IPMCAST_BOUNDARY)) + ALIGN_SIZE)
+
+type
+  PMIB_BOUNDARYROW = ^MIB_BOUNDARYROW;
+  {$EXTERNALSYM PMIB_BOUNDARYROW}
+  MIB_BOUNDARYROW = record
+    dwGroupAddress: DWORD;
+    dwGroupMask: DWORD;
+  end;
+  {$EXTERNALSYM MIB_BOUNDARYROW}
+  TMibBoundaryRow = MIB_BOUNDARYROW;
+  PMibBoundaryRow = PMIB_BOUNDARYROW;
+
+// Structure matching what goes in the registry in a block of type
+// IP_MCAST_LIMIT_INFO.  This contains the fields of
+// MIB_IPMCAST_IF_ENTRY which are configurable.
+
+  PMIB_MCAST_LIMIT_ROW = ^MIB_MCAST_LIMIT_ROW;
+  {$EXTERNALSYM PMIB_MCAST_LIMIT_ROW}
+  MIB_MCAST_LIMIT_ROW = record
+    dwTtl: DWORD;
+    dwRateLimit: DWORD;
+  end;
+  {$EXTERNALSYM MIB_MCAST_LIMIT_ROW}
+  TMibMcastLimitRow = MIB_MCAST_LIMIT_ROW;
+  PMibMcastLimitRow = PMIB_MCAST_LIMIT_ROW;
+
+const
+  MAX_SCOPE_NAME_LEN = 255;
+  {$EXTERNALSYM MAX_SCOPE_NAME_LEN}
+
+//
+// Scope names are unicode.  SNMP and MZAP use UTF-8 encoding.
+//
+
+type
+  SN_CHAR = WCHAR;
+  {$EXTERNALSYM SN_CHAR}
+  SCOPE_NAME_BUFFER = array [0..MAX_SCOPE_NAME_LEN] of SN_CHAR;
+  {$EXTERNALSYM SCOPE_NAME_BUFFER}
+  SCOPE_NAME = ^SN_CHAR;
+  {$EXTERNALSYM SCOPE_NAME}
+
+  PMIB_IPMCAST_SCOPE = ^MIB_IPMCAST_SCOPE;
+  {$EXTERNALSYM PMIB_IPMCAST_SCOPE}
+  _MIB_IPMCAST_SCOPE = record
+    dwGroupAddress: DWORD;
+    dwGroupMask: DWORD;
+    snNameBuffer: SCOPE_NAME_BUFFER;
+    dwStatus: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPMCAST_SCOPE}
+  MIB_IPMCAST_SCOPE = _MIB_IPMCAST_SCOPE;
+  {$EXTERNALSYM MIB_IPMCAST_SCOPE}
+  TMibIpmCastScope = MIB_IPMCAST_SCOPE;
+  PMibIpmCastScope = PMIB_IPMCAST_SCOPE;
+
+  PMIB_IPDESTROW = ^MIB_IPDESTROW;
+  {$EXTERNALSYM PMIB_IPDESTROW}
+  _MIB_IPDESTROW = record
+    ForwardRow: MIB_IPFORWARDROW;
+    dwForwardPreference: DWORD;
+    dwForwardViewSet: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_IPDESTROW}
+  MIB_IPDESTROW = _MIB_IPDESTROW;
+  {$EXTERNALSYM MIB_IPDESTROW}
+  TMibIpDestRow = MIB_IPDESTROW;
+  PMibIpDestRow = PMIB_IPDESTROW;
+
+  PMIB_IPDESTTABLE = ^MIB_IPDESTTABLE;
+  {$EXTERNALSYM PMIB_IPDESTTABLE}
+  _MIB_IPDESTTABLE = record
+    dwNumEntries: DWORD;
+    table: array [0..ANY_SIZE - 1] of MIB_IPDESTROW;
+  end;
+  {$EXTERNALSYM _MIB_IPDESTTABLE}
+  MIB_IPDESTTABLE = _MIB_IPDESTTABLE;
+  {$EXTERNALSYM MIB_IPDESTTABLE}
+  TMibIpDestTable = MIB_IPDESTTABLE;
+  PMibIpDestTable = PMIB_IPDESTTABLE;
+
+  PMIB_BEST_IF = ^MIB_BEST_IF;
+  {$EXTERNALSYM PMIB_BEST_IF}
+  _MIB_BEST_IF = record
+    dwDestAddr: DWORD;
+    dwIfIndex: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_BEST_IF}
+  MIB_BEST_IF = _MIB_BEST_IF;
+  {$EXTERNALSYM MIB_BEST_IF}
+  TMibBestIf = MIB_BEST_IF;
+  PMibBestIf = PMIB_BEST_IF;
+
+  PMIB_PROXYARP = ^MIB_PROXYARP;
+  {$EXTERNALSYM PMIB_PROXYARP}
+  _MIB_PROXYARP = record
+    dwAddress: DWORD;
+    dwMask: DWORD;
+    dwIfIndex: DWORD;
+  end;
+  {$EXTERNALSYM _MIB_PROXYARP}
+  MIB_PROXYARP = _MIB_PROXYARP;
+  {$EXTERNALSYM MIB_PROXYARP}
+  TMibProxyArp = MIB_PROXYARP;
+  PMibProxyArp = PMIB_PROXYARP;
+
+  PMIB_IFSTATUS = ^MIB_IFSTATUS;
+  {$EXTERNALSYM PMIB_IFSTATUS}
+  _MIB_IFSTATUS = record
+    dwIfIndex: DWORD;
+    dwAdminStatus: DWORD;
+    dwOperationalStatus: DWORD;
+    bMHbeatActive: BOOL;
+    bMHbeatAlive: BOOL;
+  end;
+  {$EXTERNALSYM _MIB_IFSTATUS}
+  MIB_IFSTATUS = _MIB_IFSTATUS;
+  {$EXTERNALSYM MIB_IFSTATUS}
+  TMibIfStatus = MIB_IFSTATUS;
+  PMibIfStatus = PMIB_IFSTATUS;
+
+  PMIB_ROUTESTATE = ^MIB_ROUTESTATE;
+  {$EXTERNALSYM PMIB_ROUTESTATE}
+  _MIB_ROUTESTATE = record
+    bRoutesSetToStack: BOOL;
+  end;
+  {$EXTERNALSYM _MIB_ROUTESTATE}
+  MIB_ROUTESTATE = _MIB_ROUTESTATE;
+  {$EXTERNALSYM MIB_ROUTESTATE}
+  TMibRouteState = MIB_ROUTESTATE;
+  PMibRouteState = PMIB_ROUTESTATE;
+
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// All the info passed to (SET/CREATE) and from (GET/GETNEXT/GETFIRST)      //
+// IP Router Manager is encapsulated in the following "discriminated"       //
+// union.  To pass, say MIB_IFROW, use the following code                   //
+//                                                                          //
+//  PMIB_OPAQUE_INFO    pInfo;                                              //
+//  PMIB_IFROW          pIfRow;                                             //
+//  DWORD rgdwBuff[(MAX_MIB_OFFSET + sizeof(MIB_IFROW))/sizeof(DWORD) + 1]; //
+//                                                                          //
+//  pInfo   = (PMIB_OPAQUE_INFO)rgdwBuffer;                                 //
+//  pIfRow  = (MIB_IFROW *)(pInfo->rgbyData);                               //
+//                                                                          //
+//  This can also be accomplished by using the following macro              //
+//                                                                          //
+//  DEFINE_MIB_BUFFER(pInfo,MIB_IFROW, pIfRow);                             //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
+
+type
+  PMibOpaqueInfo = ^TMibOpaqueInfo;
+  _MIB_OPAQUE_INFO = record
+    dwId: DWORD;
+    case Integer of
+      0: (ullAlign: Int64); // ULONGLONG (unsigned!)
+      1: (rgbyData: array [0..0] of BYTE);
+  end;
+  {$EXTERNALSYM _MIB_OPAQUE_INFO}
+  MIB_OPAQUE_INFO = _MIB_OPAQUE_INFO;
+  {$EXTERNALSYM MIB_OPAQUE_INFO}
+  TMibOpaqueInfo = MIB_OPAQUE_INFO;
+
+const
+  MAX_MIB_OFFSET = 8;
+  {$EXTERNALSYM MAX_MIB_OFFSET}
+
+// #define MIB_INFO_SIZE(S)    (MAX_MIB_OFFSET + sizeof(S))
+
+// #define MIB_INFO_SIZE_IN_DWORDS(S)      \
+//    ((MIB_INFO_SIZE(S))/sizeof(DWORD) + 1)
+
+// #define DEFINE_MIB_BUFFER(X,Y,Z)                                        \
+//    DWORD             __rgdwBuff[MIB_INFO_SIZE_IN_DWORDS(Y)]; \
+//    PMIB_OPAQUE_INFO    X = (PMIB_OPAQUE_INFO)__rgdwBuff;               \
+//    Y *                 Z = (Y *)(X->rgbyData)
+
+// #define CAST_MIB_INFO(X,Y,Z)    Z = (Y)(X->rgbyData)
+
+implementation
+
+end.

+ 494 - 0
packages/extra/winunits/jwaiptypes.pas

@@ -0,0 +1,494 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Protocol Helper API interface Unit for Object Pascal                }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: iptypes.h, released July 2000. The original Pascal     }
+{ code is: IpTypes.pas, released September 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Contributor(s): John C. Penman (jcp att craiglockhart dott com)              }
+{                 Vladimir Vassiliev (voldemarv att hotpop dott com)           }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIpTypes;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "iptypes.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinsock2, JwaWinType;
+
+type
+  // #include <time.h>  // TODO
+  time_t = Longint;
+  {$EXTERNALSYM time_t}
+
+// Definitions and structures used by getnetworkparams and getadaptersinfo apis
+
+const
+  MAX_ADAPTER_DESCRIPTION_LENGTH = 128; // arb.
+  {$EXTERNALSYM MAX_ADAPTER_DESCRIPTION_LENGTH}
+  MAX_ADAPTER_NAME_LENGTH        = 256; // arb.
+  {$EXTERNALSYM MAX_ADAPTER_NAME_LENGTH}
+  MAX_ADAPTER_ADDRESS_LENGTH     = 8; // arb.
+  {$EXTERNALSYM MAX_ADAPTER_ADDRESS_LENGTH}
+  DEFAULT_MINIMUM_ENTITIES       = 32; // arb.
+  {$EXTERNALSYM DEFAULT_MINIMUM_ENTITIES}
+  MAX_HOSTNAME_LEN               = 128; // arb.
+  {$EXTERNALSYM MAX_HOSTNAME_LEN}
+  MAX_DOMAIN_NAME_LEN            = 128; // arb.
+  {$EXTERNALSYM MAX_DOMAIN_NAME_LEN}
+  MAX_SCOPE_ID_LEN               = 256; // arb.
+  {$EXTERNALSYM MAX_SCOPE_ID_LEN}
+
+//
+// types
+//
+
+// Node Type
+
+  BROADCAST_NODETYPE    = 1;
+  {$EXTERNALSYM BROADCAST_NODETYPE}
+  PEER_TO_PEER_NODETYPE = 2;
+  {$EXTERNALSYM PEER_TO_PEER_NODETYPE}
+  MIXED_NODETYPE        = 4;
+  {$EXTERNALSYM MIXED_NODETYPE}
+  HYBRID_NODETYPE       = 8;
+  {$EXTERNALSYM HYBRID_NODETYPE}
+
+//
+// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
+//
+
+type
+  PIP_MASK_STRING = ^IP_MASK_STRING;
+  {$EXTERNALSYM PIP_MASK_STRING}
+  IP_ADDRESS_STRING = record
+    S: array [0..15] of Char;
+  end;
+  {$EXTERNALSYM IP_ADDRESS_STRING}
+  PIP_ADDRESS_STRING = ^IP_ADDRESS_STRING;
+  {$EXTERNALSYM PIP_ADDRESS_STRING}
+  IP_MASK_STRING = IP_ADDRESS_STRING;
+  {$EXTERNALSYM IP_MASK_STRING}
+  TIpAddressString = IP_ADDRESS_STRING;
+  PIpAddressString = PIP_MASK_STRING;
+
+//
+// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
+// both as dotted decimal strings
+//
+
+  PIP_ADDR_STRING = ^IP_ADDR_STRING;
+  {$EXTERNALSYM PIP_ADDR_STRING}
+  _IP_ADDR_STRING = record
+    Next: PIP_ADDR_STRING;
+    IpAddress: IP_ADDRESS_STRING;
+    IpMask: IP_MASK_STRING;
+    Context: DWORD;
+  end;
+  {$EXTERNALSYM _IP_ADDR_STRING}
+  IP_ADDR_STRING = _IP_ADDR_STRING;
+  {$EXTERNALSYM IP_ADDR_STRING}
+  TIpAddrString = IP_ADDR_STRING;
+  PIpAddrString = PIP_ADDR_STRING;
+
+//
+// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
+// strings
+//
+
+  PIP_ADAPTER_INFO = ^IP_ADAPTER_INFO;
+  {$EXTERNALSYM PIP_ADAPTER_INFO}
+  _IP_ADAPTER_INFO = record
+    Next: PIP_ADAPTER_INFO;
+    ComboIndex: DWORD;
+    AdapterName: array [0..MAX_ADAPTER_NAME_LENGTH + 3] of Char;
+    Description: array [0..MAX_ADAPTER_DESCRIPTION_LENGTH + 3] of Char;
+    AddressLength: UINT;
+    Address: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1] of BYTE;
+    Index: DWORD;
+    Type_: UINT;
+    DhcpEnabled: UINT;
+    CurrentIpAddress: PIP_ADDR_STRING;
+    IpAddressList: IP_ADDR_STRING;
+    GatewayList: IP_ADDR_STRING;
+    DhcpServer: IP_ADDR_STRING;
+    HaveWins: BOOL;
+    PrimaryWinsServer: IP_ADDR_STRING;
+    SecondaryWinsServer: IP_ADDR_STRING;
+    LeaseObtained: time_t;
+    LeaseExpires: time_t;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_INFO}
+  IP_ADAPTER_INFO = _IP_ADAPTER_INFO;
+  {$EXTERNALSYM IP_ADAPTER_INFO}
+  TIpAdapterInfo = IP_ADAPTER_INFO;
+  PIpAdapterInfo = PIP_ADAPTER_INFO;
+
+//
+// The following types require Winsock2.
+//
+
+  IP_PREFIX_ORIGIN = (
+    IpPrefixOriginOther,
+    IpPrefixOriginManual,
+    IpPrefixOriginWellKnown,
+    IpPrefixOriginDhcp,
+    IpPrefixOriginRouterAdvertisement);
+  {$EXTERNALSYM IP_PREFIX_ORIGIN}
+  TIpPrefixOrigin = IP_PREFIX_ORIGIN;
+
+  IP_SUFFIX_ORIGIN = (
+    IpSuffixOriginOther,
+    IpSuffixOriginManual,
+    IpSuffixOriginWellKnown,
+    IpSuffixOriginDhcp,
+    IpSuffixOriginLinkLayerAddress,
+    IpSuffixOriginRandom);
+  {$EXTERNALSYM IP_SUFFIX_ORIGIN}
+  TIpSuffixOrigin = IP_SUFFIX_ORIGIN;
+
+  IP_DAD_STATE = (
+    IpDadStateInvalid,
+    IpDadStateTentative,
+    IpDadStateDuplicate,
+    IpDadStateDeprecated,
+    IpDadStatePreferred);
+  {$EXTERNALSYM IP_DAD_STATE}
+  TIpDadState = IP_DAD_STATE;
+
+  PIP_ADAPTER_UNICAST_ADDRESS = ^_IP_ADAPTER_UNICAST_ADDRESS;
+  {$EXTERNALSYM PIP_ADAPTER_UNICAST_ADDRESS}
+  _IP_ADAPTER_UNICAST_ADDRESS = record
+    Union: record
+      case Integer of
+        0: (
+          Alignment: ULONGLONG);
+        1: (
+          Length: ULONG;
+          Flags: DWORD);
+    end;
+    Next: PIP_ADAPTER_UNICAST_ADDRESS;
+    Address: SOCKET_ADDRESS;
+
+    PrefixOrigin: IP_PREFIX_ORIGIN;
+    SuffixOrigin: IP_SUFFIX_ORIGIN;
+    DadState: IP_DAD_STATE;
+
+    ValidLifetime: ULONG;
+    PreferredLifetime: ULONG;
+    LeaseLifetime: ULONG;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_UNICAST_ADDRESS}
+  IP_ADAPTER_UNICAST_ADDRESS = _IP_ADAPTER_UNICAST_ADDRESS;
+  {$EXTERNALSYM IP_ADAPTER_UNICAST_ADDRESS}
+  TIpAdapterUnicastAddress = IP_ADAPTER_UNICAST_ADDRESS;
+  PIpAdapterUnicastAddress = PIP_ADAPTER_UNICAST_ADDRESS;
+
+  PIP_ADAPTER_ANYCAST_ADDRESS = ^_IP_ADAPTER_ANYCAST_ADDRESS;
+  {$EXTERNALSYM PIP_ADAPTER_ANYCAST_ADDRESS}
+  _IP_ADAPTER_ANYCAST_ADDRESS = record
+    Union: record
+      case Integer of
+        0: (
+          Alignment: ULONGLONG);
+        1: (
+          Length: ULONG;
+          Flags: DWORD);
+    end;
+    Next: PIP_ADAPTER_ANYCAST_ADDRESS;
+    Address: SOCKET_ADDRESS;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_ANYCAST_ADDRESS}
+  IP_ADAPTER_ANYCAST_ADDRESS = _IP_ADAPTER_ANYCAST_ADDRESS;
+  {$EXTERNALSYM IP_ADAPTER_ANYCAST_ADDRESS}
+  TIpAdapterAnycaseAddress = IP_ADAPTER_ANYCAST_ADDRESS;
+  PIpAdapterAnycaseAddress = PIP_ADAPTER_ANYCAST_ADDRESS;
+
+  PIP_ADAPTER_MULTICAST_ADDRESS = ^_IP_ADAPTER_MULTICAST_ADDRESS;
+  {$EXTERNALSYM PIP_ADAPTER_MULTICAST_ADDRESS}
+  _IP_ADAPTER_MULTICAST_ADDRESS = record
+    Union: record
+      case Integer of
+        0: (
+          Alignment: ULONGLONG);
+        1: (
+          Length: ULONG;
+          Flags: DWORD);
+    end;
+    Next: PIP_ADAPTER_MULTICAST_ADDRESS;
+    Address: SOCKET_ADDRESS;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_MULTICAST_ADDRESS}
+  IP_ADAPTER_MULTICAST_ADDRESS = _IP_ADAPTER_MULTICAST_ADDRESS;
+  TIpAdapterMulticastAddress = IP_ADAPTER_MULTICAST_ADDRESS;
+  PIpAdapterMulticastAddress = PIP_ADAPTER_MULTICAST_ADDRESS;  
+
+//
+// Per-address Flags
+//
+
+const
+  IP_ADAPTER_ADDRESS_DNS_ELIGIBLE = $01;
+  {$EXTERNALSYM IP_ADAPTER_ADDRESS_DNS_ELIGIBLE}
+  IP_ADAPTER_ADDRESS_TRANSIENT    = $02;
+  {$EXTERNALSYM IP_ADAPTER_ADDRESS_TRANSIENT}
+
+type
+  PIP_ADAPTER_DNS_SERVER_ADDRESS = ^_IP_ADAPTER_DNS_SERVER_ADDRESS;
+  {$EXTERNALSYM PIP_ADAPTER_DNS_SERVER_ADDRESS}
+  _IP_ADAPTER_DNS_SERVER_ADDRESS = record
+    Union: record
+      case Integer of
+        0: (
+          Alignment: ULONGLONG);
+        1: (
+          Length: ULONG;
+          Reserved: DWORD);
+    end;
+    Next: PIP_ADAPTER_DNS_SERVER_ADDRESS;
+    Address: SOCKET_ADDRESS;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_DNS_SERVER_ADDRESS}
+  IP_ADAPTER_DNS_SERVER_ADDRESS = _IP_ADAPTER_DNS_SERVER_ADDRESS;
+  {$EXTERNALSYM IP_ADAPTER_DNS_SERVER_ADDRESS}
+  TIpAdapterDnsServerAddress = IP_ADAPTER_DNS_SERVER_ADDRESS;
+  PIpAdapterDnsServerAddress = PIP_ADAPTER_DNS_SERVER_ADDRESS;  
+
+  PIP_ADAPTER_PREFIX = ^IP_ADAPTER_PREFIX;
+  {$EXTERNALSYM PIP_ADAPTER_PREFIX}
+  _IP_ADAPTER_PREFIX = record
+    Union: record
+    case Integer of
+      0: (
+        Alignment: ULONGLONG);
+      1: (
+        Length: ULONG;
+        Flags: DWORD);
+    end;
+    Next: PIP_ADAPTER_PREFIX;
+    Address: SOCKET_ADDRESS;
+    PrefixLength: ULONG;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_PREFIX}
+  IP_ADAPTER_PREFIX = _IP_ADAPTER_PREFIX;
+  {$EXTERNALSYM IP_ADAPTER_PREFIX}
+  TIpAdapterPrefix = IP_ADAPTER_PREFIX;
+  PIpAdapterPrefix = PIP_ADAPTER_PREFIX;
+
+//
+// Per-adapter Flags
+//
+
+const
+  IP_ADAPTER_DDNS_ENABLED            = $01;
+  {$EXTERNALSYM IP_ADAPTER_DDNS_ENABLED}
+  IP_ADAPTER_REGISTER_ADAPTER_SUFFIX = $02;
+  {$EXTERNALSYM IP_ADAPTER_REGISTER_ADAPTER_SUFFIX}
+  IP_ADAPTER_DHCP_ENABLED            = $04;
+  {$EXTERNALSYM IP_ADAPTER_DHCP_ENABLED}
+  IP_ADAPTER_RECEIVE_ONLY            = $08;
+  {$EXTERNALSYM IP_ADAPTER_RECEIVE_ONLY}
+  IP_ADAPTER_NO_MULTICAST            = $10;
+  {$EXTERNALSYM IP_ADAPTER_NO_MULTICAST}
+  IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG = $20;
+  {$EXTERNALSYM IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG}
+
+//
+// OperStatus values from RFC 2863
+//
+
+type
+  IF_OPER_STATUS = (
+    IfOperStatusUp,
+    IfOperStatusDown,
+    IfOperStatusTesting,
+    IfOperStatusUnknown,
+    IfOperStatusDormant,
+    IfOperStatusNotPresent,
+    IfOperStatusLowerLayerDown);
+  {$EXTERNALSYM IF_OPER_STATUS}
+  TIfOperStatus = IF_OPER_STATUS;
+
+//
+// Scope levels from RFC 2373 used with ZoneIndices array.
+//
+
+const
+  ScopeLevelInterface    = 1;
+  {$EXTERNALSYM ScopeLevelInterface}
+  ScopeLevelLink         = 2;
+  {$EXTERNALSYM ScopeLevelLink}
+  ScopeLevelSubnet       = 3;
+  {$EXTERNALSYM ScopeLevelSubnet}
+  ScopeLevelAdmin        = 4;
+  {$EXTERNALSYM ScopeLevelAdmin}
+  ScopeLevelSite         = 5;
+  {$EXTERNALSYM ScopeLevelSite}
+  ScopeLevelOrganization = 8;
+  {$EXTERNALSYM ScopeLevelOrganization}
+  ScopeLevelGlobal       = 14;
+  {$EXTERNALSYM ScopeLevelGlobal}
+
+type
+  SCOPE_LEVEL = DWORD;
+  {$EXTERNALSYM SCOPE_LEVEL}
+  TScopeLevel = SCOPE_LEVEL;
+
+  PIP_ADAPTER_ADDRESSES = ^_IP_ADAPTER_ADDRESSES;
+  {$EXTERNALSYM PIP_ADAPTER_ADDRESSES}
+  _IP_ADAPTER_ADDRESSES = record
+    Union: record
+      case Integer of
+        0: (
+          Alignment: ULONGLONG);
+        1: (
+          Length: ULONG;
+          IfIndex: DWORD);
+    end;
+    Next: PIP_ADAPTER_ADDRESSES;
+    AdapterName: PCHAR;
+    FirstUnicastAddress: PIP_ADAPTER_UNICAST_ADDRESS;
+    FirstAnycastAddress: PIP_ADAPTER_ANYCAST_ADDRESS;
+    FirstMulticastAddress: PIP_ADAPTER_MULTICAST_ADDRESS;
+    FirstDnsServerAddress: PIP_ADAPTER_DNS_SERVER_ADDRESS;
+    DnsSuffix: PWCHAR;
+    Description: PWCHAR;
+    FriendlyName: PWCHAR;
+    PhysicalAddress: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1] of BYTE;
+    PhysicalAddressLength: DWORD;
+    Flags: DWORD;
+    Mtu: DWORD;
+    IfType: DWORD;
+    OperStatus: IF_OPER_STATUS;
+    Ipv6IfIndex: DWORD;
+    ZoneIndices: array [0..15] of DWORD;
+    FirstPrefix: PIP_ADAPTER_PREFIX;
+  end;
+  {$EXTERNALSYM _IP_ADAPTER_ADDRESSES}
+  IP_ADAPTER_ADDRESSES = _IP_ADAPTER_ADDRESSES;
+  {$EXTERNALSYM IP_ADAPTER_ADDRESSES}
+  TIpAdapterAddresses = IP_ADAPTER_ADDRESSES;
+  PIpAdapterAddresses = PIP_ADAPTER_ADDRESSES;  
+
+//
+// Flags used as argument to GetAdaptersAddresses().
+// "SKIP" flags are added when the default is to include the information.
+// "INCLUDE" flags are added when the default is to skip the information.
+//
+
+const
+  GAA_FLAG_SKIP_UNICAST     = $0001;
+  {$EXTERNALSYM GAA_FLAG_SKIP_UNICAST}
+  GAA_FLAG_SKIP_ANYCAST     = $0002;
+  {$EXTERNALSYM GAA_FLAG_SKIP_ANYCAST}
+  GAA_FLAG_SKIP_MULTICAST   = $0004;
+  {$EXTERNALSYM GAA_FLAG_SKIP_MULTICAST}
+  GAA_FLAG_SKIP_DNS_SERVER  = $0008;
+  {$EXTERNALSYM GAA_FLAG_SKIP_DNS_SERVER}
+  GAA_FLAG_INCLUDE_PREFIX   = $0010;
+  {$EXTERNALSYM GAA_FLAG_INCLUDE_PREFIX}
+  GAA_FLAG_SKIP_FRIENDLY_NAME = $0020;
+  {$EXTERNALSYM GAA_FLAG_SKIP_FRIENDLY_NAME}
+
+//
+// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
+//
+
+type
+  PIP_PER_ADAPTER_INFO = ^IP_PER_ADAPTER_INFO;
+  {$EXTERNALSYM PIP_PER_ADAPTER_INFO}
+  _IP_PER_ADAPTER_INFO = record
+    AutoconfigEnabled: UINT;
+    AutoconfigActive: UINT;
+    CurrentDnsServer: PIP_ADDR_STRING;
+    DnsServerList: IP_ADDR_STRING;
+  end;
+  {$EXTERNALSYM _IP_PER_ADAPTER_INFO}
+  IP_PER_ADAPTER_INFO = _IP_PER_ADAPTER_INFO;
+  {$EXTERNALSYM IP_PER_ADAPTER_INFO}
+  TIpPerAdapterInfo = IP_PER_ADAPTER_INFO;
+  PIpPerAdapterInfo = PIP_PER_ADAPTER_INFO;
+
+//
+// FIXED_INFO - the set of IP-related information which does not depend on DHCP
+//
+
+  PFIXED_INFO = ^FIXED_INFO;
+  {$EXTERNALSYM PFIXED_INFO}
+  FIXED_INFO = record
+    HostName: array [0..MAX_HOSTNAME_LEN + 3] of Char;
+    DomainName: array[0..MAX_DOMAIN_NAME_LEN + 3] of Char;
+    CurrentDnsServer: PIP_ADDR_STRING;
+    DnsServerList: IP_ADDR_STRING;
+    NodeType: UINT;
+    ScopeId: array [0..MAX_SCOPE_ID_LEN + 3] of Char;
+    EnableRouting: UINT;
+    EnableProxy: UINT;
+    EnableDns: UINT;
+  end;
+  {$EXTERNALSYM FIXED_INFO}
+  TFixedInfo = FIXED_INFO;
+  PFixedInfo = PFIXED_INFO;
+
+  IP_INTERFACE_NAME_INFO = record
+    Index: ULONG;      // Interface Index
+    MediaType: ULONG;  // Interface Types - see ipifcons.h
+    ConnectionType: UCHAR;
+    AccessType: UCHAR;
+    DeviceGuid: TGUID; // Device GUID is the guid of the device
+                       // that IP exposes
+    InterfaceGuid: TGUID; // Interface GUID, if not GUID_NULL is the
+                          // GUID for the interface mapped to the device.
+  end;
+  PIP_INTERFACE_NAME_INFO = ^IP_INTERFACE_NAME_INFO;
+  {$EXTERNALSYM PIP_INTERFACE_NAME_INFO}
+  TIpInterfaceNameInfo = IP_INTERFACE_NAME_INFO;
+  PIpInterfaceNameInfo = ^IP_INTERFACE_NAME_INFO;
+
+implementation
+
+end.

+ 82 - 0
packages/extra/winunits/jwaisguids.pas

@@ -0,0 +1,82 @@
+{******************************************************************************}
+{                                                                              }
+{ Internet Shortcut GUID definitions API interface Unit for Object Pascal      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: isguids.h, released November 2002. The original Pascal }
+{ code is: JwaIsGuids.pas, released April 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIsGuids;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "isguids.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//
+// isguids.h - Internet Shortcut GUID definitions.
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// 
+
+const
+  CLSID_InternetShortcut: TGUID = (D1:$FBF23B40; D2:$E3F0; D3:$101B; D4:($84, $88, $00, $AA, $00, $3E, $56, $F8));
+  {$EXTERNALSYM CLSID_InternetShortcut}
+
+  IID_IUniformResourceLocatorA: TGUID = (D1:$FBF23B80; D2:$E3F0; D3:$101B; D4:($84, $88, $00, $AA, $00, $3E, $56, $F8));
+  {$EXTERNALSYM IID_IUniformResourceLocatorA}
+  IID_IUniformResourceLocatorW: TGUID = (D1:$CABB0DA0; D2:$DA57; D3:$11CF; D4:($99, $74, $00, $20, $AF, $D7, $97, $62));
+  {$EXTERNALSYM IID_IUniformResourceLocatorW}
+
+  {$IFDEF UNICODE}
+  IID_IUniformResourceLocator: TGUID = (D1:$CABB0DA0; D2:$DA57; D3:$11CF; D4:($99, $74, $00, $20, $AF, $D7, $97, $62));
+  {$EXTERNALSYM IID_IUniformResourceLocator}
+  {$ELSE}
+  IID_IUniformResourceLocator: TGUID = (D1:$FBF23B80; D2:$E3F0; D3:$101B; D4:($84, $88, $00, $AA, $00, $3E, $56, $F8));
+  {$EXTERNALSYM IID_IUniformResourceLocator}
+  {$ENDIF UNICODE}
+
+implementation
+
+end.

+ 400 - 0
packages/extra/winunits/jwaissper16.pas

@@ -0,0 +1,400 @@
+{******************************************************************************}
+{                                                                              }
+{ Security Package Error Codes API interface Unit for Object Pascal            }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: issper16.h, released June 2000. The original Pascal    }
+{ code is: IssPer16.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaIssPer16;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "issper16.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaSSPI;
+
+// Define the severities
+//
+//  Values are 32 bit values layed out as follows:
+//
+//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+//  +---+-+-+-----------------------+-------------------------------+
+//  |Sev|C|R|     Facility          |               Code            |
+//  +---+-+-+-----------------------+-------------------------------+
+//
+//  where
+//
+//      Sev - is the severity code
+//
+//          00 - Success
+//          01 - Informational
+//          10 - Warning
+//          11 - Error
+//
+//      C - is the Customer code flag
+//
+//      R - is a reserved bit
+//
+//      Facility - is the facility code
+//
+//      Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+const
+  FACILITY_SECURITY = $9;
+  {$EXTERNALSYM FACILITY_SECURITY}
+  FACILITY_NULL     = 0;
+  {$EXTERNALSYM FACILITY_NULL}
+
+//
+// Define the severity codes
+//
+
+  STATUS_SEVERITY_SUCCESS = $0;
+  {$EXTERNALSYM STATUS_SEVERITY_SUCCESS}
+  STATUS_SEVERITY_COERROR = $2;
+  {$EXTERNALSYM STATUS_SEVERITY_COERROR}
+
+//
+// MessageId: SEC_E_INSUFFICIENT_MEMORY
+//
+// MessageText:
+//
+//  Not enough memory is available to complete this request
+//
+
+  SEC_E_INSUFFICIENT_MEMORY = SECURITY_STATUS($1300);
+  {$EXTERNALSYM SEC_E_INSUFFICIENT_MEMORY}
+
+//
+// MessageId: SEC_E_INVALID_HANDLE
+//
+// MessageText:
+//
+//  The handle specified is invalid
+//
+
+  SEC_E_INVALID_HANDLE = SECURITY_STATUS($1301);
+  {$EXTERNALSYM SEC_E_INVALID_HANDLE}
+
+//
+// MessageId: SEC_E_UNSUPPORTED_FUNCTION
+//
+// MessageText:
+//
+//  The function requested is not supported
+//
+
+  SEC_E_UNSUPPORTED_FUNCTION = SECURITY_STATUS($1302);
+  {$EXTERNALSYM SEC_E_UNSUPPORTED_FUNCTION}
+
+//
+// MessageId: SEC_E_TARGET_UNKNOWN
+//
+// MessageText:
+//
+//  The specified target is unknown or unreachable
+//
+
+  SEC_E_TARGET_UNKNOWN = SECURITY_STATUS($1303);
+  {$EXTERNALSYM SEC_E_TARGET_UNKNOWN}
+
+//
+// MessageId: SEC_E_INTERNAL_ERROR
+//
+// MessageText:
+//
+//  The Local Security Authority cannot be contacted
+//
+
+  SEC_E_INTERNAL_ERROR = SECURITY_STATUS($1304);
+  {$EXTERNALSYM SEC_E_INTERNAL_ERROR}
+
+//
+// MessageId: SEC_E_SECPKG_NOT_FOUND
+//
+// MessageText:
+//
+//  The requested security package does not exist
+//
+
+  SEC_E_SECPKG_NOT_FOUND = SECURITY_STATUS($1305);
+  {$EXTERNALSYM SEC_E_SECPKG_NOT_FOUND}
+
+//
+// MessageId: SEC_E_NOT_OWNER
+//
+// MessageText:
+//
+//  The caller is not the owner of the desired credentials
+//
+
+  SEC_E_NOT_OWNER = SECURITY_STATUS($1306);
+  {$EXTERNALSYM SEC_E_NOT_OWNER}
+
+//
+// MessageId: SEC_E_CANNOT_INSTALL
+//
+// MessageText:
+//
+//  The security package failed to initialize, and cannot be installed
+//
+
+  SEC_E_CANNOT_INSTALL = SECURITY_STATUS($1307);
+  {$EXTERNALSYM SEC_E_CANNOT_INSTALL}
+
+//
+// MessageId: SEC_E_INVALID_TOKEN
+//
+// MessageText:
+//
+//  The token supplied to the function is invalid
+//
+
+  SEC_E_INVALID_TOKEN = SECURITY_STATUS($1308);
+  {$EXTERNALSYM SEC_E_INVALID_TOKEN}
+
+//
+// MessageId: SEC_E_CANNOT_PACK
+//
+// MessageText:
+//
+//  The security package is not able to marshall the logon buffer,
+//  so the logon attempt has failed
+//
+
+  SEC_E_CANNOT_PACK = SECURITY_STATUS($1309);
+  {$EXTERNALSYM SEC_E_CANNOT_PACK}
+
+//
+// MessageId: SEC_E_QOP_NOT_SUPPORTED
+//
+// MessageText:
+//
+//  The per-message Quality of Protection is not supported by the
+//  security package
+//
+
+  SEC_E_QOP_NOT_SUPPORTED = SECURITY_STATUS($130A);
+  {$EXTERNALSYM SEC_E_QOP_NOT_SUPPORTED}
+
+//
+// MessageId: SEC_E_NO_IMPERSONATION
+//
+// MessageText:
+//
+//  The security context does not allow impersonation of the client
+//
+
+  SEC_E_NO_IMPERSONATION = SECURITY_STATUS($130B);
+  {$EXTERNALSYM SEC_E_NO_IMPERSONATION}
+
+//
+// MessageId: SEC_E_LOGON_DENIED
+//
+// MessageText:
+//
+//  The logon attempt failed
+//
+
+  SEC_E_LOGON_DENIED = SECURITY_STATUS($130C);
+  {$EXTERNALSYM SEC_E_LOGON_DENIED}
+
+//
+// MessageId: SEC_E_UNKNOWN_CREDENTIALS
+//
+// MessageText:
+//
+//  The credentials supplied to the package were not
+//  recognized
+//
+
+  SEC_E_UNKNOWN_CREDENTIALS = SECURITY_STATUS($130D);
+  {$EXTERNALSYM SEC_E_UNKNOWN_CREDENTIALS}
+
+//
+// MessageId: SEC_E_NO_CREDENTIALS
+//
+// MessageText:
+//
+//  No credentials are available in the security package
+//
+
+  SEC_E_NO_CREDENTIALS = SECURITY_STATUS($130E);
+  {$EXTERNALSYM SEC_E_NO_CREDENTIALS}
+
+//
+// MessageId: SEC_E_MESSAGE_ALTERED
+//
+// MessageText:
+//
+//  The message supplied for verification has been altered
+//
+
+  SEC_E_MESSAGE_ALTERED = SECURITY_STATUS($130F);
+  {$EXTERNALSYM SEC_E_MESSAGE_ALTERED}
+
+//
+// MessageId: SEC_E_OUT_OF_SEQUENCE
+//
+// MessageText:
+//
+//  The message supplied for verification is out of sequence
+//
+
+  SEC_E_OUT_OF_SEQUENCE = SECURITY_STATUS($1310);
+  {$EXTERNALSYM SEC_E_OUT_OF_SEQUENCE}
+
+//
+// MessageId: SEC_E_NO_AUTHENTICATING_AUTHORITY
+//
+// MessageText:
+//
+//  No authority could be contacted for authentication.
+//
+
+  SEC_E_NO_AUTHENTICATING_AUTHORITY = SECURITY_STATUS($1311);
+  {$EXTERNALSYM SEC_E_NO_AUTHENTICATING_AUTHORITY}
+
+// MessageId: SEC_E_CONTEXT_EXPIRED
+//
+// MessageText:
+//
+//  The context has expired and can no longer be used.
+//
+
+  SEC_E_CONTEXT_EXPIRED = SECURITY_STATUS($1312);
+  {$EXTERNALSYM SEC_E_CONTEXT_EXPIRED}
+
+//
+// MessageId: SEC_E_INCOMPLETE_MESSAGE
+//
+// MessageText:
+//
+//  The supplied message is incomplete.  The signature was not verified.
+//
+
+  SEC_E_INCOMPLETE_MESSAGE = SECURITY_STATUS($1313);
+  {$EXTERNALSYM SEC_E_INCOMPLETE_MESSAGE}
+
+//
+// MessageId: SEC_I_CONTINUE_NEEDED
+//
+// MessageText:
+//
+//  The function completed successfully, but must be called
+//  again to complete the context
+//
+
+  SEC_I_CONTINUE_NEEDED = SECURITY_STATUS($1012);
+  {$EXTERNALSYM SEC_I_CONTINUE_NEEDED}
+
+//
+// MessageId: SEC_I_COMPLETE_NEEDED
+//
+// MessageText:
+//
+//  The function completed successfully, but CompleteToken
+//  must be called
+//
+
+  SEC_I_COMPLETE_NEEDED = SECURITY_STATUS($1013);
+  {$EXTERNALSYM SEC_I_COMPLETE_NEEDED}
+
+//
+// MessageId: SEC_I_COMPLETE_AND_CONTINUE
+//
+// MessageText:
+//
+//  The function completed successfully, but both CompleteToken
+//  and this function must be called to complete the context
+//
+
+  SEC_I_COMPLETE_AND_CONTINUE = SECURITY_STATUS($1014);
+  {$EXTERNALSYM SEC_I_COMPLETE_AND_CONTINUE}
+
+//
+// MessageId: SEC_I_LOCAL_LOGON
+//
+// MessageText:
+//
+//  The logon was completed, but no network authority was
+//  available.  The logon was made using locally known information
+//
+
+  SEC_I_LOCAL_LOGON = SECURITY_STATUS($1015);
+  {$EXTERNALSYM SEC_I_LOCAL_LOGON}
+
+//
+// MessageId: SEC_E_OK
+//
+// MessageText:
+//
+//  Call completed successfully
+//
+
+  SEC_E_OK = SECURITY_STATUS($0000);
+  {$EXTERNALSYM SEC_E_OK}
+
+//
+// Older error names for backwards compatibility
+//
+
+  SEC_E_NOT_SUPPORTED = SEC_E_UNSUPPORTED_FUNCTION;
+  {$EXTERNALSYM SEC_E_NOT_SUPPORTED}
+  SEC_E_NO_SPM        = SEC_E_INTERNAL_ERROR;
+  {$EXTERNALSYM SEC_E_NO_SPM}
+  SEC_E_BAD_PKGID     = SEC_E_SECPKG_NOT_FOUND;
+  {$EXTERNALSYM SEC_E_BAD_PKGID}
+
+implementation
+
+end.

+ 2820 - 0
packages/extra/winunits/jwalmaccess.pas

@@ -0,0 +1,2820 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Access API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmaccess.h, released November 2001. The original Pascal}
+{ code is: LmAccess.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmAccess;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmaccess.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinNT, JwaWinType, JwaLmCons;
+
+//
+// Function Prototypes - User
+//
+
+function NetUserAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserAdd}
+
+function NetUserEnum(servername: LPCWSTR; level, filter: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserEnum}
+
+function NetUserGetInfo(servername, username: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserGetInfo}
+
+function NetUserSetInfo(servername, username: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserSetInfo}
+
+function NetUserDel(servername: LPCWSTR; username: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserDel}
+
+function NetUserGetGroups(servername, username: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserGetGroups}
+
+function NetUserSetGroups(servername, username: LPCWSTR; level: DWORD; buf: LPBYTE; num_entries: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserSetGroups}
+
+function NetUserGetLocalGroups(servername, username: LPCWSTR; level, flags: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserGetLocalGroups}
+
+function NetUserModalsGet(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserModalsGet}
+
+function NetUserModalsSet(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserModalsSet}
+
+function NetUserChangePassword(domainname, username, oldpassword, newpassword: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUserChangePassword}
+
+//
+//  Data Structures - User
+//
+
+type
+  LPUSER_INFO_0 = ^USER_INFO_0;
+  {$EXTERNALSYM LPUSER_INFO_0}
+  PUSER_INFO_0 = ^USER_INFO_0;
+  {$EXTERNALSYM PUSER_INFO_0}
+  _USER_INFO_0 = record
+    usri0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_0}
+  USER_INFO_0 = _USER_INFO_0;
+  {$EXTERNALSYM USER_INFO_0}
+  TUserInfo0 = USER_INFO_0;
+  PUserInfo0 = PUSER_INFO_0;
+
+  LPUSER_INFO_1 = ^USER_INFO_1;
+  {$EXTERNALSYM LPUSER_INFO_1}
+  PUSER_INFO_1 = ^USER_INFO_1;
+  {$EXTERNALSYM PUSER_INFO_1}
+  _USER_INFO_1 = record
+    usri1_name: LPWSTR;
+    usri1_password: LPWSTR;
+    usri1_password_age: DWORD;
+    usri1_priv: DWORD;
+    usri1_home_dir: LPWSTR;
+    usri1_comment: LPWSTR;
+    usri1_flags: DWORD;
+    usri1_script_path: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1}
+  USER_INFO_1 = _USER_INFO_1;
+  {$EXTERNALSYM USER_INFO_1}
+  TUserInfo1 = USER_INFO_1;
+  PUserInfo1 = PUSER_INFO_1;
+
+  LPUSER_INFO_2 = ^USER_INFO_2;
+  {$EXTERNALSYM LPUSER_INFO_2}
+  PUSER_INFO_2 = ^USER_INFO_2;
+  {$EXTERNALSYM PUSER_INFO_2}
+  _USER_INFO_2 = record
+    usri2_name: LPWSTR;
+    usri2_password: LPWSTR;
+    usri2_password_age: DWORD;
+    usri2_priv: DWORD;
+    usri2_home_dir: LPWSTR;
+    usri2_comment: LPWSTR;
+    usri2_flags: DWORD;
+    usri2_script_path: LPWSTR;
+    usri2_auth_flags: DWORD;
+    usri2_full_name: LPWSTR;
+    usri2_usr_comment: LPWSTR;
+    usri2_parms: LPWSTR;
+    usri2_workstations: LPWSTR;
+    usri2_last_logon: DWORD;
+    usri2_last_logoff: DWORD;
+    usri2_acct_expires: DWORD;
+    usri2_max_storage: DWORD;
+    usri2_units_per_week: DWORD;
+    usri2_logon_hours: PBYTE;
+    usri2_bad_pw_count: DWORD;
+    usri2_num_logons: DWORD;
+    usri2_logon_server: LPWSTR;
+    usri2_country_code: DWORD;
+    usri2_code_page: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_2}
+  USER_INFO_2 = _USER_INFO_2;
+  {$EXTERNALSYM USER_INFO_2}
+  TUserInfo2 = USER_INFO_2;
+  PUserInfo2 = PUSER_INFO_2;
+
+  LPUSER_INFO_3 = ^USER_INFO_3;
+  {$EXTERNALSYM LPUSER_INFO_3}
+  PUSER_INFO_3 = ^USER_INFO_3;
+  {$EXTERNALSYM PUSER_INFO_3}
+  _USER_INFO_3 = record
+    usri3_name: LPWSTR;
+    usri3_password: LPWSTR;
+    usri3_password_age: DWORD;
+    usri3_priv: DWORD;
+    usri3_home_dir: LPWSTR;
+    usri3_comment: LPWSTR;
+    usri3_flags: DWORD;
+    usri3_script_path: LPWSTR;
+    usri3_auth_flags: DWORD;
+    usri3_full_name: LPWSTR;
+    usri3_usr_comment: LPWSTR;
+    usri3_parms: LPWSTR;
+    usri3_workstations: LPWSTR;
+    usri3_last_logon: DWORD;
+    usri3_last_logoff: DWORD;
+    usri3_acct_expires: DWORD;
+    usri3_max_storage: DWORD;
+    usri3_units_per_week: DWORD;
+    usri3_logon_hours: PBYTE;
+    usri3_bad_pw_count: DWORD;
+    usri3_num_logons: DWORD;
+    usri3_logon_server: LPWSTR;
+    usri3_country_code: DWORD;
+    usri3_code_page: DWORD;
+    usri3_user_id: DWORD;
+    usri3_primary_group_id: DWORD;
+    usri3_profile: LPWSTR;
+    usri3_home_dir_drive: LPWSTR;
+    usri3_password_expired: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_3}
+  USER_INFO_3 = _USER_INFO_3;
+  {$EXTERNALSYM USER_INFO_3}
+  TUserInfo3 = USER_INFO_3;
+  PUserInfo3 = PUSER_INFO_3;
+
+  LPUSER_INFO_4 = ^USER_INFO_4;
+  {$EXTERNALSYM LPUSER_INFO_4}
+  PUSER_INFO_4 = ^USER_INFO_4;
+  {$EXTERNALSYM PUSER_INFO_4}
+  _USER_INFO_4 = record
+    usri4_name: LPWSTR;
+    usri4_password: LPWSTR;
+    usri4_password_age: DWORD;
+    usri4_priv: DWORD;
+    usri4_home_dir: LPWSTR;
+    usri4_comment: LPWSTR;
+    usri4_flags: DWORD;
+    usri4_script_path: LPWSTR;
+    usri4_auth_flags: DWORD;
+    usri4_full_name: LPWSTR;
+    usri4_usr_comment: LPWSTR;
+    usri4_parms: LPWSTR;
+    usri4_workstations: LPWSTR;
+    usri4_last_logon: DWORD;
+    usri4_last_logoff: DWORD;
+    usri4_acct_expires: DWORD;
+    usri4_max_storage: DWORD;
+    usri4_units_per_week: DWORD;
+    usri4_logon_hours: PBYTE;
+    usri4_bad_pw_count: DWORD;
+    usri4_num_logons: DWORD;
+    usri4_logon_server: LPWSTR;
+    usri4_country_code: DWORD;
+    usri4_code_page: DWORD;
+    usri4_user_sid: PSID;
+    usri4_primary_group_id: DWORD;
+    usri4_profile: LPWSTR;
+    usri4_home_dir_drive: LPWSTR;
+    usri4_password_expired: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_4}
+  USER_INFO_4 = _USER_INFO_4;
+  {$EXTERNALSYM USER_INFO_4}
+  TUserInfo4 = USER_INFO_4;
+  PUserInfo4 = PUSER_INFO_4;
+
+  LPUSER_INFO_10 = ^USER_INFO_10;
+  {$EXTERNALSYM LPUSER_INFO_10}
+  PUSER_INFO_10 = ^USER_INFO_10;
+  {$EXTERNALSYM PUSER_INFO_10}
+  _USER_INFO_10 = record
+    usri10_name: LPWSTR;
+    usri10_comment: LPWSTR;
+    usri10_usr_comment: LPWSTR;
+    usri10_full_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_10}
+  USER_INFO_10 = _USER_INFO_10;
+  {$EXTERNALSYM USER_INFO_10}
+  TUserInfo10 = USER_INFO_10;
+  PUserInfo10 = PUSER_INFO_10;
+
+  LPUSER_INFO_11 = ^USER_INFO_11;
+  {$EXTERNALSYM LPUSER_INFO_11}
+  PUSER_INFO_11 = ^USER_INFO_11;
+  {$EXTERNALSYM PUSER_INFO_11}
+  _USER_INFO_11 = record
+    usri11_name: LPWSTR;
+    usri11_comment: LPWSTR;
+    usri11_usr_comment: LPWSTR;
+    usri11_full_name: LPWSTR;
+    usri11_priv: DWORD;
+    usri11_auth_flags: DWORD;
+    usri11_password_age: DWORD;
+    usri11_home_dir: LPWSTR;
+    usri11_parms: LPWSTR;
+    usri11_last_logon: DWORD;
+    usri11_last_logoff: DWORD;
+    usri11_bad_pw_count: DWORD;
+    usri11_num_logons: DWORD;
+    usri11_logon_server: LPWSTR;
+    usri11_country_code: DWORD;
+    usri11_workstations: LPWSTR;
+    usri11_max_storage: DWORD;
+    usri11_units_per_week: DWORD;
+    usri11_logon_hours: PBYTE;
+    usri11_code_page: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_11}
+  USER_INFO_11 = _USER_INFO_11;
+  {$EXTERNALSYM USER_INFO_11}
+  TUserInfo11 = USER_INFO_11;
+  PUserInfo11 = PUSER_INFO_11;
+
+  LPUSER_INFO_20 = ^USER_INFO_20;
+  {$EXTERNALSYM LPUSER_INFO_20}
+  PUSER_INFO_20 = ^USER_INFO_20;
+  {$EXTERNALSYM PUSER_INFO_20}
+  _USER_INFO_20 = record
+    usri20_name: LPWSTR;
+    usri20_full_name: LPWSTR;
+    usri20_comment: LPWSTR;
+    usri20_flags: DWORD;
+    usri20_user_id: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_20}
+  USER_INFO_20 = _USER_INFO_20;
+  {$EXTERNALSYM USER_INFO_20}
+  TUserInfo20 = USER_INFO_20;
+  PUserInfo20 = PUSER_INFO_20;
+
+  LPUSER_INFO_21 = ^USER_INFO_21;
+  {$EXTERNALSYM LPUSER_INFO_21}
+  PUSER_INFO_21 = ^USER_INFO_21;
+  {$EXTERNALSYM PUSER_INFO_21}
+  _USER_INFO_21 = record
+    usri21_password: array [0..ENCRYPTED_PWLEN - 1] of BYTE;
+  end;
+  {$EXTERNALSYM _USER_INFO_21}
+  USER_INFO_21 = _USER_INFO_21;
+  {$EXTERNALSYM USER_INFO_21}
+  TUserInfo21 = USER_INFO_21;
+  PUserInfo21 = PUSER_INFO_21;
+
+  LPUSER_INFO_22 = ^USER_INFO_22;
+  {$EXTERNALSYM LPUSER_INFO_22}
+  PUSER_INFO_22 = ^USER_INFO_22;
+  {$EXTERNALSYM PUSER_INFO_22}
+  _USER_INFO_22 = record
+    usri22_name: LPWSTR;
+    usri22_password: array [0..ENCRYPTED_PWLEN - 1] of BYTE;
+    usri22_password_age: DWORD;
+    usri22_priv: DWORD;
+    usri22_home_dir: LPWSTR;
+    usri22_comment: LPWSTR;
+    usri22_flags: DWORD;
+    usri22_script_path: LPWSTR;
+    usri22_auth_flags: DWORD;
+    usri22_full_name: LPWSTR;
+    usri22_usr_comment: LPWSTR;
+    usri22_parms: LPWSTR;
+    usri22_workstations: LPWSTR;
+    usri22_last_logon: DWORD;
+    usri22_last_logoff: DWORD;
+    usri22_acct_expires: DWORD;
+    usri22_max_storage: DWORD;
+    usri22_units_per_week: DWORD;
+    usri22_logon_hours: PBYTE;
+    usri22_bad_pw_count: DWORD;
+    usri22_num_logons: DWORD;
+    usri22_logon_server: LPWSTR;
+    usri22_country_code: DWORD;
+    usri22_code_page: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_22}
+  USER_INFO_22 = _USER_INFO_22;
+  {$EXTERNALSYM USER_INFO_22}
+  TUserInfo22 = USER_INFO_22;
+  PUserInfo22 = PUSER_INFO_22;
+
+  LPUSER_INFO_23 = ^USER_INFO_23;
+  {$EXTERNALSYM LPUSER_INFO_23}
+  PUSER_INFO_23 = ^USER_INFO_23;
+  {$EXTERNALSYM PUSER_INFO_23}
+  _USER_INFO_23 = record
+    usri23_name: LPWSTR;
+    usri23_full_name: LPWSTR;
+    usri23_comment: LPWSTR;
+    usri23_flags: DWORD;
+    usri23_user_sid: PSID;
+  end;
+  {$EXTERNALSYM _USER_INFO_23}
+  USER_INFO_23 = _USER_INFO_23;
+  {$EXTERNALSYM USER_INFO_23}
+  TUserInfo23 = USER_INFO_23;
+  PUserInfo23 = PUSER_INFO_23;
+
+  LPUSER_INFO_1003 = ^USER_INFO_1003;
+  {$EXTERNALSYM LPUSER_INFO_1003}
+  PUSER_INFO_1003 = ^USER_INFO_1003;
+  {$EXTERNALSYM PUSER_INFO_1003}
+  _USER_INFO_1003 = record
+    usri1003_password: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1003}
+  USER_INFO_1003 = _USER_INFO_1003;
+  {$EXTERNALSYM USER_INFO_1003}
+  TUserInfo1003 = USER_INFO_1003;
+  PUserInfo1003 = PUSER_INFO_1003;
+
+  LPUSER_INFO_1005 = ^USER_INFO_1005;
+  {$EXTERNALSYM LPUSER_INFO_1005}
+  PUSER_INFO_1005 = ^USER_INFO_1005;
+  {$EXTERNALSYM PUSER_INFO_1005}
+  _USER_INFO_1005 = record
+    usri1005_priv: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1005}
+  USER_INFO_1005 = _USER_INFO_1005;
+  {$EXTERNALSYM USER_INFO_1005}
+  TUserInfo1005 = USER_INFO_1005;
+  PUserInfo1005 = PUSER_INFO_1005;
+
+  LPUSER_INFO_1006 = ^USER_INFO_1006;
+  {$EXTERNALSYM LPUSER_INFO_1006}
+  PUSER_INFO_1006 = ^USER_INFO_1006;
+  {$EXTERNALSYM PUSER_INFO_1006}
+  _USER_INFO_1006 = record
+    usri1006_home_dir: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1006}
+  USER_INFO_1006 = _USER_INFO_1006;
+  {$EXTERNALSYM USER_INFO_1006}
+  TUserInfo1006 = USER_INFO_1006;
+  PUserInfo1006 = PUSER_INFO_1006;
+
+  LPUSER_INFO_1007 = ^USER_INFO_1007;
+  {$EXTERNALSYM LPUSER_INFO_1007}
+  PUSER_INFO_1007 = ^USER_INFO_1007;
+  {$EXTERNALSYM PUSER_INFO_1007}
+  _USER_INFO_1007 = record
+    usri1007_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1007}
+  USER_INFO_1007 = _USER_INFO_1007;
+  {$EXTERNALSYM USER_INFO_1007}
+  TUserInfo1007 = USER_INFO_1007;
+  PUserInfo1007 = PUSER_INFO_1007;
+
+  LPUSER_INFO_1008 = ^USER_INFO_1008;
+  {$EXTERNALSYM LPUSER_INFO_1008}
+  PUSER_INFO_1008 = ^USER_INFO_1008;
+  {$EXTERNALSYM PUSER_INFO_1008}
+  _USER_INFO_1008 = record
+    usri1008_flags: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1008}
+  USER_INFO_1008 = _USER_INFO_1008;
+  {$EXTERNALSYM USER_INFO_1008}
+  TUserInfo1008 = USER_INFO_1008;
+  PUserInfo1008 = PUSER_INFO_1008;
+
+  LPUSER_INFO_1009 = ^USER_INFO_1009;
+  {$EXTERNALSYM LPUSER_INFO_1009}
+  PUSER_INFO_1009 = ^USER_INFO_1009;
+  {$EXTERNALSYM PUSER_INFO_1009}
+  _USER_INFO_1009 = record
+    usri1009_script_path: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1009}
+  USER_INFO_1009 = _USER_INFO_1009;
+  {$EXTERNALSYM USER_INFO_1009}
+  TUserInfo1009 = USER_INFO_1009;
+  PUserInfo1009 = PUSER_INFO_1009;
+
+  LPUSER_INFO_1010 = ^USER_INFO_1010;
+  {$EXTERNALSYM LPUSER_INFO_1010}
+  PUSER_INFO_1010 = ^USER_INFO_1010;
+  {$EXTERNALSYM PUSER_INFO_1010}
+  _USER_INFO_1010 = record
+    usri1010_auth_flags: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1010}
+  USER_INFO_1010 = _USER_INFO_1010;
+  {$EXTERNALSYM USER_INFO_1010}
+  TUserInfo1010 = USER_INFO_1010;
+  PUserInfo1010 = PUSER_INFO_1010;
+
+  LPUSER_INFO_1011 = ^USER_INFO_1011;
+  {$EXTERNALSYM LPUSER_INFO_1011}
+  PUSER_INFO_1011 = ^USER_INFO_1011;
+  {$EXTERNALSYM PUSER_INFO_1011}
+  _USER_INFO_1011 = record
+    usri1011_full_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1011}
+  USER_INFO_1011 = _USER_INFO_1011;
+  {$EXTERNALSYM USER_INFO_1011}
+  TUserInfo1011 = USER_INFO_1011;
+  PUserInfo1011 = PUSER_INFO_1011;
+
+  LPUSER_INFO_1012 = ^USER_INFO_1012;
+  {$EXTERNALSYM LPUSER_INFO_1012}
+  PUSER_INFO_1012 = ^USER_INFO_1012;
+  {$EXTERNALSYM PUSER_INFO_1012}
+  _USER_INFO_1012 = record
+    usri1012_usr_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1012}
+  USER_INFO_1012 = _USER_INFO_1012;
+  {$EXTERNALSYM USER_INFO_1012}
+  TUserInfo1012 = USER_INFO_1012;
+  PUserInfo1012 = PUSER_INFO_1012;
+
+  LPUSER_INFO_1013 = ^USER_INFO_1013;
+  {$EXTERNALSYM LPUSER_INFO_1013}
+  PUSER_INFO_1013 = ^USER_INFO_1013;
+  {$EXTERNALSYM PUSER_INFO_1013}
+  _USER_INFO_1013 = record
+    usri1013_parms: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1013}
+  USER_INFO_1013 = _USER_INFO_1013;
+  {$EXTERNALSYM USER_INFO_1013}
+  TUserInfo1013 = USER_INFO_1013;
+  PUserInfo1013 = PUSER_INFO_1013;
+
+  LPUSER_INFO_1014 = ^USER_INFO_1014;
+  {$EXTERNALSYM LPUSER_INFO_1014}
+  PUSER_INFO_1014 = ^USER_INFO_1014;
+  {$EXTERNALSYM PUSER_INFO_1014}
+  _USER_INFO_1014 = record
+    usri1014_workstations: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1014}
+  USER_INFO_1014 = _USER_INFO_1014;
+  {$EXTERNALSYM USER_INFO_1014}
+  TUserInfo1014 = USER_INFO_1014;
+  PUserInfo1014 = PUSER_INFO_1014;
+
+  LPUSER_INFO_1017 = ^USER_INFO_1017;
+  {$EXTERNALSYM LPUSER_INFO_1017}
+  PUSER_INFO_1017 = ^USER_INFO_1017;
+  {$EXTERNALSYM PUSER_INFO_1017}
+  _USER_INFO_1017 = record
+    usri1017_acct_expires: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1017}
+  USER_INFO_1017 = _USER_INFO_1017;
+  {$EXTERNALSYM USER_INFO_1017}
+  TUserInfo1017 = USER_INFO_1017;
+  PUserInfo1017 = PUSER_INFO_1017;
+
+  LPUSER_INFO_1018 = ^USER_INFO_1018;
+  {$EXTERNALSYM LPUSER_INFO_1018}
+  PUSER_INFO_1018 = ^USER_INFO_1018;
+  {$EXTERNALSYM PUSER_INFO_1018}
+  _USER_INFO_1018 = record
+    usri1018_max_storage: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1018}
+  USER_INFO_1018 = _USER_INFO_1018;
+  {$EXTERNALSYM USER_INFO_1018}
+  TUserInfo1018 = USER_INFO_1018;
+  PUserInfo1018 = PUSER_INFO_1018;
+
+  LPUSER_INFO_1020 = ^USER_INFO_1020;
+  {$EXTERNALSYM LPUSER_INFO_1020}
+  PUSER_INFO_1020 = ^USER_INFO_1020;
+  {$EXTERNALSYM PUSER_INFO_1020}
+  _USER_INFO_1020 = record
+    usri1020_units_per_week: DWORD;
+    usri1020_logon_hours: LPBYTE;
+  end;
+  {$EXTERNALSYM _USER_INFO_1020}
+  USER_INFO_1020 = _USER_INFO_1020;
+  {$EXTERNALSYM USER_INFO_1020}
+  TUserInfo1020 = USER_INFO_1020;
+  PUserInfo1020 = PUSER_INFO_1020;
+
+  LPUSER_INFO_1023 = ^USER_INFO_1023;
+  {$EXTERNALSYM LPUSER_INFO_1023}
+  PUSER_INFO_1023 = ^USER_INFO_1023;
+  {$EXTERNALSYM PUSER_INFO_1023}
+  _USER_INFO_1023 = record
+    usri1023_logon_server: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1023}
+  USER_INFO_1023 = _USER_INFO_1023;
+  {$EXTERNALSYM USER_INFO_1023}
+  TUserInfo1023 = USER_INFO_1023;
+  PUserInfo1023 = PUSER_INFO_1023;
+
+  LPUSER_INFO_1024 = ^USER_INFO_1024;
+  {$EXTERNALSYM LPUSER_INFO_1024}
+  PUSER_INFO_1024 = ^USER_INFO_1024;
+  {$EXTERNALSYM PUSER_INFO_1024}
+  _USER_INFO_1024 = record
+    usri1024_country_code: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1024}
+  USER_INFO_1024 = _USER_INFO_1024;
+  {$EXTERNALSYM USER_INFO_1024}
+  TUserInfo1024 = USER_INFO_1024;
+  PUserInfo1024 = PUSER_INFO_1024;
+
+  LPUSER_INFO_1025 = ^USER_INFO_1025;
+  {$EXTERNALSYM LPUSER_INFO_1025}
+  PUSER_INFO_1025 = ^USER_INFO_1025;
+  {$EXTERNALSYM PUSER_INFO_1025}
+  _USER_INFO_1025 = record
+    usri1025_code_page: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1025}
+  USER_INFO_1025 = _USER_INFO_1025;
+  {$EXTERNALSYM USER_INFO_1025}
+  TUserInfo1025 = USER_INFO_1025;
+  PUserInfo1025 = PUSER_INFO_1025;
+
+  LPUSER_INFO_1051 = ^USER_INFO_1051;
+  {$EXTERNALSYM LPUSER_INFO_1051}
+  PUSER_INFO_1051 = ^USER_INFO_1051;
+  {$EXTERNALSYM PUSER_INFO_1051}
+  _USER_INFO_1051 = record
+    usri1051_primary_group_id: DWORD;
+  end;
+  {$EXTERNALSYM _USER_INFO_1051}
+  USER_INFO_1051 = _USER_INFO_1051;
+  {$EXTERNALSYM USER_INFO_1051}
+  TUserInfo1051 = USER_INFO_1051;
+  PUserInfo1051 = PUSER_INFO_1051;
+
+  LPUSER_INFO_1052 = ^USER_INFO_1052;
+  {$EXTERNALSYM LPUSER_INFO_1052}
+  PUSER_INFO_1052 = ^USER_INFO_1052;
+  {$EXTERNALSYM PUSER_INFO_1052}
+  _USER_INFO_1052 = record
+    usri1052_profile: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1052}
+  USER_INFO_1052 = _USER_INFO_1052;
+  {$EXTERNALSYM USER_INFO_1052}
+  TUserInfo1052 = USER_INFO_1052;
+  PUserInfo1052 = PUSER_INFO_1052;
+
+  LPUSER_INFO_1053 = ^USER_INFO_1053;
+  {$EXTERNALSYM LPUSER_INFO_1053}
+  PUSER_INFO_1053 = ^USER_INFO_1053;
+  {$EXTERNALSYM PUSER_INFO_1053}
+  _USER_INFO_1053 = record
+    usri1053_home_dir_drive: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_INFO_1053}
+  USER_INFO_1053 = _USER_INFO_1053;
+  {$EXTERNALSYM USER_INFO_1053}
+  TUserInfo1053 = USER_INFO_1053;
+  PUserInfo1053 = PUSER_INFO_1053;
+
+//
+//  Data Structures - User Modals
+//
+
+  LPUSER_MODALS_INFO_0 = ^USER_MODALS_INFO_0;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_0}
+  PUSER_MODALS_INFO_0 = ^USER_MODALS_INFO_0;
+  {$EXTERNALSYM PUSER_MODALS_INFO_0}
+  _USER_MODALS_INFO_0 = record
+    usrmod0_min_passwd_len: DWORD;
+    usrmod0_max_passwd_age: DWORD;
+    usrmod0_min_passwd_age: DWORD;
+    usrmod0_force_logoff: DWORD;
+    usrmod0_password_hist_len: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_0}
+  USER_MODALS_INFO_0 = _USER_MODALS_INFO_0;
+  {$EXTERNALSYM USER_MODALS_INFO_0}
+  TUserModalsInfo0 = USER_MODALS_INFO_0;
+  PUserModalsInfo0 = PUSER_MODALS_INFO_0;
+
+  LPUSER_MODALS_INFO_1 = ^USER_MODALS_INFO_1;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1}
+  PUSER_MODALS_INFO_1 = ^USER_MODALS_INFO_1;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1}
+  _USER_MODALS_INFO_1 = record
+    usrmod1_role: DWORD;
+    usrmod1_primary: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1}
+  USER_MODALS_INFO_1 = _USER_MODALS_INFO_1;
+  {$EXTERNALSYM USER_MODALS_INFO_1}
+  TUserModalsInfo1 = USER_MODALS_INFO_1;
+  PUserModalsInfo1 = PUSER_MODALS_INFO_1;
+
+  LPUSER_MODALS_INFO_2 = ^USER_MODALS_INFO_2;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_2}
+  PUSER_MODALS_INFO_2 = ^USER_MODALS_INFO_2;
+  {$EXTERNALSYM PUSER_MODALS_INFO_2}
+  _USER_MODALS_INFO_2 = record
+    usrmod2_domain_name: LPWSTR;
+    usrmod2_domain_id: PSID;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_2}
+  USER_MODALS_INFO_2 = _USER_MODALS_INFO_2;
+  {$EXTERNALSYM USER_MODALS_INFO_2}
+  TUserModalsInfo2 = USER_MODALS_INFO_2;
+  PUserModalsInfo2 = PUSER_MODALS_INFO_2;
+
+  LPUSER_MODALS_INFO_3 = ^USER_MODALS_INFO_3;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_3}
+  PUSER_MODALS_INFO_3 = ^USER_MODALS_INFO_3;
+  {$EXTERNALSYM PUSER_MODALS_INFO_3}
+  _USER_MODALS_INFO_3 = record
+    usrmod3_lockout_duration: DWORD;
+    usrmod3_lockout_observation_window: DWORD;
+    usrmod3_lockout_threshold: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_3}
+  USER_MODALS_INFO_3 = _USER_MODALS_INFO_3;
+  {$EXTERNALSYM USER_MODALS_INFO_3}
+  TUserModalsInfo3 = USER_MODALS_INFO_3;
+  PUserModalsInfo3 = PUSER_MODALS_INFO_3;
+
+  LPUSER_MODALS_INFO_1001 = ^USER_MODALS_INFO_1001;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1001}
+  PUSER_MODALS_INFO_1001 = ^USER_MODALS_INFO_1001;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1001}
+  _USER_MODALS_INFO_1001 = record
+    usrmod1001_min_passwd_len: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1001}
+  USER_MODALS_INFO_1001 = _USER_MODALS_INFO_1001;
+  {$EXTERNALSYM USER_MODALS_INFO_1001}
+  TUserModalsInfo1001 = USER_MODALS_INFO_1001;
+  PUserModalsInfo1001 = PUSER_MODALS_INFO_1001;
+
+  LPUSER_MODALS_INFO_1002 = ^USER_MODALS_INFO_1002;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1002}
+  PUSER_MODALS_INFO_1002 = ^USER_MODALS_INFO_1002;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1002}
+  _USER_MODALS_INFO_1002 = record
+    usrmod1002_max_passwd_age: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1002}
+  USER_MODALS_INFO_1002 = _USER_MODALS_INFO_1002;
+  {$EXTERNALSYM USER_MODALS_INFO_1002}
+  TUserModalsInfo1002 = USER_MODALS_INFO_1002;
+  PUserModalsInfo1002 = PUSER_MODALS_INFO_1002;
+
+  LPUSER_MODALS_INFO_1003 = ^USER_MODALS_INFO_1003;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1003}
+  PUSER_MODALS_INFO_1003 = ^USER_MODALS_INFO_1003;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1003}
+  _USER_MODALS_INFO_1003 = record
+    usrmod1003_min_passwd_age: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1003}
+  USER_MODALS_INFO_1003 = _USER_MODALS_INFO_1003;
+  {$EXTERNALSYM USER_MODALS_INFO_1003}
+  TUserModalsInfo1003 = USER_MODALS_INFO_1003;
+  PUserModalsInfo1003 = PUSER_MODALS_INFO_1003;
+
+  LPUSER_MODALS_INFO_1004 = ^USER_MODALS_INFO_1004;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1004}
+  PUSER_MODALS_INFO_1004 = ^USER_MODALS_INFO_1004;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1004}
+  _USER_MODALS_INFO_1004 = record
+    usrmod1004_force_logoff: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1004}
+  USER_MODALS_INFO_1004 = _USER_MODALS_INFO_1004;
+  {$EXTERNALSYM USER_MODALS_INFO_1004}
+  TUserModalsInfo1004 = USER_MODALS_INFO_1004;
+  PUserModalsInfo1004 = PUSER_MODALS_INFO_1004;
+
+  LPUSER_MODALS_INFO_1005 = ^USER_MODALS_INFO_1005;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1005}
+  PUSER_MODALS_INFO_1005 = ^USER_MODALS_INFO_1005;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1005}
+  _USER_MODALS_INFO_1005 = record
+    usrmod1005_password_hist_len: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1005}
+  USER_MODALS_INFO_1005 = _USER_MODALS_INFO_1005;
+  {$EXTERNALSYM USER_MODALS_INFO_1005}
+  TUserModalsInfo1005 = USER_MODALS_INFO_1005;
+  PUserModalsInfo1005 = PUSER_MODALS_INFO_1005;
+
+  LPUSER_MODALS_INFO_1006 = ^USER_MODALS_INFO_1006;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1006}
+  PUSER_MODALS_INFO_1006 = ^USER_MODALS_INFO_1006;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1006}
+  _USER_MODALS_INFO_1006 = record
+    usrmod1006_role: DWORD;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1006}
+  USER_MODALS_INFO_1006 = _USER_MODALS_INFO_1006;
+  {$EXTERNALSYM USER_MODALS_INFO_1006}
+  TUserModalsInfo1006 = USER_MODALS_INFO_1006;
+  PUserModalsInfo1006 = PUSER_MODALS_INFO_1006;
+
+  LPUSER_MODALS_INFO_1007 = ^USER_MODALS_INFO_1007;
+  {$EXTERNALSYM LPUSER_MODALS_INFO_1007}
+  PUSER_MODALS_INFO_1007 = ^USER_MODALS_INFO_1007;
+  {$EXTERNALSYM PUSER_MODALS_INFO_1007}
+  _USER_MODALS_INFO_1007 = record
+    usrmod1007_primary: LPWSTR;
+  end;
+  {$EXTERNALSYM _USER_MODALS_INFO_1007}
+  USER_MODALS_INFO_1007 = _USER_MODALS_INFO_1007;
+  {$EXTERNALSYM USER_MODALS_INFO_1007}
+  TUserModalsInfo1007 = USER_MODALS_INFO_1007;
+  PUserModalsInfo1007 = PUSER_MODALS_INFO_1007;
+
+//
+// Special Values and Constants - User
+//
+
+//
+//  Bit masks for field usriX_flags of USER_INFO_X (X = 0/1).
+//
+
+const
+  UF_SCRIPT                          = $0001;
+  {$EXTERNALSYM UF_SCRIPT}
+  UF_ACCOUNTDISABLE                  = $0002;
+  {$EXTERNALSYM UF_ACCOUNTDISABLE}
+  UF_HOMEDIR_REQUIRED                = $0008;
+  {$EXTERNALSYM UF_HOMEDIR_REQUIRED}
+  UF_LOCKOUT                         = $0010;
+  {$EXTERNALSYM UF_LOCKOUT}
+  UF_PASSWD_NOTREQD                  = $0020;
+  {$EXTERNALSYM UF_PASSWD_NOTREQD}
+  UF_PASSWD_CANT_CHANGE              = $0040;
+  {$EXTERNALSYM UF_PASSWD_CANT_CHANGE}
+  UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED = $0080;
+  {$EXTERNALSYM UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED}
+
+//
+// Account type bits as part of usri_flags.
+//
+
+  UF_TEMP_DUPLICATE_ACCOUNT    = $0100;
+  {$EXTERNALSYM UF_TEMP_DUPLICATE_ACCOUNT}
+  UF_NORMAL_ACCOUNT            = $0200;
+  {$EXTERNALSYM UF_NORMAL_ACCOUNT}
+  UF_INTERDOMAIN_TRUST_ACCOUNT = $0800;
+  {$EXTERNALSYM UF_INTERDOMAIN_TRUST_ACCOUNT}
+  UF_WORKSTATION_TRUST_ACCOUNT = $1000;
+  {$EXTERNALSYM UF_WORKSTATION_TRUST_ACCOUNT}
+  UF_SERVER_TRUST_ACCOUNT      = $2000;
+  {$EXTERNALSYM UF_SERVER_TRUST_ACCOUNT}
+
+  UF_MACHINE_ACCOUNT_MASK = UF_INTERDOMAIN_TRUST_ACCOUNT or UF_WORKSTATION_TRUST_ACCOUNT or UF_SERVER_TRUST_ACCOUNT;
+  {$EXTERNALSYM UF_MACHINE_ACCOUNT_MASK}
+
+  UF_ACCOUNT_TYPE_MASK = UF_TEMP_DUPLICATE_ACCOUNT or UF_NORMAL_ACCOUNT or UF_INTERDOMAIN_TRUST_ACCOUNT or UF_WORKSTATION_TRUST_ACCOUNT or UF_SERVER_TRUST_ACCOUNT;
+  {$EXTERNALSYM UF_ACCOUNT_TYPE_MASK}
+
+  UF_DONT_EXPIRE_PASSWD                     = $10000;
+  {$EXTERNALSYM UF_DONT_EXPIRE_PASSWD}
+  UF_MNS_LOGON_ACCOUNT                      = $20000;
+  {$EXTERNALSYM UF_MNS_LOGON_ACCOUNT}
+  UF_SMARTCARD_REQUIRED                     = $40000;
+  {$EXTERNALSYM UF_SMARTCARD_REQUIRED}
+  UF_TRUSTED_FOR_DELEGATION                 = $80000;
+  {$EXTERNALSYM UF_TRUSTED_FOR_DELEGATION}
+  UF_NOT_DELEGATED                          = $100000;
+  {$EXTERNALSYM UF_NOT_DELEGATED}
+  UF_USE_DES_KEY_ONLY                       = $200000;
+  {$EXTERNALSYM UF_USE_DES_KEY_ONLY}
+  UF_DONT_REQUIRE_PREAUTH                   = $400000;
+  {$EXTERNALSYM UF_DONT_REQUIRE_PREAUTH}
+  UF_PASSWORD_EXPIRED                       = DWORD($800000);
+  {$EXTERNALSYM UF_PASSWORD_EXPIRED}
+  UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = $1000000;
+  {$EXTERNALSYM UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION}
+
+  UF_SETTABLE_BITS =
+                    UF_SCRIPT or
+                    UF_ACCOUNTDISABLE or
+                    UF_LOCKOUT or
+                    UF_HOMEDIR_REQUIRED or
+                    UF_PASSWD_NOTREQD or
+                    UF_PASSWD_CANT_CHANGE or
+                    UF_ACCOUNT_TYPE_MASK or
+                    UF_DONT_EXPIRE_PASSWD or
+                    UF_MNS_LOGON_ACCOUNT or
+                    UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED or
+                    UF_SMARTCARD_REQUIRED or
+                    UF_TRUSTED_FOR_DELEGATION or
+                    UF_NOT_DELEGATED or
+                    UF_USE_DES_KEY_ONLY or
+                    UF_DONT_REQUIRE_PREAUTH or
+                    UF_PASSWORD_EXPIRED or
+                    UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION;
+  {$EXTERNALSYM UF_SETTABLE_BITS}
+
+//
+// bit masks for the NetUserEnum filter parameter.
+//
+
+  FILTER_TEMP_DUPLICATE_ACCOUNT = $0001;
+  {$EXTERNALSYM FILTER_TEMP_DUPLICATE_ACCOUNT}
+  FILTER_NORMAL_ACCOUNT         = $0002;
+  {$EXTERNALSYM FILTER_NORMAL_ACCOUNT}
+// #define FILTER_PROXY_ACCOUNT                (0x0004)
+  FILTER_INTERDOMAIN_TRUST_ACCOUNT = $0008;
+  {$EXTERNALSYM FILTER_INTERDOMAIN_TRUST_ACCOUNT}
+  FILTER_WORKSTATION_TRUST_ACCOUNT = $0010;
+  {$EXTERNALSYM FILTER_WORKSTATION_TRUST_ACCOUNT}
+  FILTER_SERVER_TRUST_ACCOUNT      = $0020;
+  {$EXTERNALSYM FILTER_SERVER_TRUST_ACCOUNT}
+
+//
+// bit masks for the NetUserGetLocalGroups flags
+//
+
+  LG_INCLUDE_INDIRECT = $0001;
+  {$EXTERNALSYM LG_INCLUDE_INDIRECT}
+
+//
+//  Bit masks for field usri2_auth_flags of USER_INFO_2.
+//
+
+  AF_OP_PRINT      = $1;
+  {$EXTERNALSYM AF_OP_PRINT}
+  AF_OP_COMM       = $2;
+  {$EXTERNALSYM AF_OP_COMM}
+  AF_OP_SERVER     = $4;
+  {$EXTERNALSYM AF_OP_SERVER}
+  AF_OP_ACCOUNTS   = $8;
+  {$EXTERNALSYM AF_OP_ACCOUNTS}
+  AF_SETTABLE_BITS = AF_OP_PRINT or AF_OP_COMM or AF_OP_SERVER or AF_OP_ACCOUNTS;
+  {$EXTERNALSYM AF_SETTABLE_BITS}
+
+//
+//  UAS role manifests under NETLOGON
+//
+
+  UAS_ROLE_STANDALONE = 0;
+  {$EXTERNALSYM UAS_ROLE_STANDALONE}
+  UAS_ROLE_MEMBER     = 1;
+  {$EXTERNALSYM UAS_ROLE_MEMBER}
+  UAS_ROLE_BACKUP     = 2;
+  {$EXTERNALSYM UAS_ROLE_BACKUP}
+  UAS_ROLE_PRIMARY    = 3;
+  {$EXTERNALSYM UAS_ROLE_PRIMARY}
+
+//
+//  Values for ParmError for NetUserSetInfo.
+//
+
+  USER_NAME_PARMNUM           = 1;
+  {$EXTERNALSYM USER_NAME_PARMNUM}
+  USER_PASSWORD_PARMNUM       = 3;
+  {$EXTERNALSYM USER_PASSWORD_PARMNUM}
+  USER_PASSWORD_AGE_PARMNUM   = 4;
+  {$EXTERNALSYM USER_PASSWORD_AGE_PARMNUM}
+  USER_PRIV_PARMNUM           = 5;
+  {$EXTERNALSYM USER_PRIV_PARMNUM}
+  USER_HOME_DIR_PARMNUM       = 6;
+  {$EXTERNALSYM USER_HOME_DIR_PARMNUM}
+  USER_COMMENT_PARMNUM        = 7;
+  {$EXTERNALSYM USER_COMMENT_PARMNUM}
+  USER_FLAGS_PARMNUM          = 8;
+  {$EXTERNALSYM USER_FLAGS_PARMNUM}
+  USER_SCRIPT_PATH_PARMNUM    = 9;
+  {$EXTERNALSYM USER_SCRIPT_PATH_PARMNUM}
+  USER_AUTH_FLAGS_PARMNUM     = 10;
+  {$EXTERNALSYM USER_AUTH_FLAGS_PARMNUM}
+  USER_FULL_NAME_PARMNUM      = 11;
+  {$EXTERNALSYM USER_FULL_NAME_PARMNUM}
+  USER_USR_COMMENT_PARMNUM    = 12;
+  {$EXTERNALSYM USER_USR_COMMENT_PARMNUM}
+  USER_PARMS_PARMNUM          = 13;
+  {$EXTERNALSYM USER_PARMS_PARMNUM}
+  USER_WORKSTATIONS_PARMNUM   = 14;
+  {$EXTERNALSYM USER_WORKSTATIONS_PARMNUM}
+  USER_LAST_LOGON_PARMNUM     = 15;
+  {$EXTERNALSYM USER_LAST_LOGON_PARMNUM}
+  USER_LAST_LOGOFF_PARMNUM    = 16;
+  {$EXTERNALSYM USER_LAST_LOGOFF_PARMNUM}
+  USER_ACCT_EXPIRES_PARMNUM   = 17;
+  {$EXTERNALSYM USER_ACCT_EXPIRES_PARMNUM}
+  USER_MAX_STORAGE_PARMNUM    = 18;
+  {$EXTERNALSYM USER_MAX_STORAGE_PARMNUM}
+  USER_UNITS_PER_WEEK_PARMNUM = 19;
+  {$EXTERNALSYM USER_UNITS_PER_WEEK_PARMNUM}
+  USER_LOGON_HOURS_PARMNUM    = 20;
+  {$EXTERNALSYM USER_LOGON_HOURS_PARMNUM}
+  USER_PAD_PW_COUNT_PARMNUM   = 21;
+  {$EXTERNALSYM USER_PAD_PW_COUNT_PARMNUM}
+  USER_NUM_LOGONS_PARMNUM     = 22;
+  {$EXTERNALSYM USER_NUM_LOGONS_PARMNUM}
+  USER_LOGON_SERVER_PARMNUM   = 23;
+  {$EXTERNALSYM USER_LOGON_SERVER_PARMNUM}
+  USER_COUNTRY_CODE_PARMNUM   = 24;
+  {$EXTERNALSYM USER_COUNTRY_CODE_PARMNUM}
+  USER_CODE_PAGE_PARMNUM      = 25;
+  {$EXTERNALSYM USER_CODE_PAGE_PARMNUM}
+  USER_PRIMARY_GROUP_PARMNUM  = 51;
+  {$EXTERNALSYM USER_PRIMARY_GROUP_PARMNUM}
+  USER_PROFILE                = 52; // ?? Delete when convenient
+  {$EXTERNALSYM USER_PROFILE}
+  USER_PROFILE_PARMNUM        = 52;
+  {$EXTERNALSYM USER_PROFILE_PARMNUM}
+  USER_HOME_DIR_DRIVE_PARMNUM = 53;
+  {$EXTERNALSYM USER_HOME_DIR_DRIVE_PARMNUM}
+
+//
+// the new infolevel counterparts of the old info level + parmnum
+//
+
+  USER_NAME_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + USER_NAME_PARMNUM;
+  {$EXTERNALSYM USER_NAME_INFOLEVEL}
+  USER_PASSWORD_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_PARMNUM;
+  {$EXTERNALSYM USER_PASSWORD_INFOLEVEL}
+  USER_PASSWORD_AGE_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_PASSWORD_AGE_PARMNUM;
+  {$EXTERNALSYM USER_PASSWORD_AGE_INFOLEVEL}
+  USER_PRIV_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + USER_PRIV_PARMNUM;
+  {$EXTERNALSYM USER_PRIV_INFOLEVEL}
+  USER_HOME_DIR_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_PARMNUM;
+  {$EXTERNALSYM USER_HOME_DIR_INFOLEVEL}
+  USER_COMMENT_INFOLEVEL        = PARMNUM_BASE_INFOLEVEL + USER_COMMENT_PARMNUM;
+  {$EXTERNALSYM USER_COMMENT_INFOLEVEL}
+  USER_FLAGS_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + USER_FLAGS_PARMNUM;
+  {$EXTERNALSYM USER_FLAGS_INFOLEVEL}
+  USER_SCRIPT_PATH_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + USER_SCRIPT_PATH_PARMNUM;
+  {$EXTERNALSYM USER_SCRIPT_PATH_INFOLEVEL}
+  USER_AUTH_FLAGS_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + USER_AUTH_FLAGS_PARMNUM;
+  {$EXTERNALSYM USER_AUTH_FLAGS_INFOLEVEL}
+  USER_FULL_NAME_INFOLEVEL      = PARMNUM_BASE_INFOLEVEL + USER_FULL_NAME_PARMNUM;
+  {$EXTERNALSYM USER_FULL_NAME_INFOLEVEL}
+  USER_USR_COMMENT_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + USER_USR_COMMENT_PARMNUM;
+  {$EXTERNALSYM USER_USR_COMMENT_INFOLEVEL}
+  USER_PARMS_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + USER_PARMS_PARMNUM;
+  {$EXTERNALSYM USER_PARMS_INFOLEVEL}
+  USER_WORKSTATIONS_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_WORKSTATIONS_PARMNUM;
+  {$EXTERNALSYM USER_WORKSTATIONS_INFOLEVEL}
+  USER_LAST_LOGON_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGON_PARMNUM;
+  {$EXTERNALSYM USER_LAST_LOGON_INFOLEVEL}
+  USER_LAST_LOGOFF_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + USER_LAST_LOGOFF_PARMNUM;
+  {$EXTERNALSYM USER_LAST_LOGOFF_INFOLEVEL}
+  USER_ACCT_EXPIRES_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_ACCT_EXPIRES_PARMNUM;
+  {$EXTERNALSYM USER_ACCT_EXPIRES_INFOLEVEL}
+  USER_MAX_STORAGE_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + USER_MAX_STORAGE_PARMNUM;
+  {$EXTERNALSYM USER_MAX_STORAGE_INFOLEVEL}
+  USER_UNITS_PER_WEEK_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + USER_UNITS_PER_WEEK_PARMNUM;
+  {$EXTERNALSYM USER_UNITS_PER_WEEK_INFOLEVEL}
+  USER_LOGON_HOURS_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + USER_LOGON_HOURS_PARMNUM;
+  {$EXTERNALSYM USER_LOGON_HOURS_INFOLEVEL}
+  USER_PAD_PW_COUNT_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_PAD_PW_COUNT_PARMNUM;
+  {$EXTERNALSYM USER_PAD_PW_COUNT_INFOLEVEL}
+  USER_NUM_LOGONS_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + USER_NUM_LOGONS_PARMNUM;
+  {$EXTERNALSYM USER_NUM_LOGONS_INFOLEVEL}
+  USER_LOGON_SERVER_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_LOGON_SERVER_PARMNUM;
+  {$EXTERNALSYM USER_LOGON_SERVER_INFOLEVEL}
+  USER_COUNTRY_CODE_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + USER_COUNTRY_CODE_PARMNUM;
+  {$EXTERNALSYM USER_COUNTRY_CODE_INFOLEVEL}
+  USER_CODE_PAGE_INFOLEVEL      = PARMNUM_BASE_INFOLEVEL + USER_CODE_PAGE_PARMNUM;
+  {$EXTERNALSYM USER_CODE_PAGE_INFOLEVEL}
+  USER_PRIMARY_GROUP_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + USER_PRIMARY_GROUP_PARMNUM;
+  {$EXTERNALSYM USER_PRIMARY_GROUP_INFOLEVEL}
+//  todo USER_POSIX_ID_PARMNUM where is it defined?
+//  USER_POSIX_ID_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + USER_POSIX_ID_PARMNUM;
+//  {$EXTERNALSYM USER_POSIX_ID_INFOLEVEL}
+  USER_HOME_DIR_DRIVE_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + USER_HOME_DIR_DRIVE_PARMNUM;
+  {$EXTERNALSYM USER_HOME_DIR_DRIVE_INFOLEVEL}
+
+//
+//  For SetInfo call (parmnum 0) when password change not required
+//
+
+  NULL_USERSETINFO_PASSWD = '              ';
+  {$EXTERNALSYM NULL_USERSETINFO_PASSWD}
+
+  TIMEQ_FOREVER             = ULONG(-1);
+  {$EXTERNALSYM TIMEQ_FOREVER}
+  USER_MAXSTORAGE_UNLIMITED = ULONG(-1);
+  {$EXTERNALSYM USER_MAXSTORAGE_UNLIMITED}
+  USER_NO_LOGOFF            = ULONG(-1);
+  {$EXTERNALSYM USER_NO_LOGOFF}
+  UNITS_PER_DAY             = 24;
+  {$EXTERNALSYM UNITS_PER_DAY}
+  UNITS_PER_WEEK            = UNITS_PER_DAY * 7;
+  {$EXTERNALSYM UNITS_PER_WEEK}
+
+//
+// Privilege levels (USER_INFO_X field usriX_priv (X = 0/1)).
+//
+
+  USER_PRIV_MASK  = $3;
+  {$EXTERNALSYM USER_PRIV_MASK}
+  USER_PRIV_GUEST = 0;
+  {$EXTERNALSYM USER_PRIV_GUEST}
+  USER_PRIV_USER  = 1;
+  {$EXTERNALSYM USER_PRIV_USER}
+  USER_PRIV_ADMIN = 2;
+  {$EXTERNALSYM USER_PRIV_ADMIN}
+
+//
+// user modals related defaults
+//
+
+  MAX_PASSWD_LEN   = PWLEN;
+  {$EXTERNALSYM MAX_PASSWD_LEN}
+  DEF_MIN_PWLEN    = 6;
+  {$EXTERNALSYM DEF_MIN_PWLEN}
+  DEF_PWUNIQUENESS = 5;
+  {$EXTERNALSYM DEF_PWUNIQUENESS}
+  DEF_MAX_PWHIST   = 8;
+  {$EXTERNALSYM DEF_MAX_PWHIST}
+
+  DEF_MAX_PWAGE    = TIMEQ_FOREVER; // forever
+  {$EXTERNALSYM DEF_MAX_PWAGE}
+  DEF_MIN_PWAGE    = 0; // 0 days
+  {$EXTERNALSYM DEF_MIN_PWAGE}
+  DEF_FORCE_LOGOFF = ULONG($ffffffff); // never
+  {$EXTERNALSYM DEF_FORCE_LOGOFF}
+  DEF_MAX_BADPW    = 0; // no limit
+  {$EXTERNALSYM DEF_MAX_BADPW}
+  ONE_DAY          = ULONG(01*24*3600); // 01 day
+  {$EXTERNALSYM ONE_DAY}
+
+//
+// User Logon Validation (codes returned)
+//
+
+  VALIDATED_LOGON     = 0;
+  {$EXTERNALSYM VALIDATED_LOGON}
+  PASSWORD_EXPIRED    = 2;
+  {$EXTERNALSYM PASSWORD_EXPIRED}
+  NON_VALIDATED_LOGON = 3;
+  {$EXTERNALSYM NON_VALIDATED_LOGON}
+
+  VALID_LOGOFF = 1;
+  {$EXTERNALSYM VALID_LOGOFF}
+
+//
+// parmnum manifests for user modals
+//
+
+  MODALS_MIN_PASSWD_LEN_PARMNUM             = 1;
+  {$EXTERNALSYM MODALS_MIN_PASSWD_LEN_PARMNUM}
+  MODALS_MAX_PASSWD_AGE_PARMNUM             = 2;
+  {$EXTERNALSYM MODALS_MAX_PASSWD_AGE_PARMNUM}
+  MODALS_MIN_PASSWD_AGE_PARMNUM             = 3;
+  {$EXTERNALSYM MODALS_MIN_PASSWD_AGE_PARMNUM}
+  MODALS_FORCE_LOGOFF_PARMNUM               = 4;
+  {$EXTERNALSYM MODALS_FORCE_LOGOFF_PARMNUM}
+  MODALS_PASSWD_HIST_LEN_PARMNUM            = 5;
+  {$EXTERNALSYM MODALS_PASSWD_HIST_LEN_PARMNUM}
+  MODALS_ROLE_PARMNUM                       = 6;
+  {$EXTERNALSYM MODALS_ROLE_PARMNUM}
+  MODALS_PRIMARY_PARMNUM                    = 7;
+  {$EXTERNALSYM MODALS_PRIMARY_PARMNUM}
+  MODALS_DOMAIN_NAME_PARMNUM                = 8;
+  {$EXTERNALSYM MODALS_DOMAIN_NAME_PARMNUM}
+  MODALS_DOMAIN_ID_PARMNUM                  = 9;
+  {$EXTERNALSYM MODALS_DOMAIN_ID_PARMNUM}
+  MODALS_LOCKOUT_DURATION_PARMNUM           = 10;
+  {$EXTERNALSYM MODALS_LOCKOUT_DURATION_PARMNUM}
+  MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM = 11;
+  {$EXTERNALSYM MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUM}
+  MODALS_LOCKOUT_THRESHOLD_PARMNUM          = 12;
+  {$EXTERNALSYM MODALS_LOCKOUT_THRESHOLD_PARMNUM}
+
+//
+// the new infolevel counterparts of the old info level + parmnum
+//
+
+  MODALS_MIN_PASSWD_LEN_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_LEN_PARMNUM;
+  {$EXTERNALSYM MODALS_MIN_PASSWD_LEN_INFOLEVEL}
+  MODALS_MAX_PASSWD_AGE_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + MODALS_MAX_PASSWD_AGE_PARMNUM;
+  {$EXTERNALSYM MODALS_MAX_PASSWD_AGE_INFOLEVEL}
+  MODALS_MIN_PASSWD_AGE_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + MODALS_MIN_PASSWD_AGE_PARMNUM;
+  {$EXTERNALSYM MODALS_MIN_PASSWD_AGE_INFOLEVEL}
+  MODALS_FORCE_LOGOFF_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + MODALS_FORCE_LOGOFF_PARMNUM;
+  {$EXTERNALSYM MODALS_FORCE_LOGOFF_INFOLEVEL}
+  MODALS_PASSWD_HIST_LEN_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + MODALS_PASSWD_HIST_LEN_PARMNUM;
+  {$EXTERNALSYM MODALS_PASSWD_HIST_LEN_INFOLEVEL}
+  MODALS_ROLE_INFOLEVEL            = PARMNUM_BASE_INFOLEVEL + MODALS_ROLE_PARMNUM;
+  {$EXTERNALSYM MODALS_ROLE_INFOLEVEL}
+  MODALS_PRIMARY_INFOLEVEL         = PARMNUM_BASE_INFOLEVEL + MODALS_PRIMARY_PARMNUM;
+  {$EXTERNALSYM MODALS_PRIMARY_INFOLEVEL}
+  MODALS_DOMAIN_NAME_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_NAME_PARMNUM;
+  {$EXTERNALSYM MODALS_DOMAIN_NAME_INFOLEVEL}
+  MODALS_DOMAIN_ID_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + MODALS_DOMAIN_ID_PARMNUM;
+  {$EXTERNALSYM MODALS_DOMAIN_ID_INFOLEVEL}
+
+//
+// Group Class
+//
+
+//
+// Function Prototypes
+//
+
+function NetGroupAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupAdd}
+
+function NetGroupAddUser(servername, GroupName, username: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupAddUser}
+
+function NetGroupEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; resume_handle: PDWORD_PTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupEnum}
+
+function NetGroupGetInfo(servername, groupname: LPCWSTR; level: DWORD; bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupGetInfo}
+
+function NetGroupSetInfo(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupSetInfo}
+
+function NetGroupDel(servername: LPCWSTR; groupname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupDel}
+
+function NetGroupDelUser(servername: LPCWSTR; GroupName: LPCWSTR; Username: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupDelUser}
+
+function NetGroupGetUsers(servername, groupname: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; ResumeHandle: PDWORD_PTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupGetUsers}
+
+function NetGroupSetUsers(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; totalentries: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGroupSetUsers}
+
+//
+//  Data Structures - Group
+//
+
+type
+  LPGROUP_INFO_0 = ^GROUP_INFO_0;
+  {$EXTERNALSYM LPGROUP_INFO_0}
+  PGROUP_INFO_0 = ^GROUP_INFO_0;
+  {$EXTERNALSYM PGROUP_INFO_0}
+  _GROUP_INFO_0 = record
+    grpi0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_0}
+  GROUP_INFO_0 = _GROUP_INFO_0;
+  {$EXTERNALSYM GROUP_INFO_0}
+  TGroupInfo0 = GROUP_INFO_0;
+  PGroupInfo0 = PGROUP_INFO_0;
+
+  LPGROUP_INFO_1 = ^GROUP_INFO_1;
+  {$EXTERNALSYM LPGROUP_INFO_1}
+  PGROUP_INFO_1 = ^GROUP_INFO_1;
+  {$EXTERNALSYM PGROUP_INFO_1}
+  _GROUP_INFO_1 = record
+    grpi1_name: LPWSTR;
+    grpi1_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_1}
+  GROUP_INFO_1 = _GROUP_INFO_1;
+  {$EXTERNALSYM GROUP_INFO_1}
+  TGroupInfo1 = GROUP_INFO_1;
+  PGroupInfo1 = PGROUP_INFO_1;
+
+  LPGROUP_INFO_2 = ^GROUP_INFO_2;
+  {$EXTERNALSYM LPGROUP_INFO_2}
+  PGROUP_INFO_2 = ^GROUP_INFO_2;
+  {$EXTERNALSYM PGROUP_INFO_2}
+  _GROUP_INFO_2 = record
+    grpi2_name: LPWSTR;
+    grpi2_comment: LPWSTR;
+    grpi2_group_id: DWORD;
+    grpi2_attributes: DWORD;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_2}
+  GROUP_INFO_2 = _GROUP_INFO_2;
+  {$EXTERNALSYM GROUP_INFO_2}
+  TGroupInfo2 = GROUP_INFO_2;
+  PGroupInfo2 = PGROUP_INFO_2;
+
+  LPGROUP_INFO_3 = ^GROUP_INFO_3;
+  {$EXTERNALSYM LPGROUP_INFO_3}
+  PGROUP_INFO_3 = ^GROUP_INFO_3;
+  {$EXTERNALSYM PGROUP_INFO_3}
+  _GROUP_INFO_3 = record
+    grpi3_name: LPWSTR;
+    grpi3_comment: LPWSTR;
+    grpi3_group_sid: PSID;
+    grpi3_attributes: DWORD;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_3}
+  GROUP_INFO_3 = _GROUP_INFO_3;
+  {$EXTERNALSYM GROUP_INFO_3}
+  TGroupInfo3 = GROUP_INFO_3;
+  PGroupInfo3 = PGROUP_INFO_3;
+
+  LPGROUP_INFO_1002 = ^GROUP_INFO_1002;
+  {$EXTERNALSYM LPGROUP_INFO_1002}
+  PGROUP_INFO_1002 = ^GROUP_INFO_1002;
+  {$EXTERNALSYM PGROUP_INFO_1002}
+  _GROUP_INFO_1002 = record
+    grpi1002_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_1002}
+  GROUP_INFO_1002 = _GROUP_INFO_1002;
+  {$EXTERNALSYM GROUP_INFO_1002}
+  TGroupInfo1002 = GROUP_INFO_1002;
+  PGroupInfo1002 = PGROUP_INFO_1002;
+
+  LPGROUP_INFO_1005 = ^GROUP_INFO_1005;
+  {$EXTERNALSYM LPGROUP_INFO_1005}
+  PGROUP_INFO_1005 = ^GROUP_INFO_1005;
+  {$EXTERNALSYM PGROUP_INFO_1005}
+  _GROUP_INFO_1005 = record
+    grpi1005_attributes: DWORD;
+  end;
+  {$EXTERNALSYM _GROUP_INFO_1005}
+  GROUP_INFO_1005 = _GROUP_INFO_1005;
+  {$EXTERNALSYM GROUP_INFO_1005}
+  TGroupInfo1005 = GROUP_INFO_1005;
+  PGroupInfo1005 = PGROUP_INFO_1005;
+
+  LPGROUP_USERS_INFO_0 = ^GROUP_USERS_INFO_0;
+  {$EXTERNALSYM LPGROUP_USERS_INFO_0}
+  PGROUP_USERS_INFO_0 = ^GROUP_USERS_INFO_0;
+  {$EXTERNALSYM PGROUP_USERS_INFO_0}
+  _GROUP_USERS_INFO_0 = record
+    grui0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _GROUP_USERS_INFO_0}
+  GROUP_USERS_INFO_0 = _GROUP_USERS_INFO_0;
+  {$EXTERNALSYM GROUP_USERS_INFO_0}
+  TGroupUsersInfo0 = GROUP_USERS_INFO_0;
+  PGroupUsersInfo0 = PGROUP_USERS_INFO_0;
+
+  LPGROUP_USERS_INFO_1 = ^GROUP_USERS_INFO_1;
+  {$EXTERNALSYM LPGROUP_USERS_INFO_1}
+  PGROUP_USERS_INFO_1 = ^GROUP_USERS_INFO_1;
+  {$EXTERNALSYM PGROUP_USERS_INFO_1}
+  _GROUP_USERS_INFO_1 = record
+    grui1_name: LPWSTR;
+    grui1_attributes: DWORD;
+  end;
+  {$EXTERNALSYM _GROUP_USERS_INFO_1}
+  GROUP_USERS_INFO_1 = _GROUP_USERS_INFO_1;
+  {$EXTERNALSYM GROUP_USERS_INFO_1}
+  TGroupUsersInfo1 = GROUP_USERS_INFO_1;
+  PGroupUsersInfo1 = PGROUP_USERS_INFO_1;
+
+//
+// Special Values and Constants - Group
+//
+
+const
+  GROUPIDMASK = $8000; // MSB set if uid refers to a group
+  {$EXTERNALSYM GROUPIDMASK}
+
+//
+// Predefined group for all normal users, administrators and guests
+// LOCAL is a special group for pinball local security.
+//
+
+  GROUP_SPECIALGRP_USERS  = WideString('USERS');
+  {$EXTERNALSYM GROUP_SPECIALGRP_USERS}
+  GROUP_SPECIALGRP_ADMINS = WideString('ADMINS');
+  {$EXTERNALSYM GROUP_SPECIALGRP_ADMINS}
+  GROUP_SPECIALGRP_GUESTS = WideString('GUESTS');
+  {$EXTERNALSYM GROUP_SPECIALGRP_GUESTS}
+  GROUP_SPECIALGRP_LOCAL  = WideString('LOCAL');
+  {$EXTERNALSYM GROUP_SPECIALGRP_LOCAL}
+
+//
+// parmnum manifests for SetInfo calls (only comment is settable)
+//
+
+  GROUP_ALL_PARMNUM        = 0;
+  {$EXTERNALSYM GROUP_ALL_PARMNUM}
+  GROUP_NAME_PARMNUM       = 1;
+  {$EXTERNALSYM GROUP_NAME_PARMNUM}
+  GROUP_COMMENT_PARMNUM    = 2;
+  {$EXTERNALSYM GROUP_COMMENT_PARMNUM}
+  GROUP_ATTRIBUTES_PARMNUM = 3;
+  {$EXTERNALSYM GROUP_ATTRIBUTES_PARMNUM}
+
+//
+// the new infolevel counterparts of the old info level + parmnum
+//
+
+  GROUP_ALL_INFOLEVEL        = PARMNUM_BASE_INFOLEVEL + GROUP_ALL_PARMNUM;
+  {$EXTERNALSYM GROUP_ALL_INFOLEVEL}
+  GROUP_NAME_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + GROUP_NAME_PARMNUM;
+  {$EXTERNALSYM GROUP_NAME_INFOLEVEL}
+  GROUP_COMMENT_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + GROUP_COMMENT_PARMNUM;
+  {$EXTERNALSYM GROUP_COMMENT_INFOLEVEL}
+  GROUP_ATTRIBUTES_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + GROUP_ATTRIBUTES_PARMNUM;
+  {$EXTERNALSYM GROUP_ATTRIBUTES_INFOLEVEL}
+//  todo see GROUP_POSIX_ID_PARMNUM
+//  GROUP_POSIX_ID_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + GROUP_POSIX_ID_PARMNUM;
+//  {$EXTERNALSYM GROUP_POSIX_ID_INFOLEVEL}
+
+//
+// LocalGroup Class
+//
+
+//
+// Function Prototypes
+//
+
+function NetLocalGroupAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupAdd}
+
+function NetLocalGroupAddMember(servername, groupname: LPCWSTR; membersid: PSID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupAddMember}
+
+function NetLocalGroupEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; resumehandle: PDWORD_PTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupEnum}
+
+function NetLocalGroupGetInfo(servername, groupname: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupGetInfo}
+
+function NetLocalGroupSetInfo(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupSetInfo}
+
+function NetLocalGroupDel(servername: LPCWSTR; groupname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupDel}
+
+function NetLocalGroupDelMember(servername: LPCWSTR; groupname: LPCWSTR; membersid: PSID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupDelMember}
+
+function NetLocalGroupGetMembers(servername, localgroupname: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; resumehandle: PDWORD_PTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupGetMembers}
+
+function NetLocalGroupSetMembers(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; totalentries: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupSetMembers}
+
+function NetLocalGroupAddMembers(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; totalentries: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupAddMembers}
+
+function NetLocalGroupDelMembers(servername, groupname: LPCWSTR; level: DWORD; buf: LPBYTE; totalentries: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetLocalGroupDelMembers}
+
+//
+//  Data Structures - LocalGroup
+//
+
+type
+  LPLOCALGROUP_INFO_0 = ^LOCALGROUP_INFO_0;
+  {$EXTERNALSYM LPLOCALGROUP_INFO_0}
+  PLOCALGROUP_INFO_0 = ^LOCALGROUP_INFO_0;
+  {$EXTERNALSYM PLOCALGROUP_INFO_0}
+  _LOCALGROUP_INFO_0 = record
+    lgrpi0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_INFO_0}
+  LOCALGROUP_INFO_0 = _LOCALGROUP_INFO_0;
+  {$EXTERNALSYM LOCALGROUP_INFO_0}
+  TLocalGroupInfo0 = LOCALGROUP_INFO_0;
+  PLocalGroupInfo0 = PLOCALGROUP_INFO_0;
+
+  LPLOCALGROUP_INFO_1 = ^LOCALGROUP_INFO_1;
+  {$EXTERNALSYM LPLOCALGROUP_INFO_1}
+  PLOCALGROUP_INFO_1 = ^LOCALGROUP_INFO_1;
+  {$EXTERNALSYM PLOCALGROUP_INFO_1}
+  _LOCALGROUP_INFO_1 = record
+    lgrpi1_name: LPWSTR;
+    lgrpi1_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_INFO_1}
+  LOCALGROUP_INFO_1 = _LOCALGROUP_INFO_1;
+  {$EXTERNALSYM LOCALGROUP_INFO_1}
+  TLocalGroupInfo1 = LOCALGROUP_INFO_1;
+  PLocalGroupInfo1 = PLOCALGROUP_INFO_1;
+
+  LPLOCALGROUP_INFO_1002 = ^LOCALGROUP_INFO_1002;
+  {$EXTERNALSYM LPLOCALGROUP_INFO_1002}
+  PLOCALGROUP_INFO_1002 = ^LOCALGROUP_INFO_1002;
+  {$EXTERNALSYM PLOCALGROUP_INFO_1002}
+  _LOCALGROUP_INFO_1002 = record
+    lgrpi1002_comment: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_INFO_1002}
+  LOCALGROUP_INFO_1002 = _LOCALGROUP_INFO_1002;
+  {$EXTERNALSYM LOCALGROUP_INFO_1002}
+  TLocalGroupInfo1002 = LOCALGROUP_INFO_1002;
+  PLocalGroupInfo1002 = PLOCALGROUP_INFO_1002;
+
+  LPLOCALGROUP_MEMBERS_INFO_0 = ^LOCALGROUP_MEMBERS_INFO_0;
+  {$EXTERNALSYM LPLOCALGROUP_MEMBERS_INFO_0}
+  PLOCALGROUP_MEMBERS_INFO_0 = ^LOCALGROUP_MEMBERS_INFO_0;
+  {$EXTERNALSYM PLOCALGROUP_MEMBERS_INFO_0}
+  _LOCALGROUP_MEMBERS_INFO_0 = record
+    lgrmi0_sid: PSID;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_MEMBERS_INFO_0}
+  LOCALGROUP_MEMBERS_INFO_0 = _LOCALGROUP_MEMBERS_INFO_0;
+  {$EXTERNALSYM LOCALGROUP_MEMBERS_INFO_0}
+  TLocalGroupMembersInfo0 = LOCALGROUP_MEMBERS_INFO_0;
+  PLocalGroupMembersInfo0 = PLOCALGROUP_MEMBERS_INFO_0;
+
+  LPLOCALGROUP_MEMBERS_INFO_1 = ^LOCALGROUP_MEMBERS_INFO_1;
+  {$EXTERNALSYM LPLOCALGROUP_MEMBERS_INFO_1}
+  PLOCALGROUP_MEMBERS_INFO_1 = ^LOCALGROUP_MEMBERS_INFO_1;
+  {$EXTERNALSYM PLOCALGROUP_MEMBERS_INFO_1}
+  _LOCALGROUP_MEMBERS_INFO_1 = record
+    lgrmi1_sid: PSID;
+    lgrmi1_sidusage: SID_NAME_USE;
+    lgrmi1_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_MEMBERS_INFO_1}
+  LOCALGROUP_MEMBERS_INFO_1 = _LOCALGROUP_MEMBERS_INFO_1;
+  {$EXTERNALSYM LOCALGROUP_MEMBERS_INFO_1}
+  TLocalGroupMembersInfo1 = LOCALGROUP_MEMBERS_INFO_1;
+  PLocalGroupMembersInfo1 = PLOCALGROUP_MEMBERS_INFO_1;
+
+  LPLOCALGROUP_MEMBERS_INFO_2 = ^LOCALGROUP_MEMBERS_INFO_2;
+  {$EXTERNALSYM LPLOCALGROUP_MEMBERS_INFO_2}
+  PLOCALGROUP_MEMBERS_INFO_2 = ^LOCALGROUP_MEMBERS_INFO_2;
+  {$EXTERNALSYM PLOCALGROUP_MEMBERS_INFO_2}
+  _LOCALGROUP_MEMBERS_INFO_2 = record
+    lgrmi2_sid: PSID;
+    lgrmi2_sidusage: SID_NAME_USE;
+    lgrmi2_domainandname: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_MEMBERS_INFO_2}
+  LOCALGROUP_MEMBERS_INFO_2 = _LOCALGROUP_MEMBERS_INFO_2;
+  {$EXTERNALSYM LOCALGROUP_MEMBERS_INFO_2}
+  TLocalGroupMembersInfo2 = LOCALGROUP_MEMBERS_INFO_2;
+  PLocalGroupMembersInfo2 = PLOCALGROUP_MEMBERS_INFO_2;
+
+  LPLOCALGROUP_MEMBERS_INFO_3 = ^LOCALGROUP_MEMBERS_INFO_3;
+  {$EXTERNALSYM LPLOCALGROUP_MEMBERS_INFO_3}
+  PLOCALGROUP_MEMBERS_INFO_3 = ^LOCALGROUP_MEMBERS_INFO_3;
+  {$EXTERNALSYM PLOCALGROUP_MEMBERS_INFO_3}
+  _LOCALGROUP_MEMBERS_INFO_3 = record
+    lgrmi3_domainandname: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_MEMBERS_INFO_3}
+  LOCALGROUP_MEMBERS_INFO_3 = _LOCALGROUP_MEMBERS_INFO_3;
+  {$EXTERNALSYM LOCALGROUP_MEMBERS_INFO_3}
+  TLocalGroupMembersInfo3 = LOCALGROUP_MEMBERS_INFO_3;
+  PLocalGroupMembersInfo3 = PLOCALGROUP_MEMBERS_INFO_3;
+
+  LPLOCALGROUP_USERS_INFO_0 = ^LOCALGROUP_USERS_INFO_0;
+  {$EXTERNALSYM LPLOCALGROUP_USERS_INFO_0}
+  PLOCALGROUP_USERS_INFO_0 = ^LOCALGROUP_USERS_INFO_0;
+  {$EXTERNALSYM PLOCALGROUP_USERS_INFO_0}
+  _LOCALGROUP_USERS_INFO_0 = record
+    lgrui0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _LOCALGROUP_USERS_INFO_0}
+  LOCALGROUP_USERS_INFO_0 = _LOCALGROUP_USERS_INFO_0;
+  {$EXTERNALSYM LOCALGROUP_USERS_INFO_0}
+  TLocalGroupUsersInfo0 = LOCALGROUP_USERS_INFO_0;
+  PLocalGroupUsersInfo0 = PLOCALGROUP_USERS_INFO_0;
+
+const
+  LOCALGROUP_NAME_PARMNUM    = 1;
+  {$EXTERNALSYM LOCALGROUP_NAME_PARMNUM}
+  LOCALGROUP_COMMENT_PARMNUM = 2;
+  {$EXTERNALSYM LOCALGROUP_COMMENT_PARMNUM}
+
+//
+// Display Information APIs
+//
+
+function NetQueryDisplayInformation(ServerName: LPCWSTR; Level, Index, EntriesRequested, PreferredMaximumLength: DWORD; ReturnedEntryCount: LPDWORD; var SortedBuffer: PVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetQueryDisplayInformation}
+
+function NetGetDisplayInformationIndex(ServerName: LPCWSTR; Level: DWORD; Prefix: LPCWSTR; Index: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGetDisplayInformationIndex}
+
+//
+// QueryDisplayInformation levels
+
+type
+  PNET_DISPLAY_USER = ^NET_DISPLAY_USER;
+  {$EXTERNALSYM PNET_DISPLAY_USER}
+  _NET_DISPLAY_USER = record
+    usri1_name: LPWSTR;
+    usri1_comment: LPWSTR;
+    usri1_flags: DWORD;
+    usri1_full_name: LPWSTR;
+    usri1_user_id: DWORD;
+    usri1_next_index: DWORD;
+  end;
+  {$EXTERNALSYM _NET_DISPLAY_USER}
+  NET_DISPLAY_USER = _NET_DISPLAY_USER;
+  {$EXTERNALSYM NET_DISPLAY_USER}
+  TNetDisplayUser = NET_DISPLAY_USER;
+  PNetDisplayUser = PNET_DISPLAY_USER;
+
+  PNET_DISPLAY_MACHINE = ^NET_DISPLAY_MACHINE;
+  {$EXTERNALSYM PNET_DISPLAY_MACHINE}
+  _NET_DISPLAY_MACHINE = record
+    usri2_name: LPWSTR;
+    usri2_comment: LPWSTR;
+    usri2_flags: DWORD;
+    usri2_user_id: DWORD;
+    usri2_next_index: DWORD;
+  end;
+  {$EXTERNALSYM _NET_DISPLAY_MACHINE}
+  NET_DISPLAY_MACHINE = _NET_DISPLAY_MACHINE;
+  {$EXTERNALSYM NET_DISPLAY_MACHINE}
+  TNetDisplayMachine = NET_DISPLAY_MACHINE;
+  PNetDisplayMachine = PNET_DISPLAY_MACHINE;
+
+  PNET_DISPLAY_GROUP = ^NET_DISPLAY_GROUP;
+  {$EXTERNALSYM PNET_DISPLAY_GROUP}
+  _NET_DISPLAY_GROUP = record
+    grpi3_name: LPWSTR;
+    grpi3_comment: LPWSTR;
+    grpi3_group_id: DWORD;
+    grpi3_attributes: DWORD;
+    grpi3_next_index: DWORD;
+  end;
+  {$EXTERNALSYM _NET_DISPLAY_GROUP}
+  NET_DISPLAY_GROUP = _NET_DISPLAY_GROUP;
+  {$EXTERNALSYM NET_DISPLAY_GROUP}
+  TNetDisplayGroup = NET_DISPLAY_GROUP;
+  PNetDisplayGroup = PNET_DISPLAY_GROUP;
+
+//
+// Access Class
+//
+
+//
+// Function Prototypes - Access
+//
+//
+// The NetAccess APIs are only available to downlevel
+//
+
+//#define NetAccessAdd RxNetAccessAdd
+
+function NetAccessAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessAdd}
+
+//#define NetAccessEnum RxNetAccessEnum
+
+function NetAccessEnum(servername, BasePath: LPCWSTR; Recursive, level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessEnum}
+
+//#define NetAccessGetInfo RxNetAccessGetInfo
+
+function NetAccessGetInfo(servername, resource: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessGetInfo}
+
+//#define NetAccessSetInfo RxNetAccessSetInfo
+
+function NetAccessSetInfo(servername, resource: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessSetInfo}
+
+//#define NetAccessDel RxNetAccessDel
+
+function NetAccessDel(servername: LPCWSTR; resource: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessDel}
+
+//#define NetAccessGetUserPerms RxNetAccessGetUserPerms
+
+function NetAccessGetUserPerms(servername, UGname, resource: LPCWSTR; Perms: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAccessGetUserPerms}
+
+//
+// Data Structures - Access
+//
+
+type
+  LPACCESS_INFO_0 = ^ACCESS_INFO_0;
+  {$EXTERNALSYM LPACCESS_INFO_0}
+  PACCESS_INFO_0 = ^ACCESS_INFO_0;
+  {$EXTERNALSYM PACCESS_INFO_0}
+  _ACCESS_INFO_0 = record
+    acc0_resource_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _ACCESS_INFO_0}
+  ACCESS_INFO_0 = _ACCESS_INFO_0;
+  {$EXTERNALSYM ACCESS_INFO_0}
+  TAccessInfo0 = ACCESS_INFO_0;
+  PAccessInfo0 = PACCESS_INFO_0;
+
+  LPACCESS_INFO_1 = ^ACCESS_INFO_1;
+  {$EXTERNALSYM LPACCESS_INFO_1}
+  PACCESS_INFO_1 = ^ACCESS_INFO_1;
+  {$EXTERNALSYM PACCESS_INFO_1}
+  _ACCESS_INFO_1 = record
+    acc1_resource_name: LPWSTR;
+    acc1_attr: DWORD;
+    acc1_count: DWORD;
+  end;
+  {$EXTERNALSYM _ACCESS_INFO_1}
+  ACCESS_INFO_1 = _ACCESS_INFO_1;
+  {$EXTERNALSYM ACCESS_INFO_1}
+  TAccessInfo1 = ACCESS_INFO_1;
+  PAccessInfo1 = PACCESS_INFO_1;
+
+  LPACCESS_INFO_1002 = ^ACCESS_INFO_1002;
+  {$EXTERNALSYM LPACCESS_INFO_1002}
+  PACCESS_INFO_1002 = ^ACCESS_INFO_1002;
+  {$EXTERNALSYM PACCESS_INFO_1002}
+  _ACCESS_INFO_1002 = record
+    acc1002_attr: DWORD;
+  end;
+  {$EXTERNALSYM _ACCESS_INFO_1002}
+  ACCESS_INFO_1002 = _ACCESS_INFO_1002;
+  {$EXTERNALSYM ACCESS_INFO_1002}
+  TAccessInfo1002 = ACCESS_INFO_1002;
+  PAccessInfo1002 = PACCESS_INFO_1002;
+
+  LPACCESS_LIST = ^ACCESS_LIST;
+  {$EXTERNALSYM LPACCESS_LIST}
+  PACCESS_LIST = ^ACCESS_LIST;
+  {$EXTERNALSYM PACCESS_LIST}
+  _ACCESS_LIST = record
+    acl_ugname: LPWSTR;
+    acl_access: DWORD;
+  end;
+  {$EXTERNALSYM _ACCESS_LIST}
+  ACCESS_LIST = _ACCESS_LIST;
+  {$EXTERNALSYM ACCESS_LIST}
+  TAccessList = ACCESS_LIST;
+  PAccessList = PACCESS_LIST;
+
+//
+// Special Values and Constants - Access
+//
+
+//
+// Maximum number of permission entries for each resource.
+//
+
+const
+  MAXPERMENTRIES = 64;
+  {$EXTERNALSYM MAXPERMENTRIES}
+
+//
+//  Bit values for the access permissions.  ACCESS_ALL is a handy
+//  way to specify maximum permissions.  These are used in
+//  acl_access field of access_list structures.
+//
+
+  ACCESS_READ   = $01;
+  {$EXTERNALSYM ACCESS_READ}
+  ACCESS_WRITE  = $02;
+  {$EXTERNALSYM ACCESS_WRITE}
+  ACCESS_CREATE = $04;
+  {$EXTERNALSYM ACCESS_CREATE}
+  ACCESS_EXEC   = $08;
+  {$EXTERNALSYM ACCESS_EXEC}
+  ACCESS_DELETE = $10;
+  {$EXTERNALSYM ACCESS_DELETE}
+  ACCESS_ATRIB  = $20;
+  {$EXTERNALSYM ACCESS_ATRIB}
+  ACCESS_PERM   = $40;
+  {$EXTERNALSYM ACCESS_PERM}
+
+  ACCESS_GROUP = $8000;
+  {$EXTERNALSYM ACCESS_GROUP}
+
+  ACCESS_NONE = 0;
+  {$EXTERNALSYM ACCESS_NONE}
+  ACCESS_ALL  = ACCESS_READ or ACCESS_WRITE or ACCESS_CREATE or ACCESS_EXEC or ACCESS_DELETE or ACCESS_ATRIB or ACCESS_PERM;
+  {$EXTERNALSYM ACCESS_ALL}
+  
+//
+// Bit values for the acc1_attr field of the ACCESS_INFO_1 structure.
+//
+
+  ACCESS_AUDIT = $1;
+  {$EXTERNALSYM ACCESS_AUDIT}
+
+  ACCESS_SUCCESS_OPEN   = $10;
+  {$EXTERNALSYM ACCESS_SUCCESS_OPEN}
+  ACCESS_SUCCESS_WRITE  = $20;
+  {$EXTERNALSYM ACCESS_SUCCESS_WRITE}
+  ACCESS_SUCCESS_DELETE = $40;
+  {$EXTERNALSYM ACCESS_SUCCESS_DELETE}
+  ACCESS_SUCCESS_ACL    = $80;
+  {$EXTERNALSYM ACCESS_SUCCESS_ACL}
+  ACCESS_SUCCESS_MASK   = $F0;
+  {$EXTERNALSYM ACCESS_SUCCESS_MASK}
+
+  ACCESS_FAIL_OPEN   = $100;
+  {$EXTERNALSYM ACCESS_FAIL_OPEN}
+  ACCESS_FAIL_WRITE  = $200;
+  {$EXTERNALSYM ACCESS_FAIL_WRITE}
+  ACCESS_FAIL_DELETE = $400;
+  {$EXTERNALSYM ACCESS_FAIL_DELETE}
+  ACCESS_FAIL_ACL    = $800;
+  {$EXTERNALSYM ACCESS_FAIL_ACL}
+  ACCESS_FAIL_MASK   = $F00;
+  {$EXTERNALSYM ACCESS_FAIL_MASK}
+
+  ACCESS_FAIL_SHIFT = 4;
+  {$EXTERNALSYM ACCESS_FAIL_SHIFT}
+
+//
+// Parmnum value for NetAccessSetInfo.
+//
+
+  ACCESS_RESOURCE_NAME_PARMNUM = 1;
+  {$EXTERNALSYM ACCESS_RESOURCE_NAME_PARMNUM}
+  ACCESS_ATTR_PARMNUM          = 2;
+  {$EXTERNALSYM ACCESS_ATTR_PARMNUM}
+  ACCESS_COUNT_PARMNUM         = 3;
+  {$EXTERNALSYM ACCESS_COUNT_PARMNUM}
+  ACCESS_ACCESS_LIST_PARMNUM   = 4;
+  {$EXTERNALSYM ACCESS_ACCESS_LIST_PARMNUM}
+
+//
+// the new infolevel counterparts of the old info level + parmnum
+//
+
+  ACCESS_RESOURCE_NAME_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + ACCESS_RESOURCE_NAME_PARMNUM;
+  {$EXTERNALSYM ACCESS_RESOURCE_NAME_INFOLEVEL}
+  ACCESS_ATTR_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + ACCESS_ATTR_PARMNUM;
+  {$EXTERNALSYM ACCESS_ATTR_INFOLEVEL}
+  ACCESS_COUNT_INFOLEVEL         = PARMNUM_BASE_INFOLEVEL + ACCESS_COUNT_PARMNUM;
+  {$EXTERNALSYM ACCESS_COUNT_INFOLEVEL}
+  ACCESS_ACCESS_LIST_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + ACCESS_ACCESS_LIST_PARMNUM;
+  {$EXTERNALSYM ACCESS_ACCESS_LIST_INFOLEVEL}
+
+//
+// ACCESS_LETTERS defines a letter for each bit position in
+// the acl_access field of struct access_list.  Note that some
+// bits have a corresponding letter of ' ' (space).
+//
+
+  ACCESS_LETTERS = 'RWCXDAP         ';
+  {$EXTERNALSYM ACCESS_LETTERS}
+
+//    ********************************
+//
+//    Password Checking API structures
+//
+//    ********************************
+
+//
+//    What kind of password checking is to be performed?
+//        NetValidateAuthentication : Check if the authentication can be done
+//        NetValidatePasswordChange: Check if the password can be changed
+//        NetValidatePasswordReset: Reset the password to the given value
+//
+
+type
+  _NET_VALIDATE_PASSWORD_TYPE = (
+    NetValidateFiller0,
+    NetValidateAuthentication,
+    NetValidatePasswordChange,
+    NetValidatePasswordReset);
+  {$EXTERNALSYM _NET_VALIDATE_PASSWORD_TYPE}
+  NET_VALIDATE_PASSWORD_TYPE = _NET_VALIDATE_PASSWORD_TYPE;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_TYPE}
+  PNET_VALIDATE_PASSWORD_TYPE = ^NET_VALIDATE_PASSWORD_TYPE;
+  {$EXTERNALSYM PNET_VALIDATE_PASSWORD_TYPE}
+  TNetValidatePasswordType = NET_VALIDATE_PASSWORD_TYPE;
+  PNetValidatePasswordType = PNET_VALIDATE_PASSWORD_TYPE;
+
+//
+//    Structure to keep the password hash
+//
+
+  _NET_VALIDATE_PASSWORD_HASH = record
+    Length: ULONG;
+    Hash: LPBYTE;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_PASSWORD_HASH}
+  NET_VALIDATE_PASSWORD_HASH = _NET_VALIDATE_PASSWORD_HASH;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_HASH}
+  PNET_VALIDATE_PASSWORD_HASH = ^NET_VALIDATE_PASSWORD_HASH;
+  {$EXTERNALSYM PNET_VALIDATE_PASSWORD_HASH}
+  TNetValidatePasswordHash = NET_VALIDATE_PASSWORD_HASH;
+  PNetValidatePasswordHash = PNET_VALIDATE_PASSWORD_HASH;
+
+// To be used with PresentFields member of NET_VALIDATE_PERSISTED_FIELDS
+
+const
+  NET_VALIDATE_PASSWORD_LAST_SET         = $00000001;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_LAST_SET}
+  NET_VALIDATE_BAD_PASSWORD_TIME         = $00000002;
+  {$EXTERNALSYM NET_VALIDATE_BAD_PASSWORD_TIME}
+  NET_VALIDATE_LOCKOUT_TIME              = $00000004;
+  {$EXTERNALSYM NET_VALIDATE_LOCKOUT_TIME}
+  NET_VALIDATE_BAD_PASSWORD_COUNT        = $00000008;
+  {$EXTERNALSYM NET_VALIDATE_BAD_PASSWORD_COUNT}
+  NET_VALIDATE_PASSWORD_HISTORY_LENGTH   = $00000010;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_HISTORY_LENGTH}
+  NET_VALIDATE_PASSWORD_HISTORY          = $00000020;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_HISTORY}
+
+//
+//    Structure to keep information about the password and related things.
+//        Present Fields: (used only in output args) which fields are changed.
+//            See the constants above.
+//        PasswordLastSet: When the password is last set.
+//        BadPasswordTime: When the password was incorrect for the last time.
+//        LockoutTime: When the account is locked out. If the account is not locked out
+//            it is 0.
+//        BadPasswordCount: How many times the password has given incorrectly in the
+//            Observation Window.
+//        PasswordHistoryLength: How many passwords are kept in the history
+//        PasswordHistory: Password hashes that are in the history
+//
+
+type
+  _NET_VALIDATE_PERSISTED_FIELDS = record
+    PresentFields: ULONG;
+    PasswordLastSet: FILETIME;
+    BadPasswordTime: FILETIME;
+    LockoutTime: FILETIME;
+    BadPasswordCount: ULONG;
+    PasswordHistoryLength: ULONG;
+    PasswordHistory: PNET_VALIDATE_PASSWORD_HASH;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_PERSISTED_FIELDS}
+  NET_VALIDATE_PERSISTED_FIELDS = _NET_VALIDATE_PERSISTED_FIELDS;
+  {$EXTERNALSYM NET_VALIDATE_PERSISTED_FIELDS}
+  PNET_VALIDATE_PERSISTED_FIELDS = ^NET_VALIDATE_PERSISTED_FIELDS;
+  {$EXTERNALSYM PNET_VALIDATE_PERSISTED_FIELDS}
+  TNetValidatePersistedFields = NET_VALIDATE_PERSISTED_FIELDS;
+  PNetValidatePersistedFields = PNET_VALIDATE_PERSISTED_FIELDS;
+
+//
+//    Output Arg
+//        ChangedPersistedFields: Any changes to the password related info
+//        ValidationStatus: Shows the result of the request
+//
+
+  _NET_VALIDATE_OUTPUT_ARG = record
+    ChangedPersistedFields: NET_VALIDATE_PERSISTED_FIELDS;
+    ValidationStatus: NET_API_STATUS;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_OUTPUT_ARG}
+  NET_VALIDATE_OUTPUT_ARG = _NET_VALIDATE_OUTPUT_ARG;
+  {$EXTERNALSYM NET_VALIDATE_OUTPUT_ARG}
+  PNET_VALIDATE_OUTPUT_ARG = ^NET_VALIDATE_OUTPUT_ARG;
+  {$EXTERNALSYM PNET_VALIDATE_OUTPUT_ARG}
+  TNetValidateOutputArg = NET_VALIDATE_OUTPUT_ARG;
+  PNetValidateOutputArg = PNET_VALIDATE_OUTPUT_ARG;  
+
+//
+//    If authentication type of password check is to be made,
+//        this kind of input must be used
+//        
+//    InputPersistedFields: Information about the account to be logged into
+//    PasswordMatched: Indicates the result of the application's authentication of the supplied password 
+//
+
+  _NET_VALIDATE_AUTHENTICATION_INPUT_ARG = record
+    InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS;
+    PasswordMatched: BOOLEAN;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_AUTHENTICATION_INPUT_ARG}
+  NET_VALIDATE_AUTHENTICATION_INPUT_ARG = _NET_VALIDATE_AUTHENTICATION_INPUT_ARG;
+  {$EXTERNALSYM NET_VALIDATE_AUTHENTICATION_INPUT_ARG}
+  PNET_VALIDATE_AUTHENTICATION_INPUT_ARG = ^NET_VALIDATE_AUTHENTICATION_INPUT_ARG;
+  {$EXTERNALSYM PNET_VALIDATE_AUTHENTICATION_INPUT_ARG}
+  TNetValidateAuthenticationInputArg = NET_VALIDATE_AUTHENTICATION_INPUT_ARG;
+  PNetValidateAuthenticationInputArg = PNET_VALIDATE_AUTHENTICATION_INPUT_ARG;
+
+//
+//    If password change type of check is to be made,
+//        this kind of input must be used
+//
+//    InputPersistedFields: Information about the account to be logged into
+//    ClearPassword: The string which password is going to be
+//    UserAccountName: Name of the user account
+//    HashedPassword: Hash of the string that the password is going to be
+//    PasswordMatch: denotes if the old password supplied by user matched or not
+//
+
+  _NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = record
+    InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS;
+    ClearPassword: LPWSTR;
+    UserAccountName: LPWSTR;
+    HashedPassword: NET_VALIDATE_PASSWORD_HASH;
+    PasswordMatch: BOOLEAN;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG}
+  NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = _NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG}
+  PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG = ^NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG;
+  {$EXTERNALSYM PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG}
+  TNetValidatePasswordChangeInputArg = NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG;
+  PNetValidatePasswordChangeInputArg = PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG;
+
+//
+//    If password reset type of check is to be made,
+//        this kind of input must be used
+//
+//    InputPersistedFields: Information about the account to be logged into
+//    ClearPassword: The string which password is going to be
+//    UserAccountName: Name of the user account
+//    HashedPassword: Hash of the string that the password is going to be
+//    PasswordMustChangeAtNextLogon: Password must change for the user to be logged in
+//    ClearLockout: If the account was locked out, this field can be used to clear lockout
+//
+
+  _NET_VALIDATE_PASSWORD_RESET_INPUT_ARG = record
+    InputPersistedFields: NET_VALIDATE_PERSISTED_FIELDS;
+    ClearPassword: LPWSTR;
+    UserAccountName: LPWSTR;
+    HashedPassword: NET_VALIDATE_PASSWORD_HASH;
+    PasswordMustChangeAtNextLogon: BOOLEAN;
+    ClearLockout: BOOLEAN;
+  end;
+  {$EXTERNALSYM _NET_VALIDATE_PASSWORD_RESET_INPUT_ARG}
+  NET_VALIDATE_PASSWORD_RESET_INPUT_ARG = _NET_VALIDATE_PASSWORD_RESET_INPUT_ARG;
+  {$EXTERNALSYM NET_VALIDATE_PASSWORD_RESET_INPUT_ARG}
+  PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG = ^NET_VALIDATE_PASSWORD_RESET_INPUT_ARG;
+  {$EXTERNALSYM PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG}
+  TNetValidatePasswordResetInputArg = NET_VALIDATE_PASSWORD_RESET_INPUT_ARG;
+  PNetValidatePasswordResetInputArg = PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG;  
+
+//
+//    Password Checking API structures end here
+//
+
+function NetValidatePasswordPolicy(ServerName: LPWSTR; Qualifier: LPVOID; ValidationType: NET_VALIDATE_PASSWORD_TYPE;
+  InputArg: LPVOID; var OutputArg: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetValidatePasswordPolicy}
+
+function NetValidatePasswordPolicyFree(var OutputArg: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetValidatePasswordPolicyFree}
+
+//
+// Domain Class
+//
+
+//
+// Function Prototypes - Domain
+//
+
+function NetGetDCName(servername, domainname: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGetDCName}
+
+function NetGetAnyDCName(servername, domainname: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGetAnyDCName}
+
+function I_NetLogonControl(ServerName: LPCWSTR; FunctionCode, QueryLevel: DWORD; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM I_NetLogonControl}
+
+function I_NetLogonControl2(ServerName: LPCWSTR; FunctionCode, QueryLevel: DWORD; Data: LPBYTE; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM I_NetLogonControl2}
+
+function NetEnumerateTrustedDomains(ServerName: LPWSTR; var DomainNames: LPWSTR): NTSTATUS; stdcall;
+{$EXTERNALSYM NetEnumerateTrustedDomains}
+
+//
+// Special Values and Constants - Domain
+//
+
+//
+// FunctionCode values for I_NetLogonControl.
+//
+// NOTE : if you change the following NETLOGON_CONTROL_* values,
+// change them in net\svcdlls\logonsrv\logon.idl file also.
+//
+
+const
+  NETLOGON_CONTROL_QUERY            = 1; // No-op: just query
+  {$EXTERNALSYM NETLOGON_CONTROL_QUERY}
+  NETLOGON_CONTROL_REPLICATE        = 2; // Force replicate on BDC
+  {$EXTERNALSYM NETLOGON_CONTROL_REPLICATE}
+  NETLOGON_CONTROL_SYNCHRONIZE      = 3; // Force synchronize on BDC
+  {$EXTERNALSYM NETLOGON_CONTROL_SYNCHRONIZE}
+  NETLOGON_CONTROL_PDC_REPLICATE    = 4; // Force PDC to broadcast change
+  {$EXTERNALSYM NETLOGON_CONTROL_PDC_REPLICATE}
+  NETLOGON_CONTROL_REDISCOVER       = 5; // Force to re-discover trusted domain DCs
+  {$EXTERNALSYM NETLOGON_CONTROL_REDISCOVER}
+  NETLOGON_CONTROL_TC_QUERY         = 6; // Query status of specified trusted channel status
+  {$EXTERNALSYM NETLOGON_CONTROL_TC_QUERY}
+  NETLOGON_CONTROL_TRANSPORT_NOTIFY = 7; // Notify netlogon that a new transport has come online
+  {$EXTERNALSYM NETLOGON_CONTROL_TRANSPORT_NOTIFY}
+  NETLOGON_CONTROL_FIND_USER        = 8; // Find named user in a trusted domain
+  {$EXTERNALSYM NETLOGON_CONTROL_FIND_USER}
+  NETLOGON_CONTROL_CHANGE_PASSWORD  = 9; // Change machine password on a secure channel to a trusted domain
+  {$EXTERNALSYM NETLOGON_CONTROL_CHANGE_PASSWORD}
+  NETLOGON_CONTROL_TC_VERIFY        = 10; // Verify status of specified trusted channel
+  {$EXTERNALSYM NETLOGON_CONTROL_TC_VERIFY}
+  NETLOGON_CONTROL_FORCE_DNS_REG    = 11; // Force DNS re-registration of all registered records
+  {$EXTERNALSYM NETLOGON_CONTROL_FORCE_DNS_REG}
+  NETLOGON_CONTROL_QUERY_DNS_REG    = 12; // Query the status of DNS updates
+  {$EXTERNALSYM NETLOGON_CONTROL_QUERY_DNS_REG}
+
+// Debug function codes
+
+  NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL = $FFFB;
+  {$EXTERNALSYM NETLOGON_CONTROL_UNLOAD_NETLOGON_DLL}
+  NETLOGON_CONTROL_BACKUP_CHANGE_LOG   = $FFFC;
+  {$EXTERNALSYM NETLOGON_CONTROL_BACKUP_CHANGE_LOG}
+  NETLOGON_CONTROL_TRUNCATE_LOG        = $FFFD;
+  {$EXTERNALSYM NETLOGON_CONTROL_TRUNCATE_LOG}
+  NETLOGON_CONTROL_SET_DBFLAG          = $FFFE;
+  {$EXTERNALSYM NETLOGON_CONTROL_SET_DBFLAG}
+  NETLOGON_CONTROL_BREAKPOINT          = $FFFF;
+  {$EXTERNALSYM NETLOGON_CONTROL_BREAKPOINT}
+
+//
+// Query level 1 for I_NetLogonControl
+//
+
+type
+  PNETLOGON_INFO_1 = ^NETLOGON_INFO_1;
+  {$EXTERNALSYM PNETLOGON_INFO_1}
+  _NETLOGON_INFO_1 = record
+    netlog1_flags: DWORD;
+    netlog1_pdc_connection_status: NET_API_STATUS;
+  end;
+  {$EXTERNALSYM _NETLOGON_INFO_1}
+  NETLOGON_INFO_1 = _NETLOGON_INFO_1;
+  {$EXTERNALSYM NETLOGON_INFO_1}
+  TNetLogonInfo1 = NETLOGON_INFO_1;
+  PNetLogonInfo1 = PNETLOGON_INFO_1;
+
+  PNETLOGON_INFO_2 = ^NETLOGON_INFO_2;
+  {$EXTERNALSYM PNETLOGON_INFO_2}
+  _NETLOGON_INFO_2 = record
+    netlog2_flags: DWORD;
+    //
+    // If NETLOGON_VERIFY_STATUS_RETURNED bit is set in
+    //  netlog2_flags, the following field will return
+    //  the status of trust verification. Otherwise,
+    //  the field will return the status of the secure
+    //  channel to the primary domain of the machine
+    //  (useful for BDCs only).
+    //
+    netlog2_pdc_connection_status: NET_API_STATUS;
+    netlog2_trusted_dc_name: LPWSTR;
+    netlog2_tc_connection_status: NET_API_STATUS;
+  end;
+  {$EXTERNALSYM _NETLOGON_INFO_2}
+  NETLOGON_INFO_2 = _NETLOGON_INFO_2;
+  {$EXTERNALSYM NETLOGON_INFO_2}
+  TNetLogonInfo2 = NETLOGON_INFO_2;
+  PNetLogonInfo2 = PNETLOGON_INFO_2;
+
+  PNETLOGON_INFO_3 = ^NETLOGON_INFO_3;
+  {$EXTERNALSYM PNETLOGON_INFO_3}
+  _NETLOGON_INFO_3 = record
+    netlog3_flags: DWORD;
+    netlog3_logon_attempts: DWORD;
+    netlog3_reserved1: DWORD;
+    netlog3_reserved2: DWORD;
+    netlog3_reserved3: DWORD;
+    netlog3_reserved4: DWORD;
+    netlog3_reserved5: DWORD;
+  end;
+  {$EXTERNALSYM _NETLOGON_INFO_3}
+  NETLOGON_INFO_3 = _NETLOGON_INFO_3;
+  {$EXTERNALSYM NETLOGON_INFO_3}
+  TNetLogonInfo3 = NETLOGON_INFO_3;
+  PNetLogonInfo3 = PNETLOGON_INFO_3;
+
+  PNETLOGON_INFO_4 = ^NETLOGON_INFO_4;
+  {$EXTERNALSYM PNETLOGON_INFO_4}
+  _NETLOGON_INFO_4 = record
+    netlog4_trusted_dc_name: LPWSTR;
+    netlog4_trusted_domain_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _NETLOGON_INFO_4}
+  NETLOGON_INFO_4 = _NETLOGON_INFO_4;
+  {$EXTERNALSYM NETLOGON_INFO_4}
+  TNetLogonInfo4 = NETLOGON_INFO_4;
+  PNetLogonInfo4 = PNETLOGON_INFO_4;
+
+//
+// Values of netlog1_flags
+//
+
+const
+  NETLOGON_REPLICATION_NEEDED      = $01; // Database is out of date
+  {$EXTERNALSYM NETLOGON_REPLICATION_NEEDED}
+  NETLOGON_REPLICATION_IN_PROGRESS = $02; // Replication is happening now
+  {$EXTERNALSYM NETLOGON_REPLICATION_IN_PROGRESS}
+  NETLOGON_FULL_SYNC_REPLICATION   = $04; // full sync replication required/progress
+  {$EXTERNALSYM NETLOGON_FULL_SYNC_REPLICATION}
+  NETLOGON_REDO_NEEDED             = $08; // Redo of previous replication needed
+  {$EXTERNALSYM NETLOGON_REDO_NEEDED}
+  NETLOGON_HAS_IP                  = $10; // The trusted domain DC has an IP address
+  {$EXTERNALSYM NETLOGON_HAS_IP}
+  NETLOGON_HAS_TIMESERV            = $20; // The trusted domain DC runs the Windows Time Service
+  {$EXTERNALSYM NETLOGON_HAS_TIMESERV}
+  NETLOGON_DNS_UPDATE_FAILURE      = $40; // There was a failure in the last update for one of the DNS records
+  {$EXTERNALSYM NETLOGON_DNS_UPDATE_FAILURE}
+  NETLOGON_VERIFY_STATUS_RETURNED  = $80; // Trust verification status returned in netlog2_pdc_connection_status
+  {$EXTERNALSYM NETLOGON_VERIFY_STATUS_RETURNED}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetUserAdd: Pointer;
+
+function NetUserAdd;
+begin
+  GetProcedureAddress(_NetUserAdd, netapi32, 'NetUserAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserAdd]
+  end;
+end;
+
+var
+  _NetUserEnum: Pointer;
+
+function NetUserEnum;
+begin
+  GetProcedureAddress(_NetUserEnum, netapi32, 'NetUserEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserEnum]
+  end;
+end;
+
+var
+  _NetUserGetInfo: Pointer;
+
+function NetUserGetInfo;
+begin
+  GetProcedureAddress(_NetUserGetInfo, netapi32, 'NetUserGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserGetInfo]
+  end;
+end;
+
+var
+  _NetUserSetInfo: Pointer;
+
+function NetUserSetInfo;
+begin
+  GetProcedureAddress(_NetUserSetInfo, netapi32, 'NetUserSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserSetInfo]
+  end;
+end;
+
+var
+  _NetUserDel: Pointer;
+
+function NetUserDel;
+begin
+  GetProcedureAddress(_NetUserDel, netapi32, 'NetUserDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserDel]
+  end;
+end;
+
+var
+  _NetUserGetGroups: Pointer;
+
+function NetUserGetGroups;
+begin
+  GetProcedureAddress(_NetUserGetGroups, netapi32, 'NetUserGetGroups');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserGetGroups]
+  end;
+end;
+
+var
+  _NetUserSetGroups: Pointer;
+
+function NetUserSetGroups;
+begin
+  GetProcedureAddress(_NetUserSetGroups, netapi32, 'NetUserSetGroups');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserSetGroups]
+  end;
+end;
+
+var
+  _NetUserGetLocalGroups: Pointer;
+
+function NetUserGetLocalGroups;
+begin
+  GetProcedureAddress(_NetUserGetLocalGroups, netapi32, 'NetUserGetLocalGroups');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserGetLocalGroups]
+  end;
+end;
+
+var
+  _NetUserModalsGet: Pointer;
+
+function NetUserModalsGet;
+begin
+  GetProcedureAddress(_NetUserModalsGet, netapi32, 'NetUserModalsGet');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserModalsGet]
+  end;
+end;
+
+var
+  _NetUserModalsSet: Pointer;
+
+function NetUserModalsSet;
+begin
+  GetProcedureAddress(_NetUserModalsSet, netapi32, 'NetUserModalsSet');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserModalsSet]
+  end;
+end;
+
+var
+  _NetUserChangePassword: Pointer;
+
+function NetUserChangePassword;
+begin
+  GetProcedureAddress(_NetUserChangePassword, netapi32, 'NetUserChangePassword');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUserChangePassword]
+  end;
+end;
+
+var
+  _NetGroupAdd: Pointer;
+
+function NetGroupAdd;
+begin
+  GetProcedureAddress(_NetGroupAdd, netapi32, 'NetGroupAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupAdd]
+  end;
+end;
+
+var
+  _NetGroupAddUser: Pointer;
+
+function NetGroupAddUser;
+begin
+  GetProcedureAddress(_NetGroupAddUser, netapi32, 'NetGroupAddUser');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupAddUser]
+  end;
+end;
+
+var
+  _NetGroupEnum: Pointer;
+
+function NetGroupEnum;
+begin
+  GetProcedureAddress(_NetGroupEnum, netapi32, 'NetGroupEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupEnum]
+  end;
+end;
+
+var
+  _NetGroupGetInfo: Pointer;
+
+function NetGroupGetInfo;
+begin
+  GetProcedureAddress(_NetGroupGetInfo, netapi32, 'NetGroupGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupGetInfo]
+  end;
+end;
+
+var
+  _NetGroupSetInfo: Pointer;
+
+function NetGroupSetInfo;
+begin
+  GetProcedureAddress(_NetGroupSetInfo, netapi32, 'NetGroupSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupSetInfo]
+  end;
+end;
+
+var
+  _NetGroupDel: Pointer;
+
+function NetGroupDel;
+begin
+  GetProcedureAddress(_NetGroupDel, netapi32, 'NetGroupDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupDel]
+  end;
+end;
+
+var
+  _NetGroupDelUser: Pointer;
+
+function NetGroupDelUser;
+begin
+  GetProcedureAddress(_NetGroupDelUser, netapi32, 'NetGroupDelUser');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupDelUser]
+  end;
+end;
+
+var
+  _NetGroupGetUsers: Pointer;
+
+function NetGroupGetUsers;
+begin
+  GetProcedureAddress(_NetGroupGetUsers, netapi32, 'NetGroupGetUsers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupGetUsers]
+  end;
+end;
+
+var
+  _NetGroupSetUsers: Pointer;
+
+function NetGroupSetUsers;
+begin
+  GetProcedureAddress(_NetGroupSetUsers, netapi32, 'NetGroupSetUsers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGroupSetUsers]
+  end;
+end;
+
+var
+  _NetLocalGroupAdd: Pointer;
+
+function NetLocalGroupAdd;
+begin
+  GetProcedureAddress(_NetLocalGroupAdd, netapi32, 'NetLocalGroupAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupAdd]
+  end;
+end;
+
+var
+  _NetLocalGroupAddMember: Pointer;
+
+function NetLocalGroupAddMember;
+begin
+  GetProcedureAddress(_NetLocalGroupAddMember, netapi32, 'NetLocalGroupAddMember');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupAddMember]
+  end;
+end;
+
+var
+  _NetLocalGroupEnum: Pointer;
+
+function NetLocalGroupEnum;
+begin
+  GetProcedureAddress(_NetLocalGroupEnum, netapi32, 'NetLocalGroupEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupEnum]
+  end;
+end;
+
+var
+  _NetLocalGroupGetInfo: Pointer;
+
+function NetLocalGroupGetInfo;
+begin
+  GetProcedureAddress(_NetLocalGroupGetInfo, netapi32, 'NetLocalGroupGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupGetInfo]
+  end;
+end;
+
+var
+  _NetLocalGroupSetInfo: Pointer;
+
+function NetLocalGroupSetInfo;
+begin
+  GetProcedureAddress(_NetLocalGroupSetInfo, netapi32, 'NetLocalGroupSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupSetInfo]
+  end;
+end;
+
+var
+  _NetLocalGroupDel: Pointer;
+
+function NetLocalGroupDel;
+begin
+  GetProcedureAddress(_NetLocalGroupDel, netapi32, 'NetLocalGroupDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupDel]
+  end;
+end;
+
+var
+  _NetLocalGroupDelMember: Pointer;
+
+function NetLocalGroupDelMember;
+begin
+  GetProcedureAddress(_NetLocalGroupDelMember, netapi32, 'NetLocalGroupDelMember');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupDelMember]
+  end;
+end;
+
+var
+  _NetLocalGroupGetMembers: Pointer;
+
+function NetLocalGroupGetMembers;
+begin
+  GetProcedureAddress(_NetLocalGroupGetMembers, netapi32, 'NetLocalGroupGetMembers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupGetMembers]
+  end;
+end;
+
+var
+  _NetLocalGroupSetMembers: Pointer;
+
+function NetLocalGroupSetMembers;
+begin
+  GetProcedureAddress(_NetLocalGroupSetMembers, netapi32, 'NetLocalGroupSetMembers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupSetMembers]
+  end;
+end;
+
+var
+  _NetLocalGroupAddMembers: Pointer;
+
+function NetLocalGroupAddMembers;
+begin
+  GetProcedureAddress(_NetLocalGroupAddMembers, netapi32, 'NetLocalGroupAddMembers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupAddMembers]
+  end;
+end;
+
+var
+  _NetLocalGroupDelMembers: Pointer;
+
+function NetLocalGroupDelMembers;
+begin
+  GetProcedureAddress(_NetLocalGroupDelMembers, netapi32, 'NetLocalGroupDelMembers');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetLocalGroupDelMembers]
+  end;
+end;
+
+var
+  _NetQueryDisplayInformation: Pointer;
+
+function NetQueryDisplayInformation;
+begin
+  GetProcedureAddress(_NetQueryDisplayInformation, netapi32, 'NetQueryDisplayInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetQueryDisplayInformation]
+  end;
+end;
+
+var
+  _NetGetDisplayInformationIndex: Pointer;
+
+function NetGetDisplayInformationIndex;
+begin
+  GetProcedureAddress(_NetGetDisplayInformationIndex, netapi32, 'NetGetDisplayInformationIndex');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGetDisplayInformationIndex]
+  end;
+end;
+
+var
+  _NetAccessAdd: Pointer;
+
+function NetAccessAdd;
+begin
+  GetProcedureAddress(_NetAccessAdd, netapi32, 'NetAccessAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessAdd]
+  end;
+end;
+
+var
+  _NetAccessEnum: Pointer;
+
+function NetAccessEnum;
+begin
+  GetProcedureAddress(_NetAccessEnum, netapi32, 'NetAccessEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessEnum]
+  end;
+end;
+
+var
+  _NetAccessGetInfo: Pointer;
+
+function NetAccessGetInfo;
+begin
+  GetProcedureAddress(_NetAccessGetInfo, netapi32, 'NetAccessGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessGetInfo]
+  end;
+end;
+
+var
+  _NetAccessSetInfo: Pointer;
+
+function NetAccessSetInfo;
+begin
+  GetProcedureAddress(_NetAccessSetInfo, netapi32, 'NetAccessSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessSetInfo]
+  end;
+end;
+
+var
+  _NetAccessDel: Pointer;
+
+function NetAccessDel;
+begin
+  GetProcedureAddress(_NetAccessDel, netapi32, 'NetAccessDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessDel]
+  end;
+end;
+
+var
+  _NetAccessGetUserPerms: Pointer;
+
+function NetAccessGetUserPerms;
+begin
+  GetProcedureAddress(_NetAccessGetUserPerms, netapi32, 'NetAccessGetUserPerms');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAccessGetUserPerms]
+  end;
+end;
+
+var
+  _NetValidatePasswordPolicy: Pointer;
+
+function NetValidatePasswordPolicy;
+begin
+  GetProcedureAddress(_NetValidatePasswordPolicy, netapi32, 'NetValidatePasswordPolicy');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetValidatePasswordPolicy]
+  end;
+end;
+
+var
+  _NetValidatePasswordPolicyFree: Pointer;
+
+function NetValidatePasswordPolicyFree;
+begin
+  GetProcedureAddress(_NetValidatePasswordPolicyFree, netapi32, 'NetValidatePasswordPolicyFree');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetValidatePasswordPolicyFree]
+  end;
+end;
+
+var
+  _NetGetDCName: Pointer;
+
+function NetGetDCName;
+begin
+  GetProcedureAddress(_NetGetDCName, netapi32, 'NetGetDCName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGetDCName]
+  end;
+end;
+
+var
+  _NetGetAnyDCName: Pointer;
+
+function NetGetAnyDCName;
+begin
+  GetProcedureAddress(_NetGetAnyDCName, netapi32, 'NetGetAnyDCName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGetAnyDCName]
+  end;
+end;
+
+var
+  _I_NetLogonControl: Pointer;
+
+function I_NetLogonControl;
+begin
+  GetProcedureAddress(_I_NetLogonControl, netapi32, 'I_NetLogonControl');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_I_NetLogonControl]
+  end;
+end;
+
+var
+  _I_NetLogonControl2: Pointer;
+
+function I_NetLogonControl2;
+begin
+  GetProcedureAddress(_I_NetLogonControl2, netapi32, 'I_NetLogonControl2');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_I_NetLogonControl2]
+  end;
+end;
+
+var
+  _NetEnumerateTrustedDomains: Pointer;
+
+function NetEnumerateTrustedDomains;
+begin
+  GetProcedureAddress(_NetEnumerateTrustedDomains, netapi32, 'NetEnumerateTrustedDomains');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetEnumerateTrustedDomains]
+  end;
+end;
+
+{$ELSE}
+
+function NetUserAdd; external netapi32 name 'NetUserAdd';
+function NetUserEnum; external netapi32 name 'NetUserEnum';
+function NetUserGetInfo; external netapi32 name 'NetUserGetInfo';
+function NetUserSetInfo; external netapi32 name 'NetUserSetInfo';
+function NetUserDel; external netapi32 name 'NetUserDel';
+function NetUserGetGroups; external netapi32 name 'NetUserGetGroups';
+function NetUserSetGroups; external netapi32 name 'NetUserSetGroups';
+function NetUserGetLocalGroups; external netapi32 name 'NetUserGetLocalGroups';
+function NetUserModalsGet; external netapi32 name 'NetUserModalsGet';
+function NetUserModalsSet; external netapi32 name 'NetUserModalsSet';
+function NetUserChangePassword; external netapi32 name 'NetUserChangePassword';
+function NetGroupAdd; external netapi32 name 'NetGroupAdd';
+function NetGroupAddUser; external netapi32 name 'NetGroupAddUser';
+function NetGroupEnum; external netapi32 name 'NetGroupEnum';
+function NetGroupGetInfo; external netapi32 name 'NetGroupGetInfo';
+function NetGroupSetInfo; external netapi32 name 'NetGroupSetInfo';
+function NetGroupDel; external netapi32 name 'NetGroupDel';
+function NetGroupDelUser; external netapi32 name 'NetGroupDelUser';
+function NetGroupGetUsers; external netapi32 name 'NetGroupGetUsers';
+function NetGroupSetUsers; external netapi32 name 'NetGroupSetUsers';
+function NetLocalGroupAdd; external netapi32 name 'NetLocalGroupAdd';
+function NetLocalGroupAddMember; external netapi32 name 'NetLocalGroupAddMember';
+function NetLocalGroupEnum; external netapi32 name 'NetLocalGroupEnum';
+function NetLocalGroupGetInfo; external netapi32 name 'NetLocalGroupGetInfo';
+function NetLocalGroupSetInfo; external netapi32 name 'NetLocalGroupSetInfo';
+function NetLocalGroupDel; external netapi32 name 'NetLocalGroupDel';
+function NetLocalGroupDelMember; external netapi32 name 'NetLocalGroupDelMember';
+function NetLocalGroupGetMembers; external netapi32 name 'NetLocalGroupGetMembers';
+function NetLocalGroupSetMembers; external netapi32 name 'NetLocalGroupSetMembers';
+function NetLocalGroupAddMembers; external netapi32 name 'NetLocalGroupAddMembers';
+function NetLocalGroupDelMembers; external netapi32 name 'NetLocalGroupDelMembers';
+function NetQueryDisplayInformation; external netapi32 name 'NetQueryDisplayInformation';
+function NetGetDisplayInformationIndex; external netapi32 name 'NetGetDisplayInformationIndex';
+function NetAccessAdd; external netapi32 name 'NetAccessAdd';
+function NetAccessEnum; external netapi32 name 'NetAccessEnum';
+function NetAccessGetInfo; external netapi32 name 'NetAccessGetInfo';
+function NetAccessSetInfo; external netapi32 name 'NetAccessSetInfo';
+function NetAccessDel; external netapi32 name 'NetAccessDel';
+function NetAccessGetUserPerms; external netapi32 name 'NetAccessGetUserPerms';
+function NetValidatePasswordPolicy; external netapi32 name 'NetValidatePasswordPolicy';
+function NetValidatePasswordPolicyFree; external netapi32 name 'NetValidatePasswordPolicyFree';
+function NetGetDCName; external netapi32 name 'NetGetDCName';
+function NetGetAnyDCName; external netapi32 name 'NetGetAnyDCName';
+function I_NetLogonControl; external netapi32 name 'I_NetLogonControl';
+function I_NetLogonControl2; external netapi32 name 'I_NetLogonControl2';
+function NetEnumerateTrustedDomains; external netapi32 name 'NetEnumerateTrustedDomains';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 276 - 0
packages/extra/winunits/jwalmalert.pas

@@ -0,0 +1,276 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Alterter API interface Unit for Object Pascal                    }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmalert.h, released November 2001. The original Pascal }
+{ code is: LmAlert.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmAlert;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmalert.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes
+//
+
+function NetAlertRaise(AlertEventName: LPCWSTR; Buffer: LPVOID; BufferSize: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAlertRaise}
+
+function NetAlertRaiseEx(AlertEventName: LPCWSTR; VariableInfo: LPVOID; VariableInfoSize: DWORD; ServiceName: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAlertRaiseEx}
+
+//
+//  Data Structures
+//
+
+type
+  _STD_ALERT = record
+    alrt_timestamp: DWORD;
+    alrt_eventname: array [0..EVLEN] of WCHAR;
+    alrt_servicename: array [0..SNLEN] of WCHAR;
+  end;
+  {$EXTERNALSYM _STD_ALERT}
+  STD_ALERT = _STD_ALERT;
+  {$EXTERNALSYM STD_ALERT}
+  PSTD_ALERT = ^STD_ALERT;
+  {$EXTERNALSYM PSTD_ALERT}
+  LPSTD_ALERT = ^STD_ALERT;
+  {$EXTERNALSYM LPSTD_ALERT}
+  TStdAlert = STD_ALERT;
+  PStdAlert = PSTD_ALERT;
+
+  _ADMIN_OTHER_INFO = record
+    alrtad_errcode: DWORD;
+    alrtad_numstrings: DWORD;
+  end;
+  {$EXTERNALSYM _ADMIN_OTHER_INFO}
+  ADMIN_OTHER_INFO = _ADMIN_OTHER_INFO;
+  {$EXTERNALSYM ADMIN_OTHER_INFO}
+  PADMIN_OTHER_INFO = ^ADMIN_OTHER_INFO;
+  {$EXTERNALSYM PADMIN_OTHER_INFO}
+  LPADMIN_OTHER_INFO = ^ADMIN_OTHER_INFO;
+  {$EXTERNALSYM LPADMIN_OTHER_INFO}
+  TAdminOtherInfo = ADMIN_OTHER_INFO;
+  PAdminOtherInfo = PADMIN_OTHER_INFO;
+
+  _ERRLOG_OTHER_INFO = record
+    alrter_errcode: DWORD;
+    alrter_offset: DWORD;
+  end;
+  {$EXTERNALSYM _ERRLOG_OTHER_INFO}
+  ERRLOG_OTHER_INFO = _ERRLOG_OTHER_INFO;
+  {$EXTERNALSYM ERRLOG_OTHER_INFO}
+  PERRLOG_OTHER_INFO = ^ERRLOG_OTHER_INFO;
+  {$EXTERNALSYM PERRLOG_OTHER_INFO}
+  LPERRLOG_OTHER_INFO = ^ERRLOG_OTHER_INFO;
+  {$EXTERNALSYM LPERRLOG_OTHER_INFO}
+  TErrlogOtherInfo = ERRLOG_OTHER_INFO;
+  PErrlogOtherInfo = PERRLOG_OTHER_INFO;
+
+  _PRINT_OTHER_INFO = record
+    alrtpr_jobid: DWORD;
+    alrtpr_status: DWORD;
+    alrtpr_submitted: DWORD;
+    alrtpr_size: DWORD;
+  end;
+  {$EXTERNALSYM _PRINT_OTHER_INFO}
+  PRINT_OTHER_INFO = _PRINT_OTHER_INFO;
+  {$EXTERNALSYM PRINT_OTHER_INFO}
+  PPRINT_OTHER_INFO = ^PRINT_OTHER_INFO;
+  {$EXTERNALSYM PPRINT_OTHER_INFO}
+  LPPRINT_OTHER_INFO = ^PRINT_OTHER_INFO;
+  {$EXTERNALSYM LPPRINT_OTHER_INFO}
+  TPrintOtherInfo = PRINT_OTHER_INFO;
+  PPrintOtherInfo = PPRINT_OTHER_INFO;
+
+  _USER_OTHER_INFO = record
+    alrtus_errcode: DWORD;
+    alrtus_numstrings: DWORD;
+  end;
+  {$EXTERNALSYM _USER_OTHER_INFO}
+  USER_OTHER_INFO = _USER_OTHER_INFO;
+  {$EXTERNALSYM USER_OTHER_INFO}
+  PUSER_OTHER_INFO = ^USER_OTHER_INFO;
+  {$EXTERNALSYM PUSER_OTHER_INFO}
+  LPUSER_OTHER_INFO = ^USER_OTHER_INFO;
+  {$EXTERNALSYM LPUSER_OTHER_INFO}
+  TUserOtherInfo = USER_OTHER_INFO;
+  PUserOtherInfo = PUSER_OTHER_INFO;
+
+//
+// Special Values and Constants
+//
+
+//
+// Name of mailslot to send alert notifications
+//
+
+const
+  ALERTER_MAILSLOT = WideString('\\.\MAILSLOT\Alerter');
+  {$EXTERNALSYM ALERTER_MAILSLOT}
+
+//
+// The following macro gives a pointer to the other_info data.
+// It takes an alert structure and returns a pointer to structure
+// beyond the standard portion.
+//
+
+function ALERT_OTHER_INFO(x: Pointer): Pointer;
+{$EXTERNALSYM ALERT_OTHER_INFO}
+
+//
+// The following macro gives a pointer to the variable-length data.
+// It takes a pointer to one of the other-info structs and returns a
+// pointer to the variable data portion.
+//
+
+// (rom) cannot be implemented in Delphi
+//function ALERT_VAR_DATA(const p): Pointer;
+
+//
+//      Names of standard Microsoft-defined alert events.
+//
+
+const
+  ALERT_PRINT_EVENT    = WideString('PRINTING');
+  {$EXTERNALSYM ALERT_PRINT_EVENT}
+  ALERT_MESSAGE_EVENT  = WideString('MESSAGE');
+  {$EXTERNALSYM ALERT_MESSAGE_EVENT}
+  ALERT_ERRORLOG_EVENT = WideString('ERRORLOG');
+  {$EXTERNALSYM ALERT_ERRORLOG_EVENT}
+  ALERT_ADMIN_EVENT    = WideString('ADMIN');
+  {$EXTERNALSYM ALERT_ADMIN_EVENT}
+  ALERT_USER_EVENT     = WideString('USER');
+  {$EXTERNALSYM ALERT_USER_EVENT}
+
+//
+//      Bitmap masks for prjob_status field of PRINTJOB.
+//
+
+// 2-7 bits also used in device status
+
+  PRJOB_QSTATUS     = $3; // Bits 0,1
+  {$EXTERNALSYM PRJOB_QSTATUS}
+  PRJOB_DEVSTATUS   = $1fc; // 2-8 bits
+  {$EXTERNALSYM PRJOB_DEVSTATUS}
+  PRJOB_COMPLETE    = $4; // Bit 2
+  {$EXTERNALSYM PRJOB_COMPLETE}
+  PRJOB_INTERV      = $8; // Bit 3
+  {$EXTERNALSYM PRJOB_INTERV}
+  PRJOB_ERROR       = $10; // Bit 4
+  {$EXTERNALSYM PRJOB_ERROR}
+  PRJOB_DESTOFFLINE = $20; // Bit 5
+  {$EXTERNALSYM PRJOB_DESTOFFLINE}
+  PRJOB_DESTPAUSED  = $40; // Bit 6
+  {$EXTERNALSYM PRJOB_DESTPAUSED}
+  PRJOB_NOTIFY      = $80; // BIT 7
+  {$EXTERNALSYM PRJOB_NOTIFY}
+  PRJOB_DESTNOPAPER = $100; // BIT 8
+  {$EXTERNALSYM PRJOB_DESTNOPAPER}
+  PRJOB_DELETED     = $8000; // BIT 15
+  {$EXTERNALSYM PRJOB_DELETED}
+
+//
+//      Values of PRJOB_QSTATUS bits in prjob_status field of PRINTJOB.
+//
+
+  PRJOB_QS_QUEUED   = 0;
+  {$EXTERNALSYM PRJOB_QS_QUEUED}
+  PRJOB_QS_PAUSED   = 1;
+  {$EXTERNALSYM PRJOB_QS_PAUSED}
+  PRJOB_QS_SPOOLING = 2;
+  {$EXTERNALSYM PRJOB_QS_SPOOLING}
+  PRJOB_QS_PRINTING = 3;
+  {$EXTERNALSYM PRJOB_QS_PRINTING}
+
+implementation
+
+function ALERT_OTHER_INFO(x: Pointer): Pointer;
+begin
+  Result := Pointer(PChar(x) + SizeOf(STD_ALERT));
+end;
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetAlertRaise: Pointer;
+
+function NetAlertRaise;
+begin
+  GetProcedureAddress(_NetAlertRaise, netapi32, 'NetAlertRaise');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAlertRaise]
+  end;
+end;
+
+var
+  _NetAlertRaiseEx: Pointer;
+
+function NetAlertRaiseEx;
+begin
+  GetProcedureAddress(_NetAlertRaiseEx, netapi32, 'NetAlertRaiseEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAlertRaiseEx]
+  end;
+end;
+
+{$ELSE}
+
+function NetAlertRaise; external netapi32 name 'NetAlertRaise';
+function NetAlertRaiseEx; external netapi32 name 'NetAlertRaiseEx';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 160 - 0
packages/extra/winunits/jwalmapibuf.pas

@@ -0,0 +1,160 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Buffer API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmapibuf.h, released November 2001. The original       }
+{ Pascal code is: LmApiBuf.pas, released Februari 2002. The initial developer  }
+{ of the Pascal code is Marcel van Brakel (brakelm att chello dott nl).        }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmApiBuf;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmapibuf.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes
+//
+
+function NetApiBufferAllocate(ByteCount: DWORD; var Buffer: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetApiBufferAllocate}
+function NetApiBufferFree(Buffer: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetApiBufferFree}
+function NetApiBufferReallocate(OldBuffer: LPVOID; NewByteCount: DWORD; var NewBuffer: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetApiBufferReallocate}
+function NetApiBufferSize(Buffer: LPVOID; var ByteCount: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetApiBufferSize}
+
+//
+// The following private function will go away eventually.
+// Call NetApiBufferAllocate instead.
+//
+
+function NetapipBufferAllocate(ByteCount: DWORD; var Buffer: LPVOID): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetapipBufferAllocate}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetApiBufferAllocate: Pointer;
+
+function NetApiBufferAllocate;
+begin
+  GetProcedureAddress(_NetApiBufferAllocate, netapi32, 'NetApiBufferAllocate');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetApiBufferAllocate]
+  end;
+end;
+
+var
+  _NetApiBufferFree: Pointer;
+
+function NetApiBufferFree;
+begin
+  GetProcedureAddress(_NetApiBufferFree, netapi32, 'NetApiBufferFree');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetApiBufferFree]
+  end;
+end;
+
+var
+  _NetApiBufferReallocate: Pointer;
+
+function NetApiBufferReallocate;
+begin
+  GetProcedureAddress(_NetApiBufferReallocate, netapi32, 'NetApiBufferReallocate');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetApiBufferReallocate]
+  end;
+end;
+
+var
+  _NetApiBufferSize: Pointer;
+
+function NetApiBufferSize;
+begin
+  GetProcedureAddress(_NetApiBufferSize, netapi32, 'NetApiBufferSize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetApiBufferSize]
+  end;
+end;
+
+var
+  _NetapipBufferAllocate: Pointer;
+
+function NetapipBufferAllocate;
+begin
+  GetProcedureAddress(_NetapipBufferAllocate, netapi32, 'NetapipBufferAllocate');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetapipBufferAllocate]
+  end;
+end;
+
+{$ELSE}
+
+function NetApiBufferAllocate; external netapi32 name 'NetApiBufferAllocate';
+function NetApiBufferFree; external netapi32 name 'NetApiBufferFree';
+function NetApiBufferReallocate; external netapi32 name 'NetApiBufferReallocate';
+function NetApiBufferSize; external netapi32 name 'NetApiBufferSize';
+function NetapipBufferAllocate; external netapi32 name 'NetapipBufferAllocate';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 225 - 0
packages/extra/winunits/jwalmat.pas

@@ -0,0 +1,225 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Scheduler API interface Unit for Object Pascal                   }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmat.h, released November 2001. The original Pascal    }
+{ code is: LmAt.pas, released Februari 2002. The initial developer of the      }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmAt;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmat.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+//  The following bits are used with Flags field in structures below.
+//
+
+//
+//  Do we exec programs for this job periodically (/EVERY switch)
+//  or one time (/NEXT switch).
+//
+
+const
+  JOB_RUN_PERIODICALLY           = $01;    //  set if EVERY
+  {$EXTERNALSYM JOB_RUN_PERIODICALLY}
+
+//
+//  Was there an error last time we tried to exec a program on behalf of
+//  this job.
+//  This flag is meaningfull on output only!
+//
+
+  JOB_EXEC_ERROR                 = $02;    //  set if error
+  {$EXTERNALSYM JOB_EXEC_ERROR}
+
+//
+//  Will this job run today or tomorrow.
+//  This flag is meaningfull on output only!
+//
+
+  JOB_RUNS_TODAY                 = $04;    //  set if today
+  {$EXTERNALSYM JOB_RUNS_TODAY}
+
+//
+//  Add current day of the month to DaysOfMonth input.
+//  This flag is meaningfull on input only!
+//
+
+  JOB_ADD_CURRENT_DATE            = $08;    // set if to add current date
+  {$EXTERNALSYM JOB_ADD_CURRENT_DATE}
+
+//
+//  Will this job be run interactively or not.  Windows NT 3.1 do not
+//  know about this bit, i.e. they submit interactive jobs only.
+//
+
+  JOB_NONINTERACTIVE              = $10;    // set for noninteractive
+  {$EXTERNALSYM JOB_NONINTERACTIVE}
+
+  JOB_INPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_ADD_CURRENT_DATE or JOB_NONINTERACTIVE;
+  {$EXTERNALSYM JOB_INPUT_FLAGS}
+
+  JOB_OUTPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_EXEC_ERROR or JOB_RUNS_TODAY or JOB_NONINTERACTIVE;
+  {$EXTERNALSYM JOB_OUTPUT_FLAGS}
+
+type
+  _AT_INFO = record
+    JobTime: DWORD_PTR;
+    DaysOfMonth: DWORD;
+    DaysOfWeek: UCHAR;
+    Flags: UCHAR;
+    Command: LPWSTR;
+  end;
+  {$EXTERNALSYM _AT_INFO}
+  AT_INFO = _AT_INFO;
+  {$EXTERNALSYM AT_INFO}
+  PAT_INFO = ^AT_INFO;
+  {$EXTERNALSYM PAT_INFO}
+  LPAT_INFO = ^AT_INFO;
+  {$EXTERNALSYM LPAT_INFO}
+  TAtInfo = AT_INFO;
+  PAtInfo = PAT_INFO;
+
+  _AT_ENUM = record
+    JobId: DWORD;
+    JobTime: DWORD_PTR;
+    DaysOfMonth: DWORD;
+    DaysOfWeek: UCHAR;
+    Flags: UCHAR;
+    Command: LPWSTR;
+  end;
+  {$EXTERNALSYM _AT_ENUM}
+  AT_ENUM = _AT_ENUM;
+  {$EXTERNALSYM AT_ENUM}
+  PAT_ENUM = ^AT_ENUM;
+  {$EXTERNALSYM PAT_ENUM}
+  LPAT_ENUM = ^AT_ENUM;
+  {$EXTERNALSYM LPAT_ENUM}
+  TAtEnum = AT_ENUM;
+  PAtEnum = PAT_ENUM;  
+
+function NetScheduleJobAdd(Servername: LPCWSTR; Buffer: LPBYTE; JobId: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetScheduleJobAdd}
+
+function NetScheduleJobDel(Servername: LPCWSTR; MinJobId, MaxJobId: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetScheduleJobDel}
+
+function NetScheduleJobEnum(Servername: LPCWSTR; var PointerToBuffer: LPBYTE; PrefferedMaximumLength: DWORD; EntriesRead, TotalEntries, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetScheduleJobEnum}
+
+function NetScheduleJobGetInfo(Servername: LPCWSTR; JobId: DWORD; var PointerToBuffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetScheduleJobGetInfo}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetScheduleJobAdd: Pointer;
+
+function NetScheduleJobAdd;
+begin
+  GetProcedureAddress(_NetScheduleJobAdd, netapi32, 'NetScheduleJobAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetScheduleJobAdd]
+  end;
+end;
+
+var
+  _NetScheduleJobDel: Pointer;
+
+function NetScheduleJobDel;
+begin
+  GetProcedureAddress(_NetScheduleJobDel, netapi32, 'NetScheduleJobDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetScheduleJobDel]
+  end;
+end;
+
+var
+  _NetScheduleJobEnum: Pointer;
+
+function NetScheduleJobEnum;
+begin
+  GetProcedureAddress(_NetScheduleJobEnum, netapi32, 'NetScheduleJobEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetScheduleJobEnum]
+  end;
+end;
+
+var
+  _NetScheduleJobGetInfo: Pointer;
+
+function NetScheduleJobGetInfo;
+begin
+  GetProcedureAddress(_NetScheduleJobGetInfo, netapi32, 'NetScheduleJobGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetScheduleJobGetInfo]
+  end;
+end;
+
+{$ELSE}
+
+function NetScheduleJobAdd; external netapi32 name 'NetScheduleJobAdd';
+function NetScheduleJobDel; external netapi32 name 'NetScheduleJobDel';
+function NetScheduleJobEnum; external netapi32 name 'NetScheduleJobEnum';
+function NetScheduleJobGetInfo; external netapi32 name 'NetScheduleJobGetInfo';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 722 - 0
packages/extra/winunits/jwalmaudit.pas

@@ -0,0 +1,722 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Audit API interface Unit for Object Pascal                       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmaudit.h, released November 2001. The original Pascal }
+{ code is: LmAudit.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmAudit;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmaudit.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+type
+  _HLOG = record
+    time: DWORD;
+    last_flags: DWORD;
+    offset: DWORD;
+    rec_offset: DWORD;
+  end;
+  {$EXTERNALSYM _HLOG}
+  HLOG = _HLOG;
+  {$EXTERNALSYM HLOG}
+  LPHLOG = ^HLOG;
+  {$EXTERNALSYM LPHLOG}
+  PHLOG = ^HLOG;
+  {$EXTERNALSYM PHLOG}
+
+const
+  LOGFLAGS_FORWARD  = 0;
+  {$EXTERNALSYM LOGFLAGS_FORWARD}
+  LOGFLAGS_BACKWARD = $1;
+  {$EXTERNALSYM LOGFLAGS_BACKWARD}
+  LOGFLAGS_SEEK     = $2;
+  {$EXTERNALSYM LOGFLAGS_SEEK}
+
+//
+// Function Prototypes - Audit
+//
+
+function NetAuditClear(server, backupfile, service: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAuditClear}
+
+function NetAuditRead(server, service: LPCWSTR; auditloghandle: LPHLOG; offset: DWORD; reserved1: LPDWORD; reserved2, offsetflag: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; bytesread, totalavailable: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAuditRead}
+
+function NetAuditWrite(type_: DWORD; buf: LPBYTE; numbytes: DWORD; service: LPCWSTR; reserved: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAuditWrite}
+
+//
+// Data Structures - Audit
+//
+
+type
+  _AUDIT_ENTRY = record
+    ae_len: DWORD;
+    ae_reserved: DWORD;
+    ae_time: DWORD;
+    ae_type: DWORD;
+    ae_data_offset: DWORD; // Offset from beginning address of audit_entry
+    ae_data_size: DWORD; // byte count of ae_data area (not incl pad).
+  end;
+  {$EXTERNALSYM _AUDIT_ENTRY}
+  AUDIT_ENTRY = _AUDIT_ENTRY;
+  {$EXTERNALSYM AUDIT_ENTRY}
+  LPAUDIT_ENTRY = ^AUDIT_ENTRY;
+  {$EXTERNALSYM LPAUDIT_ENTRY}
+  PAUDIT_ENTRY = ^AUDIT_ENTRY;
+  {$EXTERNALSYM PAUDIT_ENTRY}
+  TAuditEntry = AUDIT_ENTRY;
+  PAuditEntry = PAUDIT_ENTRY;
+
+{$DEFINE REVISED_AUDIT_ENTRY_STRUCT}
+
+  _AE_SRVSTATUS = record
+    ae_sv_status: DWORD;
+  end;
+  {$EXTERNALSYM _AE_SRVSTATUS}
+  //AE_SRVSTATUS = _AE_SRVSTATUS;
+  //{$EXTERNALSYM AE_SRVSTATUS}
+  LPAE_SRVSTATUS = ^_AE_SRVSTATUS;
+  {$EXTERNALSYM LPAE_SRVSTATUS}
+  PAE_SRVSTATUS = ^_AE_SRVSTATUS;
+  {$EXTERNALSYM PAE_SRVSTATUS}
+  TAeSrvStatus = _AE_SRVSTATUS;
+  PAeSrvStatus = PAE_SRVSTATUS;
+
+  _AE_SESSLOGON = record
+    ae_so_compname: DWORD;
+    ae_so_username: DWORD;
+    ae_so_privilege: DWORD;
+  end;
+  {$EXTERNALSYM _AE_SESSLOGON}
+  //AE_SESSLOGON = _AE_SESSLOGON;
+  //{$EXTERNALSYM AE_SESSLOGON}
+  LPAE_SESSLOGON = ^_AE_SESSLOGON;
+  {$EXTERNALSYM LPAE_SESSLOGON}
+  PAE_SESSLOGON = ^_AE_SESSLOGON;
+  {$EXTERNALSYM PAE_SESSLOGON}
+  TAeSessLogon = _AE_SESSLOGON;
+  PAeSessLogon = PAE_SESSLOGON;
+
+  _AE_SESSLOGOFF = record
+    ae_sf_compname: DWORD;
+    ae_sf_username: DWORD;
+    ae_sf_reason: DWORD;
+  end;
+  {$EXTERNALSYM _AE_SESSLOGOFF}
+  //AE_SESSLOGOFF = _AE_SESSLOGOFF;
+  //{$EXTERNALSYM AE_SESSLOGOFF}
+  LPAE_SESSLOGOFF = ^_AE_SESSLOGOFF;
+  {$EXTERNALSYM LPAE_SESSLOGOFF}
+  PAE_SESSLOGOFF = ^_AE_SESSLOGOFF;
+  {$EXTERNALSYM PAE_SESSLOGOFF}
+  TAeSessLogoff = _AE_SESSLOGOFF;
+  PAeSessLogoff = PAE_SESSLOGOFF;
+
+  _AE_SESSPWERR = record
+    ae_sp_compname: DWORD;
+    ae_sp_username: DWORD;
+  end;
+  {$EXTERNALSYM _AE_SESSPWERR}
+  //AE_SESSPWERR = _AE_SESSPWERR;
+  //{$EXTERNALSYM AE_SESSPWERR}
+  LPAE_SESSPWERR = ^_AE_SESSPWERR;
+  {$EXTERNALSYM LPAE_SESSPWERR}
+  PAE_SESSPWERR = ^_AE_SESSPWERR;
+  {$EXTERNALSYM PAE_SESSPWERR}
+  TAeSessPwerr = _AE_SESSPWERR;
+  PAeSessPwerr = PAE_SESSPWERR;
+
+  _AE_CONNSTART = record
+    ae_ct_compname: DWORD;
+    ae_ct_username: DWORD;
+    ae_ct_netname: DWORD;
+    ae_ct_connid: DWORD;
+  end;
+  {$EXTERNALSYM _AE_CONNSTART}
+  //AE_CONNSTART = _AE_CONNSTART;
+  //{$EXTERNALSYM AE_CONNSTART}
+  LPAE_CONNSTART = ^_AE_CONNSTART;
+  {$EXTERNALSYM LPAE_CONNSTART}
+  PAE_CONNSTART = ^_AE_CONNSTART;
+  {$EXTERNALSYM PAE_CONNSTART}
+  TAeConnStart = _AE_CONNSTART;
+  PAeConnStart = PAE_CONNSTART;
+
+  _AE_CONNSTOP = record
+    ae_cp_compname: DWORD;
+    ae_cp_username: DWORD;
+    ae_cp_netname: DWORD;
+    ae_cp_connid: DWORD;
+    ae_cp_reason: DWORD;
+  end;
+  {$EXTERNALSYM _AE_CONNSTOP}
+  //AE_CONNSTOP = _AE_CONNSTOP;
+  //{$EXTERNALSYM AE_CONNSTOP}
+  LPAE_CONNSTOP = ^_AE_CONNSTOP;
+  {$EXTERNALSYM LPAE_CONNSTOP}
+  PAE_CONNSTOP = ^_AE_CONNSTOP;
+  {$EXTERNALSYM PAE_CONNSTOP}
+  TAeConnStop = _AE_CONNSTOP;
+  PAeConnStop = PAE_CONNSTOP;
+
+  _AE_CONNREJ = record
+    ae_cr_compname: DWORD;
+    ae_cr_username: DWORD;
+    ae_cr_netname: DWORD;
+    ae_cr_reason: DWORD;
+  end;
+  {$EXTERNALSYM _AE_CONNREJ}
+  //AE_CONNREJ = _AE_CONNREJ;
+  //{$EXTERNALSYM AE_CONNREJ}
+  LPAE_CONNREJ = ^_AE_CONNREJ;
+  {$EXTERNALSYM LPAE_CONNREJ}
+  PAE_CONNREJ = ^_AE_CONNREJ;
+  {$EXTERNALSYM PAE_CONNREJ}
+  TAeConnRej = _AE_CONNREJ;
+  PAeConnRej = PAE_CONNREJ;
+
+  _AE_RESACCESS = record
+    ae_ra_compname: DWORD;
+    ae_ra_username: DWORD;
+    ae_ra_resname: DWORD;
+    ae_ra_operation: DWORD;
+    ae_ra_returncode: DWORD;
+    ae_ra_restype: DWORD;
+    ae_ra_fileid: DWORD;
+  end;
+  {$EXTERNALSYM _AE_RESACCESS}
+  //AE_RESACCESS = _AE_RESACCESS;
+  //{$EXTERNALSYM AE_RESACCESS}
+  LPAE_RESACCESS = ^_AE_RESACCESS;
+  {$EXTERNALSYM LPAE_RESACCESS}
+  PAE_RESACCESS = ^_AE_RESACCESS;
+  {$EXTERNALSYM PAE_RESACCESS}
+  TAeResAccess = _AE_RESACCESS;
+  PAeResAccess = PAE_RESACCESS;
+
+  _AE_RESACCESSREJ = record
+    ae_rr_compname: DWORD;
+    ae_rr_username: DWORD;
+    ae_rr_resname: DWORD;
+    ae_rr_operation: DWORD;
+  end;
+  {$EXTERNALSYM _AE_RESACCESSREJ}
+  //AE_RESACCESSREJ = _AE_RESACCESSREJ;
+  //{$EXTERNALSYM AE_RESACCESSREJ}
+  LPAE_RESACCESSREJ = ^_AE_RESACCESSREJ;
+  {$EXTERNALSYM LPAE_RESACCESSREJ}
+  PAE_RESACCESSREJ = ^_AE_RESACCESSREJ;
+  {$EXTERNALSYM PAE_RESACCESSREJ}
+  TAeResAccessRej = _AE_RESACCESSREJ;
+  PAeResAccessRej = PAE_RESACCESSREJ;
+
+  _AE_CLOSEFILE = record
+    ae_cf_compname: DWORD;
+    ae_cf_username: DWORD;
+    ae_cf_resname: DWORD;
+    ae_cf_fileid: DWORD;
+    ae_cf_duration: DWORD;
+    ae_cf_reason: DWORD;
+  end;
+  {$EXTERNALSYM _AE_CLOSEFILE}
+  //AE_CLOSEFILE = _AE_CLOSEFILE;
+  //{$EXTERNALSYM AE_CLOSEFILE}
+  LPAE_CLOSEFILE = ^_AE_CLOSEFILE;
+  {$EXTERNALSYM LPAE_CLOSEFILE}
+  PAE_CLOSEFILE = ^_AE_CLOSEFILE;
+  {$EXTERNALSYM PAE_CLOSEFILE}
+  TAeCloseFile = _AE_CLOSEFILE;
+  PAeCloseFile = PAE_CLOSEFILE;
+
+  _AE_SERVICESTAT = record
+    ae_ss_compname: DWORD;
+    ae_ss_username: DWORD;
+    ae_ss_svcname: DWORD;
+    ae_ss_status: DWORD;
+    ae_ss_code: DWORD;
+    ae_ss_text: DWORD;
+    ae_ss_returnval: DWORD;
+  end;
+  {$EXTERNALSYM _AE_SERVICESTAT}
+  //AE_SERVICESTAT = _AE_SERVICESTAT;
+  //{$EXTERNALSYM AE_SERVICESTAT}
+  LPAE_SERVICESTAT = ^_AE_SERVICESTAT;
+  {$EXTERNALSYM LPAE_SERVICESTAT}
+  PAE_SERVICESTAT = ^_AE_SERVICESTAT;
+  {$EXTERNALSYM PAE_SERVICESTAT}
+  TAeServiceStat = _AE_SERVICESTAT;
+  PAeServiceStat = PAE_SERVICESTAT;
+
+  _AE_ACLMOD = record
+    ae_am_compname: DWORD;
+    ae_am_username: DWORD;
+    ae_am_resname: DWORD;
+    ae_am_action: DWORD;
+    ae_am_datalen: DWORD;
+  end;
+  {$EXTERNALSYM _AE_ACLMOD}
+  //AE_ACLMOD = _AE_ACLMOD;
+  //{$EXTERNALSYM AE_ACLMOD}
+  LPAE_ACLMOD = ^_AE_ACLMOD;
+  {$EXTERNALSYM LPAE_ACLMOD}
+  PAE_ACLMOD = ^_AE_ACLMOD;
+  {$EXTERNALSYM PAE_ACLMOD}
+  TAeAclMod = _AE_ACLMOD;
+  PAeAclMod = PAE_ACLMOD;
+
+  _AE_UASMOD = record
+    ae_um_compname: DWORD;
+    ae_um_username: DWORD;
+    ae_um_resname: DWORD;
+    ae_um_rectype: DWORD;
+    ae_um_action: DWORD;
+    ae_um_datalen: DWORD;
+  end;
+  {$EXTERNALSYM _AE_UASMOD}
+  //AE_UASMOD = _AE_UASMOD;
+  //{$EXTERNALSYM AE_UASMOD}
+  LPAE_UASMOD = ^_AE_UASMOD;
+  {$EXTERNALSYM LPAE_UASMOD}
+  PAE_UASMOD = ^_AE_UASMOD;
+  {$EXTERNALSYM PAE_UASMOD}
+  TAeUasMod = _AE_UASMOD;
+  PAeUasMod = PAE_UASMOD;
+
+  _AE_NETLOGON = record
+    ae_no_compname: DWORD;
+    ae_no_username: DWORD;
+    ae_no_privilege: DWORD;
+    ae_no_authflags: DWORD;
+  end;
+  {$EXTERNALSYM _AE_NETLOGON}
+  //AE_NETLOGON = _AE_NETLOGON;
+  //{$EXTERNALSYM AE_NETLOGON}
+  LPAE_NETLOGON = ^_AE_NETLOGON;
+  {$EXTERNALSYM LPAE_NETLOGON}
+  PAE_NETLOGON = ^_AE_NETLOGON;
+  {$EXTERNALSYM PAE_NETLOGON}
+  TAeNetLogon = _AE_NETLOGON;
+  PAeNetLogon = PAE_NETLOGON;
+
+  _AE_NETLOGOFF = record
+    ae_nf_compname: DWORD;
+    ae_nf_username: DWORD;
+    ae_nf_reserved1: DWORD;
+    ae_nf_reserved2: DWORD;
+  end;
+  {$EXTERNALSYM _AE_NETLOGOFF}
+  //AE_NETLOGOFF = _AE_NETLOGOFF;
+  //{$EXTERNALSYM AE_NETLOGOFF}
+  LPAE_NETLOGOFF = ^_AE_NETLOGOFF;
+  {$EXTERNALSYM LPAE_NETLOGOFF}
+  PAE_NETLOGOFF = ^_AE_NETLOGOFF;
+  {$EXTERNALSYM PAE_NETLOGOFF}
+  TAeNetLogoff = _AE_NETLOGOFF;
+  PAeNetLogoff = PAE_NETLOGOFF;
+
+  _AE_ACCLIM = record
+    ae_al_compname: DWORD;
+    ae_al_username: DWORD;
+    ae_al_resname: DWORD;
+    ae_al_limit: DWORD;
+  end;
+  {$EXTERNALSYM _AE_ACCLIM}
+  //AE_ACCLIM = _AE_ACCLIM;
+  //{$EXTERNALSYM AE_ACCLIM}
+  LPAE_ACCLIM = ^_AE_ACCLIM;
+  {$EXTERNALSYM LPAE_ACCLIM}
+  PAE_ACCLIM = ^_AE_ACCLIM;
+  {$EXTERNALSYM PAE_ACCLIM}
+  TAeAccLim = _AE_ACCLIM;
+  PAeAccLim = PAE_ACCLIM;
+
+const
+  ACTION_LOCKOUT     = 0;
+  {$EXTERNALSYM ACTION_LOCKOUT}
+  ACTION_ADMINUNLOCK = 1;
+  {$EXTERNALSYM ACTION_ADMINUNLOCK}
+
+type
+  _AE_LOCKOUT = record
+    ae_lk_compname: DWORD; // Ptr to computername of client.
+    ae_lk_username: DWORD; // Ptr to username of client (NULL
+    //  if same as computername).
+    ae_lk_action: DWORD; // Action taken on account:
+    // 0 means locked out, 1 means not.
+    ae_lk_bad_pw_count: DWORD; // Bad password count at the time
+    // of lockout.
+  end;
+  {$EXTERNALSYM _AE_LOCKOUT}
+  //AE_LOCKOUT = _AE_LOCKOUT;
+  //{$EXTERNALSYM AE_LOCKOUT}
+  LPAE_LOCKOUT = ^_AE_LOCKOUT;
+  {$EXTERNALSYM LPAE_LOCKOUT}
+  PAE_LOCKOUT = ^_AE_LOCKOUT;
+  {$EXTERNALSYM PAE_LOCKOUT}
+  TAeLockout = _AE_LOCKOUT;
+  PAeLockout = PAE_LOCKOUT;
+
+  _AE_GENERIC = record
+    ae_ge_msgfile: DWORD;
+    ae_ge_msgnum: DWORD;
+    ae_ge_params: DWORD;
+    ae_ge_param1: DWORD;
+    ae_ge_param2: DWORD;
+    ae_ge_param3: DWORD;
+    ae_ge_param4: DWORD;
+    ae_ge_param5: DWORD;
+    ae_ge_param6: DWORD;
+    ae_ge_param7: DWORD;
+    ae_ge_param8: DWORD;
+    ae_ge_param9: DWORD;
+  end;
+  {$EXTERNALSYM _AE_GENERIC}
+  //AE_GENERIC = _AE_GENERIC;
+  //{$EXTERNALSYM AE_GENERIC}
+  LPAE_GENERIC = ^_AE_GENERIC;
+  {$EXTERNALSYM LPAE_GENERIC}
+  PAE_GENERIC = ^_AE_GENERIC;
+  {$EXTERNALSYM PAE_GENERIC}
+  TAeGeneric = _AE_GENERIC;
+  PAeGeneric = PAE_GENERIC;
+
+//
+// Special Values and Constants - Audit
+//
+
+//
+// Audit entry types (field ae_type in audit_entry).
+//
+
+const
+  AE_SRVSTATUS    = 0;
+  {$EXTERNALSYM AE_SRVSTATUS}
+  AE_SESSLOGON    = 1;
+  {$EXTERNALSYM AE_SESSLOGON}
+  AE_SESSLOGOFF   = 2;
+  {$EXTERNALSYM AE_SESSLOGOFF}
+  AE_SESSPWERR    = 3;
+  {$EXTERNALSYM AE_SESSPWERR}
+  AE_CONNSTART    = 4;
+  {$EXTERNALSYM AE_CONNSTART}
+  AE_CONNSTOP     = 5;
+  {$EXTERNALSYM AE_CONNSTOP}
+  AE_CONNREJ      = 6;
+  {$EXTERNALSYM AE_CONNREJ}
+  AE_RESACCESS    = 7;
+  {$EXTERNALSYM AE_RESACCESS}
+  AE_RESACCESSREJ = 8;
+  {$EXTERNALSYM AE_RESACCESSREJ}
+  AE_CLOSEFILE    = 9;
+  {$EXTERNALSYM AE_CLOSEFILE}
+  AE_SERVICESTAT  = 11;
+  {$EXTERNALSYM AE_SERVICESTAT}
+  AE_ACLMOD       = 12;
+  {$EXTERNALSYM AE_ACLMOD}
+  AE_UASMOD       = 13;
+  {$EXTERNALSYM AE_UASMOD}
+  AE_NETLOGON     = 14;
+  {$EXTERNALSYM AE_NETLOGON}
+  AE_NETLOGOFF    = 15;
+  {$EXTERNALSYM AE_NETLOGOFF}
+  AE_NETLOGDENIED = 16;
+  {$EXTERNALSYM AE_NETLOGDENIED}
+  AE_ACCLIMITEXCD = 17;
+  {$EXTERNALSYM AE_ACCLIMITEXCD}
+  AE_RESACCESS2   = 18;
+  {$EXTERNALSYM AE_RESACCESS2}
+  AE_ACLMODFAIL   = 19;
+  {$EXTERNALSYM AE_ACLMODFAIL}
+  AE_LOCKOUT      = 20;
+  {$EXTERNALSYM AE_LOCKOUT}
+  AE_GENERIC_TYPE = 21;
+  {$EXTERNALSYM AE_GENERIC_TYPE}
+
+//
+// Values for ae_ss_status field of ae_srvstatus.
+//
+
+  AE_SRVSTART  = 0;
+  {$EXTERNALSYM AE_SRVSTART}
+  AE_SRVPAUSED = 1;
+  {$EXTERNALSYM AE_SRVPAUSED}
+  AE_SRVCONT   = 2;
+  {$EXTERNALSYM AE_SRVCONT}
+  AE_SRVSTOP   = 3;
+  {$EXTERNALSYM AE_SRVSTOP}
+
+//
+// Values for ae_so_privilege field of ae_sesslogon.
+//
+
+  AE_GUEST = 0;
+  {$EXTERNALSYM AE_GUEST}
+  AE_USER  = 1;
+  {$EXTERNALSYM AE_USER}
+  AE_ADMIN = 2;
+  {$EXTERNALSYM AE_ADMIN}
+
+//
+// Values for various ae_XX_reason fields.
+//
+
+  AE_NORMAL        = 0;
+  {$EXTERNALSYM AE_NORMAL}
+  AE_USERLIMIT     = 0;
+  {$EXTERNALSYM AE_USERLIMIT}
+  AE_GENERAL       = 0;
+  {$EXTERNALSYM AE_GENERAL}
+  AE_ERROR         = 1;
+  {$EXTERNALSYM AE_ERROR}
+  AE_SESSDIS       = 1;
+  {$EXTERNALSYM AE_SESSDIS}
+  AE_BADPW         = 1;
+  {$EXTERNALSYM AE_BADPW}
+  AE_AUTODIS       = 2;
+  {$EXTERNALSYM AE_AUTODIS}
+  AE_UNSHARE       = 2;
+  {$EXTERNALSYM AE_UNSHARE}
+  AE_ADMINPRIVREQD = 2;
+  {$EXTERNALSYM AE_ADMINPRIVREQD}
+  AE_ADMINDIS      = 3;
+  {$EXTERNALSYM AE_ADMINDIS}
+  AE_NOACCESSPERM  = 3;
+  {$EXTERNALSYM AE_NOACCESSPERM}
+  AE_ACCRESTRICT   = 4;
+  {$EXTERNALSYM AE_ACCRESTRICT}
+
+  AE_NORMAL_CLOSE = 0;
+  {$EXTERNALSYM AE_NORMAL_CLOSE}
+  AE_SES_CLOSE    = 1;
+  {$EXTERNALSYM AE_SES_CLOSE}
+  AE_ADMIN_CLOSE  = 2;
+  {$EXTERNALSYM AE_ADMIN_CLOSE}
+
+//
+// Values for xx_subreason fields.
+//
+
+  AE_LIM_UNKNOWN     = 0;
+  {$EXTERNALSYM AE_LIM_UNKNOWN}
+  AE_LIM_LOGONHOURS  = 1;
+  {$EXTERNALSYM AE_LIM_LOGONHOURS}
+  AE_LIM_EXPIRED     = 2;
+  {$EXTERNALSYM AE_LIM_EXPIRED}
+  AE_LIM_INVAL_WKSTA = 3;
+  {$EXTERNALSYM AE_LIM_INVAL_WKSTA}
+  AE_LIM_DISABLED    = 4;
+  {$EXTERNALSYM AE_LIM_DISABLED}
+  AE_LIM_DELETED     = 5;
+  {$EXTERNALSYM AE_LIM_DELETED}
+
+//
+// Values for xx_action fields
+//
+
+  AE_MOD    = 0;
+  {$EXTERNALSYM AE_MOD}
+  AE_DELETE = 1;
+  {$EXTERNALSYM AE_DELETE}
+  AE_ADD    = 2;
+  {$EXTERNALSYM AE_ADD}
+
+//
+// Types of UAS record for um_rectype field
+//
+
+  AE_UAS_USER   = 0;
+  {$EXTERNALSYM AE_UAS_USER}
+  AE_UAS_GROUP  = 1;
+  {$EXTERNALSYM AE_UAS_GROUP}
+  AE_UAS_MODALS = 2;
+  {$EXTERNALSYM AE_UAS_MODALS}
+
+//
+// Bitmasks for auditing events
+//
+// The parentheses around the hex constants broke h_to_inc
+// and have been purged from the face of the earth.
+//
+
+  SVAUD_SERVICE       = $1;
+  {$EXTERNALSYM SVAUD_SERVICE}
+  SVAUD_GOODSESSLOGON = $6;
+  {$EXTERNALSYM SVAUD_GOODSESSLOGON}
+  SVAUD_BADSESSLOGON  = $18;
+  {$EXTERNALSYM SVAUD_BADSESSLOGON}
+  SVAUD_SESSLOGON     = SVAUD_GOODSESSLOGON or SVAUD_BADSESSLOGON;
+  {$EXTERNALSYM SVAUD_SESSLOGON}
+  SVAUD_GOODNETLOGON  = $60;
+  {$EXTERNALSYM SVAUD_GOODNETLOGON}
+  SVAUD_BADNETLOGON   = $180;
+  {$EXTERNALSYM SVAUD_BADNETLOGON}
+  SVAUD_NETLOGON      = SVAUD_GOODNETLOGON or SVAUD_BADNETLOGON;
+  {$EXTERNALSYM SVAUD_NETLOGON}
+  SVAUD_LOGON         = SVAUD_NETLOGON or SVAUD_SESSLOGON;
+  {$EXTERNALSYM SVAUD_LOGON}
+  SVAUD_GOODUSE       = $600;
+  {$EXTERNALSYM SVAUD_GOODUSE}
+  SVAUD_BADUSE        = $1800;
+  {$EXTERNALSYM SVAUD_BADUSE}
+  SVAUD_USE           = SVAUD_GOODUSE or SVAUD_BADUSE;
+  {$EXTERNALSYM SVAUD_USE}
+  SVAUD_USERLIST      = $2000;
+  {$EXTERNALSYM SVAUD_USERLIST}
+  SVAUD_PERMISSIONS   = $4000;
+  {$EXTERNALSYM SVAUD_PERMISSIONS}
+  SVAUD_RESOURCE      = $8000;
+  {$EXTERNALSYM SVAUD_RESOURCE}
+  SVAUD_LOGONLIM      = $00010000;
+  {$EXTERNALSYM SVAUD_LOGONLIM}
+
+//
+// Resource access audit bitmasks.
+//
+
+  AA_AUDIT_ALL = $0001;
+  {$EXTERNALSYM AA_AUDIT_ALL}
+  AA_A_OWNER   = $0004;
+  {$EXTERNALSYM AA_A_OWNER}
+  AA_CLOSE     = $0008;
+  {$EXTERNALSYM AA_CLOSE}
+  AA_S_OPEN    = $0010;
+  {$EXTERNALSYM AA_S_OPEN}
+  AA_S_WRITE   = $0020;
+  {$EXTERNALSYM AA_S_WRITE}
+  AA_S_CREATE  = $0020;
+  {$EXTERNALSYM AA_S_CREATE}
+  AA_S_DELETE  = $0040;
+  {$EXTERNALSYM AA_S_DELETE}
+  AA_S_ACL     = $0080;
+  {$EXTERNALSYM AA_S_ACL}
+  AA_S_ALL     =  AA_S_OPEN or AA_S_WRITE or AA_S_DELETE or AA_S_ACL;
+  {$EXTERNALSYM AA_S_ALL}
+  AA_F_OPEN    = $0100;
+  {$EXTERNALSYM AA_F_OPEN}
+  AA_F_WRITE   = $0200;
+  {$EXTERNALSYM AA_F_WRITE}
+  AA_F_CREATE  = $0200;
+  {$EXTERNALSYM AA_F_CREATE}
+  AA_F_DELETE  = $0400;
+  {$EXTERNALSYM AA_F_DELETE}
+  AA_F_ACL     = $0800;
+  {$EXTERNALSYM AA_F_ACL}
+  AA_F_ALL     =  AA_F_OPEN or AA_F_WRITE or AA_F_DELETE or AA_F_ACL;
+  {$EXTERNALSYM AA_F_ALL}
+
+// Pinball-specific
+
+  AA_A_OPEN   = $1000;
+  {$EXTERNALSYM AA_A_OPEN}
+  AA_A_WRITE  = $2000;
+  {$EXTERNALSYM AA_A_WRITE}
+  AA_A_CREATE = $2000;
+  {$EXTERNALSYM AA_A_CREATE}
+  AA_A_DELETE = $4000;
+  {$EXTERNALSYM AA_A_DELETE}
+  AA_A_ACL    = $8000;
+  {$EXTERNALSYM AA_A_ACL}
+  AA_A_ALL    = AA_F_OPEN or AA_F_WRITE or AA_F_DELETE or AA_F_ACL;
+  {$EXTERNALSYM AA_A_ALL}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetAuditClear: Pointer;
+
+function NetAuditClear;
+begin
+  GetProcedureAddress(_NetAuditClear, netapi32, 'NetAuditClear');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAuditClear]
+  end;
+end;
+
+var
+  _NetAuditRead: Pointer;
+
+function NetAuditRead;
+begin
+  GetProcedureAddress(_NetAuditRead, netapi32, 'NetAuditRead');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAuditRead]
+  end;
+end;
+
+var
+  _NetAuditWrite: Pointer;
+
+function NetAuditWrite;
+begin
+  GetProcedureAddress(_NetAuditWrite, netapi32, 'NetAuditWrite');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAuditWrite]
+  end;
+end;
+
+{$ELSE}
+
+function NetAuditClear; external netapi32 name 'NetAuditClear';
+function NetAuditRead; external netapi32 name 'NetAuditRead';
+function NetAuditWrite; external netapi32 name 'NetAuditWrite';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 191 - 0
packages/extra/winunits/jwalmconfig.pas

@@ -0,0 +1,191 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Config API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmconfig.h, released November 2001. The original Pascal}
+{ code is: LmConfig.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmConfig;
+
+{$I jediapilib.inc}
+
+{$WEAKPACKAGEUNIT}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmconfig.h"'}
+{$HPPEMIT ''}
+
+{$DEFINE LM_REVISED_CONFIG_APIS}
+
+//
+// Function Prototypes - Config
+//
+
+{$IFDEF LM_REVISED_CONFIG_APIS}
+
+function NetConfigGet(server, component, parameter: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConfigGet}
+
+function NetConfigGetAll(server, component: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConfigGetAll}
+
+{$ELSE}
+
+function NetConfigGet(server, component, parameter: LPCWSTR; var bufptr: LPBYTE; totalavailable: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConfigGet}
+
+function NetConfigGetAll(server, component: LPCWSTR; var bufptr: LPBYTE; totalavailable: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConfigGetAll}
+
+{$ENDIF LM_REVISED_CONFIG_APIS}
+
+function NetConfigSet(server, reserved1, component: LPCWSTR; level, reserved2: DWORD; buf: LPBYTE; reserved3: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConfigSet}
+
+function NetRegisterDomainNameChangeNotification(NotificationEventHandle: PHANDLE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetRegisterDomainNameChangeNotification}
+
+function NetUnregisterDomainNameChangeNotification(NotificationEventHandle: HANDLE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUnregisterDomainNameChangeNotification}
+
+//
+// Data Structures - Config
+//
+
+type
+  _CONFIG_INFO_0 = record
+    cfgi0_key: LPWSTR;
+    cfgi0_data: LPWSTR;
+  end;
+  {$EXTERNALSYM _CONFIG_INFO_0}
+  CONFIG_INFO_0 = _CONFIG_INFO_0;
+  {$EXTERNALSYM CONFIG_INFO_0}
+  PCONFIG_INFO_0 = ^CONFIG_INFO_0;
+  {$EXTERNALSYM PCONFIG_INFO_0}
+  LPCONFIG_INFO_0 = ^CONFIG_INFO_0;
+  {$EXTERNALSYM LPCONFIG_INFO_0}
+  TConfigInfo0 = CONFIG_INFO_0;
+  PConfigInfo0 = PCONFIG_INFO_0;  
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetConfigGet: Pointer;
+
+function NetConfigGet;
+begin
+  GetProcedureAddress(_NetConfigGet, netapi32, 'NetConfigGet');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetConfigGet]
+  end;
+end;
+
+var
+  _NetConfigGetAll: Pointer;
+
+function NetConfigGetAll;
+begin
+  GetProcedureAddress(_NetConfigGetAll, netapi32, 'NetConfigGetAll');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetConfigGetAll]
+  end;
+end;
+
+var
+  _NetConfigSet: Pointer;
+
+function NetConfigSet;
+begin
+  GetProcedureAddress(_NetConfigSet, netapi32, 'NetConfigSet');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetConfigSet]
+  end;
+end;
+
+var
+  _NetRegisterDomainNameChangeNotification: Pointer;
+
+function NetRegisterDomainNameChangeNotification;
+begin
+  GetProcedureAddress(_NetRegisterDomainNameChangeNotification, netapi32, 'NetRegisterDomainNameChangeNotification');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetRegisterDomainNameChangeNotification]
+  end;
+end;
+
+var
+  _NetUnregisterDomainNameChangeNotification: Pointer;
+
+function NetUnregisterDomainNameChangeNotification;
+begin
+  GetProcedureAddress(_NetUnregisterDomainNameChangeNotification, netapi32, 'NetUnregisterDomainNameChangeNotification');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUnregisterDomainNameChangeNotification]
+  end;
+end;
+
+{$ELSE}
+
+function NetConfigGet; external netapi32 name 'NetConfigGet';
+function NetConfigGetAll; external netapi32 name 'NetConfigGetAll';
+function NetConfigSet; external netapi32 name 'NetConfigSet';
+function NetRegisterDomainNameChangeNotification; external netapi32 name 'NetRegisterDomainNameChangeNotification';
+function NetUnregisterDomainNameChangeNotification; external netapi32 name 'NetUnregisterDomainNameChangeNotification';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 363 - 0
packages/extra/winunits/jwalmcons.pas

@@ -0,0 +1,363 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Constants API interface Unit for Object Pascal                   }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmcons.h, released November 2001. The original Pascal  }
+{ code is: LmCons.pas, released Februari 2002. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmCons;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lm.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType, JwaLmErr;
+
+const
+  NetApi32 = 'netapi32.dll';
+
+//
+// NOTE:  Lengths of strings are given as the maximum lengths of the
+// string in characters (not bytes).  This does not include space for the
+// terminating 0-characters.  When allocating space for such an item,
+// use the form:
+//
+//     TCHAR username[UNLEN+1];
+//
+// Definitions of the form LN20_* define those values in effect for
+// LanMan 2.0.
+//
+
+//
+// String Lengths for various LanMan names
+//
+
+const
+  CNLEN      = 15; // Computer name length
+  {$EXTERNALSYM CNLEN}
+  LM20_CNLEN = 15; // LM 2.0 Computer name length
+  {$EXTERNALSYM LM20_CNLEN}
+  DNLEN      = CNLEN; // Maximum domain name length
+  {$EXTERNALSYM DNLEN}
+  LM20_DNLEN = LM20_CNLEN; // LM 2.0 Maximum domain name length
+  {$EXTERNALSYM LM20_DNLEN}
+
+//#if (CNLEN != DNLEN)
+//#error CNLEN and DNLEN are not equal
+//#endif
+
+  UNCLEN      = CNLEN + 2; // UNC computer name length
+  {$EXTERNALSYM UNCLEN}
+  LM20_UNCLEN = LM20_CNLEN + 2; // LM 2.0 UNC computer name length
+  {$EXTERNALSYM LM20_UNCLEN}
+
+  NNLEN      = 80; // Net name length (share name)
+  {$EXTERNALSYM NNLEN}
+  LM20_NNLEN = 12; // LM 2.0 Net name length
+  {$EXTERNALSYM LM20_NNLEN}
+
+  RMLEN      = UNCLEN + 1 + NNLEN; // Max remote name length
+  {$EXTERNALSYM RMLEN}
+  LM20_RMLEN = LM20_UNCLEN + 1 + LM20_NNLEN; // LM 2.0 Max remote name length
+  {$EXTERNALSYM LM20_RMLEN}
+
+  SNLEN        = 80; // Service name length
+  {$EXTERNALSYM SNLEN}
+  LM20_SNLEN   = 15; // LM 2.0 Service name length
+  {$EXTERNALSYM LM20_SNLEN}
+  STXTLEN      = 256; // Service text length
+  {$EXTERNALSYM STXTLEN}
+  LM20_STXTLEN = 63; // LM 2.0 Service text length
+  {$EXTERNALSYM LM20_STXTLEN}
+
+  PATHLEN      = 256; // Max. path (not including drive name)
+  {$EXTERNALSYM PATHLEN}
+  LM20_PATHLEN = 256; // LM 2.0 Max. path
+  {$EXTERNALSYM LM20_PATHLEN}
+
+  DEVLEN      = 80; // Device name length
+  {$EXTERNALSYM DEVLEN}
+  LM20_DEVLEN = 8; // LM 2.0 Device name length
+  {$EXTERNALSYM LM20_DEVLEN}
+
+  EVLEN = 16; // Event name length
+  {$EXTERNALSYM EVLEN}
+
+//
+// User, Group and Password lengths
+//
+
+  UNLEN      = 256; // Maximum user name length
+  {$EXTERNALSYM UNLEN}
+  LM20_UNLEN = 20; // LM 2.0 Maximum user name length
+  {$EXTERNALSYM LM20_UNLEN}
+
+  GNLEN      = UNLEN; // Group name
+  {$EXTERNALSYM GNLEN}
+  LM20_GNLEN = LM20_UNLEN; // LM 2.0 Group name
+  {$EXTERNALSYM LM20_GNLEN}
+
+  PWLEN      = 256; // Maximum password length
+  {$EXTERNALSYM PWLEN}
+  LM20_PWLEN = 14; // LM 2.0 Maximum password length
+  {$EXTERNALSYM LM20_PWLEN}
+
+  SHPWLEN = 8; // Share password length (bytes)
+  {$EXTERNALSYM SHPWLEN}
+
+  CLTYPE_LEN = 12; // Length of client type string
+  {$EXTERNALSYM CLTYPE_LEN}
+
+  MAXCOMMENTSZ      = 256; // Multipurpose comment length
+  {$EXTERNALSYM MAXCOMMENTSZ}
+  LM20_MAXCOMMENTSZ = 48; // LM 2.0 Multipurpose comment length
+  {$EXTERNALSYM LM20_MAXCOMMENTSZ}
+
+  QNLEN      = NNLEN; // Queue name maximum length
+  {$EXTERNALSYM QNLEN}
+  LM20_QNLEN = LM20_NNLEN; // LM 2.0 Queue name maximum length
+  {$EXTERNALSYM LM20_QNLEN}
+
+//#if (QNLEN != NNLEN)
+//# error QNLEN and NNLEN are not equal
+//#endif
+
+//
+// The ALERTSZ and MAXDEVENTRIES defines have not yet been NT'ized.
+// Whoever ports these components should change these values appropriately.
+//
+
+  ALERTSZ       = 128; // size of alert string in server
+  {$EXTERNALSYM ALERTSZ}
+  MAXDEVENTRIES = SizeOf(Integer)*8;    // Max number of device entries
+  {$EXTERNALSYM MAXDEVENTRIES}
+
+                                        //
+                                        // We use int bitmap to represent
+                                        //
+
+  NETBIOS_NAME_LEN = 16; // NetBIOS net name (bytes)
+  {$EXTERNALSYM NETBIOS_NAME_LEN}
+
+//
+// Value to be used with APIs which have a "preferred maximum length"
+// parameter.  This value indicates that the API should just allocate
+// "as much as it takes."
+//
+
+  MAX_PREFERRED_LENGTH = DWORD(-1);
+  {$EXTERNALSYM MAX_PREFERRED_LENGTH}
+
+//
+//        Constants used with encryption
+//
+
+  CRYPT_KEY_LEN      = 7;
+  {$EXTERNALSYM CRYPT_KEY_LEN}
+  CRYPT_TXT_LEN      = 8;
+  {$EXTERNALSYM CRYPT_TXT_LEN}
+  ENCRYPTED_PWLEN    = 16;
+  {$EXTERNALSYM ENCRYPTED_PWLEN}
+  SESSION_PWLEN      = 24;
+  {$EXTERNALSYM SESSION_PWLEN}
+  SESSION_CRYPT_KLEN = 21;
+  {$EXTERNALSYM SESSION_CRYPT_KLEN}
+
+//
+//  Value to be used with SetInfo calls to allow setting of all
+//  settable parameters (parmnum zero option)
+//
+
+  PARMNUM_ALL = 0;
+  {$EXTERNALSYM PARMNUM_ALL}
+
+  PARM_ERROR_UNKNOWN     = DWORD(-1);
+  {$EXTERNALSYM PARM_ERROR_UNKNOWN}
+  PARM_ERROR_NONE        = 0;
+  {$EXTERNALSYM PARM_ERROR_NONE}
+  PARMNUM_BASE_INFOLEVEL = 1000;
+  {$EXTERNALSYM PARMNUM_BASE_INFOLEVEL}
+
+//
+// Only the UNICODE version of the LM APIs are available on NT.
+// Non-UNICODE version on other platforms
+//
+
+//#if defined( _WIN32_WINNT ) || defined( WINNT ) || defined( FORCE_UNICODE )
+
+{$IFDEF WINNT4_UP}
+{$DEFINE LM_USE_UNICODE}
+{$ENDIF WINNT4_UP}
+
+{$IFDEF LM_FORCE_UNICODE}
+{$DEFINE LM_USE_UNICODE}
+{$ENDIF LM_FORCE_UNICODE}
+
+{$IFDEF LM_USE_UNICODE}
+
+type
+  LMSTR = LPWSTR;
+  {$EXTERNALSYM LMSTR}
+  LMCSTR = LPCWSTR;
+  {$EXTERNALSYM LMCSTR}
+  PLMSTR = ^LMSTR;
+  {$NODEFINE PLMSTR}
+
+const
+  MESSAGE_FILENAME  = WideString('NETMSG');
+  {$EXTERNALSYM MESSAGE_FILENAME}
+  OS2MSG_FILENAME   = WideString('BASE');
+  {$EXTERNALSYM OS2MSG_FILENAME}
+  HELP_MSG_FILENAME = WideString('NETH');
+  {$EXTERNALSYM HELP_MSG_FILENAME}
+
+// ** INTERNAL_ONLY **
+
+// The backup message file named here is a duplicate of net.msg. It
+// is not shipped with the product, but is used at buildtime to
+// msgbind certain messages to netapi.dll and some of the services.
+// This allows for OEMs to modify the message text in net.msg and
+// have those changes show up.        Only in case there is an error in
+// retrieving the messages from net.msg do we then get the bound
+// messages out of bak.msg (really out of the message segment).
+
+  BACKUP_MSG_FILENAME = WideString('BAK.MSG');
+  {$EXTERNALSYM BACKUP_MSG_FILENAME}
+
+// ** END_INTERNAL **
+
+{$ELSE}
+
+type
+  LMSTR = LPSTR;
+  {$EXTERNALSYM LMSTR}
+  LMCSTR = LPCSTR;
+  {$EXTERNALSYM LMCSTR}
+
+const
+  MESSAGE_FILENAME  = AnsiString('NETMSG');
+  {$EXTERNALSYM MESSAGE_FILENAME}
+  OS2MSG_FILENAME   = AnsiString('BASE');
+  {$EXTERNALSYM OS2MSG_FILENAME}
+  HELP_MSG_FILENAME = AnsiString('NETH');
+  {$EXTERNALSYM HELP_MSG_FILENAME}
+
+// ** INTERNAL_ONLY **
+
+// The backup message file named here is a duplicate of net.msg. It
+// is not shipped with the product, but is used at buildtime to
+// msgbind certain messages to netapi.dll and some of the services.
+// This allows for OEMs to modify the message text in net.msg and
+// have those changes show up.        Only in case there is an error in
+// retrieving the messages from net.msg do we then get the bound
+// messages out of bak.msg (really out of the message segment).
+
+  BACKUP_MSG_FILENAME = LMSTR('BAK.MSG');
+  {$EXTERNALSYM BACKUP_MSG_FILENAME}
+
+// ** END_INTERNAL **
+
+{$ENDIF LM_USE_UNICODE}
+
+{$UNDEF LM_USE_UNICODE}
+
+//
+//        Message File Names
+//
+
+//
+// Keywords used in Function Prototypes
+//
+
+type
+  NET_API_STATUS = DWORD;
+  {$EXTERNALSYM NET_API_STATUS}
+  TNetApiStatus = NET_API_STATUS;
+
+//
+// The platform ID indicates the levels to use for platform-specific
+// information.
+//
+
+const
+  PLATFORM_ID_DOS = 300;
+  {$EXTERNALSYM PLATFORM_ID_DOS}
+  PLATFORM_ID_OS2 = 400;
+  {$EXTERNALSYM PLATFORM_ID_OS2}
+  PLATFORM_ID_NT  = 500;
+  {$EXTERNALSYM PLATFORM_ID_NT}
+  PLATFORM_ID_OSF = 600;
+  {$EXTERNALSYM PLATFORM_ID_OSF}
+  PLATFORM_ID_VMS = 700;
+  {$EXTERNALSYM PLATFORM_ID_VMS}
+
+//
+//      There message numbers assigned to different LANMAN components
+//      are as defined below.
+//
+//      lmerr.h:        2100 - 2999     NERR_BASE
+//      alertmsg.h:     3000 - 3049     ALERT_BASE
+//      lmsvc.h:        3050 - 3099     SERVICE_BASE
+//      lmerrlog.h:     3100 - 3299     ERRLOG_BASE
+//      msgtext.h:      3300 - 3499     MTXT_BASE
+//      apperr.h:       3500 - 3999     APPERR_BASE
+//      apperrfs.h:     4000 - 4299     APPERRFS_BASE
+//      apperr2.h:      4300 - 5299     APPERR2_BASE
+//      ncberr.h:       5300 - 5499     NRCERR_BASE
+//      alertmsg.h:     5500 - 5599     ALERT2_BASE
+//      lmsvc.h:        5600 - 5699     SERVICE2_BASE
+//      lmerrlog.h      5700 - 5899     ERRLOG2_BASE
+//
+
+  MIN_LANMAN_MESSAGE_ID = NERR_BASE;
+  {$EXTERNALSYM MIN_LANMAN_MESSAGE_ID}
+  MAX_LANMAN_MESSAGE_ID = 5899;
+  {$EXTERNALSYM MAX_LANMAN_MESSAGE_ID}
+
+implementation
+
+end.

+ 731 - 0
packages/extra/winunits/jwalmdfs.pas

@@ -0,0 +1,731 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager DFS API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmdfs.h, released November 2001. The original Pascal   }
+{ code is: LmDfs.pas, released Februari 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmDFS;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmdfs.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// DFS Volume state
+//
+
+const
+  DFS_VOLUME_STATES             = $F;
+  {$EXTERNALSYM DFS_VOLUME_STATES}
+
+  DFS_VOLUME_STATE_OK           = 1;
+  {$EXTERNALSYM DFS_VOLUME_STATE_OK}
+  DFS_VOLUME_STATE_INCONSISTENT = 2;
+  {$EXTERNALSYM DFS_VOLUME_STATE_INCONSISTENT}
+  DFS_VOLUME_STATE_OFFLINE      = 3;
+  {$EXTERNALSYM DFS_VOLUME_STATE_OFFLINE}
+  DFS_VOLUME_STATE_ONLINE       = 4;
+  {$EXTERNALSYM DFS_VOLUME_STATE_ONLINE}
+
+//
+// These are valid for setting the volume state on the root
+// These are available to force a resynchronize on the root
+// volume or to put it in a standby mode.
+//
+
+  DFS_VOLUME_STATE_RESYNCHRONIZE = $10;
+  {$EXTERNALSYM DFS_VOLUME_STATE_RESYNCHRONIZE}
+  DFS_VOLUME_STATE_STANDBY       = $20;
+  {$EXTERNALSYM DFS_VOLUME_STATE_STANDBY}
+
+//
+// These are valid on getting the volume state on the root
+// These are available to determine the flavor of DFS
+// A few bits are reserved to determine the flavor of the DFS root.
+// To get the flavor, and the state with DFS_VOLUME_FLAVORS.
+//
+// (_state & DFS_VOLUME_FLAVORS) will tell you the flavor of the dfs root.
+//
+//
+
+  DFS_VOLUME_FLAVORS = $0300;
+  {$EXTERNALSYM DFS_VOLUME_FLAVORS}
+
+  DFS_VOLUME_FLAVOR_UNUSED1    = $0000;
+  {$EXTERNALSYM DFS_VOLUME_FLAVOR_UNUSED1}
+  DFS_VOLUME_FLAVOR_STANDALONE = $0100;
+  {$EXTERNALSYM DFS_VOLUME_FLAVOR_STANDALONE}
+  DFS_VOLUME_FLAVOR_AD_BLOB    = $0200;
+  {$EXTERNALSYM DFS_VOLUME_FLAVOR_AD_BLOB}
+  DFS_STORAGE_FLAVOR_UNUSED2   = $0300;
+  {$EXTERNALSYM DFS_STORAGE_FLAVOR_UNUSED2}
+
+//
+// DFS Storage State
+//
+
+  DFS_STORAGE_STATES        = $F;
+  {$EXTERNALSYM DFS_STORAGE_STATES}
+  DFS_STORAGE_STATE_OFFLINE = 1;
+  {$EXTERNALSYM DFS_STORAGE_STATE_OFFLINE}
+  DFS_STORAGE_STATE_ONLINE  = 2;
+  {$EXTERNALSYM DFS_STORAGE_STATE_ONLINE}
+  DFS_STORAGE_STATE_ACTIVE  = 4;
+  {$EXTERNALSYM DFS_STORAGE_STATE_ACTIVE}
+
+//
+// Level 1:
+//
+
+type
+  LPDFS_INFO_1 = ^DFS_INFO_1;
+  {$EXTERNALSYM LPDFS_INFO_1}
+  PDFS_INFO_1 = ^DFS_INFO_1;
+  {$EXTERNALSYM PDFS_INFO_1}
+  _DFS_INFO_1 = record
+    EntryPath: LPWSTR; // Dfs name for the top of this piece of storage
+  end;
+  {$EXTERNALSYM _DFS_INFO_1}
+  DFS_INFO_1 = _DFS_INFO_1;
+  {$EXTERNALSYM DFS_INFO_1}
+  TDfsInfo1 = DFS_INFO_1;
+  PDfsInfo1 = PDFS_INFO_1;
+
+//
+// Level 2:
+//
+
+  LPDFS_INFO_2 = ^DFS_INFO_2;
+  {$EXTERNALSYM LPDFS_INFO_2}
+  PDFS_INFO_2 = ^DFS_INFO_2;
+  {$EXTERNALSYM PDFS_INFO_2}
+  _DFS_INFO_2 = record
+    EntryPath: LPWSTR; // Dfs name for the top of this volume
+    Comment: LPWSTR; // Comment for this volume
+    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
+    NumberOfStorages: DWORD; // Number of storages for this volume
+  end;
+  {$EXTERNALSYM _DFS_INFO_2}
+  DFS_INFO_2 = _DFS_INFO_2;
+  {$EXTERNALSYM DFS_INFO_2}
+  TDfsInfo2 = DFS_INFO_2;
+  PDfsInfo2 = PDFS_INFO_2;
+
+  LPDFS_STORAGE_INFO = ^DFS_STORAGE_INFO;
+  {$EXTERNALSYM LPDFS_STORAGE_INFO}
+  PDFS_STORAGE_INFO = ^DFS_STORAGE_INFO;
+  {$EXTERNALSYM PDFS_STORAGE_INFO}
+  _DFS_STORAGE_INFO = record
+    State: ULONG; // State of this storage, one of DFS_STORAGE_STATE_*
+    // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
+    ServerName: LPWSTR; // Name of server hosting this storage
+    ShareName: LPWSTR; // Name of share hosting this storage
+  end;
+  {$EXTERNALSYM _DFS_STORAGE_INFO}
+  DFS_STORAGE_INFO = _DFS_STORAGE_INFO;
+  {$EXTERNALSYM DFS_STORAGE_INFO}
+  TDfsStorageInfo = DFS_STORAGE_INFO;
+  PDfsStorageInfo = PDFS_STORAGE_INFO;
+
+//
+// Level 3:
+//
+
+  LPDFS_INFO_3 = ^DFS_INFO_3;
+  {$EXTERNALSYM LPDFS_INFO_3}
+  PDFS_INFO_3 = ^DFS_INFO_3;
+  {$EXTERNALSYM PDFS_INFO_3}
+  _DFS_INFO_3 = record
+    EntryPath: LPWSTR; // Dfs name for the top of this volume
+    Comment: LPWSTR; // Comment for this volume
+    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
+    NumberOfStorages: DWORD; // Number of storage servers for this volume
+    Storage: LPDFS_STORAGE_INFO; // An array (of NumberOfStorages elements) of storage-specific information.
+  end;
+  {$EXTERNALSYM _DFS_INFO_3}
+  DFS_INFO_3 = _DFS_INFO_3;
+  {$EXTERNALSYM DFS_INFO_3}
+  TDfsInfo3 = DFS_INFO_3;
+  PDfsInfo3 = PDFS_INFO_3;
+
+//
+// Level 4:
+//
+
+  LPDFS_INFO_4 = ^DFS_INFO_4;
+  {$EXTERNALSYM LPDFS_INFO_4}
+  PDFS_INFO_4 = ^DFS_INFO_4;
+  {$EXTERNALSYM PDFS_INFO_4}
+  _DFS_INFO_4 = record
+    EntryPath: LPWSTR; // Dfs name for the top of this volume
+    Comment: LPWSTR; // Comment for this volume
+    State: DWORD; // State of this volume, one of DFS_VOLUME_STATE_*
+    Timeout: ULONG; // Timeout, in seconds, of this junction point
+    Guid: GUID; // Guid of this junction point
+    NumberOfStorages: DWORD; // Number of storage servers for this volume
+    Storage: LPDFS_STORAGE_INFO; // An array (of NumberOfStorages elements) of storage-specific information.
+  end;
+  {$EXTERNALSYM _DFS_INFO_4}
+  DFS_INFO_4 = _DFS_INFO_4;
+  {$EXTERNALSYM DFS_INFO_4}
+  TDfsInfo4 = DFS_INFO_4;
+  PDfsInfo4 = PDFS_INFO_4;
+
+//
+// Level 100:
+//
+
+  LPDFS_INFO_100 = ^DFS_INFO_100;
+  {$EXTERNALSYM LPDFS_INFO_100}
+  PDFS_INFO_100 = ^DFS_INFO_100;
+  {$EXTERNALSYM PDFS_INFO_100}
+  _DFS_INFO_100 = record
+    Comment: LPWSTR; // Comment for this volume or storage
+  end;
+  {$EXTERNALSYM _DFS_INFO_100}
+  DFS_INFO_100 = _DFS_INFO_100;
+  {$EXTERNALSYM DFS_INFO_100}
+  TDfsInfo100 = DFS_INFO_100;
+  PDfsInfo100 = PDFS_INFO_100;
+
+//
+// Level 101:
+//
+
+  LPDFS_INFO_101 = ^DFS_INFO_101;
+  {$EXTERNALSYM LPDFS_INFO_101}
+  PDFS_INFO_101 = ^DFS_INFO_101;
+  {$EXTERNALSYM PDFS_INFO_101}
+  _DFS_INFO_101 = record
+    State: DWORD; // State of this storage, one of DFS_STORAGE_STATE_*
+    // possibly OR'd with DFS_STORAGE_STATE_ACTIVE
+  end;
+  {$EXTERNALSYM _DFS_INFO_101}
+  DFS_INFO_101 = _DFS_INFO_101;
+  {$EXTERNALSYM DFS_INFO_101}
+  TDfsInfo101 = DFS_INFO_101;
+  PDfsInfo101 = PDFS_INFO_101;
+
+//
+// Level 102:
+//
+
+  LPDFS_INFO_102 = ^DFS_INFO_102;
+  {$EXTERNALSYM LPDFS_INFO_102}
+  PDFS_INFO_102 = ^DFS_INFO_102;
+  {$EXTERNALSYM PDFS_INFO_102}
+  _DFS_INFO_102 = record
+    Timeout: ULONG; // Timeout, in seconds, of the junction
+  end;
+  {$EXTERNALSYM _DFS_INFO_102}
+  DFS_INFO_102 = _DFS_INFO_102;
+  {$EXTERNALSYM DFS_INFO_102}
+  TDfsInfo102 = DFS_INFO_102;
+  PDfsInfo102 = PDFS_INFO_102;
+
+//
+// Level 200:
+//
+
+  LPDFS_INFO_200 = ^DFS_INFO_200;
+  {$EXTERNALSYM LPDFS_INFO_200}
+  PDFS_INFO_200 = ^DFS_INFO_200;
+  {$EXTERNALSYM PDFS_INFO_200}
+  _DFS_INFO_200 = record
+    FtDfsName: LPWSTR; // FtDfs name
+  end;
+  {$EXTERNALSYM _DFS_INFO_200}
+  DFS_INFO_200 = _DFS_INFO_200;
+  {$EXTERNALSYM DFS_INFO_200}
+  TDfsInfo200 = DFS_INFO_200;
+  PDfsInfo200 = PDFS_INFO_200;
+
+//
+// Level 300:
+//
+
+  LPDFS_INFO_300 = ^DFS_INFO_300;
+  {$EXTERNALSYM LPDFS_INFO_300}
+  PDFS_INFO_300 = ^DFS_INFO_300;
+  {$EXTERNALSYM PDFS_INFO_300}
+  _DFS_INFO_300 = record
+    Flags: DWORD;
+    DfsName: LPWSTR; // Dfs name
+  end;
+  {$EXTERNALSYM _DFS_INFO_300}
+  DFS_INFO_300 = _DFS_INFO_300;
+  {$EXTERNALSYM DFS_INFO_300}
+  TDfsInfo300 = DFS_INFO_300;
+  PDfsInfo300 = PDFS_INFO_300;
+
+//
+// Add a new volume or additional storage for an existing volume at
+// DfsEntryPath.
+//
+
+function NetDfsAdd(DfsEntryPath, ServerName, ShareName, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsAdd}
+
+//
+// Flags:
+//
+
+const
+  DFS_ADD_VOLUME     = 1; // Add a new volume to the DFS if not already there
+  {$EXTERNALSYM DFS_ADD_VOLUME}
+  DFS_RESTORE_VOLUME = 2; // Volume/Replica is being restored - do not verify share etc.
+  {$EXTERNALSYM DFS_RESTORE_VOLUME}
+
+//
+// Setup/teardown API's for standard and FtDfs roots.
+//
+
+function NetDfsAddStdRoot(ServerName, RootShare, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsAddStdRoot}
+
+function NetDfsRemoveStdRoot(ServerName, RootShare: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsRemoveStdRoot}
+
+function NetDfsAddFtRoot(ServerName, RootShare, FtDfsName, Comment: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsAddFtRoot}
+
+function NetDfsRemoveFtRoot(ServerName, RootShare, FtDfsName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsRemoveFtRoot}
+
+function NetDfsRemoveFtRootForced(DomainName, ServerName, RootShare, FtDfsName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsRemoveFtRootForced}
+
+//
+// Call to reinitialize the dfsmanager on a machine
+//
+
+function NetDfsManagerInitialize(ServerName: LPWSTR; Flags: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsManagerInitialize}
+
+function NetDfsAddStdRootForced(ServerName, RootShare, Comment, Store: LPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsAddStdRootForced}
+
+function NetDfsGetDcAddress(ServerName: LPWSTR; var DcIpAddress: LPWSTR; var IsRoot: BOOLEAN; Timeout: PULONG): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsGetDcAddress}
+
+//
+// Flags for NetDfsSetDcAddress()
+//
+
+const
+  NET_DFS_SETDC_FLAGS   = $00000000;
+  {$EXTERNALSYM NET_DFS_SETDC_FLAGS}
+  NET_DFS_SETDC_TIMEOUT = $00000001;
+  {$EXTERNALSYM NET_DFS_SETDC_TIMEOUT}
+  NET_DFS_SETDC_INITPKT = $00000002;
+  {$EXTERNALSYM NET_DFS_SETDC_INITPKT}
+
+//
+// Structures used for site reporting
+//
+
+type
+  LPDFS_SITENAME_INFO = ^DFS_SITENAME_INFO;
+  {$EXTERNALSYM LPDFS_SITENAME_INFO}
+  PDFS_SITENAME_INFO = ^DFS_SITENAME_INFO;
+  {$EXTERNALSYM PDFS_SITENAME_INFO}
+  DFS_SITENAME_INFO = record
+    SiteFlags: ULONG; // Below
+    SiteName: LPWSTR;
+  end;
+  {$EXTERNALSYM DFS_SITENAME_INFO}
+  TDfsSiteNameInfo = DFS_SITENAME_INFO;
+  PDfsSiteNameInfo = PDFS_SITENAME_INFO;
+
+// SiteFlags
+
+const
+  DFS_SITE_PRIMARY = $1; // This site returned by DsGetSiteName()
+  {$EXTERNALSYM DFS_SITE_PRIMARY}
+
+type
+  LPDFS_SITELIST_INFO = ^DFS_SITELIST_INFO;
+  {$EXTERNALSYM LPDFS_SITELIST_INFO}
+  PDFS_SITELIST_INFO = ^DFS_SITELIST_INFO;
+  {$EXTERNALSYM PDFS_SITELIST_INFO}
+  DFS_SITELIST_INFO = record
+    cSites: ULONG;
+    Site: array [0..0] of DFS_SITENAME_INFO;
+  end;
+  {$EXTERNALSYM DFS_SITELIST_INFO}
+  TDfsSiteListInfo = DFS_SITELIST_INFO;
+  PDfsSiteListInfo = PDFS_SITELIST_INFO;
+
+//
+// Remove a volume or additional storage for volume from the Dfs at
+// DfsEntryPath. When applied to the last storage in a volume, removes
+// the volume from the DFS.
+//
+
+function NetDfsRemove(DfsEntryPath, ServerName, ShareName: LPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsRemove}
+
+//
+// Get information about all of the volumes in the Dfs. DfsName is
+// the "server" part of the UNC name used to refer to this particular Dfs.
+//
+// Valid levels are 1-4, 200
+//
+
+function NetDfsEnum(DfsName: LPWSTR; Level, PrefMaxLen: DWORD; var Buffer: LPBYTE; EntriesRead, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsEnum}
+
+//
+// Get information about the volume or storage.
+// If ServerName and ShareName are specified, the information returned
+// is specific to that server and share, else the information is specific
+// to the volume as a whole.
+//
+// Valid levels are 1-4, 100
+//
+
+function NetDfsGetInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsGetInfo}
+
+//
+// Set info about the volume or storage.
+// If ServerName and ShareName are specified, the information set is
+// specific to that server and share, else the information is specific
+// to the volume as a whole.
+//
+// Valid levels are 100, 101 and 102
+//
+
+function NetDfsSetInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsSetInfo}
+
+//
+// Get client's cached information about the volume or storage.
+// If ServerName and ShareName are specified, the information returned
+// is specific to that server and share, else the information is specific
+// to the volume as a whole.
+//
+// Valid levels are 1-4
+//
+
+function NetDfsGetClientInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; var Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsGetClientInfo}
+
+//
+// Set client's cached info about the volume or storage.
+// If ServerName and ShareName are specified, the information set is
+// specific to that server and share, else the information is specific
+// to the volume as a whole.
+//
+// Valid levels are 101 and 102.
+//
+
+function NetDfsSetClientInfo(DfsEntryPath, ServerName, ShareName: LPWSTR; Level: DWORD; Buffer: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsSetClientInfo}
+
+//
+// Move a DFS volume and all subordinate volumes from one place in the
+// DFS to another place in the DFS.
+//
+
+function NetDfsMove(DfsEntryPath: LPWSTR; DfsNewEntryPath: LPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsMove}
+
+function NetDfsRename(Path: LPWSTR; NewPath: LPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetDfsRename}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetDfsAdd: Pointer;
+
+function NetDfsAdd;
+begin
+  GetProcedureAddress(_NetDfsAdd, netapi32, 'NetDfsAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsAdd]
+  end;
+end;
+
+var
+  _NetDfsAddStdRoot: Pointer;
+
+function NetDfsAddStdRoot;
+begin
+  GetProcedureAddress(_NetDfsAddStdRoot, netapi32, 'NetDfsAddStdRoot');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsAddStdRoot]
+  end;
+end;
+
+var
+  _NetDfsRemoveStdRoot: Pointer;
+
+function NetDfsRemoveStdRoot;
+begin
+  GetProcedureAddress(_NetDfsRemoveStdRoot, netapi32, 'NetDfsRemoveStdRoot');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsRemoveStdRoot]
+  end;
+end;
+
+var
+  _NetDfsAddFtRoot: Pointer;
+
+function NetDfsAddFtRoot;
+begin
+  GetProcedureAddress(_NetDfsAddFtRoot, netapi32, 'NetDfsAddFtRoot');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsAddFtRoot]
+  end;
+end;
+
+var
+  _NetDfsRemoveFtRoot: Pointer;
+
+function NetDfsRemoveFtRoot;
+begin
+  GetProcedureAddress(_NetDfsRemoveFtRoot, netapi32, 'NetDfsRemoveFtRoot');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsRemoveFtRoot]
+  end;
+end;
+
+var
+  _NetDfsRemoveFtRootForced: Pointer;
+
+function NetDfsRemoveFtRootForced;
+begin
+  GetProcedureAddress(_NetDfsRemoveFtRootForced, netapi32, 'NetDfsRemoveFtRootForced');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsRemoveFtRootForced]
+  end;
+end;
+
+var
+  _NetDfsManagerInitialize: Pointer;
+
+function NetDfsManagerInitialize;
+begin
+  GetProcedureAddress(_NetDfsManagerInitialize, netapi32, 'NetDfsManagerInitialize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsManagerInitialize]
+  end;
+end;
+
+var
+  _NetDfsAddStdRootForced: Pointer;
+
+function NetDfsAddStdRootForced;
+begin
+  GetProcedureAddress(_NetDfsAddStdRootForced, netapi32, 'NetDfsAddStdRootForced');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsAddStdRootForced]
+  end;
+end;
+
+var
+  _NetDfsGetDcAddress: Pointer;
+
+function NetDfsGetDcAddress;
+begin
+  GetProcedureAddress(_NetDfsGetDcAddress, netapi32, 'NetDfsGetDcAddress');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsGetDcAddress]
+  end;
+end;
+
+var
+  _NetDfsRemove: Pointer;
+
+function NetDfsRemove;
+begin
+  GetProcedureAddress(_NetDfsRemove, netapi32, 'NetDfsRemove');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsRemove]
+  end;
+end;
+
+var
+  _NetDfsEnum: Pointer;
+
+function NetDfsEnum;
+begin
+  GetProcedureAddress(_NetDfsEnum, netapi32, 'NetDfsEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsEnum]
+  end;
+end;
+
+var
+  _NetDfsGetInfo: Pointer;
+
+function NetDfsGetInfo;
+begin
+  GetProcedureAddress(_NetDfsGetInfo, netapi32, 'NetDfsGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsGetInfo]
+  end;
+end;
+
+var
+  _NetDfsSetInfo: Pointer;
+
+function NetDfsSetInfo;
+begin
+  GetProcedureAddress(_NetDfsSetInfo, netapi32, 'NetDfsSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsSetInfo]
+  end;
+end;
+
+var
+  _NetDfsGetClientInfo: Pointer;
+
+function NetDfsGetClientInfo;
+begin
+  GetProcedureAddress(_NetDfsGetClientInfo, netapi32, 'NetDfsGetClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsGetClientInfo]
+  end;
+end;
+
+var
+  _NetDfsSetClientInfo: Pointer;
+
+function NetDfsSetClientInfo;
+begin
+  GetProcedureAddress(_NetDfsSetClientInfo, netapi32, 'NetDfsSetClientInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsSetClientInfo]
+  end;
+end;
+
+var
+  _NetDfsMove: Pointer;
+
+function NetDfsMove;
+begin
+  GetProcedureAddress(_NetDfsMove, netapi32, 'NetDfsMove');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsMove]
+  end;
+end;
+
+var
+  _NetDfsRename: Pointer;
+
+function NetDfsRename;
+begin
+  GetProcedureAddress(_NetDfsRename, netapi32, 'NetDfsRename');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetDfsRename]
+  end;
+end;
+
+{$ELSE}
+
+function NetDfsAdd; external netapi32 name 'NetDfsAdd';
+function NetDfsAddStdRoot; external netapi32 name 'NetDfsAddStdRoot';
+function NetDfsRemoveStdRoot; external netapi32 name 'NetDfsRemoveStdRoot';
+function NetDfsAddFtRoot; external netapi32 name 'NetDfsAddFtRoot';
+function NetDfsRemoveFtRoot; external netapi32 name 'NetDfsRemoveFtRoot';
+function NetDfsRemoveFtRootForced; external netapi32 name 'NetDfsRemoveFtRootForced';
+function NetDfsManagerInitialize; external netapi32 name 'NetDfsManagerInitialize';
+function NetDfsAddStdRootForced; external netapi32 name 'NetDfsAddStdRootForced';
+function NetDfsGetDcAddress; external netapi32 name 'NetDfsGetDcAddress';
+function NetDfsRemove; external netapi32 name 'NetDfsRemove';
+function NetDfsEnum; external netapi32 name 'NetDfsEnum';
+function NetDfsGetInfo; external netapi32 name 'NetDfsGetInfo';
+function NetDfsSetInfo; external netapi32 name 'NetDfsSetInfo';
+function NetDfsGetClientInfo; external netapi32 name 'NetDfsGetClientInfo';
+function NetDfsSetClientInfo; external netapi32 name 'NetDfsSetClientInfo';
+function NetDfsMove; external netapi32 name 'NetDfsMove';
+function NetDfsRename; external netapi32 name 'NetDfsRename';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 930 - 0
packages/extra/winunits/jwalmerr.pas

@@ -0,0 +1,930 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Error API interface Unit for Object Pascal                       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmerr.h, released November 2001. The original Pascal   }
+{ code is: LmErr.pas, released Februari 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmErr;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmerr.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+const
+  NERR_Success = 0; // Success
+  {$EXTERNALSYM NERR_Success}
+
+// ERROR_ equates can be intermixed with NERR_ equates.
+
+//    NERR_BASE is the base of error codes from network utilities,
+//      chosen to avoid conflict with system and redirector error codes.
+//      2100 is a value that has been assigned to us by system.
+
+  NERR_BASE = 2100;
+  {$EXTERNALSYM NERR_BASE}
+
+//*INTERNAL_ONLY*
+
+{**********WARNING *****************
+ *See the comment in lmcons.h for  *
+ *info on the allocation of errors *
+ ***********************************}
+
+{**********WARNING *****************
+ *The range 2750-2799 has been     *
+ *allocated to the IBM LAN Server  *
+ ***********************************}
+
+{**********WARNING *****************
+ *The range 2900-2999 has been     *
+ *reserved for Microsoft OEMs      *
+ ***********************************}
+
+// UNUSED BASE+0
+// UNUSED BASE+1
+  NERR_NetNotStarted = NERR_BASE + 2; // The workstation driver is not installed.
+  {$EXTERNALSYM NERR_NetNotStarted}
+  NERR_UnknownServer = NERR_BASE + 3; // The server could not be located.
+  {$EXTERNALSYM NERR_UnknownServer}
+  NERR_ShareMem      = NERR_BASE + 4; // An internal error occurred.  The network cannot access a shared memory segment.
+  {$EXTERNALSYM NERR_ShareMem}
+
+  NERR_NoNetworkResource = NERR_BASE + 5; // A network resource shortage occurred .
+  {$EXTERNALSYM NERR_NoNetworkResource}
+  NERR_RemoteOnly        = NERR_BASE + 6; // This operation is not supported on workstations.
+  {$EXTERNALSYM NERR_RemoteOnly}
+  NERR_DevNotRedirected  = NERR_BASE + 7; // The device is not connected.
+  {$EXTERNALSYM NERR_DevNotRedirected}
+// NERR_BASE+8 is used for ERROR_CONNECTED_OTHER_PASSWORD
+// NERR_BASE+9 is used for ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT
+// UNUSED BASE+10
+// UNUSED BASE+11
+// UNUSED BASE+12
+// UNUSED BASE+13
+  NERR_ServerNotStarted = NERR_BASE + 14; // The Server service is not started.
+  {$EXTERNALSYM NERR_ServerNotStarted}
+  NERR_ItemNotFound     = NERR_BASE + 15; // The queue is empty.
+  {$EXTERNALSYM NERR_ItemNotFound}
+  NERR_UnknownDevDir    = NERR_BASE + 16; // The device or directory does not exist.
+  {$EXTERNALSYM NERR_UnknownDevDir}
+  NERR_RedirectedPath   = NERR_BASE + 17; // The operation is invalid on a redirected resource.
+  {$EXTERNALSYM NERR_RedirectedPath}
+  NERR_DuplicateShare   = NERR_BASE + 18; // The name has already been shared.
+  {$EXTERNALSYM NERR_DuplicateShare}
+  NERR_NoRoom           = NERR_BASE + 19; // The server is currently out of the requested resource.
+  {$EXTERNALSYM NERR_NoRoom}
+// UNUSED BASE+20
+  NERR_TooManyItems    = NERR_BASE + 21; // Requested addition of items exceeds the maximum allowed.
+  {$EXTERNALSYM NERR_TooManyItems}
+  NERR_InvalidMaxUsers = NERR_BASE + 22; // The Peer service supports only two simultaneous users.
+  {$EXTERNALSYM NERR_InvalidMaxUsers}
+  NERR_BufTooSmall     = NERR_BASE + 23; // The API return buffer is too small.
+  {$EXTERNALSYM NERR_BufTooSmall}
+// UNUSED BASE+24
+// UNUSED BASE+25
+// UNUSED BASE+26
+  NERR_RemoteErr = NERR_BASE + 27; // A remote API error occurred.
+  {$EXTERNALSYM NERR_RemoteErr}
+// UNUSED BASE+28
+// UNUSED BASE+29
+// UNUSED BASE+30
+  NERR_LanmanIniError = NERR_BASE + 31; // An error occurred when opening or reading the configuration file.
+  {$EXTERNALSYM NERR_LanmanIniError}
+// UNUSED BASE+32
+// UNUSED BASE+33
+// UNUSED BASE+34
+// UNUSED BASE+35
+  NERR_NetworkError           = NERR_BASE + 36; // A general network error occurred.
+  {$EXTERNALSYM NERR_NetworkError}
+  NERR_WkstaInconsistentState = NERR_BASE + 37;
+  {$EXTERNALSYM NERR_WkstaInconsistentState}
+    // The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.
+  NERR_WkstaNotStarted   = NERR_BASE + 38; // The Workstation service has not been started.
+  {$EXTERNALSYM NERR_WkstaNotStarted}
+  NERR_BrowserNotStarted = NERR_BASE + 39; // The requested information is not available.
+  {$EXTERNALSYM NERR_BrowserNotStarted}
+  NERR_InternalError     = NERR_BASE + 40; // An internal Windows 2000 error occurred.
+  {$EXTERNALSYM NERR_InternalError}
+  NERR_BadTransactConfig = NERR_BASE + 41; // The server is not configured for transactions.
+  {$EXTERNALSYM NERR_BadTransactConfig}
+  NERR_InvalidAPI        = NERR_BASE + 42; // The requested API is not supported on the remote server.
+  {$EXTERNALSYM NERR_InvalidAPI}
+  NERR_BadEventName      = NERR_BASE + 43; // The event name is invalid.
+  {$EXTERNALSYM NERR_BadEventName}
+  NERR_DupNameReboot     = NERR_BASE + 44; // The computer name already exists on the network. Change it and restart the computer.
+  {$EXTERNALSYM NERR_DupNameReboot}
+
+//
+//      Config API related
+//              Error codes from BASE+45 to BASE+49
+
+// UNUSED BASE+45
+  NERR_CfgCompNotFound  = NERR_BASE + 46; // The specified component could not be found in the configuration information.
+  {$EXTERNALSYM NERR_CfgCompNotFound}
+  NERR_CfgParamNotFound = NERR_BASE + 47; // The specified parameter could not be found in the configuration information.
+  {$EXTERNALSYM NERR_CfgParamNotFound}
+  NERR_LineTooLong = NERR_BASE + 49; // A line in the configuration file is too long.
+  {$EXTERNALSYM NERR_LineTooLong}
+
+//
+//      Spooler API related
+//              Error codes from BASE+50 to BASE+79
+
+  NERR_QNotFound        = NERR_BASE + 50; // The printer does not exist.
+  {$EXTERNALSYM NERR_QNotFound}
+  NERR_JobNotFound      = NERR_BASE + 51; // The print job does not exist.
+  {$EXTERNALSYM NERR_JobNotFound}
+  NERR_DestNotFound     = NERR_BASE + 52; // The printer destination cannot be found.
+  {$EXTERNALSYM NERR_DestNotFound}
+  NERR_DestExists       = NERR_BASE + 53; // The printer destination already exists.
+  {$EXTERNALSYM NERR_DestExists}
+  NERR_QExists          = NERR_BASE + 54; // The printer queue already exists.
+  {$EXTERNALSYM NERR_QExists}
+  NERR_QNoRoom          = NERR_BASE + 55; // No more printers can be added.
+  {$EXTERNALSYM NERR_QNoRoom}
+  NERR_JobNoRoom        = NERR_BASE + 56; // No more print jobs can be added.
+  {$EXTERNALSYM NERR_JobNoRoom}
+  NERR_DestNoRoom       = NERR_BASE + 57; // No more printer destinations can be added.
+  {$EXTERNALSYM NERR_DestNoRoom}
+  NERR_DestIdle         = NERR_BASE + 58; // This printer destination is idle and cannot accept control operations.
+  {$EXTERNALSYM NERR_DestIdle}
+  NERR_DestInvalidOp    = NERR_BASE + 59; // This printer destination request contains an invalid control function.
+  {$EXTERNALSYM NERR_DestInvalidOp}
+  NERR_ProcNoRespond    = NERR_BASE + 60; // The print processor is not responding.
+  {$EXTERNALSYM NERR_ProcNoRespond}
+  NERR_SpoolerNotLoaded = NERR_BASE + 61; // The spooler is not running.
+  {$EXTERNALSYM NERR_SpoolerNotLoaded}
+  NERR_DestInvalidState = NERR_BASE + 62; // This operation cannot be performed on the print destination in its current state.
+  {$EXTERNALSYM NERR_DestInvalidState}
+  NERR_QInvalidState    = NERR_BASE + 63; // This operation cannot be performed on the printer queue in its current state.
+  {$EXTERNALSYM NERR_QInvalidState}
+  NERR_JobInvalidState  = NERR_BASE + 64; // This operation cannot be performed on the print job in its current state.
+  {$EXTERNALSYM NERR_JobInvalidState}
+  NERR_SpoolNoMemory    = NERR_BASE + 65; // A spooler memory allocation failure occurred.
+  {$EXTERNALSYM NERR_SpoolNoMemory}
+  NERR_DriverNotFound   = NERR_BASE + 66; // The device driver does not exist.
+  {$EXTERNALSYM NERR_DriverNotFound}
+  NERR_DataTypeInvalid  = NERR_BASE + 67; // The data type is not supported by the print processor.
+  {$EXTERNALSYM NERR_DataTypeInvalid}
+  NERR_ProcNotFound     = NERR_BASE + 68; // The print processor is not installed.
+  {$EXTERNALSYM NERR_ProcNotFound}
+
+//
+//      Service API related
+//              Error codes from BASE+80 to BASE+99
+
+  NERR_ServiceTableLocked  = NERR_BASE + 80; // The service database is locked.
+  {$EXTERNALSYM NERR_ServiceTableLocked}
+  NERR_ServiceTableFull    = NERR_BASE + 81; // The service table is full.
+  {$EXTERNALSYM NERR_ServiceTableFull}
+  NERR_ServiceInstalled    = NERR_BASE + 82; // The requested service has already been started.
+  {$EXTERNALSYM NERR_ServiceInstalled}
+  NERR_ServiceEntryLocked  = NERR_BASE + 83; // The service does not respond to control actions.
+  {$EXTERNALSYM NERR_ServiceEntryLocked}
+  NERR_ServiceNotInstalled = NERR_BASE + 84; // The service has not been started.
+  {$EXTERNALSYM NERR_ServiceNotInstalled}
+  NERR_BadServiceName      = NERR_BASE + 85; // The service name is invalid.
+  {$EXTERNALSYM NERR_BadServiceName}
+  NERR_ServiceCtlTimeout   = NERR_BASE + 86; // The service is not responding to the control function.
+  {$EXTERNALSYM NERR_ServiceCtlTimeout}
+  NERR_ServiceCtlBusy      = NERR_BASE + 87; // The service control is busy.
+  {$EXTERNALSYM NERR_ServiceCtlBusy}
+  NERR_BadServiceProgName  = NERR_BASE + 88; // The configuration file contains an invalid service program name.
+  {$EXTERNALSYM NERR_BadServiceProgName}
+  NERR_ServiceNotCtrl      = NERR_BASE + 89; // The service could not be controlled in its present state.
+  {$EXTERNALSYM NERR_ServiceNotCtrl}
+  NERR_ServiceKillProc     = NERR_BASE + 90; // The service ended abnormally.
+  {$EXTERNALSYM NERR_ServiceKillProc}
+  NERR_ServiceCtlNotValid  = NERR_BASE + 91; // The requested pause,continue, or stop is not valid for this service.
+  {$EXTERNALSYM NERR_ServiceCtlNotValid}
+  NERR_NotInDispatchTbl    = NERR_BASE + 92; // The service control dispatcher could not find the service name in the dispatch table.
+  {$EXTERNALSYM NERR_NotInDispatchTbl}
+  NERR_BadControlRecv      = NERR_BASE + 93; // The service control dispatcher pipe read failed.
+  {$EXTERNALSYM NERR_BadControlRecv}
+  NERR_ServiceNotStarting  = NERR_BASE + 94; // A thread for the new service could not be created.
+  {$EXTERNALSYM NERR_ServiceNotStarting}
+
+//
+//      Wksta and Logon API related
+//              Error codes from BASE+100 to BASE+118
+
+  NERR_AlreadyLoggedOn   = NERR_BASE + 100; // This workstation is already logged on to the local-area network.
+  {$EXTERNALSYM NERR_AlreadyLoggedOn}
+  NERR_NotLoggedOn       = NERR_BASE + 101; // The workstation is not logged on to the local-area network.
+  {$EXTERNALSYM NERR_NotLoggedOn}
+  NERR_BadUsername       = NERR_BASE + 102; // The user name or group name parameter is invalid.
+  {$EXTERNALSYM NERR_BadUsername}
+  NERR_BadPassword       = NERR_BASE + 103; // The password parameter is invalid.
+  {$EXTERNALSYM NERR_BadPassword}
+  NERR_UnableToAddName_W = NERR_BASE + 104; // @W The logon processor did not add the message alias.
+  {$EXTERNALSYM NERR_UnableToAddName_W}
+  NERR_UnableToAddName_F = NERR_BASE + 105; // The logon processor did not add the message alias.
+  {$EXTERNALSYM NERR_UnableToAddName_F}
+  NERR_UnableToDelName_W = NERR_BASE + 106; // @W The logoff processor did not delete the message alias.
+  {$EXTERNALSYM NERR_UnableToDelName_W}
+  NERR_UnableToDelName_F = NERR_BASE + 107; // The logoff processor did not delete the message alias.
+  {$EXTERNALSYM NERR_UnableToDelName_F}
+// UNUSED BASE+108
+  NERR_LogonsPaused        = NERR_BASE + 109; // Network logons are paused.
+  {$EXTERNALSYM NERR_LogonsPaused}
+  NERR_LogonServerConflict = NERR_BASE + 110; // A centralized logon-server conflict occurred.
+  {$EXTERNALSYM NERR_LogonServerConflict}
+  NERR_LogonNoUserPath     = NERR_BASE + 111; // The server is configured without a valid user path.
+  {$EXTERNALSYM NERR_LogonNoUserPath}
+  NERR_LogonScriptError    = NERR_BASE + 112; // An error occurred while loading or running the logon script.
+  {$EXTERNALSYM NERR_LogonScriptError}
+// UNUSED BASE+113
+  NERR_StandaloneLogon     = NERR_BASE + 114; // The logon server was not specified.  Your computer will be logged on as STANDALONE.
+  {$EXTERNALSYM NERR_StandaloneLogon}
+  NERR_LogonServerNotFound = NERR_BASE + 115; // The logon server could not be found.
+  {$EXTERNALSYM NERR_LogonServerNotFound}
+  NERR_LogonDomainExists   = NERR_BASE + 116; // There is already a logon domain for this computer.
+  {$EXTERNALSYM NERR_LogonDomainExists}
+  NERR_NonValidatedLogon   = NERR_BASE + 117; // The logon server could not validate the logon.
+  {$EXTERNALSYM NERR_NonValidatedLogon}
+
+//
+//      ACF API related (access, user, group)
+//              Error codes from BASE+119 to BASE+149
+
+  NERR_ACFNotFound          = NERR_BASE + 119; // The security database could not be found.
+  {$EXTERNALSYM NERR_ACFNotFound}
+  NERR_GroupNotFound        = NERR_BASE + 120; // The group name could not be found.
+  {$EXTERNALSYM NERR_GroupNotFound}
+  NERR_UserNotFound         = NERR_BASE + 121; // The user name could not be found.
+  {$EXTERNALSYM NERR_UserNotFound}
+  NERR_ResourceNotFound     = NERR_BASE + 122; // The resource name could not be found.
+  {$EXTERNALSYM NERR_ResourceNotFound}
+  NERR_GroupExists          = NERR_BASE + 123; // The group already exists.
+  {$EXTERNALSYM NERR_GroupExists}
+  NERR_UserExists           = NERR_BASE + 124; // The account already exists.
+  {$EXTERNALSYM NERR_UserExists}
+  NERR_ResourceExists       = NERR_BASE + 125; // The resource permission list already exists.
+  {$EXTERNALSYM NERR_ResourceExists}
+  NERR_NotPrimary           = NERR_BASE + 126; // This operation is only allowed on the primary domain controller of the domain.
+  {$EXTERNALSYM NERR_NotPrimary}
+  NERR_ACFNotLoaded         = NERR_BASE + 127; // The security database has not been started.
+  {$EXTERNALSYM NERR_ACFNotLoaded}
+  NERR_ACFNoRoom            = NERR_BASE + 128; // There are too many names in the user accounts database.
+  {$EXTERNALSYM NERR_ACFNoRoom}
+  NERR_ACFFileIOFail        = NERR_BASE + 129; // A disk I/O failure occurred.
+  {$EXTERNALSYM NERR_ACFFileIOFail}
+  NERR_ACFTooManyLists      = NERR_BASE + 130; // The limit of 64 entries per resource was exceeded.
+  {$EXTERNALSYM NERR_ACFTooManyLists}
+  NERR_UserLogon            = NERR_BASE + 131; // Deleting a user with a session is not allowed.
+  {$EXTERNALSYM NERR_UserLogon}
+  NERR_ACFNoParent          = NERR_BASE + 132; // The parent directory could not be located.
+  {$EXTERNALSYM NERR_ACFNoParent}
+  NERR_CanNotGrowSegment    = NERR_BASE + 133; // Unable to add to the security database session cache segment.
+  {$EXTERNALSYM NERR_CanNotGrowSegment}
+  NERR_SpeGroupOp           = NERR_BASE + 134; // This operation is not allowed on this special group.
+  {$EXTERNALSYM NERR_SpeGroupOp}
+  NERR_NotInCache           = NERR_BASE + 135; // This user is not cached in user accounts database session cache.
+  {$EXTERNALSYM NERR_NotInCache}
+  NERR_UserInGroup          = NERR_BASE + 136; // The user already belongs to this group.
+  {$EXTERNALSYM NERR_UserInGroup}
+  NERR_UserNotInGroup       = NERR_BASE + 137; // The user does not belong to this group.
+  {$EXTERNALSYM NERR_UserNotInGroup}
+  NERR_AccountUndefined     = NERR_BASE + 138; // This user account is undefined.
+  {$EXTERNALSYM NERR_AccountUndefined}
+  NERR_AccountExpired       = NERR_BASE + 139; // This user account has expired.
+  {$EXTERNALSYM NERR_AccountExpired}
+  NERR_InvalidWorkstation   = NERR_BASE + 140; // The user is not allowed to log on from this workstation.
+  {$EXTERNALSYM NERR_InvalidWorkstation}
+  NERR_InvalidLogonHours    = NERR_BASE + 141; // The user is not allowed to log on at this time.
+  {$EXTERNALSYM NERR_InvalidLogonHours}
+  NERR_PasswordExpired      = NERR_BASE + 142; // The password of this user has expired.
+  {$EXTERNALSYM NERR_PasswordExpired}
+  NERR_PasswordCantChange   = NERR_BASE + 143; // The password of this user cannot change.
+  {$EXTERNALSYM NERR_PasswordCantChange}
+  NERR_PasswordHistConflict = NERR_BASE + 144; // This password cannot be used now.
+  {$EXTERNALSYM NERR_PasswordHistConflict}
+  NERR_PasswordTooShort     = NERR_BASE + 145; // The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.
+  {$EXTERNALSYM NERR_PasswordTooShort}
+  NERR_PasswordTooRecent    = NERR_BASE + 146; // The password of this user is too recent to change.
+  {$EXTERNALSYM NERR_PasswordTooRecent}
+  NERR_InvalidDatabase      = NERR_BASE + 147; // The security database is corrupted.
+  {$EXTERNALSYM NERR_InvalidDatabase}
+  NERR_DatabaseUpToDate     = NERR_BASE + 148; // No updates are necessary to this replicant network/local security database.
+  {$EXTERNALSYM NERR_DatabaseUpToDate}
+  NERR_SyncRequired         = NERR_BASE + 149; // This replicant database is outdated; synchronization is required.
+  {$EXTERNALSYM NERR_SyncRequired}
+
+//
+//      Use API related
+//              Error codes from BASE+150 to BASE+169
+
+  NERR_UseNotFound    = NERR_BASE + 150; // The network connection could not be found.
+  {$EXTERNALSYM NERR_UseNotFound}
+  NERR_BadAsgType     = NERR_BASE + 151; // This asg_type is invalid.
+  {$EXTERNALSYM NERR_BadAsgType}
+  NERR_DeviceIsShared = NERR_BASE + 152; // This device is currently being shared.
+  {$EXTERNALSYM NERR_DeviceIsShared}
+
+//
+//      Message Server related
+//              Error codes BASE+170 to BASE+209
+
+  NERR_NoComputerName     = NERR_BASE + 170; // The computer name could not be added as a message alias.  The name may already exist on the network.
+  {$EXTERNALSYM NERR_NoComputerName}
+  NERR_MsgAlreadyStarted  = NERR_BASE + 171; // The Messenger service is already started.
+  {$EXTERNALSYM NERR_MsgAlreadyStarted}
+  NERR_MsgInitFailed      = NERR_BASE + 172; // The Messenger service failed to start.
+  {$EXTERNALSYM NERR_MsgInitFailed}
+  NERR_NameNotFound       = NERR_BASE + 173; // The message alias could not be found on the network.
+  {$EXTERNALSYM NERR_NameNotFound}
+  NERR_AlreadyForwarded   = NERR_BASE + 174; // This message alias has already been forwarded.
+  {$EXTERNALSYM NERR_AlreadyForwarded}
+  NERR_AddForwarded       = NERR_BASE + 175; // This message alias has been added but is still forwarded.
+  {$EXTERNALSYM NERR_AddForwarded}
+  NERR_AlreadyExists      = NERR_BASE + 176; // This message alias already exists locally.
+  {$EXTERNALSYM NERR_AlreadyExists}
+  NERR_TooManyNames       = NERR_BASE + 177; // The maximum number of added message aliases has been exceeded.
+  {$EXTERNALSYM NERR_TooManyNames}
+  NERR_DelComputerName    = NERR_BASE + 178; // The computer name could not be deleted.
+  {$EXTERNALSYM NERR_DelComputerName}
+  NERR_LocalForward       = NERR_BASE + 179; // Messages cannot be forwarded back to the same workstation.
+  {$EXTERNALSYM NERR_LocalForward}
+  NERR_GrpMsgProcessor    = NERR_BASE + 180; // An error occurred in the domain message processor.
+  {$EXTERNALSYM NERR_GrpMsgProcessor}
+  NERR_PausedRemote       = NERR_BASE + 181; // The message was sent, but the recipient has paused the Messenger service.
+  {$EXTERNALSYM NERR_PausedRemote}
+  NERR_BadReceive         = NERR_BASE + 182; // The message was sent but not received.
+  {$EXTERNALSYM NERR_BadReceive}
+  NERR_NameInUse          = NERR_BASE + 183; // The message alias is currently in use. Try again later.
+  {$EXTERNALSYM NERR_NameInUse}
+  NERR_MsgNotStarted      = NERR_BASE + 184; // The Messenger service has not been started.
+  {$EXTERNALSYM NERR_MsgNotStarted}
+  NERR_NotLocalName       = NERR_BASE + 185; // The name is not on the local computer.
+  {$EXTERNALSYM NERR_NotLocalName}
+  NERR_NoForwardName      = NERR_BASE + 186; // The forwarded message alias could not be found on the network.
+  {$EXTERNALSYM NERR_NoForwardName}
+  NERR_RemoteFull         = NERR_BASE + 187; // The message alias table on the remote station is full.
+  {$EXTERNALSYM NERR_RemoteFull}
+  NERR_NameNotForwarded   = NERR_BASE + 188; // Messages for this alias are not currently being forwarded.
+  {$EXTERNALSYM NERR_NameNotForwarded}
+  NERR_TruncatedBroadcast = NERR_BASE + 189; // The broadcast message was truncated.
+  {$EXTERNALSYM NERR_TruncatedBroadcast}
+  NERR_InvalidDevice      = NERR_BASE + 194; // This is an invalid device name.
+  {$EXTERNALSYM NERR_InvalidDevice}
+  NERR_WriteFault         = NERR_BASE + 195; // A write fault occurred.
+  {$EXTERNALSYM NERR_WriteFault}
+// UNUSED BASE+196
+  NERR_DuplicateName = NERR_BASE + 197; // A duplicate message alias exists on the network.
+  {$EXTERNALSYM NERR_DuplicateName}
+  NERR_DeleteLater   = NERR_BASE + 198; // @W This message alias will be deleted later.
+  {$EXTERNALSYM NERR_DeleteLater}
+  NERR_IncompleteDel = NERR_BASE + 199; // The message alias was not successfully deleted from all networks.
+  {$EXTERNALSYM NERR_IncompleteDel}
+  NERR_MultipleNets  = NERR_BASE + 200; // This operation is not supported on computers with multiple networks.
+  {$EXTERNALSYM NERR_MultipleNets}
+
+//
+//      Server API related
+//             Error codes BASE+210 to BASE+229
+
+  NERR_NetNameNotFound        = NERR_BASE + 210; // This shared resource does not exist.
+  {$EXTERNALSYM NERR_NetNameNotFound}
+  NERR_DeviceNotShared        = NERR_BASE + 211; // This device is not shared.
+  {$EXTERNALSYM NERR_DeviceNotShared}
+  NERR_ClientNameNotFound     = NERR_BASE + 212; // A session does not exist with that computer name.
+  {$EXTERNALSYM NERR_ClientNameNotFound}
+  NERR_FileIdNotFound         = NERR_BASE + 214; // There is not an open file with that identification number.
+  {$EXTERNALSYM NERR_FileIdNotFound}
+  NERR_ExecFailure            = NERR_BASE + 215; // A failure occurred when executing a remote administration command.
+  {$EXTERNALSYM NERR_ExecFailure}
+  NERR_TmpFile                = NERR_BASE + 216; // A failure occurred when opening a remote temporary file.
+  {$EXTERNALSYM NERR_TmpFile}
+  NERR_TooMuchData            = NERR_BASE + 217; // The data returned from a remote administration command has been truncated to 64K.
+  {$EXTERNALSYM NERR_TooMuchData}
+  NERR_DeviceShareConflict    = NERR_BASE + 218; // This device cannot be shared as both a spooled and a non-spooled resource.
+  {$EXTERNALSYM NERR_DeviceShareConflict}
+  NERR_BrowserTableIncomplete = NERR_BASE + 219; // The information in the list of servers may be incorrect.
+  {$EXTERNALSYM NERR_BrowserTableIncomplete}
+  NERR_NotLocalDomain         = NERR_BASE + 220; // The computer is not active in this domain.
+  {$EXTERNALSYM NERR_NotLocalDomain}
+  NERR_IsDfsShare             = NERR_BASE + 221; // The share must be removed from the Distributed File System before it can be deleted.
+  {$EXTERNALSYM NERR_IsDfsShare}
+
+//
+//      CharDev API related
+//              Error codes BASE+230 to BASE+249
+
+// UNUSED BASE+230
+  NERR_DevInvalidOpCode  = NERR_BASE + 231; // The operation is invalid for this device.
+  {$EXTERNALSYM NERR_DevInvalidOpCode}
+  NERR_DevNotFound       = NERR_BASE + 232; // This device cannot be shared.
+  {$EXTERNALSYM NERR_DevNotFound}
+  NERR_DevNotOpen        = NERR_BASE + 233; // This device was not open.
+  {$EXTERNALSYM NERR_DevNotOpen}
+  NERR_BadQueueDevString = NERR_BASE + 234; // This device name list is invalid.
+  {$EXTERNALSYM NERR_BadQueueDevString}
+  NERR_BadQueuePriority  = NERR_BASE + 235; // The queue priority is invalid.
+  {$EXTERNALSYM NERR_BadQueuePriority}
+  NERR_NoCommDevs        = NERR_BASE + 237; // There are no shared communication devices.
+  {$EXTERNALSYM NERR_NoCommDevs}
+  NERR_QueueNotFound     = NERR_BASE + 238; // The queue you specified does not exist.
+  {$EXTERNALSYM NERR_QueueNotFound}
+  NERR_BadDevString      = NERR_BASE + 240; // This list of devices is invalid.
+  {$EXTERNALSYM NERR_BadDevString}
+  NERR_BadDev            = NERR_BASE + 241; // The requested device is invalid.
+  {$EXTERNALSYM NERR_BadDev}
+  NERR_InUseBySpooler    = NERR_BASE + 242; // This device is already in use by the spooler.
+  {$EXTERNALSYM NERR_InUseBySpooler}
+  NERR_CommDevInUse      = NERR_BASE + 243; // This device is already in use as a communication device.
+  {$EXTERNALSYM NERR_CommDevInUse}
+
+//
+//      NetICanonicalize and NetIType and NetIMakeLMFileName
+//      NetIListCanon and NetINameCheck
+//              Error codes BASE+250 to BASE+269
+
+  NERR_InvalidComputer = NERR_BASE + 251; // This computer name is invalid.
+  {$EXTERNALSYM NERR_InvalidComputer}
+// UNUSED BASE+252
+// UNUSED BASE+253
+  NERR_MaxLenExceeded = NERR_BASE + 254; // The string and prefix specified are too long.
+  {$EXTERNALSYM NERR_MaxLenExceeded}
+// UNUSED BASE+255
+  NERR_BadComponent = NERR_BASE + 256; // This path component is invalid.
+  {$EXTERNALSYM NERR_BadComponent}
+  NERR_CantType     = NERR_BASE + 257; // Could not determine the type of input.
+  {$EXTERNALSYM NERR_CantType}
+// UNUSED BASE+258
+// UNUSED BASE+259
+  NERR_TooManyEntries = NERR_BASE + 262; // The buffer for types is not big enough.
+  {$EXTERNALSYM NERR_TooManyEntries}
+
+//
+//      NetProfile
+//              Error codes BASE+270 to BASE+276
+
+  NERR_ProfileFileTooBig = NERR_BASE + 270; // Profile files cannot exceed 64K.
+  {$EXTERNALSYM NERR_ProfileFileTooBig}
+  NERR_ProfileOffset     = NERR_BASE + 271; // The start offset is out of range.
+  {$EXTERNALSYM NERR_ProfileOffset}
+  NERR_ProfileCleanup    = NERR_BASE + 272; // The system cannot delete current connections to network resources.
+  {$EXTERNALSYM NERR_ProfileCleanup}
+  NERR_ProfileUnknownCmd = NERR_BASE + 273; // The system was unable to parse the command line in this file.
+  {$EXTERNALSYM NERR_ProfileUnknownCmd}
+  NERR_ProfileLoadErr    = NERR_BASE + 274; // An error occurred while loading the profile file.
+  {$EXTERNALSYM NERR_ProfileLoadErr}
+  NERR_ProfileSaveErr    = NERR_BASE + 275; // @W Errors occurred while saving the profile file.  The profile was partially saved.
+  {$EXTERNALSYM NERR_ProfileSaveErr}
+
+//
+//      NetAudit and NetErrorLog
+//              Error codes BASE+277 to BASE+279
+
+  NERR_LogOverflow    = NERR_BASE + 277; // Log file %1 is full.
+  {$EXTERNALSYM NERR_LogOverflow}
+  NERR_LogFileChanged = NERR_BASE + 278; // This log file has changed between reads.
+  {$EXTERNALSYM NERR_LogFileChanged}
+  NERR_LogFileCorrupt = NERR_BASE + 279; // Log file %1 is corrupt.
+  {$EXTERNALSYM NERR_LogFileCorrupt}
+
+//
+//      NetRemote
+//              Error codes BASE+280 to BASE+299
+
+  NERR_SourceIsDir      = NERR_BASE + 280; // The source path cannot be a directory.
+  {$EXTERNALSYM NERR_SourceIsDir}
+  NERR_BadSource        = NERR_BASE + 281; // The source path is illegal.
+  {$EXTERNALSYM NERR_BadSource}
+  NERR_BadDest          = NERR_BASE + 282; // The destination path is illegal.
+  {$EXTERNALSYM NERR_BadDest}
+  NERR_DifferentServers = NERR_BASE + 283; // The source and destination paths are on different servers.
+  {$EXTERNALSYM NERR_DifferentServers}
+// UNUSED BASE+284
+  NERR_RunSrvPaused = NERR_BASE + 285; // The Run server you requested is paused.
+  {$EXTERNALSYM NERR_RunSrvPaused}
+// UNUSED BASE+286
+// UNUSED BASE+287
+// UNUSED BASE+288
+  NERR_ErrCommRunSrv = NERR_BASE + 289; // An error occurred when communicating with a Run server.
+  {$EXTERNALSYM NERR_ErrCommRunSrv}
+// UNUSED BASE+290
+  NERR_ErrorExecingGhost = NERR_BASE + 291; // An error occurred when starting a background process.
+  {$EXTERNALSYM NERR_ErrorExecingGhost}
+  NERR_ShareNotFound     = NERR_BASE + 292; // The shared resource you are connected to could not be found.
+  {$EXTERNALSYM NERR_ShareNotFound}
+// UNUSED BASE+293
+// UNUSED BASE+294
+
+//
+//  NetWksta.sys (redir) returned error codes.
+//
+//          NERR_BASE + (300-329)
+
+  NERR_InvalidLana     = NERR_BASE + 300; // The LAN adapter number is invalid.
+  {$EXTERNALSYM NERR_InvalidLana}
+  NERR_OpenFiles       = NERR_BASE + 301; // There are open files on the connection.
+  {$EXTERNALSYM NERR_OpenFiles}
+  NERR_ActiveConns     = NERR_BASE + 302; // Active connections still exist.
+  {$EXTERNALSYM NERR_ActiveConns}
+  NERR_BadPasswordCore = NERR_BASE + 303; // This share name or password is invalid.
+  {$EXTERNALSYM NERR_BadPasswordCore}
+  NERR_DevInUse        = NERR_BASE + 304; // The device is being accessed by an active process.
+  {$EXTERNALSYM NERR_DevInUse}
+  NERR_LocalDrive      = NERR_BASE + 305; // The drive letter is in use locally.
+  {$EXTERNALSYM NERR_LocalDrive}
+
+//
+//  Alert error codes.
+//
+//          NERR_BASE + (330-339)
+
+  NERR_AlertExists       = NERR_BASE + 330; // The specified client is already registered for the specified event.
+  {$EXTERNALSYM NERR_AlertExists}
+  NERR_TooManyAlerts     = NERR_BASE + 331; // The alert table is full.
+  {$EXTERNALSYM NERR_TooManyAlerts}
+  NERR_NoSuchAlert       = NERR_BASE + 332; // An invalid or nonexistent alert name was raised.
+  {$EXTERNALSYM NERR_NoSuchAlert}
+  NERR_BadRecipient      = NERR_BASE + 333; // The alert recipient is invalid.
+  {$EXTERNALSYM NERR_BadRecipient}
+  NERR_AcctLimitExceeded = NERR_BASE + 334; // A user's session with this server has been deleted
+  {$EXTERNALSYM NERR_AcctLimitExceeded}
+                                                // because the user's logon hours are no longer valid.
+
+//
+//  Additional Error and Audit log codes.
+//
+//          NERR_BASE +(340-343)
+
+  NERR_InvalidLogSeek = NERR_BASE + 340; // The log file does not contain the requested record number.
+  {$EXTERNALSYM NERR_InvalidLogSeek}
+// UNUSED BASE+341
+// UNUSED BASE+342
+// UNUSED BASE+343
+
+//
+//  Additional UAS and NETLOGON codes
+//
+//          NERR_BASE +(350-359)
+
+  NERR_BadUasConfig       = NERR_BASE + 350; // The user accounts database is not configured correctly.
+  {$EXTERNALSYM NERR_BadUasConfig}
+  NERR_InvalidUASOp       = NERR_BASE + 351; // This operation is not permitted when the Netlogon service is running.
+  {$EXTERNALSYM NERR_InvalidUASOp}
+  NERR_LastAdmin          = NERR_BASE + 352; // This operation is not allowed on the last administrative account.
+  {$EXTERNALSYM NERR_LastAdmin}
+  NERR_DCNotFound         = NERR_BASE + 353; // Could not find domain controller for this domain.
+  {$EXTERNALSYM NERR_DCNotFound}
+  NERR_LogonTrackingError = NERR_BASE + 354; // Could not set logon information for this user.
+  {$EXTERNALSYM NERR_LogonTrackingError}
+  NERR_NetlogonNotStarted = NERR_BASE + 355; // The Netlogon service has not been started.
+  {$EXTERNALSYM NERR_NetlogonNotStarted}
+  NERR_CanNotGrowUASFile  = NERR_BASE + 356; // Unable to add to the user accounts database.
+  {$EXTERNALSYM NERR_CanNotGrowUASFile}
+  NERR_TimeDiffAtDC       = NERR_BASE + 357; // This server's clock is not synchronized with the primary domain controller's clock.
+  {$EXTERNALSYM NERR_TimeDiffAtDC}
+  NERR_PasswordMismatch   = NERR_BASE + 358; // A password mismatch has been detected.
+  {$EXTERNALSYM NERR_PasswordMismatch}
+
+//
+//  Server Integration error codes.
+//
+//          NERR_BASE +(360-369)
+
+  NERR_NoSuchServer       = NERR_BASE + 360; // The server identification does not specify a valid server.
+  {$EXTERNALSYM NERR_NoSuchServer}
+  NERR_NoSuchSession      = NERR_BASE + 361; // The session identification does not specify a valid session.
+  {$EXTERNALSYM NERR_NoSuchSession}
+  NERR_NoSuchConnection   = NERR_BASE + 362; // The connection identification does not specify a valid connection.
+  {$EXTERNALSYM NERR_NoSuchConnection}
+  NERR_TooManyServers     = NERR_BASE + 363; // There is no space for another entry in the table of available servers.
+  {$EXTERNALSYM NERR_TooManyServers}
+  NERR_TooManySessions    = NERR_BASE + 364; // The server has reached the maximum number of sessions it supports.
+  {$EXTERNALSYM NERR_TooManySessions}
+  NERR_TooManyConnections = NERR_BASE + 365; // The server has reached the maximum number of connections it supports.
+  {$EXTERNALSYM NERR_TooManyConnections}
+  NERR_TooManyFiles       = NERR_BASE + 366; // The server cannot open more files because it has reached its maximum number.
+  {$EXTERNALSYM NERR_TooManyFiles}
+  NERR_NoAlternateServers = NERR_BASE + 367; // There are no alternate servers registered on this server.
+  {$EXTERNALSYM NERR_NoAlternateServers}
+// UNUSED BASE+368
+// UNUSED BASE+369
+
+  NERR_TryDownLevel = NERR_BASE + 370; // Try down-level (remote admin protocol) version of API instead.
+  {$EXTERNALSYM NERR_TryDownLevel}
+
+//
+//  UPS error codes.
+//
+//          NERR_BASE + (380-384)
+
+  NERR_UPSDriverNotStarted = NERR_BASE + 380; // The UPS driver could not be accessed by the UPS service.
+  {$EXTERNALSYM NERR_UPSDriverNotStarted}
+  NERR_UPSInvalidConfig    = NERR_BASE + 381; // The UPS service is not configured correctly.
+  {$EXTERNALSYM NERR_UPSInvalidConfig}
+  NERR_UPSInvalidCommPort  = NERR_BASE + 382; // The UPS service could not access the specified Comm Port.
+  {$EXTERNALSYM NERR_UPSInvalidCommPort}
+  NERR_UPSSignalAsserted   = NERR_BASE + 383; // The UPS indicated a line fail or low battery situation. Service not started.
+  {$EXTERNALSYM NERR_UPSSignalAsserted}
+  NERR_UPSShutdownFailed   = NERR_BASE + 384; // The UPS service failed to perform a system shut down.
+  {$EXTERNALSYM NERR_UPSShutdownFailed}
+
+//
+//  Remoteboot error codes.
+//
+//           NERR_BASE + (400-419)
+//           Error codes 400 - 405 are used by RPLBOOT.SYS.
+//           Error codes 403, 407 - 416 are used by RPLLOADR.COM,
+//           Error code 417 is the alerter message of REMOTEBOOT (RPLSERVR.EXE).
+//           Error code 418 is for when REMOTEBOOT can't start
+//           Error code 419 is for a disallowed 2nd rpl connection
+//
+
+  NERR_BadDosRetCode      = NERR_BASE + 400; // The program below returned an MS-DOS error code:
+  {$EXTERNALSYM NERR_BadDosRetCode}
+  NERR_ProgNeedsExtraMem  = NERR_BASE + 401; // The program below needs more memory:
+  {$EXTERNALSYM NERR_ProgNeedsExtraMem}
+  NERR_BadDosFunction     = NERR_BASE + 402; // The program below called an unsupported MS-DOS function:
+  {$EXTERNALSYM NERR_BadDosFunction}
+  NERR_RemoteBootFailed   = NERR_BASE + 403; // The workstation failed to boot.
+  {$EXTERNALSYM NERR_RemoteBootFailed}
+  NERR_BadFileCheckSum    = NERR_BASE + 404; // The file below is corrupt.
+  {$EXTERNALSYM NERR_BadFileCheckSum}
+  NERR_NoRplBootSystem    = NERR_BASE + 405; // No loader is specified in the boot-block definition file.
+  {$EXTERNALSYM NERR_NoRplBootSystem}
+  NERR_RplLoadrNetBiosErr = NERR_BASE + 406; // NetBIOS returned an error: The NCB and SMB are dumped above.
+  {$EXTERNALSYM NERR_RplLoadrNetBiosErr}
+  NERR_RplLoadrDiskErr    = NERR_BASE + 407; // A disk I/O error occurred.
+  {$EXTERNALSYM NERR_RplLoadrDiskErr}
+  NERR_ImageParamErr      = NERR_BASE + 408; // Image parameter substitution failed.
+  {$EXTERNALSYM NERR_ImageParamErr}
+  NERR_TooManyImageParams = NERR_BASE + 409; // Too many image parameters cross disk sector boundaries.
+  {$EXTERNALSYM NERR_TooManyImageParams}
+  NERR_NonDosFloppyUsed   = NERR_BASE + 410; // The image was not generated from an MS-DOS diskette formatted with /S.
+  {$EXTERNALSYM NERR_NonDosFloppyUsed}
+  NERR_RplBootRestart     = NERR_BASE + 411; // Remote boot will be restarted later.
+  {$EXTERNALSYM NERR_RplBootRestart}
+  NERR_RplSrvrCallFailed  = NERR_BASE + 412; // The call to the Remoteboot server failed.
+  {$EXTERNALSYM NERR_RplSrvrCallFailed}
+  NERR_CantConnectRplSrvr = NERR_BASE + 413; // Cannot connect to the Remoteboot server.
+  {$EXTERNALSYM NERR_CantConnectRplSrvr}
+  NERR_CantOpenImageFile  = NERR_BASE + 414; // Cannot open image file on the Remoteboot server.
+  {$EXTERNALSYM NERR_CantOpenImageFile}
+  NERR_CallingRplSrvr     = NERR_BASE + 415; // Connecting to the Remoteboot server...
+  {$EXTERNALSYM NERR_CallingRplSrvr}
+  NERR_StartingRplBoot    = NERR_BASE + 416; // Connecting to the Remoteboot server...
+  {$EXTERNALSYM NERR_StartingRplBoot}
+  NERR_RplBootServiceTerm = NERR_BASE + 417; // Remote boot service was stopped; check the error log for the cause of the problem.
+  {$EXTERNALSYM NERR_RplBootServiceTerm}
+  NERR_RplBootStartFailed = NERR_BASE + 418; // Remote boot startup failed; check the error log for the cause of the problem.
+  {$EXTERNALSYM NERR_RplBootStartFailed}
+  NERR_RPL_CONNECTED      = NERR_BASE + 419; // A second connection to a Remoteboot resource is not allowed.
+  {$EXTERNALSYM NERR_RPL_CONNECTED}
+
+//
+//  FTADMIN API error codes
+//
+//       NERR_BASE + (425-434)
+//
+//       (Currently not used in NT)
+//
+
+//
+//  Browser service API error codes
+//
+//       NERR_BASE + (450-475)
+//
+
+  NERR_BrowserConfiguredToNotRun = NERR_BASE + 450; // The browser service was configured with MaintainServerList=No.
+  {$EXTERNALSYM NERR_BrowserConfiguredToNotRun}
+
+//
+//  Additional Remoteboot error codes.
+//
+//          NERR_BASE + (510-550)
+
+  NERR_RplNoAdaptersStarted      = NERR_BASE + 510; // Service failed to start since none of the network adapters started with this service.
+  {$EXTERNALSYM NERR_RplNoAdaptersStarted}
+  NERR_RplBadRegistry            = NERR_BASE + 511; // Service failed to start due to bad startup information in the registry.
+  {$EXTERNALSYM NERR_RplBadRegistry}
+  NERR_RplBadDatabase            = NERR_BASE + 512; // Service failed to start because its database is absent or corrupt.
+  {$EXTERNALSYM NERR_RplBadDatabase}
+  NERR_RplRplfilesShare          = NERR_BASE + 513; // Service failed to start because RPLFILES share is absent.
+  {$EXTERNALSYM NERR_RplRplfilesShare}
+  NERR_RplNotRplServer           = NERR_BASE + 514; // Service failed to start because RPLUSER group is absent.
+  {$EXTERNALSYM NERR_RplNotRplServer}
+  NERR_RplCannotEnum             = NERR_BASE + 515; // Cannot enumerate service records.
+  {$EXTERNALSYM NERR_RplCannotEnum}
+  NERR_RplWkstaInfoCorrupted     = NERR_BASE + 516; // Workstation record information has been corrupted.
+  {$EXTERNALSYM NERR_RplWkstaInfoCorrupted}
+  NERR_RplWkstaNotFound          = NERR_BASE + 517; // Workstation record was not found.
+  {$EXTERNALSYM NERR_RplWkstaNotFound}
+  NERR_RplWkstaNameUnavailable   = NERR_BASE + 518; // Workstation name is in use by some other workstation.
+  {$EXTERNALSYM NERR_RplWkstaNameUnavailable}
+  NERR_RplProfileInfoCorrupted   = NERR_BASE + 519; // Profile record information has been corrupted.
+  {$EXTERNALSYM NERR_RplProfileInfoCorrupted}
+  NERR_RplProfileNotFound        = NERR_BASE + 520; // Profile record was not found.
+  {$EXTERNALSYM NERR_RplProfileNotFound}
+  NERR_RplProfileNameUnavailable = NERR_BASE + 521; // Profile name is in use by some other profile.
+  {$EXTERNALSYM NERR_RplProfileNameUnavailable}
+  NERR_RplProfileNotEmpty        = NERR_BASE + 522; // There are workstations using this profile.
+  {$EXTERNALSYM NERR_RplProfileNotEmpty}
+  NERR_RplConfigInfoCorrupted    = NERR_BASE + 523; // Configuration record information has been corrupted.
+  {$EXTERNALSYM NERR_RplConfigInfoCorrupted}
+  NERR_RplConfigNotFound         = NERR_BASE + 524; // Configuration record was not found.
+  {$EXTERNALSYM NERR_RplConfigNotFound}
+  NERR_RplAdapterInfoCorrupted   = NERR_BASE + 525; // Adapter id record information has been corrupted.
+  {$EXTERNALSYM NERR_RplAdapterInfoCorrupted}
+  NERR_RplInternal               = NERR_BASE + 526; // An internal service error has occurred.
+  {$EXTERNALSYM NERR_RplInternal}
+  NERR_RplVendorInfoCorrupted    = NERR_BASE + 527; // Vendor id record information has been corrupted.
+  {$EXTERNALSYM NERR_RplVendorInfoCorrupted}
+  NERR_RplBootInfoCorrupted      = NERR_BASE + 528; // Boot block record information has been corrupted.
+  {$EXTERNALSYM NERR_RplBootInfoCorrupted}
+  NERR_RplWkstaNeedsUserAcct     = NERR_BASE + 529; // The user account for this workstation record is missing.
+  {$EXTERNALSYM NERR_RplWkstaNeedsUserAcct}
+  NERR_RplNeedsRPLUSERAcct       = NERR_BASE + 530; // The RPLUSER local group could not be found.
+  {$EXTERNALSYM NERR_RplNeedsRPLUSERAcct}
+  NERR_RplBootNotFound           = NERR_BASE + 531; // Boot block record was not found.
+  {$EXTERNALSYM NERR_RplBootNotFound}
+  NERR_RplIncompatibleProfile    = NERR_BASE + 532; // Chosen profile is incompatible with this workstation.
+  {$EXTERNALSYM NERR_RplIncompatibleProfile}
+  NERR_RplAdapterNameUnavailable = NERR_BASE + 533; // Chosen network adapter id is in use by some other workstation.
+  {$EXTERNALSYM NERR_RplAdapterNameUnavailable}
+  NERR_RplConfigNotEmpty         = NERR_BASE + 534; // There are profiles using this configuration.
+  {$EXTERNALSYM NERR_RplConfigNotEmpty}
+  NERR_RplBootInUse              = NERR_BASE + 535; // There are workstations, profiles or configurations using this boot block.
+  {$EXTERNALSYM NERR_RplBootInUse}
+  NERR_RplBackupDatabase         = NERR_BASE + 536; // Service failed to backup Remoteboot database.
+  {$EXTERNALSYM NERR_RplBackupDatabase}
+  NERR_RplAdapterNotFound        = NERR_BASE + 537; // Adapter record was not found.
+  {$EXTERNALSYM NERR_RplAdapterNotFound}
+  NERR_RplVendorNotFound         = NERR_BASE + 538; // Vendor record was not found.
+  {$EXTERNALSYM NERR_RplVendorNotFound}
+  NERR_RplVendorNameUnavailable  = NERR_BASE + 539; // Vendor name is in use by some other vendor record.
+  {$EXTERNALSYM NERR_RplVendorNameUnavailable}
+  NERR_RplBootNameUnavailable    = NERR_BASE + 540; // (boot name, vendor id) is in use by some other boot block record.
+  {$EXTERNALSYM NERR_RplBootNameUnavailable}
+  NERR_RplConfigNameUnavailable  = NERR_BASE + 541; // Configuration name is in use by some other configuration.
+  {$EXTERNALSYM NERR_RplConfigNameUnavailable}
+
+//*INTERNAL_ONLY*
+
+//
+//  Dfs API error codes.
+//
+//          NERR_BASE + (560-590)
+
+  NERR_DfsInternalCorruption        = NERR_BASE + 560; // The internal database maintained by the DFS service is corrupt
+  {$EXTERNALSYM NERR_DfsInternalCorruption}
+  NERR_DfsVolumeDataCorrupt         = NERR_BASE + 561; // One of the records in the internal DFS database is corrupt
+  {$EXTERNALSYM NERR_DfsVolumeDataCorrupt}
+  NERR_DfsNoSuchVolume              = NERR_BASE + 562; // There is no DFS name whose entry path matches the input Entry Path
+  {$EXTERNALSYM NERR_DfsNoSuchVolume}
+  NERR_DfsVolumeAlreadyExists       = NERR_BASE + 563; // A root or link with the given name already exists
+  {$EXTERNALSYM NERR_DfsVolumeAlreadyExists}
+  NERR_DfsAlreadyShared             = NERR_BASE + 564; // The server share specified is already shared in the DFS
+  {$EXTERNALSYM NERR_DfsAlreadyShared}
+  NERR_DfsNoSuchShare               = NERR_BASE + 565; // The indicated server share does not support the indicated DFS namespace
+  {$EXTERNALSYM NERR_DfsNoSuchShare}
+  NERR_DfsNotALeafVolume            = NERR_BASE + 566; // The operation is not valid on this portion of the namespace
+  {$EXTERNALSYM NERR_DfsNotALeafVolume}
+  NERR_DfsLeafVolume                = NERR_BASE + 567; // The operation is not valid on this portion of the namespace
+  {$EXTERNALSYM NERR_DfsLeafVolume}
+  NERR_DfsVolumeHasMultipleServers  = NERR_BASE + 568; // The operation is ambiguous because the link has multiple servers
+  {$EXTERNALSYM NERR_DfsVolumeHasMultipleServers}
+  NERR_DfsCantCreateJunctionPoint   = NERR_BASE + 569; // Unable to create a link
+  {$EXTERNALSYM NERR_DfsCantCreateJunctionPoint}
+  NERR_DfsServerNotDfsAware         = NERR_BASE + 570; // The server is not DFS Aware
+  {$EXTERNALSYM NERR_DfsServerNotDfsAware}
+  NERR_DfsBadRenamePath             = NERR_BASE + 571; // The specified rename target path is invalid
+  {$EXTERNALSYM NERR_DfsBadRenamePath}
+  NERR_DfsVolumeIsOffline           = NERR_BASE + 572; // The specified DFS link is offline
+  {$EXTERNALSYM NERR_DfsVolumeIsOffline}
+  NERR_DfsNoSuchServer              = NERR_BASE + 573; // The specified server is not a server for this link
+  {$EXTERNALSYM NERR_DfsNoSuchServer}
+  NERR_DfsCyclicalName              = NERR_BASE + 574; // A cycle in the DFS name was detected
+  {$EXTERNALSYM NERR_DfsCyclicalName}
+  NERR_DfsNotSupportedInServerDfs   = NERR_BASE + 575; // The operation is not supported on a server-based DFS
+  {$EXTERNALSYM NERR_DfsNotSupportedInServerDfs}
+  NERR_DfsDuplicateService          = NERR_BASE + 576; // This link is already supported by the specified server-share
+  {$EXTERNALSYM NERR_DfsDuplicateService}
+  NERR_DfsCantRemoveLastServerShare = NERR_BASE + 577; // Can't remove the last server-share supporting this root or link
+  {$EXTERNALSYM NERR_DfsCantRemoveLastServerShare}
+  NERR_DfsVolumeIsInterDfs          = NERR_BASE + 578; // The operation is not supported for an Inter-DFS link
+  {$EXTERNALSYM NERR_DfsVolumeIsInterDfs}
+  NERR_DfsInconsistent              = NERR_BASE + 579; // The internal state of the DFS Service has become inconsistent
+  {$EXTERNALSYM NERR_DfsInconsistent}
+  NERR_DfsServerUpgraded            = NERR_BASE + 580; // The DFS Service has been installed on the specified server
+  {$EXTERNALSYM NERR_DfsServerUpgraded}
+  NERR_DfsDataIsIdentical           = NERR_BASE + 581; // The DFS data being reconciled is identical
+  {$EXTERNALSYM NERR_DfsDataIsIdentical}
+  NERR_DfsCantRemoveDfsRoot         = NERR_BASE + 582; // The DFS root cannot be deleted - Uninstall DFS if required
+  {$EXTERNALSYM NERR_DfsCantRemoveDfsRoot}
+  NERR_DfsChildOrParentInDfs        = NERR_BASE + 583; // A child or parent directory of the share is already in a DFS
+  {$EXTERNALSYM NERR_DfsChildOrParentInDfs}
+  NERR_DfsInternalError             = NERR_BASE + 590; // DFS internal error
+  {$EXTERNALSYM NERR_DfsInternalError}
+
+//
+//  Net setup error codes.
+//
+//          NERR_BASE + (591-600)
+
+  NERR_SetupAlreadyJoined           = NERR_BASE + 591; // This machine is already joined to a domain.
+  {$EXTERNALSYM NERR_SetupAlreadyJoined}
+  NERR_SetupNotJoined               = NERR_BASE + 592; // This machine is not currently joined to a domain.
+  {$EXTERNALSYM NERR_SetupNotJoined}
+  NERR_SetupDomainController        = NERR_BASE + 593; // This machine is a domain controller and cannot be unjoined from a domain.
+  {$EXTERNALSYM NERR_SetupDomainController}
+  NERR_DefaultJoinRequired          = NERR_BASE + 594; // The destination domain controller does not support creating machine accounts in OUs.
+  {$EXTERNALSYM NERR_DefaultJoinRequired}
+  NERR_InvalidWorkgroupName         = NERR_BASE + 595; // The specified workgroup name is invalid.
+  {$EXTERNALSYM NERR_InvalidWorkgroupName}
+  NERR_NameUsesIncompatibleCodePage = NERR_BASE + 596; // The specified computer name is incompatible with the default language used on the domain controller.
+  {$EXTERNALSYM NERR_NameUsesIncompatibleCodePage}
+  NERR_ComputerAccountNotFound      = NERR_BASE + 597; // The specified computer account could not be found.
+  {$EXTERNALSYM NERR_ComputerAccountNotFound}
+  NERR_PersonalSku                  = NERR_BASE + 598; // This version of Windows cannot be joined to a domain.
+  {$EXTERNALSYM NERR_PersonalSku}
+
+//
+//  Some Password and account error results
+//
+//          NERR_BASE + (601 - 608)
+//
+
+  NERR_PasswordMustChange           = NERR_BASE  +  601;   // Password must change at next logon
+  {$EXTERNALSYM NERR_PasswordMustChange}
+  NERR_AccountLockedOut             = NERR_BASE  +  602;   // Account is locked out
+  {$EXTERNALSYM NERR_AccountLockedOut}
+  NERR_PasswordTooLong              = NERR_BASE  +  603;   // Password is too long
+  {$EXTERNALSYM NERR_PasswordTooLong}
+  NERR_PasswordNotComplexEnough     = NERR_BASE  +  604;   // Password doesn't meet the complexity policy
+  {$EXTERNALSYM NERR_PasswordNotComplexEnough}
+  NERR_PasswordFilterError          = NERR_BASE  +  605;   // Password doesn't meet the requirements of the filter dll's
+  {$EXTERNALSYM NERR_PasswordFilterError}
+
+//**********WARNING ****************
+//The range 2750-2799 has been     *
+//allocated to the IBM LAN Server  *
+//*********************************
+
+//**********WARNING ****************
+//The range 2900-2999 has been     *
+//reserved for Microsoft OEMs      *
+//*********************************
+
+//*END_INTERNAL*
+
+  MAX_NERR = NERR_BASE + 899; // This is the last error in NERR range.
+  {$EXTERNALSYM MAX_NERR}
+
+//
+// end of list
+//
+//    WARNING:  Do not exceed MAX_NERR; values above this are used by
+//              other error code ranges (errlog.h, service.h, apperr.h).
+
+implementation
+
+end.

+ 2188 - 0
packages/extra/winunits/jwalmerrlog.pas

@@ -0,0 +1,2188 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Error Log API interface Unit for Object Pascal                   }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmerrlog.h, released November 2001. The original Pascal}
+{ code is: LmErrLog.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmErrLog;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmerrlog.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Data Structures - Config
+//
+
+type
+  _ERROR_LOG = record
+     el_len: DWORD;
+     el_reserved: DWORD;
+     el_time: DWORD;
+     el_error: DWORD;
+     el_name: LPWSTR;             // pointer to service name
+     el_text: LPWSTR;             // pointer to string array
+     el_data: LPBYTE;             // pointer to BYTE array
+     el_data_size: DWORD;         // byte count of el_data area
+     el_nstrings: DWORD;          // number of strings in el_text.
+  end;
+  {$EXTERNALSYM _ERROR_LOG}
+  ERROR_LOG = _ERROR_LOG;
+  {$EXTERNALSYM ERROR_LOG}
+  PERROR_LOG = ^ERROR_LOG;
+  {$EXTERNALSYM PERROR_LOG}
+  LPERROR_LOG = ^ERROR_LOG;
+  {$EXTERNALSYM LPERROR_LOG}
+  TErrorLog = ERROR_LOG;
+  PErrorLog = PERROR_LOG;
+
+{$DEFINE REVISED_ERROR_LOG_STRUCT}
+
+  _HLOG = record
+     time: DWORD;
+     last_flags: DWORD;
+     offset: DWORD;
+     rec_offset: DWORD;
+  end;
+  {$EXTERNALSYM _HLOG}
+  HLOG = _HLOG;
+  {$EXTERNALSYM HLOG}
+  PHLOG = ^HLOG;
+  {$EXTERNALSYM PHLOG}
+  LPHLOG = ^HLOG;
+  {$EXTERNALSYM LPHLOG}
+
+const
+  LOGFLAGS_FORWARD   = 0;
+  {$EXTERNALSYM LOGFLAGS_FORWARD}
+  LOGFLAGS_BACKWARD  = $1;
+  {$EXTERNALSYM LOGFLAGS_BACKWARD}
+  LOGFLAGS_SEEK      = $2;
+  {$EXTERNALSYM LOGFLAGS_SEEK}
+
+//
+// Function Prototypes - ErrorLog
+//
+
+function NetErrorLogClear(server, backupfile: LPCWSTR; reserved: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetErrorLogClear}
+
+function NetErrorLogRead(server: LPCWSTR; reserved1: LPWSTR; errloghandle: LPHLOG; offset: DWORD; reserved2: LPDWORD;
+  reserved3, offsetflag: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; bytesread, totalbytes: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetErrorLogRead}
+
+function NetErrorLogWrite(reserved1: LPBYTE; code: DWORD; component: LPCWSTR; buffer: LPBYTE; numbytes: DWORD;
+  msgbuf: LPBYTE; strcount: DWORD; reserved2: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetErrorLogWrite}
+
+//
+// Special Values and Constants
+//
+
+//
+//  Generic (could be used by more than one service)
+//   error log messages from 0 to 25
+//
+// Do not change the comments following the manifest constants without
+// understanding how mapmsg works.
+//
+
+const
+  ERRLOG_BASE = 3100;        { NELOG errors start here }
+  {$EXTERNALSYM ERRLOG_BASE}
+
+  NELOG_Internal_Error = ERRLOG_BASE + 0;
+  {$EXTERNALSYM NELOG_Internal_Error}
+
+    {
+    * The operation failed because a network software error occurred.
+    }
+
+  NELOG_Resource_Shortage = ERRLOG_BASE + 1;
+  {$EXTERNALSYM NELOG_Resource_Shortage}
+
+    {
+    * The system ran out of a resource controlled by the %1 option.
+    }
+
+  NELOG_Unable_To_Lock_Segment = ERRLOG_BASE + 2;
+  {$EXTERNALSYM NELOG_Unable_To_Lock_Segment}
+
+    {
+    * The service failed to obtain a long-term lock on the
+    *  segment for network control blocks (NCBs). The error code is the data.
+    }
+
+  NELOG_Unable_To_Unlock_Segment = ERRLOG_BASE + 3;
+  {$EXTERNALSYM NELOG_Unable_To_Unlock_Segment}
+
+    {
+    * The service failed to release the long-term lock on the
+    *  segment for network control blocks (NCBs). The error code is the data.
+    }
+
+  NELOG_Uninstall_Service = ERRLOG_BASE + 4;
+  {$EXTERNALSYM NELOG_Uninstall_Service}
+
+    {
+    * There was an error stopping service %1.
+    *  The error code from NetServiceControl is the data.
+    }
+
+  NELOG_Init_Exec_Fail = ERRLOG_BASE + 5;
+  {$EXTERNALSYM NELOG_Init_Exec_Fail}
+
+    {
+    * Initialization failed because of a system execution failure on
+    *  path %1. The system error code is the data.
+    }
+
+  NELOG_Ncb_Error = ERRLOG_BASE + 6;
+  {$EXTERNALSYM NELOG_Ncb_Error}
+
+    {
+    * An unexpected network control block (NCB) was received. The NCB is the data.
+    }
+
+  NELOG_Net_Not_Started = ERRLOG_BASE + 7;
+  {$EXTERNALSYM NELOG_Net_Not_Started}
+
+    {
+    * The network is not started.
+    }
+
+  NELOG_Ioctl_Error = ERRLOG_BASE + 8;
+  {$EXTERNALSYM NELOG_Ioctl_Error}
+
+    {
+    * A DosDevIoctl or DosFsCtl to NETWKSTA.SYS failed.
+    * The data shown is in this format:
+    *     DWORD  approx CS:IP of call to ioctl or fsctl
+    *     WORD   error code
+    *     WORD   ioctl or fsctl number
+    }
+
+  NELOG_System_Semaphore = ERRLOG_BASE + 9;
+  {$EXTERNALSYM NELOG_System_Semaphore}
+
+    {
+    * Unable to create or open system semaphore %1.
+    *  The error code is the data.
+    }
+
+  NELOG_Init_OpenCreate_Err = ERRLOG_BASE + 10;
+  {$EXTERNALSYM NELOG_Init_OpenCreate_Err}
+
+    {
+    * Initialization failed because of an open/create error on the
+    *  file %1. The system error code is the data.
+    }
+
+  NELOG_NetBios = ERRLOG_BASE + 11;
+  {$EXTERNALSYM NELOG_NetBios}
+
+    {
+    * An unexpected NetBIOS error occurred.
+    *  The error code is the data.
+    }
+
+  NELOG_SMB_Illegal = ERRLOG_BASE + 12;
+  {$EXTERNALSYM NELOG_SMB_Illegal}
+
+    {
+    * An illegal server message block (SMB) was received.
+    *  The SMB is the data.
+    }
+
+  NELOG_Service_Fail = ERRLOG_BASE + 13;
+  {$EXTERNALSYM NELOG_Service_Fail}
+
+    {
+    * Initialization failed because the requested service %1
+    *  could not be started.
+   }
+
+  NELOG_Entries_Lost = ERRLOG_BASE + 14;
+  {$EXTERNALSYM NELOG_Entries_Lost}
+
+    {
+    * Some entries in the error log were lost because of a buffer
+    * overflow.
+    }
+
+//
+//  Server specific error log messages from 20 to 40
+//
+
+  NELOG_Init_Seg_Overflow = ERRLOG_BASE + 20;
+  {$EXTERNALSYM NELOG_Init_Seg_Overflow}
+
+    {
+    * Initialization parameters controlling resource usage other
+    *  than net buffers are sized so that too much memory is needed.
+    }
+
+  NELOG_Srv_No_Mem_Grow = ERRLOG_BASE + 21;
+  {$EXTERNALSYM NELOG_Srv_No_Mem_Grow}
+
+    {
+    * The server cannot increase the size of a memory segment.
+    }
+
+  NELOG_Access_File_Bad = ERRLOG_BASE + 22;
+  {$EXTERNALSYM NELOG_Access_File_Bad}
+
+    {
+    * Initialization failed because account file %1 is either incorrect
+    * or not present.
+    }
+
+  NELOG_Srvnet_Not_Started = ERRLOG_BASE + 23;
+  {$EXTERNALSYM NELOG_Srvnet_Not_Started}
+
+    {
+    * Initialization failed because network %1 was not started.
+    }
+
+  NELOG_Init_Chardev_Err = ERRLOG_BASE + 24;
+  {$EXTERNALSYM NELOG_Init_Chardev_Err}
+
+    {
+    * The server failed to start. Either all three chdev
+    *  parameters must be zero or all three must be nonzero.
+    }
+
+  NELOG_Remote_API = ERRLOG_BASE + 25;
+  {$EXTERNALSYM NELOG_Remote_API}
+
+    { A remote API request was halted due to the following
+    * invalid description string: %1.
+    }
+
+  NELOG_Ncb_TooManyErr = ERRLOG_BASE + 26;
+  {$EXTERNALSYM NELOG_Ncb_TooManyErr}
+
+    { The network %1 ran out of network control blocks (NCBs).  You may need to increase NCBs
+    * for this network.  The following information includes the
+    * number of NCBs submitted by the server when this error occurred:
+    }
+
+  NELOG_Mailslot_err = ERRLOG_BASE + 27;
+  {$EXTERNALSYM NELOG_Mailslot_err}
+
+    { The server cannot create the %1 mailslot needed to send
+    * the ReleaseMemory alert message.  The error received is:
+    }
+
+  NELOG_ReleaseMem_Alert = ERRLOG_BASE + 28;
+  {$EXTERNALSYM NELOG_ReleaseMem_Alert}
+
+    { The server failed to register for the ReleaseMemory alert,
+    * with recipient %1. The error code from
+    * NetAlertStart is the data.
+    }
+
+  NELOG_AT_cannot_write = ERRLOG_BASE + 29;
+  {$EXTERNALSYM NELOG_AT_cannot_write}
+
+    { The server cannot update the AT schedule file. The file
+    * is corrupted.
+    }
+
+  NELOG_Cant_Make_Msg_File = ERRLOG_BASE + 30;
+  {$EXTERNALSYM NELOG_Cant_Make_Msg_File}
+
+    { The server encountered an error when calling
+    * NetIMakeLMFileName. The error code is the data.
+    }
+
+  NELOG_Exec_Netservr_NoMem = ERRLOG_BASE + 31;
+  {$EXTERNALSYM NELOG_Exec_Netservr_NoMem}
+
+    { Initialization failed because of a system execution failure on
+    * path %1. There is not enough memory to start the process.
+    * The system error code is the data.
+    }
+
+  NELOG_Server_Lock_Failure = ERRLOG_BASE + 32;
+  {$EXTERNALSYM NELOG_Server_Lock_Failure}
+
+    { Longterm lock of the server buffers failed.
+    * Check swap disk's free space and restart the system to start the server.
+    }
+
+//
+//  Message service and POPUP specific error log messages from 40 to 55
+//
+
+  NELOG_Msg_Shutdown = ERRLOG_BASE + 40;
+  {$EXTERNALSYM NELOG_Msg_Shutdown}
+
+    {
+    * The service has stopped due to repeated consecutive
+    *  occurrences of a network control block (NCB) error.  The last bad NCB follows
+    *  in raw data.
+    }
+
+  NELOG_Msg_Sem_Shutdown = ERRLOG_BASE + 41;
+  {$EXTERNALSYM NELOG_Msg_Sem_Shutdown}
+
+    {
+    * The Message server has stopped due to a lock on the
+    *  Message server shared data segment.
+    }
+
+  NELOG_Msg_Log_Err = ERRLOG_BASE + 50;
+  {$EXTERNALSYM NELOG_Msg_Log_Err}
+
+    {
+    * A file system error occurred while opening or writing to the
+    *  system message log file %1. Message logging has been
+    *  switched off due to the error. The error code is the data.
+    }
+
+  NELOG_VIO_POPUP_ERR = ERRLOG_BASE + 51;
+  {$EXTERNALSYM NELOG_VIO_POPUP_ERR}
+
+    {
+    * Unable to display message POPUP due to system VIO call error.
+    *  The error code is the data.
+    }
+
+  NELOG_Msg_Unexpected_SMB_Type = ERRLOG_BASE + 52;
+  {$EXTERNALSYM NELOG_Msg_Unexpected_SMB_Type}
+
+    {
+    * An illegal server message block (SMB) was received.  The SMB is the data.
+    }
+
+//
+//  Workstation specific error log messages from 60 to 75
+//
+
+  NELOG_Wksta_Infoseg = ERRLOG_BASE + 60;
+  {$EXTERNALSYM NELOG_Wksta_Infoseg}
+
+    {
+    * The workstation information segment is bigger than 64K.
+    *  The size follows, in DWORD format:
+    }
+
+  NELOG_Wksta_Compname = ERRLOG_BASE + 61;
+  {$EXTERNALSYM NELOG_Wksta_Compname}
+
+    {
+    * The workstation was unable to get the name-number of the computer.
+    }
+
+  NELOG_Wksta_BiosThreadFailure = ERRLOG_BASE + 62;
+  {$EXTERNALSYM NELOG_Wksta_BiosThreadFailure}
+
+    {
+    * The workstation could not initialize the Async NetBIOS Thread.
+    *  The error code is the data.
+    }
+
+  NELOG_Wksta_IniSeg = ERRLOG_BASE + 63;
+  {$EXTERNALSYM NELOG_Wksta_IniSeg}
+
+    {
+    * The workstation could not open the initial shared segment.
+    *  The error code is the data.
+    }
+
+  NELOG_Wksta_HostTab_Full = ERRLOG_BASE + 64;
+  {$EXTERNALSYM NELOG_Wksta_HostTab_Full}
+
+    {
+    * The workstation host table is full.
+    }
+
+  NELOG_Wksta_Bad_Mailslot_SMB = ERRLOG_BASE + 65;
+  {$EXTERNALSYM NELOG_Wksta_Bad_Mailslot_SMB}
+
+    {
+    * A bad mailslot server message block (SMB) was received.  The SMB is the data.
+    }
+
+  NELOG_Wksta_UASInit = ERRLOG_BASE + 66;
+  {$EXTERNALSYM NELOG_Wksta_UASInit}
+
+    {
+    * The workstation encountered an error while trying to start the user accounts database.
+    *  The error code is the data.
+    }
+
+  NELOG_Wksta_SSIRelogon = ERRLOG_BASE + 67;
+  {$EXTERNALSYM NELOG_Wksta_SSIRelogon}
+
+    {
+    * The workstation encountered an error while responding to an SSI revalidation request.
+    *  The function code and the error codes are the data.
+    }
+
+//
+//  Alerter service specific error log messages from 70 to 79
+//
+
+  NELOG_Build_Name = ERRLOG_BASE + 70;
+  {$EXTERNALSYM NELOG_Build_Name}
+
+    {
+    * The Alerter service had a problem creating the list of
+    * alert recipients.  The error code is %1.
+    }
+
+  NELOG_Name_Expansion = ERRLOG_BASE + 71;
+  {$EXTERNALSYM NELOG_Name_Expansion}
+
+    {
+    * There was an error expanding %1 as a group name. Try
+    *  splitting the group into two or more smaller groups.
+    }
+
+  NELOG_Message_Send = ERRLOG_BASE + 72;
+  {$EXTERNALSYM NELOG_Message_Send}
+
+    {
+    * There was an error sending %2 the alert message -
+    *  (
+    *  %3 )
+    *  The error code is %1.
+    }
+
+  NELOG_Mail_Slt_Err = ERRLOG_BASE + 73;
+  {$EXTERNALSYM NELOG_Mail_Slt_Err}
+
+    {
+    * There was an error in creating or reading the alerter mailslot.
+    *  The error code is %1.
+    }
+
+  NELOG_AT_cannot_read = ERRLOG_BASE + 74;
+  {$EXTERNALSYM NELOG_AT_cannot_read}
+
+    {
+    * The server could not read the AT schedule file.
+    }
+
+  NELOG_AT_sched_err = ERRLOG_BASE + 75;
+  {$EXTERNALSYM NELOG_AT_sched_err}
+
+    {
+    * The server found an invalid AT schedule record.
+    }
+
+  NELOG_AT_schedule_file_created = ERRLOG_BASE + 76;
+  {$EXTERNALSYM NELOG_AT_schedule_file_created}
+
+    {
+    * The server could not find an AT schedule file so it created one.
+    }
+
+  NELOG_Srvnet_NB_Open = ERRLOG_BASE + 77;
+  {$EXTERNALSYM NELOG_Srvnet_NB_Open}
+
+    {
+    * The server could not access the %1 network with NetBiosOpen.
+    }
+
+  NELOG_AT_Exec_Err = ERRLOG_BASE + 78;
+  {$EXTERNALSYM NELOG_AT_Exec_Err}
+
+    {
+    * The AT command processor could not run %1.
+   }
+
+//
+//      Cache Lazy Write and HPFS386 specific error log messages from 80 to 89
+//
+
+  NELOG_Lazy_Write_Err = ERRLOG_BASE + 80;
+  {$EXTERNALSYM NELOG_Lazy_Write_Err}
+
+        {
+        * WARNING:  Because of a lazy-write error, drive %1 now
+        *  contains some corrupted data.  The cache is stopped.
+        }
+
+  NELOG_HotFix = ERRLOG_BASE + 81;
+  {$EXTERNALSYM NELOG_HotFix}
+
+    {
+    * A defective sector on drive %1 has been replaced (hotfixed).
+    * No data was lost.  You should run CHKDSK soon to restore full
+    * performance and replenish the volume's spare sector pool.
+    *
+    * The hotfix occurred while processing a remote request.
+    }
+
+  NELOG_HardErr_From_Server = ERRLOG_BASE + 82;
+  {$EXTERNALSYM NELOG_HardErr_From_Server}
+
+    {
+    * A disk error occurred on the HPFS volume in drive %1.
+    * The error occurred while processing a remote request.
+    }
+
+  NELOG_LocalSecFail1 = ERRLOG_BASE + 83;
+  {$EXTERNALSYM NELOG_LocalSecFail1}
+
+    {
+    * The user accounts database (NET.ACC) is corrupted.  The local security
+    * system is replacing the corrupted NET.ACC with the backup
+    * made at %1.
+    * Any updates made to the database after this time are lost.
+    *
+    }
+
+  NELOG_LocalSecFail2 = ERRLOG_BASE + 84;
+  {$EXTERNALSYM NELOG_LocalSecFail2}
+
+    {
+    * The user accounts database (NET.ACC) is missing.  The local
+    * security system is restoring the backup database
+    * made at %1.
+    * Any updates made to the database made after this time are lost.
+    *
+    }
+
+  NELOG_LocalSecFail3 = ERRLOG_BASE + 85;
+  {$EXTERNALSYM NELOG_LocalSecFail3}
+
+    {
+    * Local security could not be started because the user accounts database
+    * (NET.ACC) was missing or corrupted, and no usable backup
+    * database was present.
+    *
+    * THE SYSTEM IS NOT SECURE.
+    }
+
+  NELOG_LocalSecGeneralFail = ERRLOG_BASE + 86;
+  {$EXTERNALSYM NELOG_LocalSecGeneralFail}
+
+    {
+    * Local security could not be started because an error
+    * occurred during initialization. The error code returned is %1.
+    *
+    * THE SYSTEM IS NOT SECURE.
+    *
+    }
+
+//
+//  NETWKSTA.SYS specific error log messages from 90 to 99
+//
+
+  NELOG_NetWkSta_Internal_Error = ERRLOG_BASE + 90;
+  {$EXTERNALSYM NELOG_NetWkSta_Internal_Error}
+
+    {
+    * A NetWksta internal error has occurred:
+    *  %1
+    }
+
+  NELOG_NetWkSta_No_Resource = ERRLOG_BASE + 91;
+  {$EXTERNALSYM NELOG_NetWkSta_No_Resource}
+
+    {
+    * The redirector is out of a resource: %1.
+    }
+
+  NELOG_NetWkSta_SMB_Err = ERRLOG_BASE + 92;
+  {$EXTERNALSYM NELOG_NetWkSta_SMB_Err}
+
+    {
+    * A server message block (SMB) error occurred on the connection to %1.
+    *  The SMB header is the data.
+    }
+
+  NELOG_NetWkSta_VC_Err = ERRLOG_BASE + 93;
+  {$EXTERNALSYM NELOG_NetWkSta_VC_Err}
+
+    {
+    * A virtual circuit error occurred on the session to %1.
+    *  The network control block (NCB) command and return code is the data.
+    }
+
+  NELOG_NetWkSta_Stuck_VC_Err = ERRLOG_BASE + 94;
+  {$EXTERNALSYM NELOG_NetWkSta_Stuck_VC_Err}
+
+    {
+    * Hanging up a stuck session to %1.
+    }
+
+  NELOG_NetWkSta_NCB_Err = ERRLOG_BASE + 95;
+  {$EXTERNALSYM NELOG_NetWkSta_NCB_Err}
+
+    {
+    * A network control block (NCB) error occurred (%1).
+    *  The NCB is the data.
+    }
+
+  NELOG_NetWkSta_Write_Behind_Err = ERRLOG_BASE + 96;
+  {$EXTERNALSYM NELOG_NetWkSta_Write_Behind_Err}
+
+    {
+    * A write operation to %1 failed.
+    *  Data may have been lost.
+    }
+
+  NELOG_NetWkSta_Reset_Err = ERRLOG_BASE + 97;
+  {$EXTERNALSYM NELOG_NetWkSta_Reset_Err}
+
+    {
+    * Reset of driver %1 failed to complete the network control block (NCB).
+    *  The NCB is the data.
+    }
+
+  NELOG_NetWkSta_Too_Many = ERRLOG_BASE + 98;
+  {$EXTERNALSYM NELOG_NetWkSta_Too_Many}
+
+    {
+    * The amount of resource %1 requested was more
+    *  than the maximum. The maximum amount was allocated.
+    }
+
+//
+//  Spooler specific error log messages from 100 to 103
+//
+
+  NELOG_Srv_Thread_Failure = ERRLOG_BASE + 104;
+  {$EXTERNALSYM NELOG_Srv_Thread_Failure}
+
+    {
+    * The server could not create a thread.
+    *  The THREADS parameter in the CONFIG.SYS file should be increased.
+    }
+
+  NELOG_Srv_Close_Failure = ERRLOG_BASE + 105;
+  {$EXTERNALSYM NELOG_Srv_Close_Failure}
+
+    {
+    * The server could not close %1.
+    *  The file is probably corrupted.
+    }
+
+  NELOG_ReplUserCurDir = ERRLOG_BASE + 106;
+  {$EXTERNALSYM NELOG_ReplUserCurDir}
+
+    {
+    *The replicator cannot update directory %1. It has tree integrity
+    * and is the current directory for some process.
+    }
+
+  NELOG_ReplCannotMasterDir = ERRLOG_BASE + 107;
+  {$EXTERNALSYM NELOG_ReplCannotMasterDir}
+
+    {
+    *The server cannot export directory %1 to client %2.
+    * It is exported from another server.
+    }
+
+  NELOG_ReplUpdateError = ERRLOG_BASE + 108;
+  {$EXTERNALSYM NELOG_ReplUpdateError}
+
+    {
+    *The replication server could not update directory %2 from the source
+    * on %3 due to error %1.
+    }
+
+  NELOG_ReplLostMaster = ERRLOG_BASE + 109;
+  {$EXTERNALSYM NELOG_ReplLostMaster}
+
+    {
+    *Master %1 did not send an update notice for directory %2 at the expected
+    * time.
+    }
+
+  NELOG_NetlogonAuthDCFail = ERRLOG_BASE + 110;
+  {$EXTERNALSYM NELOG_NetlogonAuthDCFail}
+
+    {
+    *This computer could not authenticate with %2, a Windows domain controller
+    * for domain %1, and therefore this computer might deny logon requests.
+    * This inability to authenticate might be caused by another computer on the
+    * same network using the same name or the password for this computer account
+    * is not recognized. If this message appears again, contact your system
+    * administrator.
+    }
+
+  NELOG_ReplLogonFailed = ERRLOG_BASE + 111;
+  {$EXTERNALSYM NELOG_ReplLogonFailed}
+
+    {
+    *The replicator attempted to log on at %2 as %1 and failed.
+    }
+
+  NELOG_ReplNetErr = ERRLOG_BASE + 112;
+  {$EXTERNALSYM NELOG_ReplNetErr}
+
+    {
+    *  Network error %1 occurred.
+    }
+
+  NELOG_ReplMaxFiles = ERRLOG_BASE + 113;
+  {$EXTERNALSYM NELOG_ReplMaxFiles}
+
+    {
+    *  Replicator limit for files in a directory has been exceeded.
+    }
+
+  NELOG_ReplMaxTreeDepth = ERRLOG_BASE + 114;
+  {$EXTERNALSYM NELOG_ReplMaxTreeDepth}
+
+    {
+    *  Replicator limit for tree depth has been exceeded.
+    }
+
+  NELOG_ReplBadMsg = ERRLOG_BASE + 115;
+  {$EXTERNALSYM NELOG_ReplBadMsg}
+
+    {
+    *  Unrecognized message received in mailslot.
+    }
+
+  NELOG_ReplSysErr = ERRLOG_BASE + 116;
+  {$EXTERNALSYM NELOG_ReplSysErr}
+
+    {
+    *  System error %1 occurred.
+    }
+
+  NELOG_ReplUserLoged = ERRLOG_BASE + 117;
+  {$EXTERNALSYM NELOG_ReplUserLoged}
+
+    {
+    *  Cannot log on. User is currently logged on and argument TRYUSER
+    *  is set to NO.
+    }
+
+  NELOG_ReplBadImport = ERRLOG_BASE + 118;
+  {$EXTERNALSYM NELOG_ReplBadImport}
+
+    {
+    *  IMPORT path %1 cannot be found.
+    }
+
+  NELOG_ReplBadExport = ERRLOG_BASE + 119;
+  {$EXTERNALSYM NELOG_ReplBadExport}
+
+    {
+    *  EXPORT path %1 cannot be found.
+    }
+
+  NELOG_ReplSignalFileErr = ERRLOG_BASE + 120;
+  {$EXTERNALSYM NELOG_ReplSignalFileErr}
+
+    {
+    *  Replicator failed to update signal file in directory %2 due to
+    *  %1 system error.
+    }
+
+  NELOG_DiskFT = (ERRLOG_BASE+121);
+  {$EXTERNALSYM NELOG_DiskFT}
+
+    {
+    * Disk Fault Tolerance Error
+    *
+    * %1
+    }
+
+  NELOG_ReplAccessDenied = ERRLOG_BASE + 122;
+  {$EXTERNALSYM NELOG_ReplAccessDenied}
+
+    {
+    *  Replicator could not access %2
+    *  on %3 due to system error %1.
+    }
+
+  NELOG_NetlogonFailedPrimary = ERRLOG_BASE + 123;
+  {$EXTERNALSYM NELOG_NetlogonFailedPrimary}
+
+    {
+    *The primary domain controller for domain %1 has apparently failed.
+    }
+
+  NELOG_NetlogonPasswdSetFailed = ERRLOG_BASE + 124;
+  {$EXTERNALSYM NELOG_NetlogonPasswdSetFailed}
+
+    {
+    * Changing machine account password for account %1 failed with
+    * the following error: %n%2
+    }
+
+  NELOG_NetlogonTrackingError = ERRLOG_BASE + 125;
+  {$EXTERNALSYM NELOG_NetlogonTrackingError}
+
+    {
+    *An error occurred while updating the logon or logoff information for %1.
+    }
+
+  NELOG_NetlogonSyncError = ERRLOG_BASE + 126;
+  {$EXTERNALSYM NELOG_NetlogonSyncError}
+
+    {
+    *An error occurred while synchronizing with primary domain controller %1
+    }
+
+  NELOG_NetlogonRequireSignOrSealError = ERRLOG_BASE + 127;
+  {$EXTERNALSYM NELOG_NetlogonRequireSignOrSealError}
+
+    {
+    * The session setup to the Windows NT or Windows 2000 Domain Controller %1 for the domain %2
+    * failed because %1 does not support signing or sealing the Netlogon
+    * session.
+    *
+    * Either upgrade the Domain controller or set the RequireSignOrSeal
+    * registry entry on this machine to 0.
+    }
+
+//
+//  UPS service specific error log messages from 130 to 135
+//
+
+  NELOG_UPS_PowerOut = ERRLOG_BASE + 130;
+  {$EXTERNALSYM NELOG_UPS_PowerOut}
+
+    {
+    * A power failure was detected at the server.
+    }
+
+  NELOG_UPS_Shutdown = ERRLOG_BASE + 131;
+  {$EXTERNALSYM NELOG_UPS_Shutdown}
+
+    {
+    * The UPS service performed server shut down.
+    }
+
+  NELOG_UPS_CmdFileError = ERRLOG_BASE + 132;
+  {$EXTERNALSYM NELOG_UPS_CmdFileError}
+
+    {
+    * The UPS service did not complete execution of the
+    * user specified shut down command file.
+    }
+
+  NELOG_UPS_CannotOpenDriver = (ERRLOG_BASE+133);
+  {$EXTERNALSYM NELOG_UPS_CannotOpenDriver}
+
+    {
+    * The UPS driver could not be opened.  The error code is
+    * the data.
+    }
+
+  NELOG_UPS_PowerBack = ERRLOG_BASE + 134;
+  {$EXTERNALSYM NELOG_UPS_PowerBack}
+
+    {
+    * Power has been restored.
+    }
+
+  NELOG_UPS_CmdFileConfig = ERRLOG_BASE + 135;
+  {$EXTERNALSYM NELOG_UPS_CmdFileConfig}
+
+    {
+    * There is a problem with a configuration of user specified
+    * shut down command file.
+    }
+
+  NELOG_UPS_CmdFileExec = ERRLOG_BASE + 136;
+  {$EXTERNALSYM NELOG_UPS_CmdFileExec}
+
+    {
+    * The UPS service failed to execute a user specified shutdown
+    * command file %1.  The error code is the data.
+    }
+
+//
+//  Remoteboot server specific error log messages are from 150 to 157
+//
+
+  NELOG_Missing_Parameter = ERRLOG_BASE + 150;
+  {$EXTERNALSYM NELOG_Missing_Parameter}
+
+    {
+    * Initialization failed because of an invalid or missing
+    *  parameter in the configuration file %1.
+    }
+
+  NELOG_Invalid_Config_Line = ERRLOG_BASE + 151;
+  {$EXTERNALSYM NELOG_Invalid_Config_Line}
+
+    {
+    * Initialization failed because of an invalid line in the
+    *  configuration file %1. The invalid line is the data.
+    }
+
+  NELOG_Invalid_Config_File = ERRLOG_BASE + 152;
+  {$EXTERNALSYM NELOG_Invalid_Config_File}
+
+    {
+    * Initialization failed because of an error in the configuration
+    *  file %1.
+    }
+
+  NELOG_File_Changed = ERRLOG_BASE + 153;
+  {$EXTERNALSYM NELOG_File_Changed}
+
+    {
+    * The file %1 has been changed after initialization.
+    *  The boot-block loading was temporarily terminated.
+    }
+
+  NELOG_Files_Dont_Fit = ERRLOG_BASE + 154;
+  {$EXTERNALSYM NELOG_Files_Dont_Fit}
+
+    {
+    * The files do not fit to the boot-block configuration
+    * file %1. Change the BASE and ORG definitions or the order
+    * of the files.
+    }
+
+  NELOG_Wrong_DLL_Version = ERRLOG_BASE + 155;
+  {$EXTERNALSYM NELOG_Wrong_DLL_Version}
+
+    {
+    * Initialization failed because the dynamic-link
+    *  library %1 returned an incorrect version number.
+    }
+
+  NELOG_Error_in_DLL = ERRLOG_BASE + 156;
+  {$EXTERNALSYM NELOG_Error_in_DLL}
+
+    {
+    * There was an unrecoverable error in the dynamic-
+    *  link library of the service.
+    }
+
+  NELOG_System_Error = ERRLOG_BASE + 157;
+  {$EXTERNALSYM NELOG_System_Error}
+
+    {
+    * The system returned an unexpected error code.
+    *  The error code is the data.
+    }
+
+  NELOG_FT_ErrLog_Too_Large = ERRLOG_BASE + 158;
+  {$EXTERNALSYM NELOG_FT_ErrLog_Too_Large}
+
+    {
+    * The fault-tolerance error log file, LANROOT\LOGS\FT.LOG,
+    *  is more than 64K.
+    }
+
+  NELOG_FT_Update_In_Progress = ERRLOG_BASE + 159;
+  {$EXTERNALSYM NELOG_FT_Update_In_Progress}
+
+    {
+    * The fault-tolerance error-log file, LANROOT\LOGS\FT.LOG, had the
+    * update in progress bit set upon opening, which means that the
+    * system crashed while working on the error log.
+    }
+
+  NELOG_Joined_Domain = ERRLOG_BASE + 160;
+  {$EXTERNALSYM NELOG_Joined_Domain}
+
+    {
+    * This computer has been successfully joined to %1 '%2'.
+    }
+
+  NELOG_Joined_Workgroup = ERRLOG_BASE + 161;
+  {$EXTERNALSYM NELOG_Joined_Workgroup}
+
+    (*
+    * This computer has been successfully joined to workgroup '%1'.
+    *)
+
+//
+// Microsoft has created a generic error log entry for OEMs to use to
+// log errors from OEM value added services.  The code, which is the
+// 2nd arg to NetErrorLogWrite, is 3299.  This value is manifest in
+// NET/H/ERRLOG.H as NELOG_OEM_Code.  The text for error log entry
+// NELOG_OEM_Code is:  "%1 %2 %3 %4 %5 %6 %7 %8 %9.".
+//
+// Microsoft suggests that OEMs use the insertion strings as follows:
+// %1:  OEM System Name (e.g. 3+Open)
+// %2:  OEM Service Name (e.g. 3+Mail)
+// %3:  Severity level (e.g.  error, warning, etc.)
+// %4:  OEM error log entry sub-identifier  (e.g. error code #)
+// %5 - % 9:  Text.
+//
+// The call to NetErrorWrite must set nstrings = 9, and provide 9
+// ASCIIZ strings.  If the caller does not have 9 insertion strings,
+// provide null strings for the empty insertion strings.
+//
+
+  NELOG_OEM_Code = ERRLOG_BASE + 199;
+  {$EXTERNALSYM NELOG_OEM_Code}
+
+    {
+    * %1 %2 %3 %4 %5 %6 %7 %8 %9.
+    }
+
+//
+// another error log range defined for NT Lanman.
+//
+
+  ERRLOG2_BASE = 5700        { New NT NELOG errors start here };
+  {$EXTERNALSYM ERRLOG2_BASE}
+
+  NELOG_NetlogonSSIInitError = ERRLOG2_BASE + 0;
+  {$EXTERNALSYM NELOG_NetlogonSSIInitError}
+
+    {
+     * The Netlogon service could not initialize the replication data
+     * structures successfully. The service was terminated.  The following
+     * error occurred: %n%1
+     }
+
+  NELOG_NetlogonFailedToUpdateTrustList = ERRLOG2_BASE + 1;
+  {$EXTERNALSYM NELOG_NetlogonFailedToUpdateTrustList}
+
+    {
+     * The Netlogon service failed to update the domain trust list.  The
+     * following error occurred: %n%1
+     }
+
+  NELOG_NetlogonFailedToAddRpcInterface = ERRLOG2_BASE + 2;
+  {$EXTERNALSYM NELOG_NetlogonFailedToAddRpcInterface}
+
+    {
+     * The Netlogon service could not add the RPC interface.  The
+     * service was terminated. The following error occurred: %n%1
+     }
+
+  NELOG_NetlogonFailedToReadMailslot = ERRLOG2_BASE + 3;
+  {$EXTERNALSYM NELOG_NetlogonFailedToReadMailslot}
+
+    {
+     * The Netlogon service could not read a mailslot message from %1 due
+     * to the following error: %n%2
+     }
+
+  NELOG_NetlogonFailedToRegisterSC = ERRLOG2_BASE + 4;
+  {$EXTERNALSYM NELOG_NetlogonFailedToRegisterSC}
+
+    (*
+     * The Netlogon service failed to register the service with the
+     * service controller. The service was terminated. The following
+     * error occurred: %n%1
+     *)
+
+  NELOG_NetlogonChangeLogCorrupt = ERRLOG2_BASE + 5;
+  {$EXTERNALSYM NELOG_NetlogonChangeLogCorrupt}
+
+    {
+     * The change log cache maintained by the Netlogon service for %1
+     * database changes is inconsistent. The Netlogon service is resetting
+     * the change log.
+     }
+
+  NELOG_NetlogonFailedToCreateShare = ERRLOG2_BASE + 6;
+  {$EXTERNALSYM NELOG_NetlogonFailedToCreateShare}
+
+    {
+     * The Netlogon service could not create server share %1.  The following
+     * error occurred: %n%2
+     }
+
+  NELOG_NetlogonDownLevelLogonFailed = ERRLOG2_BASE + 7;
+  {$EXTERNALSYM NELOG_NetlogonDownLevelLogonFailed}
+
+    {
+     * The down-level logon request for the user %1 from %2 failed.
+     }
+
+  NELOG_NetlogonDownLevelLogoffFailed = ERRLOG2_BASE + 8;
+  {$EXTERNALSYM NELOG_NetlogonDownLevelLogoffFailed}
+
+    {
+     * The down-level logoff request for the user %1 from %2 failed.
+     }
+
+  NELOG_NetlogonNTLogonFailed = ERRLOG2_BASE + 9;
+  {$EXTERNALSYM NELOG_NetlogonNTLogonFailed}
+
+    {
+     * The Windows NT or Windows 2000 %1 logon request for the user %2\%3 from %4 (via %5)
+     * failed.
+     }
+
+  NELOG_NetlogonNTLogoffFailed = ERRLOG2_BASE + 10;
+  {$EXTERNALSYM NELOG_NetlogonNTLogoffFailed}
+
+    {
+     * The Windows NT or Windows 2000 %1 logoff request for the user %2\%3 from %4
+     * failed.
+     }
+
+  NELOG_NetlogonPartialSyncCallSuccess = ERRLOG2_BASE + 11;
+  {$EXTERNALSYM NELOG_NetlogonPartialSyncCallSuccess}
+
+    {
+     * The partial synchronization request from the server %1 completed
+     * successfully. %2 changes(s) has(have) been returned to the
+     * caller.
+     }
+
+  NELOG_NetlogonPartialSyncCallFailed = ERRLOG2_BASE + 12;
+  {$EXTERNALSYM NELOG_NetlogonPartialSyncCallFailed}
+
+    {
+     * The partial synchronization request from the server %1 failed with
+     * the following error: %n%2
+     }
+
+  NELOG_NetlogonFullSyncCallSuccess = ERRLOG2_BASE + 13;
+  {$EXTERNALSYM NELOG_NetlogonFullSyncCallSuccess}
+
+    {
+     * The full synchronization request from the server %1 completed
+     * successfully. %2 object(s) has(have) been returned to
+     * the caller.
+     }
+
+  NELOG_NetlogonFullSyncCallFailed = ERRLOG2_BASE + 14;
+  {$EXTERNALSYM NELOG_NetlogonFullSyncCallFailed}
+
+    {
+     * The full synchronization request from the server %1 failed with
+     * the following error: %n%2
+     }
+
+  NELOG_NetlogonPartialSyncSuccess = ERRLOG2_BASE + 15;
+  {$EXTERNALSYM NELOG_NetlogonPartialSyncSuccess}
+
+    {
+     * The partial synchronization replication of the %1 database from the
+     * primary domain controller %2 completed successfully. %3 change(s) is(are)
+     * applied to the database.
+     }
+
+  NELOG_NetlogonPartialSyncFailed = ERRLOG2_BASE + 16;
+  {$EXTERNALSYM NELOG_NetlogonPartialSyncFailed}
+
+    {
+     * The partial synchronization replication of the %1 database from the
+     * primary domain controller %2 failed with the following error: %n%3
+     }
+
+  NELOG_NetlogonFullSyncSuccess = ERRLOG2_BASE + 17;
+  {$EXTERNALSYM NELOG_NetlogonFullSyncSuccess}
+
+    {
+     * The full synchronization replication of the %1 database from the
+     * primary domain controller %2 completed successfully.
+     }
+
+  NELOG_NetlogonFullSyncFailed = ERRLOG2_BASE + 18;
+  {$EXTERNALSYM NELOG_NetlogonFullSyncFailed}
+
+    {
+     * The full synchronization replication of the %1 database from the
+     * primary domain controller %2 failed with the following error: %n%3
+     }
+
+  NELOG_NetlogonAuthNoDomainController = ERRLOG2_BASE + 19;
+  {$EXTERNALSYM NELOG_NetlogonAuthNoDomainController}
+
+    {
+     * This computer was not able to set up a secure session with a domain
+     * controller in domain %1 due to the following: %n%2
+     * %nThis may lead to authentication problems. Make sure that this
+     * computer is connected to the network. If the problem persists,
+     * please contact your domain administrator.
+     *
+     * %n%nADDITIONAL INFO
+     * %nIf this computer is a domain controller for the specified domain, it
+     * sets up the secure session to the primary domain controller emulator in the specified
+     * domain. Otherwise, this computer sets up the secure session to any domain controller
+     * in the specified domain.
+     }
+
+  NELOG_NetlogonAuthNoTrustLsaSecret = ERRLOG2_BASE + 20;
+  {$EXTERNALSYM NELOG_NetlogonAuthNoTrustLsaSecret}
+
+    {
+     * The session setup to the Windows NT or Windows 2000 Domain Controller %1 for the domain %2
+     * failed because the computer %3 does not have a local security database account.
+     }
+
+  NELOG_NetlogonAuthNoTrustSamAccount = ERRLOG2_BASE + 21;
+  {$EXTERNALSYM NELOG_NetlogonAuthNoTrustSamAccount}
+
+    {
+     * The session setup to the Windows NT or Windows 2000 Domain Controller %1 for the domain %2
+     * failed because the Domain Controller did not have an account %4
+     * needed to set up the session by this computer %3.
+     *
+     * %n%nADDITIONAL DATA
+     * %nIf this computer is a member of or a Domain Controller in the specified domain, the
+     * aforementioned account is a computer account for this computer in the specified domain.
+     * Otherwise, the account is an interdomain trust account with the specified domain.
+     }
+
+  NELOG_NetlogonServerAuthFailed = ERRLOG2_BASE + 22;
+  {$EXTERNALSYM NELOG_NetlogonServerAuthFailed}
+
+    {
+     * The session setup from the computer %1 failed to authenticate.
+     * The name(s) of the account(s) referenced in the security database is
+     * %2.  The following error occurred: %n%3
+     }
+
+  NELOG_NetlogonServerAuthNoTrustSamAccount = ERRLOG2_BASE + 23;
+  {$EXTERNALSYM NELOG_NetlogonServerAuthNoTrustSamAccount}
+
+    {
+     * The session setup from computer '%1' failed because the security database
+     * does not contain a trust account '%2' referenced by the specified computer.
+     *
+     * %n%nUSER ACTION
+     *
+     * %nIf this is the first occurrence of this event for the specified computer
+     * and account, this may be a transient issue that doesn't require any action
+     * at this time. Otherwise, the following steps may be taken to resolve this problem:
+     *
+     * %n%nIf '%2' is a legitimate machine account for the computer '%1', then '%1'
+     * should be rejoined to the domain.
+     *
+     * %n%nIf '%2' is a legitimate interdomain trust account, then the trust should
+     * be recreated.
+     *
+     * %n%nOtherwise, assuming that '%2' is not a legitimate account, the following
+     * action should be taken on '%1':
+     *
+     * %n%nIf '%1' is a Domain Controller, then the trust associated with '%2' should be deleted.
+     *
+     * %n%nIf '%1' is not a Domain Controller, it should be disjoined from the domain.
+     }
+
+//
+// General log messages for NT services.
+//
+
+  NELOG_FailedToRegisterSC = ERRLOG2_BASE + 24;
+  {$EXTERNALSYM NELOG_FailedToRegisterSC}
+
+    {
+     * Could not register control handler with service controller %1.
+     }
+
+  NELOG_FailedToSetServiceStatus = ERRLOG2_BASE + 25;
+  {$EXTERNALSYM NELOG_FailedToSetServiceStatus}
+
+    {
+     * Could not set service status with service controller %1.
+     }
+
+  NELOG_FailedToGetComputerName = ERRLOG2_BASE + 26;
+  {$EXTERNALSYM NELOG_FailedToGetComputerName}
+
+    {
+     * Could not find the computer name %1.
+     }
+
+  NELOG_DriverNotLoaded = ERRLOG2_BASE + 27;
+  {$EXTERNALSYM NELOG_DriverNotLoaded}
+
+    {
+     * Could not load %1 device driver.
+     }
+
+  NELOG_NoTranportLoaded = ERRLOG2_BASE + 28;
+  {$EXTERNALSYM NELOG_NoTranportLoaded}
+
+    {
+     * Could not load any transport.
+     }
+
+//
+// More Netlogon service events
+//
+
+  NELOG_NetlogonFailedDomainDelta = ERRLOG2_BASE + 29;
+  {$EXTERNALSYM NELOG_NetlogonFailedDomainDelta}
+
+    {
+     * Replication of the %1 Domain Object "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedGlobalGroupDelta = ERRLOG2_BASE + 30;
+  {$EXTERNALSYM NELOG_NetlogonFailedGlobalGroupDelta}
+
+    {
+     * Replication of the %1 Global Group "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedLocalGroupDelta = ERRLOG2_BASE + 31;
+  {$EXTERNALSYM NELOG_NetlogonFailedLocalGroupDelta}
+
+    {
+     * Replication of the %1 Local Group "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedUserDelta = ERRLOG2_BASE + 32;
+  {$EXTERNALSYM NELOG_NetlogonFailedUserDelta}
+
+    {
+     * Replication of the %1 User "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedPolicyDelta = ERRLOG2_BASE + 33;
+  {$EXTERNALSYM NELOG_NetlogonFailedPolicyDelta}
+
+    {
+     * Replication of the %1 Policy Object "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedTrustedDomainDelta = ERRLOG2_BASE + 34;
+  {$EXTERNALSYM NELOG_NetlogonFailedTrustedDomainDelta}
+
+    {
+     * Replication of the %1 Trusted Domain Object "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedAccountDelta = ERRLOG2_BASE + 35;
+  {$EXTERNALSYM NELOG_NetlogonFailedAccountDelta}
+
+    {
+     * Replication of the %1 Account Object "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonFailedSecretDelta = ERRLOG2_BASE + 36;
+  {$EXTERNALSYM NELOG_NetlogonFailedSecretDelta}
+
+    {
+     * Replication of the %1 Secret "%2" from primary domain controller
+     * %3 failed with the following error: %n%4
+     }
+
+  NELOG_NetlogonSystemError = ERRLOG2_BASE + 37;
+  {$EXTERNALSYM NELOG_NetlogonSystemError}
+
+    {
+    * The system returned the following unexpected error code: %n%1
+    }
+
+  NELOG_NetlogonDuplicateMachineAccounts = ERRLOG2_BASE + 38;
+  {$EXTERNALSYM NELOG_NetlogonDuplicateMachineAccounts}
+
+    {
+    * Netlogon has detected two machine accounts for server "%1".
+    * The server can be either a Windows 2000 Server that is a member of the
+    * domain or the server can be a LAN Manager server with an account in the
+    * SERVERS global group.  It cannot be both.
+    }
+
+  NELOG_NetlogonTooManyGlobalGroups = ERRLOG2_BASE + 39;
+  {$EXTERNALSYM NELOG_NetlogonTooManyGlobalGroups}
+
+    {
+    * This domain has more global groups than can be replicated to a LanMan
+    * BDC.  Either delete some of your global groups or remove the LanMan
+    * BDCs from the domain.
+    }
+
+  NELOG_NetlogonBrowserDriver = ERRLOG2_BASE + 40;
+  {$EXTERNALSYM NELOG_NetlogonBrowserDriver}
+
+    {
+    * The Browser driver returned the following error to Netlogon: %n%1
+    }
+
+  NELOG_NetlogonAddNameFailure = ERRLOG2_BASE + 41;
+  {$EXTERNALSYM NELOG_NetlogonAddNameFailure}
+
+    {
+    * Netlogon could not register the %1<1B> name for the following reason: %n%2
+    }
+
+//
+//  More Remoteboot service events.
+//
+  NELOG_RplMessages = ERRLOG2_BASE + 42;
+  {$EXTERNALSYM NELOG_RplMessages}
+
+    {
+    * Service failed to retrieve messages needed to boot remote boot clients.
+    }
+
+  NELOG_RplXnsBoot = ERRLOG2_BASE + 43;
+  {$EXTERNALSYM NELOG_RplXnsBoot}
+
+    {
+    * Service experienced a severe error and can no longer provide remote boot
+    * for 3Com 3Start remote boot clients.
+    }
+
+  NELOG_RplSystem = ERRLOG2_BASE + 44;
+  {$EXTERNALSYM NELOG_RplSystem}
+
+    {
+    * Service experienced a severe system error and will shut itself down.
+    }
+
+  NELOG_RplWkstaTimeout = ERRLOG2_BASE + 45;
+  {$EXTERNALSYM NELOG_RplWkstaTimeout}
+
+    {
+    * Client with computer name %1 failed to acknowledge receipt of the
+    * boot data.  Remote boot of this client was not completed.
+    }
+
+  NELOG_RplWkstaFileOpen = ERRLOG2_BASE + 46;
+  {$EXTERNALSYM NELOG_RplWkstaFileOpen}
+
+    {
+    * Client with computer name %1 was not booted due to an error in opening
+    * file %2.
+    }
+
+  NELOG_RplWkstaFileRead = ERRLOG2_BASE + 47;
+  {$EXTERNALSYM NELOG_RplWkstaFileRead}
+
+    {
+    * Client with computer name %1 was not booted due to an error in reading
+    * file %2.
+    }
+
+  NELOG_RplWkstaMemory = ERRLOG2_BASE + 48;
+  {$EXTERNALSYM NELOG_RplWkstaMemory}
+
+    {
+    * Client with computer name %1 was not booted due to insufficient memory
+    * at the remote boot server.
+    }
+
+  NELOG_RplWkstaFileChecksum = ERRLOG2_BASE + 49;
+  {$EXTERNALSYM NELOG_RplWkstaFileChecksum}
+
+    {
+    * Client with computer name %1 will be booted without using checksums
+    * because checksum for file %2 could not be calculated.
+    }
+
+  NELOG_RplWkstaFileLineCount = ERRLOG2_BASE + 50;
+  {$EXTERNALSYM NELOG_RplWkstaFileLineCount}
+
+    {
+    * Client with computer name %1 was not booted due to too many lines in
+    * file %2.
+    }
+
+  NELOG_RplWkstaBbcFile = ERRLOG2_BASE + 51;
+  {$EXTERNALSYM NELOG_RplWkstaBbcFile}
+
+    {
+    * Client with computer name %1 was not booted because the boot block
+    * configuration file %2 for this client does not contain boot block
+    * line and/or loader line.
+    }
+
+  NELOG_RplWkstaFileSize = ERRLOG2_BASE + 52;
+  {$EXTERNALSYM NELOG_RplWkstaFileSize}
+
+    {
+    * Client with computer name %1 was not booted due to a bad size of
+    * file %2.
+    }
+
+  NELOG_RplWkstaInternal = ERRLOG2_BASE + 53;
+  {$EXTERNALSYM NELOG_RplWkstaInternal}
+
+    {
+    * Client with computer name %1 was not booted due to remote boot
+    * service internal error.
+    }
+
+  NELOG_RplWkstaWrongVersion = ERRLOG2_BASE + 54;
+  {$EXTERNALSYM NELOG_RplWkstaWrongVersion}
+
+    {
+    * Client with computer name %1 was not booted because file %2 has an
+    * invalid boot header.
+    }
+
+  NELOG_RplWkstaNetwork = ERRLOG2_BASE + 55;
+  {$EXTERNALSYM NELOG_RplWkstaNetwork}
+
+    {
+    * Client with computer name %1 was not booted due to network error.
+    }
+
+  NELOG_RplAdapterResource = ERRLOG2_BASE + 56;
+  {$EXTERNALSYM NELOG_RplAdapterResource}
+
+    {
+    * Client with adapter id %1 was not booted due to lack of resources.
+    }
+
+  NELOG_RplFileCopy = ERRLOG2_BASE + 57;
+  {$EXTERNALSYM NELOG_RplFileCopy}
+
+    {
+    * Service experienced error copying file or directory %1.
+    }
+
+  NELOG_RplFileDelete = ERRLOG2_BASE + 58;
+  {$EXTERNALSYM NELOG_RplFileDelete}
+
+    {
+    * Service experienced error deleting file or directory %1.
+    }
+
+  NELOG_RplFilePerms = ERRLOG2_BASE + 59;
+  {$EXTERNALSYM NELOG_RplFilePerms}
+
+    {
+    * Service experienced error setting permissions on file or directory %1.
+    }
+  NELOG_RplCheckConfigs = ERRLOG2_BASE + 60;
+  {$EXTERNALSYM NELOG_RplCheckConfigs}
+
+    {
+    * Service experienced error evaluating RPL configurations.
+    }
+  NELOG_RplCreateProfiles = ERRLOG2_BASE + 61;
+  {$EXTERNALSYM NELOG_RplCreateProfiles}
+
+    {
+    * Service experienced error creating RPL profiles for all configurations.
+    }
+  NELOG_RplRegistry = ERRLOG2_BASE + 62;
+  {$EXTERNALSYM NELOG_RplRegistry}
+
+    {
+    * Service experienced error accessing registry.
+    }
+  NELOG_RplReplaceRPLDISK = ERRLOG2_BASE + 63;
+  {$EXTERNALSYM NELOG_RplReplaceRPLDISK}
+
+    {
+    * Service experienced error replacing possibly outdated RPLDISK.SYS.
+    }
+  NELOG_RplCheckSecurity = ERRLOG2_BASE + 64;
+  {$EXTERNALSYM NELOG_RplCheckSecurity}
+
+    {
+    * Service experienced error adding security accounts or setting
+    * file permissions.  These accounts are the RPLUSER local group
+    * and the user accounts for the individual RPL workstations.
+    }
+  NELOG_RplBackupDatabase = ERRLOG2_BASE + 65;
+  {$EXTERNALSYM NELOG_RplBackupDatabase}
+
+    {
+    * Service failed to back up its database.
+    }
+  NELOG_RplInitDatabase = ERRLOG2_BASE + 66;
+  {$EXTERNALSYM NELOG_RplInitDatabase}
+
+    {
+    * Service failed to initialize from its database.  The database may be
+    * missing or corrupted.  Service will attempt restoring the database
+    * from the backup.
+    }
+  NELOG_RplRestoreDatabaseFailure = ERRLOG2_BASE + 67;
+  {$EXTERNALSYM NELOG_RplRestoreDatabaseFailure}
+
+    {
+    * Service failed to restore its database from the backup.  Service
+    * will not start.
+    }
+  NELOG_RplRestoreDatabaseSuccess = ERRLOG2_BASE + 68;
+  {$EXTERNALSYM NELOG_RplRestoreDatabaseSuccess}
+
+    {
+    * Service successfully restored its database from the backup.
+    }
+  NELOG_RplInitRestoredDatabase = ERRLOG2_BASE + 69;
+  {$EXTERNALSYM NELOG_RplInitRestoredDatabase}
+
+    {
+    * Service failed to initialize from its restored database.  Service
+    * will not start.
+    }
+
+//
+// More Netlogon and RPL service events
+//
+  NELOG_NetlogonSessionTypeWrong = ERRLOG2_BASE + 70;
+  {$EXTERNALSYM NELOG_NetlogonSessionTypeWrong}
+
+    {
+     * The session setup to the Windows NT or Windows 2000 Domain Controller %1 from computer
+     * %2 using account %4 failed.  %2 is declared to be a BDC in domain %3.
+     * However, %2 tried to connect as either a DC in a trusted domain,
+     * a member workstation in domain %3, or as a server in domain %3.
+     * Use the Active Directory Users and Computers tool or Server Manager to remove the BDC account for %2.
+     }
+  NELOG_RplUpgradeDBTo40 = ERRLOG2_BASE + 71;
+  {$EXTERNALSYM NELOG_RplUpgradeDBTo40}
+
+    {
+    * The Remoteboot database was in NT 3.5 / NT 3.51 format and NT is
+    * attempting to convert it to NT 4.0 format. The JETCONV converter
+    * will write to the Application event log when it is finished.
+    }
+  NELOG_NetlogonLanmanBdcsNotAllowed = ERRLOG2_BASE + 72;
+  {$EXTERNALSYM NELOG_NetlogonLanmanBdcsNotAllowed}
+
+    {
+     * Global group SERVERS exists in domain %1 and has members.
+     * This group defines Lan Manager BDCs in the domain.
+     * Lan Manager BDCs are not permitted in NT domains.
+     }
+  NELOG_NetlogonNoDynamicDns = ERRLOG2_BASE + 73;
+  {$EXTERNALSYM NELOG_NetlogonNoDynamicDns}
+
+    {
+     * The following DNS server that is authoritative for the DNS domain controller
+     * locator records of this domain controller does not support dynamic DNS updates:
+     *
+     * %n%nDNS server IP address: %1
+     * %nReturned Response Code (RCODE): %2
+     * %nReturned Status Code: %3
+     *
+     * %n%nUSER ACTION
+     *
+     * %nConfigure the DNS server to allow dynamic DNS updates or manually add the DNS
+     * records from the file '%SystemRoot%\System32\Config\Netlogon.dns' to the DNS database.
+     }
+
+  NELOG_NetlogonDynamicDnsRegisterFailure = ERRLOG2_BASE + 74;
+  {$EXTERNALSYM NELOG_NetlogonDynamicDnsRegisterFailure}
+
+    {
+      *
+      * The dynamic registration of the DNS record '%1' failed on the following DNS server:
+      *
+      * %n%nDNS server IP address: %3
+      * %nReturned Response Code (RCODE): %4
+      * %nReturned Status Code: %5
+      *
+      * %n%nFor computers and users to locate this domain controller, this record must be
+      * registered in DNS.
+      *
+      * %n%nUSER ACTION
+      *
+      * %nDetermine what might have caused this failure, resolve the problem, and initiate
+      * registration of the DNS records by the domain controller. To determine what might
+      * have caused this failure, run DCDiag.exe. You can find this program on the Windows
+      * Server 2003 installation CD in Support\Tools\support.cab. To learn more about
+      * DCDiag.exe, see Help and Support Center. To initiate registration of the DNS records by
+      * this domain controller, run 'nltest.exe /dsregdns' from the command prompt on the domain
+      * controller or restart Net Logon service. Nltest.exe is available in the Microsoft Windows
+      * Server Resource Kit CD. %n  Or, you can manually add this record to DNS, but it is not
+      * recommended.
+      *
+      * %n%nADDITIONAL DATA
+      * %nError Value: %2
+      *
+     }
+
+  NELOG_NetlogonDynamicDnsDeregisterFailure = ERRLOG2_BASE + 75;
+  {$EXTERNALSYM NELOG_NetlogonDynamicDnsDeregisterFailure}
+
+    {
+      * The dynamic deletion of the DNS record '%1' failed on the following DNS server:
+      *
+      * %n%nDNS server IP address: %3
+      * %nReturned Response Code (RCODE): %4
+      * %nReturned Status Code: %5
+      *
+      * %n%nUSER ACTION
+      *
+      * %nTo prevent remote computers from connecting unnecessarily to the domain controller,
+      * delete the record manually or troubleshoot the failure to dynamically delete the
+      * record. To learn more about debugging DNS, see Help and Support Center.
+      *
+      * %n%nADDITIONAL DATA
+      * %nError Value: %2
+     }
+
+  NELOG_NetlogonFailedFileCreate = ERRLOG2_BASE + 76;
+  {$EXTERNALSYM NELOG_NetlogonFailedFileCreate}
+
+    {
+     * Failed to create/open file %1 with the following error: %n%2
+     }
+
+  NELOG_NetlogonGetSubnetToSite = ERRLOG2_BASE + 77;
+  {$EXTERNALSYM NELOG_NetlogonGetSubnetToSite}
+
+    {
+     * Netlogon got the following error while trying to get the subnet to site
+     * mapping information from the DS: %n%1
+     }
+
+  NELOG_NetlogonNoSiteForClient = ERRLOG2_BASE + 78;
+  {$EXTERNALSYM NELOG_NetlogonNoSiteForClient}
+
+   {
+    * '%1' tried to determine its site by looking up its IP address ('%2')
+    * in the Configuration\Sites\Subnets container in the DS.  No subnet matched
+    * the IP address.  Consider adding a subnet object for this IP address.
+    }
+
+  NELOG_NetlogonBadSiteName = ERRLOG2_BASE + 79;
+  {$EXTERNALSYM NELOG_NetlogonBadSiteName}
+
+    {
+     * The site name for this computer is '%1'.  That site name is not a valid
+     * site name.  A site name must be a valid DNS label.
+     * Rename the site to be a valid name.
+     }
+
+  NELOG_NetlogonBadSubnetName = ERRLOG2_BASE + 80;
+  {$EXTERNALSYM NELOG_NetlogonBadSubnetName}
+
+    {
+     * The subnet object '%1' appears in the Configuration\Sites\Subnets
+     * container in the DS.  The name is not syntactically valid.  The valid
+     * syntax is xx.xx.xx.xx/yy where xx.xx.xx.xx is a valid IP subnet number
+     * and yy is the number of bits in the subnet mask.
+     *
+     * Correct the name of the subnet object.
+     }
+
+  NELOG_NetlogonDynamicDnsServerFailure = ERRLOG2_BASE + 81;
+  {$EXTERNALSYM NELOG_NetlogonDynamicDnsServerFailure}
+
+    {
+     * Dynamic registration or deletion of one or more DNS records associated with DNS
+     * domain '%1' failed.  These records are used by other computers to locate this
+     * server as a domain controller (if the specified domain is an Active Directory
+     * domain) or as an LDAP server (if the specified domain is an application partition).
+     *
+     * %n%nPossible causes of failure include:
+     *
+     * %n- TCP/IP properties of the network connections of this computer contain wrong IP address(es) of the preferred and alternate DNS servers
+     * %n- Specified preferred and alternate DNS servers are not running
+     * %n- DNS server(s) primary for the records to be registered is not running
+     * %n- Preferred or alternate DNS servers are configured with wrong root hints
+     * %n- Parent DNS zone contains incorrect delegation to the child zone authoritative for the DNS records that failed registration
+     *
+     * %n%nUSER ACTION
+     *
+     * %nFix possible misconfiguration(s) specified above and initiate registration or deletion of
+     * the DNS records by running 'nltest.exe /dsregdns' from the command prompt or by restarting
+     * Net Logon service. Nltest.exe is available in the Microsoft Windows Server Resource Kit CD.
+     }
+
+  NELOG_NetlogonDynamicDnsFailure = ERRLOG2_BASE + 82;
+  {$EXTERNALSYM NELOG_NetlogonDynamicDnsFailure}
+
+    {
+     * Dynamic registration or deregistration of one or more DNS records failed with the following error: %n%1
+     }
+
+  NELOG_NetlogonRpcCallCancelled = ERRLOG2_BASE + 83;
+  {$EXTERNALSYM NELOG_NetlogonRpcCallCancelled}
+
+    {
+     * The session setup to the Windows NT or Windows 2000 Domain Controller %1 for the domain %2
+     * is not responsive.  The current RPC call from Netlogon on \\%3 to %1 has been cancelled.
+     }
+
+  NELOG_NetlogonDcSiteCovered = ERRLOG2_BASE + 84;
+  {$EXTERNALSYM NELOG_NetlogonDcSiteCovered}
+
+    {
+     * Site '%2' does not have any Domain Controllers for domain '%3'.
+     * Domain Controllers in site '%1' have been automatically
+     * selected to cover site '%2' for domain '%3' based on configured
+     * Directory Server replication costs.
+     }
+
+  NELOG_NetlogonDcSiteNotCovered = ERRLOG2_BASE + 85;
+  {$EXTERNALSYM NELOG_NetlogonDcSiteNotCovered}
+
+    {
+     * This Domain Controller no longer automatically covers site '%1' for domain '%2'.
+     }
+
+  NELOG_NetlogonGcSiteCovered = ERRLOG2_BASE + 86;
+  {$EXTERNALSYM NELOG_NetlogonGcSiteCovered}
+
+    {
+     * Site '%2' does not have any Global Catalog servers for forest '%3'.
+     * Global Catalog servers in site '%1' have been automatically
+     * selected to cover site '%2' for forest '%3' based on configured
+     * Directory Server replication costs.
+     }
+
+  NELOG_NetlogonGcSiteNotCovered = ERRLOG2_BASE + 87;
+  {$EXTERNALSYM NELOG_NetlogonGcSiteNotCovered}
+
+    {
+     * This Global Catalog server no longer automatically covers site '%1' for forest '%2'.
+     }
+
+  NELOG_NetlogonFailedSpnUpdate = ERRLOG2_BASE + 88;
+  {$EXTERNALSYM NELOG_NetlogonFailedSpnUpdate}
+
+    {
+     * Attempt to update HOST Service Principal Names (SPNs) of the computer
+     * object in Active Directory failed. The updated values were '%1' and '%2'.
+     * The following error occurred: %n%3
+     }
+
+  NELOG_NetlogonFailedDnsHostNameUpdate = ERRLOG2_BASE + 89;
+  {$EXTERNALSYM NELOG_NetlogonFailedDnsHostNameUpdate}
+
+    {
+     * Attempt to update DNS Host Name of the computer object
+     * in Active Directory failed. The updated value was '%1'.
+     * The following error occurred: %n%2
+     }
+
+  NELOG_NetlogonAuthNoUplevelDomainController = ERRLOG2_BASE + 90;
+  {$EXTERNALSYM NELOG_NetlogonAuthNoUplevelDomainController}
+
+    {
+     * No suitable Domain Controller is available for domain %1.
+     * An NT4 or older domain controller is available but it cannot
+     * be used for authentication purposes in the Windows 2000 or newer
+     * domain that this computer is a member of.
+     * The following error occurred:%n%2
+     }
+
+  NELOG_NetlogonAuthDomainDowngraded = ERRLOG2_BASE + 91;
+  {$EXTERNALSYM NELOG_NetlogonAuthDomainDowngraded}
+
+    {
+     * The domain of this computer, %1 has been downgraded from Windows 2000
+     * or newer to Windows NT4 or older. The computer cannot function properly
+     * in this case for authentication purposes. This computer needs to rejoin
+     * the domain.
+     * The following error occurred:%n%2
+     }
+
+  NELOG_NetlogonNdncSiteCovered = ERRLOG2_BASE + 92;
+  {$EXTERNALSYM NELOG_NetlogonNdncSiteCovered}
+
+    {
+     * Site '%2' does not have any LDAP servers for non-domain NC '%3'.
+     * LDAP servers in site '%1' have been automatically selected to
+     * cover site '%2' for non-domain NC '%3' based on configured
+     * Directory Server replication costs.
+     }
+
+  NELOG_NetlogonNdncSiteNotCovered = ERRLOG2_BASE + 93;
+  {$EXTERNALSYM NELOG_NetlogonNdncSiteNotCovered}
+
+    {
+     * This LDAP server no longer automatically covers site '%1' for non-domain NC '%2'.
+     }
+
+  NELOG_NetlogonDcOldSiteCovered = ERRLOG2_BASE + 94;
+  {$EXTERNALSYM NELOG_NetlogonDcOldSiteCovered}
+
+    {
+     * Site '%2' is no longer manually configured in the registry as
+     * covered by this Domain Controller for domain '%3'. As a result,
+     * site '%2' does not have any Domain Controllers for domain '%3'.
+     * Domain Controllers in site '%1' have been automatically
+     * selected to cover site '%2' for domain '%3' based on configured
+     * Directory Server replication costs.
+     }
+
+  NELOG_NetlogonDcSiteNotCoveredAuto = ERRLOG2_BASE + 95;
+  {$EXTERNALSYM NELOG_NetlogonDcSiteNotCoveredAuto}
+
+    {
+     * This Domain Controller no longer automatically covers site '%1' for domain '%2'.
+     * However, site '%1' is still (manually) covered by this Domain Controller for
+     * domain '%2' since this site has been manually configured in the registry.
+     }
+
+  NELOG_NetlogonGcOldSiteCovered = ERRLOG2_BASE + 96;
+  {$EXTERNALSYM NELOG_NetlogonGcOldSiteCovered}
+
+    {
+     * Site '%2' is no longer manually configured in the registry as
+     * covered by this Global Catalog server for forest '%3'. As a result,
+     * site '%2' does not have any Global Catalog servers for forest '%3'.
+     * Global Catalog servers in site '%1' have been automatically
+     * selected to cover site '%2' for forest '%3' based on configured
+     * Directory Server replication costs.
+     }
+
+  NELOG_NetlogonGcSiteNotCoveredAuto = ERRLOG2_BASE + 97;
+  {$EXTERNALSYM NELOG_NetlogonGcSiteNotCoveredAuto}
+
+    {
+     * This Global Catalog server no longer automatically covers site '%1' for forest '%2'.
+     * However, site '%1' is still (manually) covered by this Global catalog for
+     * forest '%2' since this site has been manually configured in the registry.
+     }
+
+  NELOG_NetlogonNdncOldSiteCovered = ERRLOG2_BASE + 98;
+  {$EXTERNALSYM NELOG_NetlogonNdncOldSiteCovered}
+
+    {
+     * Site '%2' is no longer manually configured in the registry as
+     * covered by this LDAP server for non-domain NC '%3'. As a result,
+     * site '%2' does not have any LDAP servers for non-domain NC '%3'.
+     * LDAP servers in site '%1' have been automatically
+     * selected to cover site '%2' for non-domain NC '%3' based on
+     * configured Directory Server replication costs.
+     }
+
+  NELOG_NetlogonNdncSiteNotCoveredAuto = ERRLOG2_BASE + 99;
+  {$EXTERNALSYM NELOG_NetlogonNdncSiteNotCoveredAuto}
+
+    {
+     * This LDAP server no longer automatically covers site '%1' for non-domain NC '%2'.
+     * However, site '%1' is still (manually) covered by this LDAP server for
+     * non-domain NC '%2' since this site has been manually configured in the registry.
+     }
+
+  NELOG_NetlogonSpnMultipleSamAccountNames = ERRLOG2_BASE + 100;
+  {$EXTERNALSYM NELOG_NetlogonSpnMultipleSamAccountNames}
+
+    {
+     * Attempt to update DnsHostName and HOST Service Principal Name (SPN) attributes
+     * of the computer object in Active Directory failed because the Domain Controller
+     * '%1' had more than one account with the name '%2' corresponding to this computer.
+     * Not having SPNs registered may result in authentication failures for this computer.
+     * Contact your domain administrator who may need to manually resolve the account name
+     * collision.
+     }
+
+  NELOG_NetlogonSpnCrackNamesFailure = ERRLOG2_BASE + 101;
+  {$EXTERNALSYM NELOG_NetlogonSpnCrackNamesFailure}
+
+    {
+     * Attempt to update DnsHostName and HOST Service Principal Name (SPN) attributes
+     * of the computer object in Active Directory failed because this computer account
+     * name, '%2' could not be mapped to the computer object on Domain Controller '%1'.
+     * Not having SPNs registered may result in authentication failures for this computer.
+     * Contact your domain administrator. The following technical information may be
+     * useful for the resolution of this failure:%n
+     * DsCrackNames status = 0x%3, crack error = 0x%4.
+     }
+
+  NELOG_NetlogonNoAddressToSiteMapping = ERRLOG2_BASE + 102;
+  {$EXTERNALSYM NELOG_NetlogonNoAddressToSiteMapping}
+
+    {
+     * None of the IP addresses (%2) of this Domain Controller map to the configured site '%1'.
+     * While this may be a temporary situation due to IP address changes, it is generally
+     * recommended that the IP address of the Domain Controller (accessible to machines in
+     * its domain) maps to the Site which it services. If the above list of IP addresses is
+     * stable, consider moving this server to a site (or create one if it does not already
+     * exist) such that the above IP address maps to the selected site. This may require the
+     * creation of a new subnet object (whose range includes the above IP address) which maps
+     * to the selected site object.
+     }
+
+  NELOG_NetlogonInvalidGenericParameterValue = ERRLOG2_BASE + 103;
+  {$EXTERNALSYM NELOG_NetlogonInvalidGenericParameterValue}
+
+    {
+     * The following error occurred while reading a parameter '%2' in the
+     * Netlogon %1 registry section:%n%3
+     }
+
+  NELOG_NetlogonInvalidDwordParameterValue = ERRLOG2_BASE + 104;
+  {$EXTERNALSYM NELOG_NetlogonInvalidDwordParameterValue}
+
+    {
+     * The Netlogon %1 registry key contains an invalid value 0x%2 for parameter '%3'.
+     * The minimum and maximum values allowed for this parameter are 0x%4 and 0x%5, respectively.
+     * The value of 0x%6 has been assigned to this parameter.
+     }
+
+  NELOG_NetlogonServerAuthFailedNoAccount = ERRLOG2_BASE + 105;
+  {$EXTERNALSYM NELOG_NetlogonServerAuthFailedNoAccount}
+
+    {
+     * The session setup from the computer %1 failed to authenticate.
+     * The following error occurred: %n%2
+     }
+
+  NELOG_NetlogonNoDynamicDnsManual = ERRLOG2_BASE + 106;
+  {$EXTERNALSYM NELOG_NetlogonNoDynamicDnsManual}
+
+    (*
+     * Dynamic DNS updates have been manually disabled on this domain controller.
+     *
+     * %n%nUSER ACTION
+     *
+     * %nReconfigure this domain controller to use dynamic DNS updates or manually add the DNS
+     * records from the file '%SystemRoot%\System32\Config\Netlogon.dns' to the DNS database.
+     *)
+
+  NELOG_NetlogonNoSiteForClients = ERRLOG2_BASE + 107;
+  {$EXTERNALSYM NELOG_NetlogonNoSiteForClients}
+
+    {
+     * During the past %1 hours there have been %2 connections to this Domain
+     * Controller from client machines whose IP addresses don't map to any of
+     * the existing sites in the enterprise. Those clients, therefore, have
+     * undefined sites and may connect to any Domain Controller including
+     * those that are in far distant locations from the clients. A client's site
+     * is determined by the mapping of its subnet to one of the existing sites.
+     * To move the above clients to one of the sites, please consider creating
+     * subnet object(s) covering the above IP addresses with mapping to one of the
+     * existing sites.  The names and IP addresses of the clients in question have
+     * been logged on this computer in the following log file
+     * '%SystemRoot%\debug\netlogon.log' and, potentially, in the log file
+     * '%SystemRoot%\debug\netlogon.bak' created if the former log becomes full.
+     * The log(s) may contain additional unrelated debugging information. To filter
+     * out the needed information, please search for lines which contain text
+     * 'NO_CLIENT_SITE:'. The first word after this string is the client name and
+     * the second word is the client IP address. The maximum size of the log(s) is
+     * controlled by the following registry DWORD value
+     * 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\LogFileMaxSize';
+     * the default is %3 bytes.  The current maximum size is %4 bytes.  To set a
+     * different maximum size, create the above registry value and set the desired
+     * maximum size in bytes.
+     }
+
+  NELOG_NetlogonDnsDeregAborted               = ERRLOG2_BASE + 108;
+  {$EXTERNALSYM NELOG_NetlogonDnsDeregAborted}
+
+    (*
+     * The deregistration of some DNS domain controller locator records was aborted
+     * at the time of this domain controller demotion because the DNS deregistrations
+     * took too long.
+     *
+     * %n%nUSER ACTION
+     *
+     * %nManually delete the DNS records listed in the file
+     * '%SystemRoot%\System32\Config\Netlogon.dns' from the DNS database.
+     *)
+
+  NELOG_NetlogonRpcPortRequestFailure         = ERRLOG2_BASE + 109;
+  {$EXTERNALSYM NELOG_NetlogonRpcPortRequestFailure}
+
+    (*
+     * The NetLogon service on this domain controller has been configured to use port %1
+     * for incoming RPC connections over TCP/IP from remote machines. However, the
+     * following error occurred when Netlogon attempted to register this port with the RPC
+     * endpoint mapper service: %n%2 %nThis will prevent the NetLogon service on remote
+     * machines from connecting to this domain controller over TCP/IP that may result in
+     * authentication problems.
+     *
+     * %n%nUSER ACTION
+     *
+     * %nThe specified port is configured via the Group Policy or via a registry value 'DcTcpipPort'
+     * under the 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters'
+     * registry key; the value configured through the Group Policy takes precedence. If the
+     * port specified is in error, reset it to a correct value. You can also remove this
+     * configuration for the port in which case the port will be assigned dynamically by
+     * the endpoint mapper at the time the NetLogon service on remote machines makes RPC connections
+     * to this domain controller. After the misconfiguration is corrected, restart the NetLogon
+     * service on this machine and verify that this event log no longer appears.
+     *)
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetErrorLogClear: Pointer;
+
+function NetErrorLogClear;
+begin
+  GetProcedureAddress(_NetErrorLogClear, netapi32, 'NetErrorLogClear');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetErrorLogClear]
+  end;
+end;
+
+var
+  _NetErrorLogRead: Pointer;
+
+function NetErrorLogRead;
+begin
+  GetProcedureAddress(_NetErrorLogRead, netapi32, 'NetErrorLogRead');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetErrorLogRead]
+  end;
+end;
+
+var
+  _NetErrorLogWrite: Pointer;
+
+function NetErrorLogWrite;
+begin
+  GetProcedureAddress(_NetErrorLogWrite, netapi32, 'NetErrorLogWrite');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetErrorLogWrite]
+  end;
+end;
+
+{$ELSE}
+
+function NetErrorLogClear; external netapi32 name 'NetErrorLogClear';
+function NetErrorLogRead; external netapi32 name 'NetErrorLogRead';
+function NetErrorLogWrite; external netapi32 name 'NetErrorLogWrite';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 366 - 0
packages/extra/winunits/jwalmjoin.pas

@@ -0,0 +1,366 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Join API interface Unit for Object Pascal                        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmjoin.h, released November 2001. The original Pascal  }
+{ code is: LmJoin.pas, released Februari 2002. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmJoin;
+
+{$WEAKPACKAGEUNIT}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmjoin.h"'}
+{$HPPEMIT ''}
+
+//
+// Types of name that can be validated
+//
+
+type
+  _NETSETUP_NAME_TYPE = (
+    NetSetupUnknown,
+    NetSetupMachine,
+    NetSetupWorkgroup,
+    NetSetupDomain,
+    NetSetupNonExistentDomain
+    {$IFDEF WIN2000_UP}
+    , NetSetupDnsMachine
+    {$ENDIF WIN2000_UP}
+    );
+  {$EXTERNALSYM _NETSETUP_NAME_TYPE}
+  NETSETUP_NAME_TYPE = _NETSETUP_NAME_TYPE;
+  {$EXTERNALSYM NETSETUP_NAME_TYPE}
+  PNETSETUP_NAME_TYPE = ^NETSETUP_NAME_TYPE;
+  {$EXTERNALSYM PNETSETUP_NAME_TYPE}
+  TNetSetupNameType = NETSETUP_NAME_TYPE;
+  PNetSetupNameType = PNETSETUP_NAME_TYPE;
+
+//
+// Status of a workstation
+//
+
+  _NETSETUP_JOIN_STATUS = (
+    NetSetupUnknownStatus,
+    NetSetupUnjoined,
+    NetSetupWorkgroupName,
+    NetSetupDomainName);
+  {$EXTERNALSYM _NETSETUP_JOIN_STATUS}
+  NETSETUP_JOIN_STATUS = _NETSETUP_JOIN_STATUS;
+  {$EXTERNALSYM NETSETUP_JOIN_STATUS}
+  PNETSETUP_JOIN_STATUS = ^NETSETUP_JOIN_STATUS;
+  {$EXTERNALSYM PNETSETUP_JOIN_STATUS}
+  TNetSetupJoinStatus = NETSETUP_JOIN_STATUS;
+  PNetSetupJoinStatus = PNETSETUP_JOIN_STATUS;
+
+//
+// Flags to determine the behavior of the join/unjoin APIs
+//
+
+const
+  NETSETUP_JOIN_DOMAIN   = $00000001; // If not present, workgroup is joined
+  {$EXTERNALSYM NETSETUP_JOIN_DOMAIN}
+  NETSETUP_ACCT_CREATE   = $00000002; // Do the server side account creation/rename
+  {$EXTERNALSYM NETSETUP_ACCT_CREATE}
+  NETSETUP_ACCT_DELETE   = $00000004; // Delete the account when a domain is left
+  {$EXTERNALSYM NETSETUP_ACCT_DELETE}
+  NETSETUP_WIN9X_UPGRADE = $00000010; // Invoked during upgrade of Windows 9x to
+  {$EXTERNALSYM NETSETUP_WIN9X_UPGRADE}
+                                                // Windows NT
+  NETSETUP_DOMAIN_JOIN_IF_JOINED = $00000020; // Allow the client to join a new domain
+  {$EXTERNALSYM NETSETUP_DOMAIN_JOIN_IF_JOINED}
+                                                // even if it is already joined to a domain
+  NETSETUP_JOIN_UNSECURE      = $00000040; // Performs an unsecure join
+  {$EXTERNALSYM NETSETUP_JOIN_UNSECURE}
+  NETSETUP_MACHINE_PWD_PASSED = $00000080; // Indicates that the machine (not user) password
+  {$EXTERNALSYM NETSETUP_MACHINE_PWD_PASSED}
+                                                //  is passed. Valid only for unsecure joins
+  NETSETUP_DEFER_SPN_SET = $00000100; // Specifies that writting SPN and DnsHostName
+  {$EXTERNALSYM NETSETUP_DEFER_SPN_SET}
+                                                //  attributes on the computer object should be
+                                                //  defered until rename that will follow join
+
+  NETSETUP_INSTALL_INVOCATION = $00040000; // The APIs were invoked during install
+  {$EXTERNALSYM NETSETUP_INSTALL_INVOCATION}
+
+  NETSETUP_IGNORE_UNSUPPORTED_FLAGS = $10000000;  // If this bit is set, unrecognized flags
+                                                       //  will be ignored by the NetJoin API and
+                                                       //  the API will behave as if the flags
+                                                       //  were not set.
+  {$EXTERNALSYM NETSETUP_IGNORE_UNSUPPORTED_FLAGS}
+
+  NETSETUP_VALID_UNJOIN_FLAGS = NETSETUP_ACCT_DELETE or NETSETUP_IGNORE_UNSUPPORTED_FLAGS;
+  {$EXTERNALSYM NETSETUP_VALID_UNJOIN_FLAGS}
+
+//
+// 0x80000000 is reserved for internal use only
+//
+
+//
+// Joins a machine to the domain.
+//
+
+function NetJoinDomain(lpServer, lpDomain, lpAccountOU, lpAccount, lpPassword: LPCWSTR; fJoinOptions: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetJoinDomain}
+
+function NetUnjoinDomain(lpServer, lpAccount, lpPassword: LPCWSTR; fUnjoinOptions: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUnjoinDomain}
+
+function NetRenameMachineInDomain(lpServer, lpNewMachineName, lpAccount, lpPassword: LPCWSTR; fRenameOptions: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetRenameMachineInDomain}
+
+//
+// Determine the validity of a name
+//
+
+function NetValidateName(lpServer, lpName, lpAccount, lpPassword: LPCWSTR; NameType: NETSETUP_NAME_TYPE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetValidateName}
+
+//
+// Determines whether a workstation is joined to a domain or not
+//
+
+function NetGetJoinInformation(lpServer: LPCWSTR; var lpNameBuffer: LPWSTR; BufferType: PNETSETUP_JOIN_STATUS): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGetJoinInformation}
+
+//
+// Determines the list of OUs that the client can create a machine account in
+//
+
+function NetGetJoinableOUs(lpServer, lpDomain, lpAccount, lpPassword: LPCWSTR; OUCount: LPDWORD; var OUs: LPLPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetGetJoinableOUs}
+
+//
+// Computer rename preparation APIs
+//
+
+const
+  NET_IGNORE_UNSUPPORTED_FLAGS = $01;
+  {$EXTERNALSYM NET_IGNORE_UNSUPPORTED_FLAGS}
+
+function NetAddAlternateComputerName(Server, AlternateName, DomainAccount, DomainAccountPassword: LPCWSTR; Reserved: ULONG): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetAddAlternateComputerName}
+
+function NetRemoveAlternateComputerName(Server, AlternateName, DomainAccount, DomainAccountPassword: LPCWSTR; Reserved: ULONG): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetRemoveAlternateComputerName}
+
+function NetSetPrimaryComputerName(Server, PrimaryName, DomainAccount, DomainAccountPassword: LPCWSTR; Reserved: ULONG): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetSetPrimaryComputerName}
+
+//
+// The following enumeration must be kept
+// in sync with COMPUTER_NAME_TYPE defined
+// in winbase.h
+//
+
+type
+  _NET_COMPUTER_NAME_TYPE = (
+    NetPrimaryComputerName,
+    NetAlternateComputerNames,
+    NetAllComputerNames,
+    NetComputerNameTypeMax);
+  {$EXTERNALSYM _NET_COMPUTER_NAME_TYPE}
+  NET_COMPUTER_NAME_TYPE = _NET_COMPUTER_NAME_TYPE;
+  {$EXTERNALSYM NET_COMPUTER_NAME_TYPE}
+  PNET_COMPUTER_NAME_TYPE = ^NET_COMPUTER_NAME_TYPE;
+  {$EXTERNALSYM PNET_COMPUTER_NAME_TYPE}
+  TNetComputerNameType = NET_COMPUTER_NAME_TYPE;
+  PNetComputerNameType = PNET_COMPUTER_NAME_TYPE;
+
+function NetEnumerateComputerNames(Server: LPCWSTR; NameType: NET_COMPUTER_NAME_TYPE; Reserved: ULONG; EntryCount: PDWORD; var ComputerNames: LPLPWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetEnumerateComputerNames}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetJoinDomain: Pointer;
+
+function NetJoinDomain;
+begin
+  GetProcedureAddress(_NetJoinDomain, netapi32, 'NetJoinDomain');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetJoinDomain]
+  end;
+end;
+
+var
+  _NetUnjoinDomain: Pointer;
+
+function NetUnjoinDomain;
+begin
+  GetProcedureAddress(_NetUnjoinDomain, netapi32, 'NetUnjoinDomain');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUnjoinDomain]
+  end;
+end;
+
+var
+  _NetRenameMachineInDomain: Pointer;
+
+function NetRenameMachineInDomain;
+begin
+  GetProcedureAddress(_NetRenameMachineInDomain, netapi32, 'NetRenameMachineInDomain');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetRenameMachineInDomain]
+  end;
+end;
+
+var
+  _NetValidateName: Pointer;
+
+function NetValidateName;
+begin
+  GetProcedureAddress(_NetValidateName, netapi32, 'NetValidateName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetValidateName]
+  end;
+end;
+
+var
+  _NetGetJoinInformation: Pointer;
+
+function NetGetJoinInformation;
+begin
+  GetProcedureAddress(_NetGetJoinInformation, netapi32, 'NetGetJoinInformation');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGetJoinInformation]
+  end;
+end;
+
+var
+  _NetGetJoinableOUs: Pointer;
+
+function NetGetJoinableOUs;
+begin
+  GetProcedureAddress(_NetGetJoinableOUs, netapi32, 'NetGetJoinableOUs');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetGetJoinableOUs]
+  end;
+end;
+
+var
+  _NetAddAlternateComputerName: Pointer;
+
+function NetAddAlternateComputerName;
+begin
+  GetProcedureAddress(_NetAddAlternateComputerName, netapi32, 'NetAddAlternateComputerName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetAddAlternateComputerName]
+  end;
+end;
+
+var
+  _NetRemoveAlternateComputerName: Pointer;
+
+function NetRemoveAlternateComputerName;
+begin
+  GetProcedureAddress(_NetRemoveAlternateComputerName, netapi32, 'NetRemoveAlternateComputerName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetRemoveAlternateComputerName]
+  end;
+end;
+
+var
+  _NetSetPrimaryComputerName: Pointer;
+
+function NetSetPrimaryComputerName;
+begin
+  GetProcedureAddress(_NetSetPrimaryComputerName, netapi32, 'NetSetPrimaryComputerName');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetSetPrimaryComputerName]
+  end;
+end;
+
+var
+  _NetEnumerateComputerNames: Pointer;
+
+function NetEnumerateComputerNames;
+begin
+  GetProcedureAddress(_NetEnumerateComputerNames, netapi32, 'NetEnumerateComputerNames');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetEnumerateComputerNames]
+  end;
+end;
+
+{$ELSE}
+
+function NetJoinDomain; external netapi32 name 'NetJoinDomain';
+function NetUnjoinDomain; external netapi32 name 'NetUnjoinDomain';
+function NetRenameMachineInDomain; external netapi32 name 'NetRenameMachineInDomain';
+function NetValidateName; external netapi32 name 'NetValidateName';
+function NetGetJoinInformation; external netapi32 name 'NetGetJoinInformation';
+function NetGetJoinableOUs; external netapi32 name 'NetGetJoinableOUs';
+function NetAddAlternateComputerName; external netapi32 name 'NetAddAlternateComputerName';
+function NetRemoveAlternateComputerName; external netapi32 name 'NetRemoveAlternateComputerName';
+function NetSetPrimaryComputerName; external netapi32 name 'NetSetPrimaryComputerName';
+function NetEnumerateComputerNames; external netapi32 name 'NetEnumerateComputerNames';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 207 - 0
packages/extra/winunits/jwalmmsg.pas

@@ -0,0 +1,207 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Messages API interface Unit for Object Pascal                    }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmmsg.h, released November 2001. The original Pascal   } 
+{ code is: LmMsg.pas, released Februari 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmMsg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmmsg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes
+//
+
+function NetMessageNameAdd(servername, msgname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetMessageNameAdd}
+
+function NetMessageNameEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries: LPDWORD; resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetMessageNameEnum}
+
+function NetMessageNameGetInfo(servername, msgname: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetMessageNameGetInfo}
+
+function NetMessageNameDel(servername, msgname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetMessageNameDel}
+
+function NetMessageBufferSend(servername, msgname, fromname: LPCWSTR; buf: LPBYTE; buflen: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetMessageBufferSend}
+
+//
+//  Data Structures
+//
+
+type
+  _MSG_INFO_0 = record
+    msgi0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _MSG_INFO_0}
+  MSG_INFO_0 = _MSG_INFO_0;
+  {$EXTERNALSYM MSG_INFO_0}
+  PMSG_INFO_0 = ^MSG_INFO_0;
+  {$EXTERNALSYM PMSG_INFO_0}
+  LPMSG_INFO_0 = ^MSG_INFO_0;
+  {$EXTERNALSYM LPMSG_INFO_0}
+  TMsgInfo0 = MSG_INFO_0;
+  PMsgInfo0 = PMSG_INFO_0;
+
+  _MSG_INFO_1 = record
+    msgi1_name: LPWSTR;
+    msgi1_forward_flag: DWORD;
+    msgi1_forward: LPWSTR;
+  end;
+  {$EXTERNALSYM _MSG_INFO_1}
+  MSG_INFO_1 = _MSG_INFO_1;
+  {$EXTERNALSYM MSG_INFO_1}
+  PMSG_INFO_1 = ^MSG_INFO_1;
+  {$EXTERNALSYM PMSG_INFO_1}
+  LPMSG_INFO_1 = ^MSG_INFO_1;
+  {$EXTERNALSYM LPMSG_INFO_1}
+  TMsgInfo1 = MSG_INFO_1;
+  PMsgInfo1 = PMSG_INFO_1;
+
+//
+// Special Values and Constants
+//
+
+//
+// Values for msgi1_forward_flag.
+//
+
+const
+  MSGNAME_NOT_FORWARDED  = 0;      // Name not forwarded
+  {$EXTERNALSYM MSGNAME_NOT_FORWARDED}
+  MSGNAME_FORWARDED_TO   = $04;    // Name forward to remote station
+  {$EXTERNALSYM MSGNAME_FORWARDED_TO}
+  MSGNAME_FORWARDED_FROM = $10;    // Name forwarded from remote station
+  {$EXTERNALSYM MSGNAME_FORWARDED_FROM}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetMessageNameAdd: Pointer;
+
+function NetMessageNameAdd;
+begin
+  GetProcedureAddress(_NetMessageNameAdd, netapi32, 'NetMessageNameAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetMessageNameAdd]
+  end;
+end;
+
+var
+  _NetMessageNameEnum: Pointer;
+
+function NetMessageNameEnum;
+begin
+  GetProcedureAddress(_NetMessageNameEnum, netapi32, 'NetMessageNameEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetMessageNameEnum]
+  end;
+end;
+
+var
+  _NetMessageNameGetInfo: Pointer;
+
+function NetMessageNameGetInfo;
+begin
+  GetProcedureAddress(_NetMessageNameGetInfo, netapi32, 'NetMessageNameGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetMessageNameGetInfo]
+  end;
+end;
+
+var
+  _NetMessageNameDel: Pointer;
+
+function NetMessageNameDel;
+begin
+  GetProcedureAddress(_NetMessageNameDel, netapi32, 'NetMessageNameDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetMessageNameDel]
+  end;
+end;
+
+var
+  _NetMessageBufferSend: Pointer;
+
+function NetMessageBufferSend;
+begin
+  GetProcedureAddress(_NetMessageBufferSend, netapi32, 'NetMessageBufferSend');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetMessageBufferSend]
+  end;
+end;
+
+{$ELSE}
+
+function NetMessageNameAdd; external netapi32 name 'NetMessageNameAdd';
+function NetMessageNameEnum; external netapi32 name 'NetMessageNameEnum';
+function NetMessageNameGetInfo; external netapi32 name 'NetMessageNameGetInfo';
+function NetMessageNameDel; external netapi32 name 'NetMessageNameDel';
+function NetMessageBufferSend; external netapi32 name 'NetMessageBufferSend';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 201 - 0
packages/extra/winunits/jwalmremutl.pas

@@ -0,0 +1,201 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Remote API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmremutl.h, released November 2001. The original Pascal}
+{ code is: LmRemUtl.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmRemUtl;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmremutl.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Type Definitions
+//
+
+type
+  {$IFDEF DESC_CHAR_UNICODE}
+  DESC_CHAR = WCHAR;
+  {$EXTERNALSYM DESC_CHAR}
+  {$ELSE}
+  DESC_CHAR = Char;
+  {$EXTERNALSYM DESC_CHAR}
+  {$ENDIF DESC_CHAR_UNICODE}
+  TDescChar = DESC_CHAR;
+
+  LPDESC = ^DESC_CHAR;
+  {$EXTERNALSYM LPDESC}
+  PDesc = LPDESC;
+
+//
+// Function Prototypes
+//
+
+function NetRemoteTOD(UncServerName: LPCWSTR; var BufferPtr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetRemoteTOD}
+
+function NetRemoteComputerSupports(UncServerName: LPCWSTR; OptionsWanted: DWORD; OptionsSupported: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetRemoteComputerSupports}
+
+{$IFDEF SUPPORTS_VARARGS}
+// mvb Delphi 6 and up only (because of the varargs)
+function RxRemoteApi(ApiNumber: DWORD; UncServerName: LPCWSTR; ParmDescString, DataDesc16, DataDesc32, DataDescSmb,
+  AuxDesc16, AuxDesc32, AuxDescSmb: LPDESC; Flags: DWORD{, ...}): NET_API_STATUS; cdecl; varargs;
+{$EXTERNALSYM RxRemoteApi}
+{$ENDIF SUPPORTS_VARARGS}
+
+//
+//  Data Structures
+//
+
+type
+  _TIME_OF_DAY_INFO = record
+    tod_elapsedt: DWORD;
+    tod_msecs: DWORD;
+    tod_hours: DWORD;
+    tod_mins: DWORD;
+    tod_secs: DWORD;
+    tod_hunds: DWORD;
+    tod_timezone: LONG;
+    tod_tinterval: DWORD;
+    tod_day: DWORD;
+    tod_month: DWORD;
+    tod_year: DWORD;
+    tod_weekday: DWORD;
+  end;
+  {$EXTERNALSYM _TIME_OF_DAY_INFO}
+  TIME_OF_DAY_INFO = _TIME_OF_DAY_INFO;
+  {$EXTERNALSYM TIME_OF_DAY_INFO}
+  PTIME_OF_DAY_INFO = ^TIME_OF_DAY_INFO;
+  {$EXTERNALSYM PTIME_OF_DAY_INFO}
+  LPTIME_OF_DAY_INFO = ^TIME_OF_DAY_INFO;
+  {$EXTERNALSYM LPTIME_OF_DAY_INFO}
+  TTimeOfDayInfo = TIME_OF_DAY_INFO;
+  PTimeOfDayInfo = PTIME_OF_DAY_INFO;  
+
+//
+// Special Values and Constants
+//
+
+//
+// Mask bits for use with NetRemoteComputerSupports:
+//
+
+const
+  SUPPORTS_REMOTE_ADMIN_PROTOCOL = $00000002;
+  {$EXTERNALSYM SUPPORTS_REMOTE_ADMIN_PROTOCOL}
+  SUPPORTS_RPC                   = $00000004;
+  {$EXTERNALSYM SUPPORTS_RPC}
+  SUPPORTS_SAM_PROTOCOL          = $00000008;
+  {$EXTERNALSYM SUPPORTS_SAM_PROTOCOL}
+  SUPPORTS_UNICODE               = $00000010;
+  {$EXTERNALSYM SUPPORTS_UNICODE}
+  SUPPORTS_LOCAL                 = $00000020;
+  {$EXTERNALSYM SUPPORTS_LOCAL}
+  SUPPORTS_ANY                   = DWORD($FFFFFFFF);
+  {$EXTERNALSYM SUPPORTS_ANY}
+
+//
+// Flag bits for RxRemoteApi:
+//
+
+const
+  NO_PERMISSION_REQUIRED = $00000001;      // set if use NULL session
+  {$EXTERNALSYM NO_PERMISSION_REQUIRED}
+  ALLOCATE_RESPONSE      = $00000002;      // set if RxRemoteApi allocates response buffer
+  {$EXTERNALSYM ALLOCATE_RESPONSE}
+  USE_SPECIFIC_TRANSPORT = DWORD($80000000);
+  {$EXTERNALSYM USE_SPECIFIC_TRANSPORT}
+
+implementation
+
+// todo cdecl function so no dynamic linking for the time being...
+
+{$IFDEF SUPPORTS_VARARGS}
+function RxRemoteApi; external netapi32 name 'RxRemoteApi';
+{$ENDIF SUPPORTS_VARARGS}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetRemoteTOD: Pointer;
+
+function NetRemoteTOD;
+begin
+  GetProcedureAddress(_NetRemoteTOD, netapi32, 'NetRemoteTOD');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetRemoteTOD]
+  end;
+end;
+
+var
+  _NetRemoteComputerSupports: Pointer;
+
+function NetRemoteComputerSupports;
+begin
+  GetProcedureAddress(_NetRemoteComputerSupports, netapi32, 'NetRemoteComputerSupports');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetRemoteComputerSupports]
+  end;
+end;
+
+{$ELSE}
+
+function NetRemoteTOD; external netapi32 name 'NetRemoteTOD';
+function NetRemoteComputerSupports; external netapi32 name 'NetRemoteComputerSupports';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 564 - 0
packages/extra/winunits/jwalmrepl.pas

@@ -0,0 +1,564 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Replicator API interface Unit for Object Pascal                  }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmrepl.h, released November 2001. The original Pascal  }
+{ code is: LmRepl.pas, released Februari 2002. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmRepl;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmrepl.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Replicator Configuration APIs
+//
+
+const
+  REPL_ROLE_EXPORT = 1;
+  {$EXTERNALSYM REPL_ROLE_EXPORT}
+  REPL_ROLE_IMPORT = 2;
+  {$EXTERNALSYM REPL_ROLE_IMPORT}
+  REPL_ROLE_BOTH   = 3;
+  {$EXTERNALSYM REPL_ROLE_BOTH}
+
+  REPL_INTERVAL_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + 0;
+  {$EXTERNALSYM REPL_INTERVAL_INFOLEVEL}
+  REPL_PULSE_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + 1;
+  {$EXTERNALSYM REPL_PULSE_INFOLEVEL}
+  REPL_GUARDTIME_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + 2;
+  {$EXTERNALSYM REPL_GUARDTIME_INFOLEVEL}
+  REPL_RANDOM_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + 3;
+  {$EXTERNALSYM REPL_RANDOM_INFOLEVEL}
+
+type
+  _REPL_INFO_0 = record
+    rp0_role: DWORD;
+    rp0_exportpath: LPWSTR;
+    rp0_exportlist: LPWSTR;
+    rp0_importpath: LPWSTR;
+    rp0_importlist: LPWSTR;
+    rp0_logonusername: LPWSTR;
+    rp0_interval: DWORD;
+    rp0_pulse: DWORD;
+    rp0_guardtime: DWORD;
+    rp0_random: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_INFO_0}
+  REPL_INFO_0 = _REPL_INFO_0;
+  {$EXTERNALSYM REPL_INFO_0}
+  LPREPL_INFO_0 = ^REPL_INFO_0;
+  {$EXTERNALSYM LPREPL_INFO_0}
+  PREPL_INFO_0 = ^REPL_INFO_0;
+  {$EXTERNALSYM PREPL_INFO_0}
+  TReplInfo0 = REPL_INFO_0;
+  PReplInfo0 = PREPL_INFO_0;
+
+  _REPL_INFO_1000 = record
+    rp1000_interval: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_INFO_1000}
+  REPL_INFO_1000 = _REPL_INFO_1000;
+  {$EXTERNALSYM REPL_INFO_1000}
+  LPREPL_INFO_1000 = ^REPL_INFO_1000;
+  {$EXTERNALSYM LPREPL_INFO_1000}
+  PREPL_INFO_1000 = ^REPL_INFO_1000;
+  {$EXTERNALSYM PREPL_INFO_1000}
+  TReplInfo1000 = REPL_INFO_1000;
+  PReplInfo1000 = PREPL_INFO_1000;
+
+  _REPL_INFO_1001 = record
+    rp1001_pulse: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_INFO_1001}
+  REPL_INFO_1001 = _REPL_INFO_1001;
+  {$EXTERNALSYM REPL_INFO_1001}
+  LPREPL_INFO_1001 = ^REPL_INFO_1001;
+  {$EXTERNALSYM LPREPL_INFO_1001}
+  PREPL_INFO_1001 = ^REPL_INFO_1001;
+  {$EXTERNALSYM PREPL_INFO_1001}
+  TReplInfo1001 = REPL_INFO_1001;
+  PReplInfo1001 = PREPL_INFO_1001;
+
+  _REPL_INFO_1002 = record
+    rp1002_guardtime: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_INFO_1002}
+  REPL_INFO_1002 = _REPL_INFO_1002;
+  {$EXTERNALSYM REPL_INFO_1002}
+  LPREPL_INFO_1002 = ^REPL_INFO_1002;
+  {$EXTERNALSYM LPREPL_INFO_1002}
+  PREPL_INFO_1002 = ^REPL_INFO_1002;
+  {$EXTERNALSYM PREPL_INFO_1002}
+  TReplInfo1002 = REPL_INFO_1002;
+  PReplInfo1002 = PREPL_INFO_1002;
+
+  _REPL_INFO_1003 = record
+    rp1003_random: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_INFO_1003}
+  REPL_INFO_1003 = _REPL_INFO_1003;
+  {$EXTERNALSYM REPL_INFO_1003}
+  LPREPL_INFO_1003 = ^REPL_INFO_1003;
+  {$EXTERNALSYM LPREPL_INFO_1003}
+  PREPL_INFO_1003 = ^REPL_INFO_1003;
+  {$EXTERNALSYM PREPL_INFO_1003}
+  TReplInfo1003 = REPL_INFO_1003;
+  PReplInfo1003 = PREPL_INFO_1003;
+
+function NetReplGetInfo(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplGetInfo}
+
+function NetReplSetInfo(servername: LPCWSTR; level: DWORD; buf: LPBYTE ; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplSetInfo}
+
+//
+// Replicator Export Directory APIs
+//
+
+const
+  REPL_INTEGRITY_FILE = 1;
+  {$EXTERNALSYM REPL_INTEGRITY_FILE}
+  REPL_INTEGRITY_TREE = 2;
+  {$EXTERNALSYM REPL_INTEGRITY_TREE}
+
+  REPL_EXTENT_FILE = 1;
+  {$EXTERNALSYM REPL_EXTENT_FILE}
+  REPL_EXTENT_TREE = 2;
+  {$EXTERNALSYM REPL_EXTENT_TREE}
+
+  REPL_EXPORT_INTEGRITY_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + 0;
+  {$EXTERNALSYM REPL_EXPORT_INTEGRITY_INFOLEVEL}
+  REPL_EXPORT_EXTENT_INFOLEVEL    = PARMNUM_BASE_INFOLEVEL + 1;
+  {$EXTERNALSYM REPL_EXPORT_EXTENT_INFOLEVEL}
+
+type
+  _REPL_EDIR_INFO_0 = record
+    rped0_dirname: LPWSTR;
+  end;
+  {$EXTERNALSYM _REPL_EDIR_INFO_0}
+  REPL_EDIR_INFO_0 = _REPL_EDIR_INFO_0;
+  {$EXTERNALSYM REPL_EDIR_INFO_0}
+  LPREPL_EDIR_INFO_0 = ^REPL_EDIR_INFO_0;
+  {$EXTERNALSYM LPREPL_EDIR_INFO_0}
+  PREPL_EDIR_INFO_0 = ^REPL_EDIR_INFO_0;
+  {$EXTERNALSYM PREPL_EDIR_INFO_0}
+  TReplEdirInfo0 = REPL_EDIR_INFO_0;
+  PReplEdirInfo0 = PREPL_EDIR_INFO_0;
+
+  _REPL_EDIR_INFO_1 = record
+    rped1_dirname: LPWSTR;
+    rped1_integrity: DWORD;
+    rped1_extent: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_EDIR_INFO_1}
+  REPL_EDIR_INFO_1 = _REPL_EDIR_INFO_1;
+  {$EXTERNALSYM REPL_EDIR_INFO_1}
+  LPREPL_EDIR_INFO_1 = ^REPL_EDIR_INFO_1;
+  {$EXTERNALSYM LPREPL_EDIR_INFO_1}
+  PREPL_EDIR_INFO_1 = ^REPL_EDIR_INFO_1;
+  {$EXTERNALSYM PREPL_EDIR_INFO_1}
+  TReplEdirInfo1 = REPL_EDIR_INFO_1;
+  PReplEdirInfo1 = PREPL_EDIR_INFO_1;
+
+  _REPL_EDIR_INFO_2 = record
+    rped2_dirname: LPWSTR;
+    rped2_integrity: DWORD;
+    rped2_extent: DWORD;
+    rped2_lockcount: DWORD;
+    rped2_locktime: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_EDIR_INFO_2}
+  REPL_EDIR_INFO_2 = _REPL_EDIR_INFO_2;
+  {$EXTERNALSYM REPL_EDIR_INFO_2}
+  LPREPL_EDIR_INFO_2 = ^REPL_EDIR_INFO_2;
+  {$EXTERNALSYM LPREPL_EDIR_INFO_2}
+  PREPL_EDIR_INFO_2 = ^REPL_EDIR_INFO_2;
+  {$EXTERNALSYM PREPL_EDIR_INFO_2}
+  TReplEdirInfo2 = REPL_EDIR_INFO_2;
+  PReplEdirInfo2 = PREPL_EDIR_INFO_2;
+
+  _REPL_EDIR_INFO_1000 = record
+    rped1000_integrity: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_EDIR_INFO_1000}
+  REPL_EDIR_INFO_1000 = _REPL_EDIR_INFO_1000;
+  {$EXTERNALSYM REPL_EDIR_INFO_1000}
+  LPREPL_EDIR_INFO_1000 = ^REPL_EDIR_INFO_1000;
+  {$EXTERNALSYM LPREPL_EDIR_INFO_1000}
+  PREPL_EDIR_INFO_1000 = ^REPL_EDIR_INFO_1000;
+  {$EXTERNALSYM PREPL_EDIR_INFO_1000}
+  TReplEdirInfo1000 = REPL_EDIR_INFO_1000;
+  PReplEdirInfo1000 = PREPL_EDIR_INFO_1000;
+
+  _REPL_EDIR_INFO_1001 = record
+    rped1001_extent: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_EDIR_INFO_1001}
+  REPL_EDIR_INFO_1001 = _REPL_EDIR_INFO_1001;
+  {$EXTERNALSYM REPL_EDIR_INFO_1001}
+  LPREPL_EDIR_INFO_1001 = ^REPL_EDIR_INFO_1001;
+  {$EXTERNALSYM LPREPL_EDIR_INFO_1001}
+  PREPL_EDIR_INFO_1001 = ^REPL_EDIR_INFO_1001;
+  {$EXTERNALSYM PREPL_EDIR_INFO_1001}
+  TReplEdirInfo1001 = REPL_EDIR_INFO_1001;
+  PReplEdirInfo1001 = PREPL_EDIR_INFO_1001;
+
+function NetReplExportDirAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE ; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirAdd}
+
+function NetReplExportDirDel(servername: LPCWSTR; dirname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirDel}
+
+function NetReplExportDirEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resumehandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirEnum}
+
+function NetReplExportDirGetInfo(servername, dirname: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirGetInfo}
+
+function NetReplExportDirSetInfo(servername, dirname: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirSetInfo}
+
+function NetReplExportDirLock(servername: LPCWSTR; dirname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirLock}
+
+function NetReplExportDirUnlock(servername: LPCWSTR; dirname: LPCWSTR; unlockforce: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplExportDirUnlock}
+
+const
+  REPL_UNLOCK_NOFORCE = 0;
+  {$EXTERNALSYM REPL_UNLOCK_NOFORCE}
+  REPL_UNLOCK_FORCE   = 1;
+  {$EXTERNALSYM REPL_UNLOCK_FORCE}
+
+//
+// Replicator Import Directory APIs
+//
+
+type
+  _REPL_IDIR_INFO_0 = record
+    rpid0_dirname: LPWSTR;
+  end;
+  {$EXTERNALSYM _REPL_IDIR_INFO_0}
+  REPL_IDIR_INFO_0 = _REPL_IDIR_INFO_0;
+  {$EXTERNALSYM REPL_IDIR_INFO_0}
+  LPREPL_IDIR_INFO_0 = ^REPL_IDIR_INFO_0;
+  {$EXTERNALSYM LPREPL_IDIR_INFO_0}
+  PREPL_IDIR_INFO_0 = ^REPL_IDIR_INFO_0;
+  {$EXTERNALSYM PREPL_IDIR_INFO_0}
+  TReplIdirInfo0 = REPL_IDIR_INFO_0;
+  PReplIdirInfo0 = PREPL_IDIR_INFO_0;
+
+  _REPL_IDIR_INFO_1 = record
+    rpid1_dirname: LPWSTR;
+    rpid1_state: DWORD;
+    rpid1_mastername: LPWSTR;
+    rpid1_last_update_time: DWORD;
+    rpid1_lockcount: DWORD;
+    rpid1_locktime: DWORD;
+  end;
+  {$EXTERNALSYM _REPL_IDIR_INFO_1}
+  REPL_IDIR_INFO_1 = _REPL_IDIR_INFO_1;
+  {$EXTERNALSYM REPL_IDIR_INFO_1}
+  LPREPL_IDIR_INFO_1 = ^REPL_IDIR_INFO_1;
+  {$EXTERNALSYM LPREPL_IDIR_INFO_1}
+  PREPL_IDIR_INFO_1 = ^REPL_IDIR_INFO_1;
+  {$EXTERNALSYM PREPL_IDIR_INFO_1}
+  TReplIdirInfo1 = REPL_IDIR_INFO_1;
+  PReplIdirInfo1 = PREPL_IDIR_INFO_1;
+
+function NetReplImportDirAdd(servername: LPCWSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirAdd}
+
+function NetReplImportDirDel(servername: LPCWSTR; dirname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirDel}
+
+function NetReplImportDirEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resumehandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirEnum}
+
+function NetReplImportDirGetInfo(servername, dirname: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirGetInfo}
+
+function NetReplImportDirLock(servername: LPCWSTR; dirname: LPCWSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirLock}
+
+function NetReplImportDirUnlock(servername: LPCWSTR; dirname: LPCWSTR; unlockforce: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetReplImportDirUnlock}
+
+const
+  REPL_STATE_OK               = 0;
+  {$EXTERNALSYM REPL_STATE_OK}
+  REPL_STATE_NO_MASTER        = 1;
+  {$EXTERNALSYM REPL_STATE_NO_MASTER}
+  REPL_STATE_NO_SYNC          = 2;
+  {$EXTERNALSYM REPL_STATE_NO_SYNC}
+  REPL_STATE_NEVER_REPLICATED = 3;
+  {$EXTERNALSYM REPL_STATE_NEVER_REPLICATED}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetReplGetInfo: Pointer;
+
+function NetReplGetInfo;
+begin
+  GetProcedureAddress(_NetReplGetInfo, netapi32, 'NetReplGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplGetInfo]
+  end;
+end;
+
+var
+  _NetReplSetInfo: Pointer;
+
+function NetReplSetInfo;
+begin
+  GetProcedureAddress(_NetReplSetInfo, netapi32, 'NetReplSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplSetInfo]
+  end;
+end;
+
+var
+  _NetReplExportDirAdd: Pointer;
+
+function NetReplExportDirAdd;
+begin
+  GetProcedureAddress(_NetReplExportDirAdd, netapi32, 'NetReplExportDirAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirAdd]
+  end;
+end;
+
+var
+  _NetReplExportDirDel: Pointer;
+
+function NetReplExportDirDel;
+begin
+  GetProcedureAddress(_NetReplExportDirDel, netapi32, 'NetReplExportDirDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirDel]
+  end;
+end;
+
+var
+  _NetReplExportDirEnum: Pointer;
+
+function NetReplExportDirEnum;
+begin
+  GetProcedureAddress(_NetReplExportDirEnum, netapi32, 'NetReplExportDirEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirEnum]
+  end;
+end;
+
+var
+  _NetReplExportDirGetInfo: Pointer;
+
+function NetReplExportDirGetInfo;
+begin
+  GetProcedureAddress(_NetReplExportDirGetInfo, netapi32, 'NetReplExportDirGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirGetInfo]
+  end;
+end;
+
+var
+  _NetReplExportDirSetInfo: Pointer;
+
+function NetReplExportDirSetInfo;
+begin
+  GetProcedureAddress(_NetReplExportDirSetInfo, netapi32, 'NetReplExportDirSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirSetInfo]
+  end;
+end;
+
+var
+  _NetReplExportDirLock: Pointer;
+
+function NetReplExportDirLock;
+begin
+  GetProcedureAddress(_NetReplExportDirLock, netapi32, 'NetReplExportDirLock');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirLock]
+  end;
+end;
+
+var
+  _NetReplExportDirUnlock: Pointer;
+
+function NetReplExportDirUnlock;
+begin
+  GetProcedureAddress(_NetReplExportDirUnlock, netapi32, 'NetReplExportDirUnlock');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplExportDirUnlock]
+  end;
+end;
+
+var
+  _NetReplImportDirAdd: Pointer;
+
+function NetReplImportDirAdd;
+begin
+  GetProcedureAddress(_NetReplImportDirAdd, netapi32, 'NetReplImportDirAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirAdd]
+  end;
+end;
+
+var
+  _NetReplImportDirDel: Pointer;
+
+function NetReplImportDirDel;
+begin
+  GetProcedureAddress(_NetReplImportDirDel, netapi32, 'NetReplImportDirDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirDel]
+  end;
+end;
+
+var
+  _NetReplImportDirEnum: Pointer;
+
+function NetReplImportDirEnum;
+begin
+  GetProcedureAddress(_NetReplImportDirEnum, netapi32, 'NetReplImportDirEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirEnum]
+  end;
+end;
+
+var
+  _NetReplImportDirGetInfo: Pointer;
+
+function NetReplImportDirGetInfo;
+begin
+  GetProcedureAddress(_NetReplImportDirGetInfo, netapi32, 'NetReplImportDirGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirGetInfo]
+  end;
+end;
+
+var
+  _NetReplImportDirLock: Pointer;
+
+function NetReplImportDirLock;
+begin
+  GetProcedureAddress(_NetReplImportDirLock, netapi32, 'NetReplImportDirLock');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirLock]
+  end;
+end;
+
+var
+  _NetReplImportDirUnlock: Pointer;
+
+function NetReplImportDirUnlock;
+begin
+  GetProcedureAddress(_NetReplImportDirUnlock, netapi32, 'NetReplImportDirUnlock');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetReplImportDirUnlock]
+  end;
+end;
+
+{$ELSE}
+
+function NetReplGetInfo; external netapi32 name 'NetReplGetInfo';
+function NetReplSetInfo; external netapi32 name 'NetReplSetInfo';
+function NetReplExportDirAdd; external netapi32 name 'NetReplExportDirAdd';
+function NetReplExportDirDel; external netapi32 name 'NetReplExportDirDel';
+function NetReplExportDirEnum; external netapi32 name 'NetReplExportDirEnum';
+function NetReplExportDirGetInfo; external netapi32 name 'NetReplExportDirGetInfo';
+function NetReplExportDirSetInfo; external netapi32 name 'NetReplExportDirSetInfo';
+function NetReplExportDirLock; external netapi32 name 'NetReplExportDirLock';
+function NetReplExportDirUnlock; external netapi32 name 'NetReplExportDirUnlock';
+function NetReplImportDirAdd; external netapi32 name 'NetReplImportDirAdd';
+function NetReplImportDirDel; external netapi32 name 'NetReplImportDirDel';
+function NetReplImportDirEnum; external netapi32 name 'NetReplImportDirEnum';
+function NetReplImportDirGetInfo; external netapi32 name 'NetReplImportDirGetInfo';
+function NetReplImportDirLock; external netapi32 name 'NetReplImportDirLock';
+function NetReplImportDirUnlock; external netapi32 name 'NetReplImportDirUnlock';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 2604 - 0
packages/extra/winunits/jwalmserver.pas

@@ -0,0 +1,2604 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Server API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmserver.h, released November 2001. The original Pascal}
+{ code is: LmServer.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmServer;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmserver.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinSvc, JwaWinType;
+
+//
+// Function Prototypes - SERVER
+//
+
+function NetServerEnum(servername: LMCSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread: LPDWORD; totalentries: LPDWORD; servertype: DWORD; domain: LMCSTR; resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerEnum}
+
+function NetServerEnumEx(ServerName: LMCSTR; Level: DWORD; var Bufptr: LPBYTE; PrefMaxlen: DWORD; EntriesRead: LPDWORD; totalentries: LPDWORD; servertype: DWORD; domain: LMCSTR; FirstNameToReturn: LMCSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerEnumEx}
+
+function NetServerGetInfo(servername: LMSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerGetInfo}
+
+function NetServerSetInfo(servername: LMSTR; level: DWORD; buf: LPBYTE; ParmError: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerSetInfo}
+
+//
+// Temporary hack function.
+//
+
+// todo cdecl??
+
+function NetServerSetInfoCommandLine(argc: WORD; argv: PLMSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerSetInfoCommandLine}
+
+function NetServerDiskEnum(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerDiskEnum}
+
+function NetServerComputerNameAdd(ServerName, EmulatedDomainName, EmulatedServerName: LMSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerComputerNameAdd}
+
+function NetServerComputerNameDel(ServerName: LMSTR; EmulatedServerName: LMSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerComputerNameDel}
+
+function NetServerTransportAdd(servername: LMSTR; level: DWORD; bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerTransportAdd}
+
+function NetServerTransportAddEx(servername: LMSTR; level: DWORD; bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerTransportAddEx}
+
+function NetServerTransportDel(servername: LMSTR; level: DWORD; bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerTransportDel}
+
+function NetServerTransportEnum(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resumehandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServerTransportEnum}
+
+//
+// The following function can be called by Win NT services to register
+// their service type.  This function is exported from advapi32.dll.
+// Therefore, if this is the only function called by that service, then
+// it is not necessary to link to netapi32.lib.
+//
+
+function SetServiceBits(hServiceStatus: SERVICE_STATUS_HANDLE; dwServiceBits: DWORD; bSetBitsOn: BOOL; bUpdateImmediately: BOOL): BOOL; stdcall;
+{$EXTERNALSYM SetServiceBits}
+
+//
+// Data Structures - SERVER
+//
+
+type
+  LPSERVER_INFO_100 = ^SERVER_INFO_100;
+  {$EXTERNALSYM LPSERVER_INFO_100}
+  PSERVER_INFO_100 = ^SERVER_INFO_100;
+  {$EXTERNALSYM PSERVER_INFO_100}
+  _SERVER_INFO_100 = record
+    sv100_platform_id: DWORD;
+    sv100_name: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_100}
+  SERVER_INFO_100 = _SERVER_INFO_100;
+  {$EXTERNALSYM SERVER_INFO_100}
+  TServerInfo100 = SERVER_INFO_100;
+  PServerInfo100 = PSERVER_INFO_100;
+
+  LPSERVER_INFO_101 = ^SERVER_INFO_101;
+  {$EXTERNALSYM LPSERVER_INFO_101}
+  PSERVER_INFO_101 = ^SERVER_INFO_101;
+  {$EXTERNALSYM PSERVER_INFO_101}
+  _SERVER_INFO_101 = record
+    sv101_platform_id: DWORD;
+    sv101_name: LMSTR;
+    sv101_version_major: DWORD;
+    sv101_version_minor: DWORD;
+    sv101_type: DWORD;
+    sv101_comment: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_101}
+  SERVER_INFO_101 = _SERVER_INFO_101;
+  {$EXTERNALSYM SERVER_INFO_101}
+  TServerInfo101 = SERVER_INFO_101;
+  PServerInfo101 = PSERVER_INFO_101;
+
+  LPSERVER_INFO_102 = ^SERVER_INFO_102;
+  {$EXTERNALSYM LPSERVER_INFO_102}
+  PSERVER_INFO_102 = ^SERVER_INFO_102;
+  {$EXTERNALSYM PSERVER_INFO_102}
+  _SERVER_INFO_102 = record
+    sv102_platform_id: DWORD;
+    sv102_name: LMSTR;
+    sv102_version_major: DWORD;
+    sv102_version_minor: DWORD;
+    sv102_type: DWORD;
+    sv102_comment: LMSTR;
+    sv102_users: DWORD;
+    sv102_disc: LONG;
+    sv102_hidden: BOOL;
+    sv102_announce: DWORD;
+    sv102_anndelta: DWORD;
+    sv102_licenses: DWORD;
+    sv102_userpath: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_102}
+  SERVER_INFO_102 = _SERVER_INFO_102;
+  {$EXTERNALSYM SERVER_INFO_102}
+  TServerInfo102 = SERVER_INFO_102;
+  PServerInfo102 = PSERVER_INFO_102;
+
+  LPSERVER_INFO_402 = ^SERVER_INFO_402;
+  {$EXTERNALSYM LPSERVER_INFO_402}
+  PSERVER_INFO_402 = ^SERVER_INFO_402;
+  {$EXTERNALSYM PSERVER_INFO_402}
+  _SERVER_INFO_402 = record
+    sv402_ulist_mtime: DWORD;
+    sv402_glist_mtime: DWORD;
+    sv402_alist_mtime: DWORD;
+    sv402_alerts: LMSTR;
+    sv402_security: DWORD;
+    sv402_numadmin: DWORD;
+    sv402_lanmask: DWORD;
+    sv402_guestacct: LMSTR;
+    sv402_chdevs: DWORD;
+    sv402_chdevq: DWORD;
+    sv402_chdevjobs: DWORD;
+    sv402_connections: DWORD;
+    sv402_shares: DWORD;
+    sv402_openfiles: DWORD;
+    sv402_sessopens: DWORD;
+    sv402_sessvcs: DWORD;
+    sv402_sessreqs: DWORD;
+    sv402_opensearch: DWORD;
+    sv402_activelocks: DWORD;
+    sv402_numreqbuf: DWORD;
+    sv402_sizreqbuf: DWORD;
+    sv402_numbigbuf: DWORD;
+    sv402_numfiletasks: DWORD;
+    sv402_alertsched: DWORD;
+    sv402_erroralert: DWORD;
+    sv402_logonalert: DWORD;
+    sv402_accessalert: DWORD;
+    sv402_diskalert: DWORD;
+    sv402_netioalert: DWORD;
+    sv402_maxauditsz: DWORD;
+    sv402_srvheuristics: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_402}
+  SERVER_INFO_402 = _SERVER_INFO_402;
+  {$EXTERNALSYM SERVER_INFO_402}
+  TServerInfo402 = SERVER_INFO_402;
+  PServerInfo402 = PSERVER_INFO_402;
+
+  LPSERVER_INFO_403 = ^SERVER_INFO_403;
+  {$EXTERNALSYM LPSERVER_INFO_403}
+  PSERVER_INFO_403 = ^SERVER_INFO_403;
+  {$EXTERNALSYM PSERVER_INFO_403}
+  _SERVER_INFO_403 = record
+    sv403_ulist_mtime: DWORD;
+    sv403_glist_mtime: DWORD;
+    sv403_alist_mtime: DWORD;
+    sv403_alerts: LMSTR;
+    sv403_security: DWORD;
+    sv403_numadmin: DWORD;
+    sv403_lanmask: DWORD;
+    sv403_guestacct: LMSTR;
+    sv403_chdevs: DWORD;
+    sv403_chdevq: DWORD;
+    sv403_chdevjobs: DWORD;
+    sv403_connections: DWORD;
+    sv403_shares: DWORD;
+    sv403_openfiles: DWORD;
+    sv403_sessopens: DWORD;
+    sv403_sessvcs: DWORD;
+    sv403_sessreqs: DWORD;
+    sv403_opensearch: DWORD;
+    sv403_activelocks: DWORD;
+    sv403_numreqbuf: DWORD;
+    sv403_sizreqbuf: DWORD;
+    sv403_numbigbuf: DWORD;
+    sv403_numfiletasks: DWORD;
+    sv403_alertsched: DWORD;
+    sv403_erroralert: DWORD;
+    sv403_logonalert: DWORD;
+    sv403_accessalert: DWORD;
+    sv403_diskalert: DWORD;
+    sv403_netioalert: DWORD;
+    sv403_maxauditsz: DWORD;
+    sv403_srvheuristics: LMSTR;
+    sv403_auditedevents: DWORD;
+    sv403_autoprofile: DWORD;
+    sv403_autopath: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_403}
+  SERVER_INFO_403 = _SERVER_INFO_403;
+  {$EXTERNALSYM SERVER_INFO_403}
+  TServerInfo403 = SERVER_INFO_403;
+  PServerInfo403 = PSERVER_INFO_403;
+
+  LPSERVER_INFO_502 = ^SERVER_INFO_502;
+  {$EXTERNALSYM LPSERVER_INFO_502}
+  PSERVER_INFO_502 = ^SERVER_INFO_502;
+  {$EXTERNALSYM PSERVER_INFO_502}
+  _SERVER_INFO_502 = record
+    sv502_sessopens: DWORD;
+    sv502_sessvcs: DWORD;
+    sv502_opensearch: DWORD;
+    sv502_sizreqbuf: DWORD;
+    sv502_initworkitems: DWORD;
+    sv502_maxworkitems: DWORD;
+    sv502_rawworkitems: DWORD;
+    sv502_irpstacksize: DWORD;
+    sv502_maxrawbuflen: DWORD;
+    sv502_sessusers: DWORD;
+    sv502_sessconns: DWORD;
+    sv502_maxpagedmemoryusage: DWORD;
+    sv502_maxnonpagedmemoryusage: DWORD;
+    sv502_enablesoftcompat: BOOL;
+    sv502_enableforcedlogoff: BOOL;
+    sv502_timesource: BOOL;
+    sv502_acceptdownlevelapis: BOOL;
+    sv502_lmannounce: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_502}
+  SERVER_INFO_502 = _SERVER_INFO_502;
+  {$EXTERNALSYM SERVER_INFO_502}
+  TServerInfo502 = SERVER_INFO_502;
+  PServerInfo502 = PSERVER_INFO_502;
+
+  LPSERVER_INFO_503 = ^SERVER_INFO_503;
+  {$EXTERNALSYM LPSERVER_INFO_503}
+  PSERVER_INFO_503 = ^SERVER_INFO_503;
+  {$EXTERNALSYM PSERVER_INFO_503}
+  _SERVER_INFO_503 = record
+    sv503_sessopens: DWORD;
+    sv503_sessvcs: DWORD;
+    sv503_opensearch: DWORD;
+    sv503_sizreqbuf: DWORD;
+    sv503_initworkitems: DWORD;
+    sv503_maxworkitems: DWORD;
+    sv503_rawworkitems: DWORD;
+    sv503_irpstacksize: DWORD;
+    sv503_maxrawbuflen: DWORD;
+    sv503_sessusers: DWORD;
+    sv503_sessconns: DWORD;
+    sv503_maxpagedmemoryusage: DWORD;
+    sv503_maxnonpagedmemoryusage: DWORD;
+    sv503_enablesoftcompat: BOOL;
+    sv503_enableforcedlogoff: BOOL;
+    sv503_timesource: BOOL;
+    sv503_acceptdownlevelapis: BOOL;
+    sv503_lmannounce: BOOL;
+    sv503_domain: LMSTR;
+    sv503_maxcopyreadlen: DWORD;
+    sv503_maxcopywritelen: DWORD;
+    sv503_minkeepsearch: DWORD;
+    sv503_maxkeepsearch: DWORD;
+    sv503_minkeepcomplsearch: DWORD;
+    sv503_maxkeepcomplsearch: DWORD;
+    sv503_threadcountadd: DWORD;
+    sv503_numblockthreads: DWORD;
+    sv503_scavtimeout: DWORD;
+    sv503_minrcvqueue: DWORD;
+    sv503_minfreeworkitems: DWORD;
+    sv503_xactmemsize: DWORD;
+    sv503_threadpriority: DWORD;
+    sv503_maxmpxct: DWORD;
+    sv503_oplockbreakwait: DWORD;
+    sv503_oplockbreakresponsewait: DWORD;
+    sv503_enableoplocks: BOOL;
+    sv503_enableoplockforceclose: BOOL;
+    sv503_enablefcbopens: BOOL;
+    sv503_enableraw: BOOL;
+    sv503_enablesharednetdrives: BOOL;
+    sv503_minfreeconnections: DWORD;
+    sv503_maxfreeconnections: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_503}
+  SERVER_INFO_503 = _SERVER_INFO_503;
+  {$EXTERNALSYM SERVER_INFO_503}
+  TServerInfo503 = SERVER_INFO_503;
+  PServerInfo503 = PSERVER_INFO_503;
+
+  LPSERVER_INFO_599 = ^SERVER_INFO_599;
+  {$EXTERNALSYM LPSERVER_INFO_599}
+  PSERVER_INFO_599 = ^SERVER_INFO_599;
+  {$EXTERNALSYM PSERVER_INFO_599}
+  _SERVER_INFO_599 = record
+    sv599_sessopens: DWORD;
+    sv599_sessvcs: DWORD;
+    sv599_opensearch: DWORD;
+    sv599_sizreqbuf: DWORD;
+    sv599_initworkitems: DWORD;
+    sv599_maxworkitems: DWORD;
+    sv599_rawworkitems: DWORD;
+    sv599_irpstacksize: DWORD;
+    sv599_maxrawbuflen: DWORD;
+    sv599_sessusers: DWORD;
+    sv599_sessconns: DWORD;
+    sv599_maxpagedmemoryusage: DWORD;
+    sv599_maxnonpagedmemoryusage: DWORD;
+    sv599_enablesoftcompat: BOOL;
+    sv599_enableforcedlogoff: BOOL;
+    sv599_timesource: BOOL;
+    sv599_acceptdownlevelapis: BOOL;
+    sv599_lmannounce: BOOL;
+    sv599_domain: LMSTR;
+    sv599_maxcopyreadlen: DWORD;
+    sv599_maxcopywritelen: DWORD;
+    sv599_minkeepsearch: DWORD;
+    sv599_maxkeepsearch: DWORD;
+    sv599_minkeepcomplsearch: DWORD;
+    sv599_maxkeepcomplsearch: DWORD;
+    sv599_threadcountadd: DWORD;
+    sv599_numblockthreads: DWORD;
+    sv599_scavtimeout: DWORD;
+    sv599_minrcvqueue: DWORD;
+    sv599_minfreeworkitems: DWORD;
+    sv599_xactmemsize: DWORD;
+    sv599_threadpriority: DWORD;
+    sv599_maxmpxct: DWORD;
+    sv599_oplockbreakwait: DWORD;
+    sv599_oplockbreakresponsewait: DWORD;
+    sv599_enableoplocks: BOOL;
+    sv599_enableoplockforceclose: BOOL;
+    sv599_enablefcbopens: BOOL;
+    sv599_enableraw: BOOL;
+    sv599_enablesharednetdrives: BOOL;
+    sv599_minfreeconnections: DWORD;
+    sv599_maxfreeconnections: DWORD;
+    sv599_initsesstable: DWORD;
+    sv599_initconntable: DWORD;
+    sv599_initfiletable: DWORD;
+    sv599_initsearchtable: DWORD;
+    sv599_alertschedule: DWORD;
+    sv599_errorthreshold: DWORD;
+    sv599_networkerrorthreshold: DWORD;
+    sv599_diskspacethreshold: DWORD;
+    sv599_reserved: DWORD;
+    sv599_maxlinkdelay: DWORD;
+    sv599_minlinkthroughput: DWORD;
+    sv599_linkinfovalidtime: DWORD;
+    sv599_scavqosinfoupdatetime: DWORD;
+    sv599_maxworkitemidletime: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_599}
+  SERVER_INFO_599 = _SERVER_INFO_599;
+  {$EXTERNALSYM SERVER_INFO_599}
+  TServerInfo599 = SERVER_INFO_599;
+  PServerInfo599 = PSERVER_INFO_599;
+
+  LPSERVER_INFO_598 = ^SERVER_INFO_598;
+  {$EXTERNALSYM LPSERVER_INFO_598}
+  PSERVER_INFO_598 = ^SERVER_INFO_598;
+  {$EXTERNALSYM PSERVER_INFO_598}
+  _SERVER_INFO_598 = record
+    sv598_maxrawworkitems: DWORD;
+    sv598_maxthreadsperqueue: DWORD;
+    sv598_producttype: DWORD;
+    sv598_serversize: DWORD;
+    sv598_connectionlessautodisc: DWORD;
+    sv598_sharingviolationretries: DWORD;
+    sv598_sharingviolationdelay: DWORD;
+    sv598_maxglobalopensearch: DWORD;
+    sv598_removeduplicatesearches: DWORD;
+    sv598_lockviolationoffset: DWORD;
+    sv598_lockviolationdelay: DWORD;
+    sv598_mdlreadswitchover: DWORD;
+    sv598_cachedopenlimit: DWORD;
+    sv598_otherqueueaffinity: DWORD;
+    sv598_restrictnullsessaccess: BOOL;
+    sv598_enablewfw311directipx: BOOL;
+    sv598_queuesamplesecs: DWORD;
+    sv598_balancecount: DWORD;
+    sv598_preferredaffinity: DWORD;
+    sv598_maxfreerfcbs: DWORD;
+    sv598_maxfreemfcbs: DWORD;
+    sv598_maxfreelfcbs: DWORD;
+    sv598_maxfreepagedpoolchunks: DWORD;
+    sv598_minpagedpoolchunksize: DWORD;
+    sv598_maxpagedpoolchunksize: DWORD;
+    sv598_sendsfrompreferredprocessor: BOOL;
+    sv598_cacheddirectorylimit: DWORD;
+    sv598_maxcopylength: DWORD;
+    sv598_enablecompression: BOOL;
+    sv598_autosharewks: BOOL;
+    sv598_autoshareserver: BOOL;
+    sv598_enablesecuritysignature: BOOL;
+    sv598_requiresecuritysignature: BOOL;
+    sv598_minclientbuffersize: DWORD;
+    sv598_serverguid: GUID;
+    sv598_ConnectionNoSessionsTimeout: DWORD;
+    sv598_IdleThreadTimeOut: DWORD;
+    sv598_enableW9xsecuritysignature: BOOL;
+    sv598_enforcekerberosreauthentication: BOOL;
+    sv598_disabledos: BOOL;
+    sv598_lowdiskspaceminimum: DWORD;
+    sv598_disablestrictnamechecking: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_598}
+  SERVER_INFO_598 = _SERVER_INFO_598;
+  {$EXTERNALSYM SERVER_INFO_598}
+  TServerInfo598 = SERVER_INFO_598;
+  PServerInfo598 = PSERVER_INFO_598;
+
+  LPSERVER_INFO_1005 = ^SERVER_INFO_1005;
+  {$EXTERNALSYM LPSERVER_INFO_1005}
+  PSERVER_INFO_1005 = ^SERVER_INFO_1005;
+  {$EXTERNALSYM PSERVER_INFO_1005}
+  _SERVER_INFO_1005 = record
+    sv1005_comment: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1005}
+  SERVER_INFO_1005 = _SERVER_INFO_1005;
+  {$EXTERNALSYM SERVER_INFO_1005}
+  TServerInfo1005 = SERVER_INFO_1005;
+  PServerInfo1005 = PSERVER_INFO_1005;
+
+  LPSERVER_INFO_1107 = ^SERVER_INFO_1107;
+  {$EXTERNALSYM LPSERVER_INFO_1107}
+  PSERVER_INFO_1107 = ^SERVER_INFO_1107;
+  {$EXTERNALSYM PSERVER_INFO_1107}
+  _SERVER_INFO_1107 = record
+    sv1107_users: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1107}
+  SERVER_INFO_1107 = _SERVER_INFO_1107;
+  {$EXTERNALSYM SERVER_INFO_1107}
+  TServerInfo1107 = SERVER_INFO_1107;
+  PServerInfo1107 = PSERVER_INFO_1107;
+
+  LPSERVER_INFO_1010 = ^SERVER_INFO_1010;
+  {$EXTERNALSYM LPSERVER_INFO_1010}
+  PSERVER_INFO_1010 = ^SERVER_INFO_1010;
+  {$EXTERNALSYM PSERVER_INFO_1010}
+  _SERVER_INFO_1010 = record
+    sv1010_disc: LONG;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1010}
+  SERVER_INFO_1010 = _SERVER_INFO_1010;
+  {$EXTERNALSYM SERVER_INFO_1010}
+  TServerInfo1010 = SERVER_INFO_1010;
+  PServerInfo1010 = PSERVER_INFO_1010;
+
+  LPSERVER_INFO_1016 = ^SERVER_INFO_1016;
+  {$EXTERNALSYM LPSERVER_INFO_1016}
+  PSERVER_INFO_1016 = ^SERVER_INFO_1016;
+  {$EXTERNALSYM PSERVER_INFO_1016}
+  _SERVER_INFO_1016 = record
+    sv1016_hidden: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1016}
+  SERVER_INFO_1016 = _SERVER_INFO_1016;
+  {$EXTERNALSYM SERVER_INFO_1016}
+  TServerInfo1016 = SERVER_INFO_1016;
+  PServerInfo1016 = PSERVER_INFO_1016;
+
+  LPSERVER_INFO_1017 = ^SERVER_INFO_1017;
+  {$EXTERNALSYM LPSERVER_INFO_1017}
+  PSERVER_INFO_1017 = ^SERVER_INFO_1017;
+  {$EXTERNALSYM PSERVER_INFO_1017}
+  _SERVER_INFO_1017 = record
+    sv1017_announce: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1017}
+  SERVER_INFO_1017 = _SERVER_INFO_1017;
+  {$EXTERNALSYM SERVER_INFO_1017}
+  TServerInfo1017 = SERVER_INFO_1017;
+  PServerInfo1017 = PSERVER_INFO_1017;
+
+  LPSERVER_INFO_1018 = ^SERVER_INFO_1018;
+  {$EXTERNALSYM LPSERVER_INFO_1018}
+  PSERVER_INFO_1018 = ^SERVER_INFO_1018;
+  {$EXTERNALSYM PSERVER_INFO_1018}
+  _SERVER_INFO_1018 = record
+    sv1018_anndelta: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1018}
+  SERVER_INFO_1018 = _SERVER_INFO_1018;
+  {$EXTERNALSYM SERVER_INFO_1018}
+  TServerInfo1018 = SERVER_INFO_1018;
+  PServerInfo1018 = PSERVER_INFO_1018;
+
+  LPSERVER_INFO_1501 = ^SERVER_INFO_1501;
+  {$EXTERNALSYM LPSERVER_INFO_1501}
+  PSERVER_INFO_1501 = ^SERVER_INFO_1501;
+  {$EXTERNALSYM PSERVER_INFO_1501}
+  _SERVER_INFO_1501 = record
+    sv1501_sessopens: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1501}
+  SERVER_INFO_1501 = _SERVER_INFO_1501;
+  {$EXTERNALSYM SERVER_INFO_1501}
+  TServerInfo1501 = SERVER_INFO_1501;
+  PServerInfo1501 = PSERVER_INFO_1501;
+
+  LPSERVER_INFO_1502 = ^SERVER_INFO_1502;
+  {$EXTERNALSYM LPSERVER_INFO_1502}
+  PSERVER_INFO_1502 = ^SERVER_INFO_1502;
+  {$EXTERNALSYM PSERVER_INFO_1502}
+  _SERVER_INFO_1502 = record
+    sv1502_sessvcs: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1502}
+  SERVER_INFO_1502 = _SERVER_INFO_1502;
+  {$EXTERNALSYM SERVER_INFO_1502}
+  TServerInfo1502 = SERVER_INFO_1502;
+  PServerInfo1502 = PSERVER_INFO_1502;
+
+  LPSERVER_INFO_1503 = ^SERVER_INFO_1503;
+  {$EXTERNALSYM LPSERVER_INFO_1503}
+  PSERVER_INFO_1503 = ^SERVER_INFO_1503;
+  {$EXTERNALSYM PSERVER_INFO_1503}
+  _SERVER_INFO_1503 = record
+    sv1503_opensearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1503}
+  SERVER_INFO_1503 = _SERVER_INFO_1503;
+  {$EXTERNALSYM SERVER_INFO_1503}
+  TServerInfo1503 = SERVER_INFO_1503;
+  PServerInfo1503 = PSERVER_INFO_1503;
+
+  LPSERVER_INFO_1506 = ^SERVER_INFO_1506;
+  {$EXTERNALSYM LPSERVER_INFO_1506}
+  PSERVER_INFO_1506 = ^SERVER_INFO_1506;
+  {$EXTERNALSYM PSERVER_INFO_1506}
+  _SERVER_INFO_1506 = record
+    sv1506_maxworkitems: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1506}
+  SERVER_INFO_1506 = _SERVER_INFO_1506;
+  {$EXTERNALSYM SERVER_INFO_1506}
+  TServerInfo1506 = SERVER_INFO_1506;
+  PServerInfo1506 = PSERVER_INFO_1506;
+
+  LPSERVER_INFO_1509 = ^SERVER_INFO_1509;
+  {$EXTERNALSYM LPSERVER_INFO_1509}
+  PSERVER_INFO_1509 = ^SERVER_INFO_1509;
+  {$EXTERNALSYM PSERVER_INFO_1509}
+  _SERVER_INFO_1509 = record
+    sv1509_maxrawbuflen: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1509}
+  SERVER_INFO_1509 = _SERVER_INFO_1509;
+  {$EXTERNALSYM SERVER_INFO_1509}
+  TServerInfo1509 = SERVER_INFO_1509;
+  PServerInfo1509 = PSERVER_INFO_1509;
+
+  LPSERVER_INFO_1510 = ^SERVER_INFO_1510;
+  {$EXTERNALSYM LPSERVER_INFO_1510}
+  PSERVER_INFO_1510 = ^SERVER_INFO_1510;
+  {$EXTERNALSYM PSERVER_INFO_1510}
+  _SERVER_INFO_1510 = record
+    sv1510_sessusers: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1510}
+  SERVER_INFO_1510 = _SERVER_INFO_1510;
+  {$EXTERNALSYM SERVER_INFO_1510}
+  TServerInfo1510 = SERVER_INFO_1510;
+  PServerInfo1510 = PSERVER_INFO_1510;
+
+  LPSERVER_INFO_1511 = ^SERVER_INFO_1511;
+  {$EXTERNALSYM LPSERVER_INFO_1511}
+  PSERVER_INFO_1511 = ^SERVER_INFO_1511;
+  {$EXTERNALSYM PSERVER_INFO_1511}
+  _SERVER_INFO_1511 = record
+    sv1511_sessconns: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1511}
+  SERVER_INFO_1511 = _SERVER_INFO_1511;
+  {$EXTERNALSYM SERVER_INFO_1511}
+  TServerInfo1511 = SERVER_INFO_1511;
+  PServerInfo1511 = PSERVER_INFO_1511;
+
+  LPSERVER_INFO_1512 = ^SERVER_INFO_1512;
+  {$EXTERNALSYM LPSERVER_INFO_1512}
+  PSERVER_INFO_1512 = ^SERVER_INFO_1512;
+  {$EXTERNALSYM PSERVER_INFO_1512}
+  _SERVER_INFO_1512 = record
+    sv1512_maxnonpagedmemoryusage: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1512}
+  SERVER_INFO_1512 = _SERVER_INFO_1512;
+  {$EXTERNALSYM SERVER_INFO_1512}
+  TServerInfo1512 = SERVER_INFO_1512;
+  PServerInfo1512 = PSERVER_INFO_1512;
+
+  LPSERVER_INFO_1513 = ^SERVER_INFO_1513;
+  {$EXTERNALSYM LPSERVER_INFO_1513}
+  PSERVER_INFO_1513 = ^SERVER_INFO_1513;
+  {$EXTERNALSYM PSERVER_INFO_1513}
+  _SERVER_INFO_1513 = record
+    sv1513_maxpagedmemoryusage: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1513}
+  SERVER_INFO_1513 = _SERVER_INFO_1513;
+  {$EXTERNALSYM SERVER_INFO_1513}
+  TServerInfo1513 = SERVER_INFO_1513;
+  PServerInfo1513 = PSERVER_INFO_1513;
+
+  LPSERVER_INFO_1514 = ^SERVER_INFO_1514;
+  {$EXTERNALSYM LPSERVER_INFO_1514}
+  PSERVER_INFO_1514 = ^SERVER_INFO_1514;
+  {$EXTERNALSYM PSERVER_INFO_1514}
+  _SERVER_INFO_1514 = record
+    sv1514_enablesoftcompat: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1514}
+  SERVER_INFO_1514 = _SERVER_INFO_1514;
+  {$EXTERNALSYM SERVER_INFO_1514}
+  TServerInfo1514 = SERVER_INFO_1514;
+  PServerInfo1514 = PSERVER_INFO_1514;
+
+  LPSERVER_INFO_1515 = ^SERVER_INFO_1515;
+  {$EXTERNALSYM LPSERVER_INFO_1515}
+  PSERVER_INFO_1515 = ^SERVER_INFO_1515;
+  {$EXTERNALSYM PSERVER_INFO_1515}
+  _SERVER_INFO_1515 = record
+    sv1515_enableforcedlogoff: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1515}
+  SERVER_INFO_1515 = _SERVER_INFO_1515;
+  {$EXTERNALSYM SERVER_INFO_1515}
+  TServerInfo1515 = SERVER_INFO_1515;
+  PServerInfo1515 = PSERVER_INFO_1515;
+
+  LPSERVER_INFO_1516 = ^SERVER_INFO_1516;
+  {$EXTERNALSYM LPSERVER_INFO_1516}
+  PSERVER_INFO_1516 = ^SERVER_INFO_1516;
+  {$EXTERNALSYM PSERVER_INFO_1516}
+  _SERVER_INFO_1516 = record
+    sv1516_timesource: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1516}
+  SERVER_INFO_1516 = _SERVER_INFO_1516;
+  {$EXTERNALSYM SERVER_INFO_1516}
+  TServerInfo1516 = SERVER_INFO_1516;
+  PServerInfo1516 = PSERVER_INFO_1516;
+
+  LPSERVER_INFO_1518 = ^SERVER_INFO_1518;
+  {$EXTERNALSYM LPSERVER_INFO_1518}
+  PSERVER_INFO_1518 = ^SERVER_INFO_1518;
+  {$EXTERNALSYM PSERVER_INFO_1518}
+  _SERVER_INFO_1518 = record
+    sv1518_lmannounce: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1518}
+  SERVER_INFO_1518 = _SERVER_INFO_1518;
+  {$EXTERNALSYM SERVER_INFO_1518}
+  TServerInfo1518 = SERVER_INFO_1518;
+  PServerInfo1518 = PSERVER_INFO_1518;
+
+  LPSERVER_INFO_1520 = ^SERVER_INFO_1520;
+  {$EXTERNALSYM LPSERVER_INFO_1520}
+  PSERVER_INFO_1520 = ^SERVER_INFO_1520;
+  {$EXTERNALSYM PSERVER_INFO_1520}
+  _SERVER_INFO_1520 = record
+    sv1520_maxcopyreadlen: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1520}
+  SERVER_INFO_1520 = _SERVER_INFO_1520;
+  {$EXTERNALSYM SERVER_INFO_1520}
+  TServerInfo1520 = SERVER_INFO_1520;
+  PServerInfo1520 = PSERVER_INFO_1520;
+
+  LPSERVER_INFO_1521 = ^SERVER_INFO_1521;
+  {$EXTERNALSYM LPSERVER_INFO_1521}
+  PSERVER_INFO_1521 = ^SERVER_INFO_1521;
+  {$EXTERNALSYM PSERVER_INFO_1521}
+  _SERVER_INFO_1521 = record
+    sv1521_maxcopywritelen: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1521}
+  SERVER_INFO_1521 = _SERVER_INFO_1521;
+  {$EXTERNALSYM SERVER_INFO_1521}
+  TServerInfo1521 = SERVER_INFO_1521;
+  PServerInfo1521 = PSERVER_INFO_1521;
+
+  LPSERVER_INFO_1522 = ^SERVER_INFO_1522;
+  {$EXTERNALSYM LPSERVER_INFO_1522}
+  PSERVER_INFO_1522 = ^SERVER_INFO_1522;
+  {$EXTERNALSYM PSERVER_INFO_1522}
+  _SERVER_INFO_1522 = record
+    sv1522_minkeepsearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1522}
+  SERVER_INFO_1522 = _SERVER_INFO_1522;
+  {$EXTERNALSYM SERVER_INFO_1522}
+  TServerInfo1522 = SERVER_INFO_1522;
+  PServerInfo1522 = PSERVER_INFO_1522;
+
+  LPSERVER_INFO_1523 = ^SERVER_INFO_1523;
+  {$EXTERNALSYM LPSERVER_INFO_1523}
+  PSERVER_INFO_1523 = ^SERVER_INFO_1523;
+  {$EXTERNALSYM PSERVER_INFO_1523}
+  _SERVER_INFO_1523 = record
+    sv1523_maxkeepsearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1523}
+  SERVER_INFO_1523 = _SERVER_INFO_1523;
+  {$EXTERNALSYM SERVER_INFO_1523}
+  TServerInfo1523 = SERVER_INFO_1523;
+  PServerInfo1523 = PSERVER_INFO_1523;
+
+  LPSERVER_INFO_1524 = ^SERVER_INFO_1524;
+  {$EXTERNALSYM LPSERVER_INFO_1524}
+  PSERVER_INFO_1524 = ^SERVER_INFO_1524;
+  {$EXTERNALSYM PSERVER_INFO_1524}
+  _SERVER_INFO_1524 = record
+    sv1524_minkeepcomplsearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1524}
+  SERVER_INFO_1524 = _SERVER_INFO_1524;
+  {$EXTERNALSYM SERVER_INFO_1524}
+  TServerInfo1524 = SERVER_INFO_1524;
+  PServerInfo1524 = PSERVER_INFO_1524;
+
+  LPSERVER_INFO_1525 = ^SERVER_INFO_1525;
+  {$EXTERNALSYM LPSERVER_INFO_1525}
+  PSERVER_INFO_1525 = ^SERVER_INFO_1525;
+  {$EXTERNALSYM PSERVER_INFO_1525}
+  _SERVER_INFO_1525 = record
+    sv1525_maxkeepcomplsearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1525}
+  SERVER_INFO_1525 = _SERVER_INFO_1525;
+  {$EXTERNALSYM SERVER_INFO_1525}
+  TServerInfo1525 = SERVER_INFO_1525;
+  PServerInfo1525 = PSERVER_INFO_1525;
+
+  LPSERVER_INFO_1528 = ^SERVER_INFO_1528;
+  {$EXTERNALSYM LPSERVER_INFO_1528}
+  PSERVER_INFO_1528 = ^SERVER_INFO_1528;
+  {$EXTERNALSYM PSERVER_INFO_1528}
+  _SERVER_INFO_1528 = record
+    sv1528_scavtimeout: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1528}
+  SERVER_INFO_1528 = _SERVER_INFO_1528;
+  {$EXTERNALSYM SERVER_INFO_1528}
+  TServerInfo1528 = SERVER_INFO_1528;
+  PServerInfo1528 = PSERVER_INFO_1528;
+
+  LPSERVER_INFO_1529 = ^SERVER_INFO_1529;
+  {$EXTERNALSYM LPSERVER_INFO_1529}
+  PSERVER_INFO_1529 = ^SERVER_INFO_1529;
+  {$EXTERNALSYM PSERVER_INFO_1529}
+  _SERVER_INFO_1529 = record
+    sv1529_minrcvqueue: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1529}
+  SERVER_INFO_1529 = _SERVER_INFO_1529;
+  {$EXTERNALSYM SERVER_INFO_1529}
+  TServerInfo1529 = SERVER_INFO_1529;
+  PServerInfo1529 = PSERVER_INFO_1529;
+
+  LPSERVER_INFO_1530 = ^SERVER_INFO_1530;
+  {$EXTERNALSYM LPSERVER_INFO_1530}
+  PSERVER_INFO_1530 = ^SERVER_INFO_1530;
+  {$EXTERNALSYM PSERVER_INFO_1530}
+  _SERVER_INFO_1530 = record
+    sv1530_minfreeworkitems: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1530}
+  SERVER_INFO_1530 = _SERVER_INFO_1530;
+  {$EXTERNALSYM SERVER_INFO_1530}
+  TServerInfo1530 = SERVER_INFO_1530;
+  PServerInfo1530 = PSERVER_INFO_1530;
+
+  LPSERVER_INFO_1533 = ^SERVER_INFO_1533;
+  {$EXTERNALSYM LPSERVER_INFO_1533}
+  PSERVER_INFO_1533 = ^SERVER_INFO_1533;
+  {$EXTERNALSYM PSERVER_INFO_1533}
+  _SERVER_INFO_1533 = record
+    sv1533_maxmpxct: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1533}
+  SERVER_INFO_1533 = _SERVER_INFO_1533;
+  {$EXTERNALSYM SERVER_INFO_1533}
+  TServerInfo1533 = SERVER_INFO_1533;
+  PServerInfo1533 = PSERVER_INFO_1533;
+
+  LPSERVER_INFO_1534 = ^SERVER_INFO_1534;
+  {$EXTERNALSYM LPSERVER_INFO_1534}
+  PSERVER_INFO_1534 = ^SERVER_INFO_1534;
+  {$EXTERNALSYM PSERVER_INFO_1534}
+  _SERVER_INFO_1534 = record
+    sv1534_oplockbreakwait: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1534}
+  SERVER_INFO_1534 = _SERVER_INFO_1534;
+  {$EXTERNALSYM SERVER_INFO_1534}
+  TServerInfo1534 = SERVER_INFO_1534;
+  PServerInfo1534 = PSERVER_INFO_1534;
+
+  LPSERVER_INFO_1535 = ^SERVER_INFO_1535;
+  {$EXTERNALSYM LPSERVER_INFO_1535}
+  PSERVER_INFO_1535 = ^SERVER_INFO_1535;
+  {$EXTERNALSYM PSERVER_INFO_1535}
+  _SERVER_INFO_1535 = record
+    sv1535_oplockbreakresponsewait: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1535}
+  SERVER_INFO_1535 = _SERVER_INFO_1535;
+  {$EXTERNALSYM SERVER_INFO_1535}
+  TServerInfo1535 = SERVER_INFO_1535;
+  PServerInfo1535 = PSERVER_INFO_1535;
+
+  LPSERVER_INFO_1536 = ^SERVER_INFO_1536;
+  {$EXTERNALSYM LPSERVER_INFO_1536}
+  PSERVER_INFO_1536 = ^SERVER_INFO_1536;
+  {$EXTERNALSYM PSERVER_INFO_1536}
+  _SERVER_INFO_1536 = record
+    sv1536_enableoplocks: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1536}
+  SERVER_INFO_1536 = _SERVER_INFO_1536;
+  {$EXTERNALSYM SERVER_INFO_1536}
+  TServerInfo1536 = SERVER_INFO_1536;
+  PServerInfo1536 = PSERVER_INFO_1536;
+
+  LPSERVER_INFO_1537 = ^SERVER_INFO_1537;
+  {$EXTERNALSYM LPSERVER_INFO_1537}
+  PSERVER_INFO_1537 = ^SERVER_INFO_1537;
+  {$EXTERNALSYM PSERVER_INFO_1537}
+  _SERVER_INFO_1537 = record
+    sv1537_enableoplockforceclose: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1537}
+  SERVER_INFO_1537 = _SERVER_INFO_1537;
+  {$EXTERNALSYM SERVER_INFO_1537}
+  TServerInfo1537 = SERVER_INFO_1537;
+  PServerInfo1537 = PSERVER_INFO_1537;
+
+  LPSERVER_INFO_1538 = ^SERVER_INFO_1538;
+  {$EXTERNALSYM LPSERVER_INFO_1538}
+  PSERVER_INFO_1538 = ^SERVER_INFO_1538;
+  {$EXTERNALSYM PSERVER_INFO_1538}
+  _SERVER_INFO_1538 = record
+    sv1538_enablefcbopens: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1538}
+  SERVER_INFO_1538 = _SERVER_INFO_1538;
+  {$EXTERNALSYM SERVER_INFO_1538}
+  TServerInfo1538 = SERVER_INFO_1538;
+  PServerInfo1538 = PSERVER_INFO_1538;
+
+  LPSERVER_INFO_1539 = ^SERVER_INFO_1539;
+  {$EXTERNALSYM LPSERVER_INFO_1539}
+  PSERVER_INFO_1539 = ^SERVER_INFO_1539;
+  {$EXTERNALSYM PSERVER_INFO_1539}
+  _SERVER_INFO_1539 = record
+    sv1539_enableraw: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1539}
+  SERVER_INFO_1539 = _SERVER_INFO_1539;
+  {$EXTERNALSYM SERVER_INFO_1539}
+  TServerInfo1539 = SERVER_INFO_1539;
+  PServerInfo1539 = PSERVER_INFO_1539;
+
+  LPSERVER_INFO_1540 = ^SERVER_INFO_1540;
+  {$EXTERNALSYM LPSERVER_INFO_1540}
+  PSERVER_INFO_1540 = ^SERVER_INFO_1540;
+  {$EXTERNALSYM PSERVER_INFO_1540}
+  _SERVER_INFO_1540 = record
+    sv1540_enablesharednetdrives: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1540}
+  SERVER_INFO_1540 = _SERVER_INFO_1540;
+  {$EXTERNALSYM SERVER_INFO_1540}
+  TServerInfo1540 = SERVER_INFO_1540;
+  PServerInfo1540 = PSERVER_INFO_1540;
+
+  LPSERVER_INFO_1541 = ^SERVER_INFO_1541;
+  {$EXTERNALSYM LPSERVER_INFO_1541}
+  PSERVER_INFO_1541 = ^SERVER_INFO_1541;
+  {$EXTERNALSYM PSERVER_INFO_1541}
+  _SERVER_INFO_1541 = record
+    sv1541_minfreeconnections: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1541}
+  SERVER_INFO_1541 = _SERVER_INFO_1541;
+  {$EXTERNALSYM SERVER_INFO_1541}
+  TServerInfo1541 = SERVER_INFO_1541;
+  PServerInfo1541 = PSERVER_INFO_1541;
+
+  LPSERVER_INFO_1542 = ^SERVER_INFO_1542;
+  {$EXTERNALSYM LPSERVER_INFO_1542}
+  PSERVER_INFO_1542 = ^SERVER_INFO_1542;
+  {$EXTERNALSYM PSERVER_INFO_1542}
+  _SERVER_INFO_1542 = record
+    sv1542_maxfreeconnections: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1542}
+  SERVER_INFO_1542 = _SERVER_INFO_1542;
+  {$EXTERNALSYM SERVER_INFO_1542}
+  TServerInfo1542 = SERVER_INFO_1542;
+  PServerInfo1542 = PSERVER_INFO_1542;
+
+  LPSERVER_INFO_1543 = ^SERVER_INFO_1543;
+  {$EXTERNALSYM LPSERVER_INFO_1543}
+  PSERVER_INFO_1543 = ^SERVER_INFO_1543;
+  {$EXTERNALSYM PSERVER_INFO_1543}
+  _SERVER_INFO_1543 = record
+    sv1543_initsesstable: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1543}
+  SERVER_INFO_1543 = _SERVER_INFO_1543;
+  {$EXTERNALSYM SERVER_INFO_1543}
+  TServerInfo1543 = SERVER_INFO_1543;
+  PServerInfo1543 = PSERVER_INFO_1543;
+
+  LPSERVER_INFO_1544 = ^SERVER_INFO_1544;
+  {$EXTERNALSYM LPSERVER_INFO_1544}
+  PSERVER_INFO_1544 = ^SERVER_INFO_1544;
+  {$EXTERNALSYM PSERVER_INFO_1544}
+  _SERVER_INFO_1544 = record
+    sv1544_initconntable: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1544}
+  SERVER_INFO_1544 = _SERVER_INFO_1544;
+  {$EXTERNALSYM SERVER_INFO_1544}
+  TServerInfo1544 = SERVER_INFO_1544;
+  PServerInfo1544 = PSERVER_INFO_1544;
+
+  LPSERVER_INFO_1545 = ^SERVER_INFO_1545;
+  {$EXTERNALSYM LPSERVER_INFO_1545}
+  PSERVER_INFO_1545 = ^SERVER_INFO_1545;
+  {$EXTERNALSYM PSERVER_INFO_1545}
+  _SERVER_INFO_1545 = record
+    sv1545_initfiletable: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1545}
+  SERVER_INFO_1545 = _SERVER_INFO_1545;
+  {$EXTERNALSYM SERVER_INFO_1545}
+  TServerInfo1545 = SERVER_INFO_1545;
+  PServerInfo1545 = PSERVER_INFO_1545;
+
+  LPSERVER_INFO_1546 = ^SERVER_INFO_1546;
+  {$EXTERNALSYM LPSERVER_INFO_1546}
+  PSERVER_INFO_1546 = ^SERVER_INFO_1546;
+  {$EXTERNALSYM PSERVER_INFO_1546}
+  _SERVER_INFO_1546 = record
+    sv1546_initsearchtable: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1546}
+  SERVER_INFO_1546 = _SERVER_INFO_1546;
+  {$EXTERNALSYM SERVER_INFO_1546}
+  TServerInfo1546 = SERVER_INFO_1546;
+  PServerInfo1546 = PSERVER_INFO_1546;
+
+  LPSERVER_INFO_1547 = ^SERVER_INFO_1547;
+  {$EXTERNALSYM LPSERVER_INFO_1547}
+  PSERVER_INFO_1547 = ^SERVER_INFO_1547;
+  {$EXTERNALSYM PSERVER_INFO_1547}
+  _SERVER_INFO_1547 = record
+    sv1547_alertschedule: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1547}
+  SERVER_INFO_1547 = _SERVER_INFO_1547;
+  {$EXTERNALSYM SERVER_INFO_1547}
+  TServerInfo1547 = SERVER_INFO_1547;
+  PServerInfo1547 = PSERVER_INFO_1547;
+
+  LPSERVER_INFO_1548 = ^SERVER_INFO_1548;
+  {$EXTERNALSYM LPSERVER_INFO_1548}
+  PSERVER_INFO_1548 = ^SERVER_INFO_1548;
+  {$EXTERNALSYM PSERVER_INFO_1548}
+  _SERVER_INFO_1548 = record
+    sv1548_errorthreshold: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1548}
+  SERVER_INFO_1548 = _SERVER_INFO_1548;
+  {$EXTERNALSYM SERVER_INFO_1548}
+  TServerInfo1548 = SERVER_INFO_1548;
+  PServerInfo1548 = PSERVER_INFO_1548;
+
+  LPSERVER_INFO_1549 = ^SERVER_INFO_1549;
+  {$EXTERNALSYM LPSERVER_INFO_1549}
+  PSERVER_INFO_1549 = ^SERVER_INFO_1549;
+  {$EXTERNALSYM PSERVER_INFO_1549}
+  _SERVER_INFO_1549 = record
+    sv1549_networkerrorthreshold: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1549}
+  SERVER_INFO_1549 = _SERVER_INFO_1549;
+  {$EXTERNALSYM SERVER_INFO_1549}
+  TServerInfo1549 = SERVER_INFO_1549;
+  PServerInfo1549 = PSERVER_INFO_1549;
+
+  LPSERVER_INFO_1550 = ^SERVER_INFO_1550;
+  {$EXTERNALSYM LPSERVER_INFO_1550}
+  PSERVER_INFO_1550 = ^SERVER_INFO_1550;
+  {$EXTERNALSYM PSERVER_INFO_1550}
+  _SERVER_INFO_1550 = record
+    sv1550_diskspacethreshold: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1550}
+  SERVER_INFO_1550 = _SERVER_INFO_1550;
+  {$EXTERNALSYM SERVER_INFO_1550}
+  TServerInfo1550 = SERVER_INFO_1550;
+  PServerInfo1550 = PSERVER_INFO_1550;
+
+  LPSERVER_INFO_1552 = ^SERVER_INFO_1552;
+  {$EXTERNALSYM LPSERVER_INFO_1552}
+  PSERVER_INFO_1552 = ^SERVER_INFO_1552;
+  {$EXTERNALSYM PSERVER_INFO_1552}
+  _SERVER_INFO_1552 = record
+    sv1552_maxlinkdelay: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1552}
+  SERVER_INFO_1552 = _SERVER_INFO_1552;
+  {$EXTERNALSYM SERVER_INFO_1552}
+  TServerInfo1552 = SERVER_INFO_1552;
+  PServerInfo1552 = PSERVER_INFO_1552;
+
+  LPSERVER_INFO_1553 = ^SERVER_INFO_1553;
+  {$EXTERNALSYM LPSERVER_INFO_1553}
+  PSERVER_INFO_1553 = ^SERVER_INFO_1553;
+  {$EXTERNALSYM PSERVER_INFO_1553}
+  _SERVER_INFO_1553 = record
+    sv1553_minlinkthroughput: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1553}
+  SERVER_INFO_1553 = _SERVER_INFO_1553;
+  {$EXTERNALSYM SERVER_INFO_1553}
+  TServerInfo1553 = SERVER_INFO_1553;
+  PServerInfo1553 = PSERVER_INFO_1553;
+
+  LPSERVER_INFO_1554 = ^SERVER_INFO_1554;
+  {$EXTERNALSYM LPSERVER_INFO_1554}
+  PSERVER_INFO_1554 = ^SERVER_INFO_1554;
+  {$EXTERNALSYM PSERVER_INFO_1554}
+  _SERVER_INFO_1554 = record
+    sv1554_linkinfovalidtime: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1554}
+  SERVER_INFO_1554 = _SERVER_INFO_1554;
+  {$EXTERNALSYM SERVER_INFO_1554}
+  TServerInfo1554 = SERVER_INFO_1554;
+  PServerInfo1554 = PSERVER_INFO_1554;
+
+  LPSERVER_INFO_1555 = ^SERVER_INFO_1555;
+  {$EXTERNALSYM LPSERVER_INFO_1555}
+  PSERVER_INFO_1555 = ^SERVER_INFO_1555;
+  {$EXTERNALSYM PSERVER_INFO_1555}
+  _SERVER_INFO_1555 = record
+    sv1555_scavqosinfoupdatetime: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1555}
+  SERVER_INFO_1555 = _SERVER_INFO_1555;
+  {$EXTERNALSYM SERVER_INFO_1555}
+  TServerInfo1555 = SERVER_INFO_1555;
+  PServerInfo1555 = PSERVER_INFO_1555;
+
+  LPSERVER_INFO_1556 = ^SERVER_INFO_1556;
+  {$EXTERNALSYM LPSERVER_INFO_1556}
+  PSERVER_INFO_1556 = ^SERVER_INFO_1556;
+  {$EXTERNALSYM PSERVER_INFO_1556}
+  _SERVER_INFO_1556 = record
+    sv1556_maxworkitemidletime: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1556}
+  SERVER_INFO_1556 = _SERVER_INFO_1556;
+  {$EXTERNALSYM SERVER_INFO_1556}
+  TServerInfo1556 = SERVER_INFO_1556;
+  PServerInfo1556 = PSERVER_INFO_1556;
+
+  LPSERVER_INFO_1557 = ^SERVER_INFO_1557;
+  {$EXTERNALSYM LPSERVER_INFO_1557}
+  PSERVER_INFO_1557 = ^SERVER_INFO_1557;
+  {$EXTERNALSYM PSERVER_INFO_1557}
+  _SERVER_INFO_1557 = record
+    sv1557_maxrawworkitems: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1557}
+  SERVER_INFO_1557 = _SERVER_INFO_1557;
+  {$EXTERNALSYM SERVER_INFO_1557}
+  TServerInfo1557 = SERVER_INFO_1557;
+  PServerInfo1557 = PSERVER_INFO_1557;
+
+  LPSERVER_INFO_1560 = ^SERVER_INFO_1560;
+  {$EXTERNALSYM LPSERVER_INFO_1560}
+  PSERVER_INFO_1560 = ^SERVER_INFO_1560;
+  {$EXTERNALSYM PSERVER_INFO_1560}
+  _SERVER_INFO_1560 = record
+    sv1560_producttype: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1560}
+  SERVER_INFO_1560 = _SERVER_INFO_1560;
+  {$EXTERNALSYM SERVER_INFO_1560}
+  TServerInfo1560 = SERVER_INFO_1560;
+  PServerInfo1560 = PSERVER_INFO_1560;
+
+  LPSERVER_INFO_1561 = ^SERVER_INFO_1561;
+  {$EXTERNALSYM LPSERVER_INFO_1561}
+  PSERVER_INFO_1561 = ^SERVER_INFO_1561;
+  {$EXTERNALSYM PSERVER_INFO_1561}
+  _SERVER_INFO_1561 = record
+    sv1561_serversize: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1561}
+  SERVER_INFO_1561 = _SERVER_INFO_1561;
+  {$EXTERNALSYM SERVER_INFO_1561}
+  TServerInfo1561 = SERVER_INFO_1561;
+  PServerInfo1561 = PSERVER_INFO_1561;
+
+  LPSERVER_INFO_1562 = ^SERVER_INFO_1562;
+  {$EXTERNALSYM LPSERVER_INFO_1562}
+  PSERVER_INFO_1562 = ^SERVER_INFO_1562;
+  {$EXTERNALSYM PSERVER_INFO_1562}
+  _SERVER_INFO_1562 = record
+    sv1562_connectionlessautodisc: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1562}
+  SERVER_INFO_1562 = _SERVER_INFO_1562;
+  {$EXTERNALSYM SERVER_INFO_1562}
+  TServerInfo1562 = SERVER_INFO_1562;
+  PServerInfo1562 = PSERVER_INFO_1562;
+
+  LPSERVER_INFO_1563 = ^SERVER_INFO_1563;
+  {$EXTERNALSYM LPSERVER_INFO_1563}
+  PSERVER_INFO_1563 = ^SERVER_INFO_1563;
+  {$EXTERNALSYM PSERVER_INFO_1563}
+  _SERVER_INFO_1563 = record
+    sv1563_sharingviolationretries: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1563}
+  SERVER_INFO_1563 = _SERVER_INFO_1563;
+  {$EXTERNALSYM SERVER_INFO_1563}
+  TServerInfo1563 = SERVER_INFO_1563;
+  PServerInfo1563 = PSERVER_INFO_1563;
+
+  LPSERVER_INFO_1564 = ^SERVER_INFO_1564;
+  {$EXTERNALSYM LPSERVER_INFO_1564}
+  PSERVER_INFO_1564 = ^SERVER_INFO_1564;
+  {$EXTERNALSYM PSERVER_INFO_1564}
+  _SERVER_INFO_1564 = record
+    sv1564_sharingviolationdelay: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1564}
+  SERVER_INFO_1564 = _SERVER_INFO_1564;
+  {$EXTERNALSYM SERVER_INFO_1564}
+  TServerInfo1564 = SERVER_INFO_1564;
+  PServerInfo1564 = PSERVER_INFO_1564;
+
+  LPSERVER_INFO_1565 = ^SERVER_INFO_1565;
+  {$EXTERNALSYM LPSERVER_INFO_1565}
+  PSERVER_INFO_1565 = ^SERVER_INFO_1565;
+  {$EXTERNALSYM PSERVER_INFO_1565}
+  _SERVER_INFO_1565 = record
+    sv1565_maxglobalopensearch: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1565}
+  SERVER_INFO_1565 = _SERVER_INFO_1565;
+  {$EXTERNALSYM SERVER_INFO_1565}
+  TServerInfo1565 = SERVER_INFO_1565;
+  PServerInfo1565 = PSERVER_INFO_1565;
+
+  LPSERVER_INFO_1566 = ^SERVER_INFO_1566;
+  {$EXTERNALSYM LPSERVER_INFO_1566}
+  PSERVER_INFO_1566 = ^SERVER_INFO_1566;
+  {$EXTERNALSYM PSERVER_INFO_1566}
+  _SERVER_INFO_1566 = record
+    sv1566_removeduplicatesearches: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1566}
+  SERVER_INFO_1566 = _SERVER_INFO_1566;
+  {$EXTERNALSYM SERVER_INFO_1566}
+  TServerInfo1566 = SERVER_INFO_1566;
+  PServerInfo1566 = PSERVER_INFO_1566;
+
+  LPSERVER_INFO_1567 = ^SERVER_INFO_1567;
+  {$EXTERNALSYM LPSERVER_INFO_1567}
+  PSERVER_INFO_1567 = ^SERVER_INFO_1567;
+  {$EXTERNALSYM PSERVER_INFO_1567}
+  _SERVER_INFO_1567 = record
+    sv1567_lockviolationretries: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1567}
+  SERVER_INFO_1567 = _SERVER_INFO_1567;
+  {$EXTERNALSYM SERVER_INFO_1567}
+  TServerInfo1567 = SERVER_INFO_1567;
+  PServerInfo1567 = PSERVER_INFO_1567;
+
+  LPSERVER_INFO_1568 = ^SERVER_INFO_1568;
+  {$EXTERNALSYM LPSERVER_INFO_1568}
+  PSERVER_INFO_1568 = ^SERVER_INFO_1568;
+  {$EXTERNALSYM PSERVER_INFO_1568}
+  _SERVER_INFO_1568 = record
+    sv1568_lockviolationoffset: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1568}
+  SERVER_INFO_1568 = _SERVER_INFO_1568;
+  {$EXTERNALSYM SERVER_INFO_1568}
+  TServerInfo1568 = SERVER_INFO_1568;
+  PServerInfo1568 = PSERVER_INFO_1568;
+
+  LPSERVER_INFO_1569 = ^SERVER_INFO_1569;
+  {$EXTERNALSYM LPSERVER_INFO_1569}
+  PSERVER_INFO_1569 = ^SERVER_INFO_1569;
+  {$EXTERNALSYM PSERVER_INFO_1569}
+  _SERVER_INFO_1569 = record
+    sv1569_lockviolationdelay: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1569}
+  SERVER_INFO_1569 = _SERVER_INFO_1569;
+  {$EXTERNALSYM SERVER_INFO_1569}
+  TServerInfo1569 = SERVER_INFO_1569;
+  PServerInfo1569 = PSERVER_INFO_1569;
+
+  LPSERVER_INFO_1570 = ^SERVER_INFO_1570;
+  {$EXTERNALSYM LPSERVER_INFO_1570}
+  PSERVER_INFO_1570 = ^SERVER_INFO_1570;
+  {$EXTERNALSYM PSERVER_INFO_1570}
+  _SERVER_INFO_1570 = record
+    sv1570_mdlreadswitchover: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1570}
+  SERVER_INFO_1570 = _SERVER_INFO_1570;
+  {$EXTERNALSYM SERVER_INFO_1570}
+  TServerInfo1570 = SERVER_INFO_1570;
+  PServerInfo1570 = PSERVER_INFO_1570;
+
+  LPSERVER_INFO_1571 = ^SERVER_INFO_1571;
+  {$EXTERNALSYM LPSERVER_INFO_1571}
+  PSERVER_INFO_1571 = ^SERVER_INFO_1571;
+  {$EXTERNALSYM PSERVER_INFO_1571}
+  _SERVER_INFO_1571 = record
+    sv1571_cachedopenlimit: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1571}
+  SERVER_INFO_1571 = _SERVER_INFO_1571;
+  {$EXTERNALSYM SERVER_INFO_1571}
+  TServerInfo1571 = SERVER_INFO_1571;
+  PServerInfo1571 = PSERVER_INFO_1571;
+
+  LPSERVER_INFO_1572 = ^SERVER_INFO_1572;
+  {$EXTERNALSYM LPSERVER_INFO_1572}
+  PSERVER_INFO_1572 = ^SERVER_INFO_1572;
+  {$EXTERNALSYM PSERVER_INFO_1572}
+  _SERVER_INFO_1572 = record
+    sv1572_criticalthreads: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1572}
+  SERVER_INFO_1572 = _SERVER_INFO_1572;
+  {$EXTERNALSYM SERVER_INFO_1572}
+  TServerInfo1572 = SERVER_INFO_1572;
+  PServerInfo1572 = PSERVER_INFO_1572;
+
+  LPSERVER_INFO_1573 = ^SERVER_INFO_1573;
+  {$EXTERNALSYM LPSERVER_INFO_1573}
+  PSERVER_INFO_1573 = ^SERVER_INFO_1573;
+  {$EXTERNALSYM PSERVER_INFO_1573}
+  _SERVER_INFO_1573 = record
+    sv1573_restrictnullsessaccess: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1573}
+  SERVER_INFO_1573 = _SERVER_INFO_1573;
+  {$EXTERNALSYM SERVER_INFO_1573}
+  TServerInfo1573 = SERVER_INFO_1573;
+  PServerInfo1573 = PSERVER_INFO_1573;
+
+  LPSERVER_INFO_1574 = ^SERVER_INFO_1574;
+  {$EXTERNALSYM LPSERVER_INFO_1574}
+  PSERVER_INFO_1574 = ^SERVER_INFO_1574;
+  {$EXTERNALSYM PSERVER_INFO_1574}
+  _SERVER_INFO_1574 = record
+    sv1574_enablewfw311directipx: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1574}
+  SERVER_INFO_1574 = _SERVER_INFO_1574;
+  {$EXTERNALSYM SERVER_INFO_1574}
+  TServerInfo1574 = SERVER_INFO_1574;
+  PServerInfo1574 = PSERVER_INFO_1574;
+
+  LPSERVER_INFO_1575 = ^SERVER_INFO_1575;
+  {$EXTERNALSYM LPSERVER_INFO_1575}
+  PSERVER_INFO_1575 = ^SERVER_INFO_1575;
+  {$EXTERNALSYM PSERVER_INFO_1575}
+  _SERVER_INFO_1575 = record
+    sv1575_otherqueueaffinity: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1575}
+  SERVER_INFO_1575 = _SERVER_INFO_1575;
+  {$EXTERNALSYM SERVER_INFO_1575}
+  TServerInfo1575 = SERVER_INFO_1575;
+  PServerInfo1575 = PSERVER_INFO_1575;
+
+  LPSERVER_INFO_1576 = ^SERVER_INFO_1576;
+  {$EXTERNALSYM LPSERVER_INFO_1576}
+  PSERVER_INFO_1576 = ^SERVER_INFO_1576;
+  {$EXTERNALSYM PSERVER_INFO_1576}
+  _SERVER_INFO_1576 = record
+    sv1576_queuesamplesecs: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1576}
+  SERVER_INFO_1576 = _SERVER_INFO_1576;
+  {$EXTERNALSYM SERVER_INFO_1576}
+  TServerInfo1576 = SERVER_INFO_1576;
+  PServerInfo1576 = PSERVER_INFO_1576;
+
+  LPSERVER_INFO_1577 = ^SERVER_INFO_1577;
+  {$EXTERNALSYM LPSERVER_INFO_1577}
+  PSERVER_INFO_1577 = ^SERVER_INFO_1577;
+  {$EXTERNALSYM PSERVER_INFO_1577}
+  _SERVER_INFO_1577 = record
+    sv1577_balancecount: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1577}
+  SERVER_INFO_1577 = _SERVER_INFO_1577;
+  {$EXTERNALSYM SERVER_INFO_1577}
+  TServerInfo1577 = SERVER_INFO_1577;
+  PServerInfo1577 = PSERVER_INFO_1577;
+
+  LPSERVER_INFO_1578 = ^SERVER_INFO_1578;
+  {$EXTERNALSYM LPSERVER_INFO_1578}
+  PSERVER_INFO_1578 = ^SERVER_INFO_1578;
+  {$EXTERNALSYM PSERVER_INFO_1578}
+  _SERVER_INFO_1578 = record
+    sv1578_preferredaffinity: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1578}
+  SERVER_INFO_1578 = _SERVER_INFO_1578;
+  {$EXTERNALSYM SERVER_INFO_1578}
+  TServerInfo1578 = SERVER_INFO_1578;
+  PServerInfo1578 = PSERVER_INFO_1578;
+
+  LPSERVER_INFO_1579 = ^SERVER_INFO_1579;
+  {$EXTERNALSYM LPSERVER_INFO_1579}
+  PSERVER_INFO_1579 = ^SERVER_INFO_1579;
+  {$EXTERNALSYM PSERVER_INFO_1579}
+  _SERVER_INFO_1579 = record
+    sv1579_maxfreerfcbs: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1579}
+  SERVER_INFO_1579 = _SERVER_INFO_1579;
+  {$EXTERNALSYM SERVER_INFO_1579}
+  TServerInfo1579 = SERVER_INFO_1579;
+  PServerInfo1579 = PSERVER_INFO_1579;
+
+  LPSERVER_INFO_1580 = ^SERVER_INFO_1580;
+  {$EXTERNALSYM LPSERVER_INFO_1580}
+  PSERVER_INFO_1580 = ^SERVER_INFO_1580;
+  {$EXTERNALSYM PSERVER_INFO_1580}
+  _SERVER_INFO_1580 = record
+    sv1580_maxfreemfcbs: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1580}
+  SERVER_INFO_1580 = _SERVER_INFO_1580;
+  {$EXTERNALSYM SERVER_INFO_1580}
+  TServerInfo1580 = SERVER_INFO_1580;
+  PServerInfo1580 = PSERVER_INFO_1580;
+
+  LPSERVER_INFO_1581 = ^SERVER_INFO_1581;
+  {$EXTERNALSYM LPSERVER_INFO_1581}
+  PSERVER_INFO_1581 = ^SERVER_INFO_1581;
+  {$EXTERNALSYM PSERVER_INFO_1581}
+  _SERVER_INFO_1581 = record
+    sv1581_maxfreemlcbs: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1581}
+  SERVER_INFO_1581 = _SERVER_INFO_1581;
+  {$EXTERNALSYM SERVER_INFO_1581}
+  TServerInfo1581 = SERVER_INFO_1581;
+  PServerInfo1581 = PSERVER_INFO_1581;
+
+  LPSERVER_INFO_1582 = ^SERVER_INFO_1582;
+  {$EXTERNALSYM LPSERVER_INFO_1582}
+  PSERVER_INFO_1582 = ^SERVER_INFO_1582;
+  {$EXTERNALSYM PSERVER_INFO_1582}
+  _SERVER_INFO_1582 = record
+    sv1582_maxfreepagedpoolchunks: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1582}
+  SERVER_INFO_1582 = _SERVER_INFO_1582;
+  {$EXTERNALSYM SERVER_INFO_1582}
+  TServerInfo1582 = SERVER_INFO_1582;
+  PServerInfo1582 = PSERVER_INFO_1582;
+
+  LPSERVER_INFO_1583 = ^SERVER_INFO_1583;
+  {$EXTERNALSYM LPSERVER_INFO_1583}
+  PSERVER_INFO_1583 = ^SERVER_INFO_1583;
+  {$EXTERNALSYM PSERVER_INFO_1583}
+  _SERVER_INFO_1583 = record
+    sv1583_minpagedpoolchunksize: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1583}
+  SERVER_INFO_1583 = _SERVER_INFO_1583;
+  {$EXTERNALSYM SERVER_INFO_1583}
+  TServerInfo1583 = SERVER_INFO_1583;
+  PServerInfo1583 = PSERVER_INFO_1583;
+
+  LPSERVER_INFO_1584 = ^SERVER_INFO_1584;
+  {$EXTERNALSYM LPSERVER_INFO_1584}
+  PSERVER_INFO_1584 = ^SERVER_INFO_1584;
+  {$EXTERNALSYM PSERVER_INFO_1584}
+  _SERVER_INFO_1584 = record
+    sv1584_maxpagedpoolchunksize: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1584}
+  SERVER_INFO_1584 = _SERVER_INFO_1584;
+  {$EXTERNALSYM SERVER_INFO_1584}
+  TServerInfo1584 = SERVER_INFO_1584;
+  PServerInfo1584 = PSERVER_INFO_1584;
+
+  LPSERVER_INFO_1585 = ^SERVER_INFO_1585;
+  {$EXTERNALSYM LPSERVER_INFO_1585}
+  PSERVER_INFO_1585 = ^SERVER_INFO_1585;
+  {$EXTERNALSYM PSERVER_INFO_1585}
+  _SERVER_INFO_1585 = record
+    sv1585_sendsfrompreferredprocessor: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1585}
+  SERVER_INFO_1585 = _SERVER_INFO_1585;
+  {$EXTERNALSYM SERVER_INFO_1585}
+  TServerInfo1585 = SERVER_INFO_1585;
+  PServerInfo1585 = PSERVER_INFO_1585;
+
+  LPSERVER_INFO_1586 = ^SERVER_INFO_1586;
+  {$EXTERNALSYM LPSERVER_INFO_1586}
+  PSERVER_INFO_1586 = ^SERVER_INFO_1586;
+  {$EXTERNALSYM PSERVER_INFO_1586}
+  _SERVER_INFO_1586 = record
+    sv1586_maxthreadsperqueue: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1586}
+  SERVER_INFO_1586 = _SERVER_INFO_1586;
+  {$EXTERNALSYM SERVER_INFO_1586}
+  TServerInfo1586 = SERVER_INFO_1586;
+  PServerInfo1586 = PSERVER_INFO_1586;
+
+  LPSERVER_INFO_1587 = ^SERVER_INFO_1587;
+  {$EXTERNALSYM LPSERVER_INFO_1587}
+  PSERVER_INFO_1587 = ^SERVER_INFO_1587;
+  {$EXTERNALSYM PSERVER_INFO_1587}
+  _SERVER_INFO_1587 = record
+    sv1587_cacheddirectorylimit: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1587}
+  SERVER_INFO_1587 = _SERVER_INFO_1587;
+  {$EXTERNALSYM SERVER_INFO_1587}
+  TServerInfo1587 = SERVER_INFO_1587;
+  PServerInfo1587 = PSERVER_INFO_1587;
+
+  LPSERVER_INFO_1588 = ^SERVER_INFO_1588;
+  {$EXTERNALSYM LPSERVER_INFO_1588}
+  PSERVER_INFO_1588 = ^SERVER_INFO_1588;
+  {$EXTERNALSYM PSERVER_INFO_1588}
+  _SERVER_INFO_1588 = record
+    sv1588_maxcopylength: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1588}
+  SERVER_INFO_1588 = _SERVER_INFO_1588;
+  {$EXTERNALSYM SERVER_INFO_1588}
+  TServerInfo1588 = SERVER_INFO_1588;
+  PServerInfo1588 = PSERVER_INFO_1588;
+
+  LPSERVER_INFO_1590 = ^SERVER_INFO_1590;
+  {$EXTERNALSYM LPSERVER_INFO_1590}
+  PSERVER_INFO_1590 = ^SERVER_INFO_1590;
+  {$EXTERNALSYM PSERVER_INFO_1590}
+  _SERVER_INFO_1590 = record
+    sv1590_enablecompression: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1590}
+  SERVER_INFO_1590 = _SERVER_INFO_1590;
+  {$EXTERNALSYM SERVER_INFO_1590}
+  TServerInfo1590 = SERVER_INFO_1590;
+  PServerInfo1590 = PSERVER_INFO_1590;
+
+  LPSERVER_INFO_1591 = ^SERVER_INFO_1591;
+  {$EXTERNALSYM LPSERVER_INFO_1591}
+  PSERVER_INFO_1591 = ^SERVER_INFO_1591;
+  {$EXTERNALSYM PSERVER_INFO_1591}
+  _SERVER_INFO_1591 = record
+    sv1591_autosharewks: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1591}
+  SERVER_INFO_1591 = _SERVER_INFO_1591;
+  {$EXTERNALSYM SERVER_INFO_1591}
+  TServerInfo1591 = SERVER_INFO_1591;
+  PServerInfo1591 = PSERVER_INFO_1591;
+
+  LPSERVER_INFO_1592 = ^SERVER_INFO_1592;
+  {$EXTERNALSYM LPSERVER_INFO_1592}
+  PSERVER_INFO_1592 = ^SERVER_INFO_1592;
+  {$EXTERNALSYM PSERVER_INFO_1592}
+  _SERVER_INFO_1592 = record
+    sv1592_autosharewks: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1592}
+  SERVER_INFO_1592 = _SERVER_INFO_1592;
+  {$EXTERNALSYM SERVER_INFO_1592}
+  TServerInfo1592 = SERVER_INFO_1592;
+  PServerInfo1592 = PSERVER_INFO_1592;
+
+  LPSERVER_INFO_1593 = ^SERVER_INFO_1593;
+  {$EXTERNALSYM LPSERVER_INFO_1593}
+  PSERVER_INFO_1593 = ^SERVER_INFO_1593;
+  {$EXTERNALSYM PSERVER_INFO_1593}
+  _SERVER_INFO_1593 = record
+    sv1593_enablesecuritysignature: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1593}
+  SERVER_INFO_1593 = _SERVER_INFO_1593;
+  {$EXTERNALSYM SERVER_INFO_1593}
+  TServerInfo1593 = SERVER_INFO_1593;
+  PServerInfo1593 = PSERVER_INFO_1593;
+
+  LPSERVER_INFO_1594 = ^SERVER_INFO_1594;
+  {$EXTERNALSYM LPSERVER_INFO_1594}
+  PSERVER_INFO_1594 = ^SERVER_INFO_1594;
+  {$EXTERNALSYM PSERVER_INFO_1594}
+  _SERVER_INFO_1594 = record
+    sv1594_requiresecuritysignature: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1594}
+  SERVER_INFO_1594 = _SERVER_INFO_1594;
+  {$EXTERNALSYM SERVER_INFO_1594}
+  TServerInfo1594 = SERVER_INFO_1594;
+  PServerInfo1594 = PSERVER_INFO_1594;
+
+  LPSERVER_INFO_1595 = ^SERVER_INFO_1595;
+  {$EXTERNALSYM LPSERVER_INFO_1595}
+  PSERVER_INFO_1595 = ^SERVER_INFO_1595;
+  {$EXTERNALSYM PSERVER_INFO_1595}
+  _SERVER_INFO_1595 = record
+    sv1595_minclientbuffersize: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1595}
+  SERVER_INFO_1595 = _SERVER_INFO_1595;
+  {$EXTERNALSYM SERVER_INFO_1595}
+  TServerInfo1595 = SERVER_INFO_1595;
+  PServerInfo1595 = PSERVER_INFO_1595;
+
+  LPSERVER_INFO_1596 = ^SERVER_INFO_1596;
+  {$EXTERNALSYM LPSERVER_INFO_1596}
+  PSERVER_INFO_1596 = ^SERVER_INFO_1596;
+  {$EXTERNALSYM PSERVER_INFO_1596}
+  _SERVER_INFO_1596 = record
+    sv1596_ConnectionNoSessionsTimeout: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1596}
+  SERVER_INFO_1596 = _SERVER_INFO_1596;
+  {$EXTERNALSYM SERVER_INFO_1596}
+  TServerInfo1596 = SERVER_INFO_1596;
+  PServerInfo1596 = PSERVER_INFO_1596;
+
+  LPSERVER_INFO_1597 = ^SERVER_INFO_1597;
+  {$EXTERNALSYM LPSERVER_INFO_1597}
+  PSERVER_INFO_1597 = ^SERVER_INFO_1597;
+  {$EXTERNALSYM PSERVER_INFO_1597}
+  _SERVER_INFO_1597 = record
+    sv1597_IdleThreadTimeOut: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1597}
+  SERVER_INFO_1597 = _SERVER_INFO_1597;
+  {$EXTERNALSYM SERVER_INFO_1597}
+  TServerInfo1597 = SERVER_INFO_1597;
+  PServerInfo1597 = PSERVER_INFO_1597;
+
+  LPSERVER_INFO_1598 = ^SERVER_INFO_1598;
+  {$EXTERNALSYM LPSERVER_INFO_1598}
+  PSERVER_INFO_1598 = ^SERVER_INFO_1598;
+  {$EXTERNALSYM PSERVER_INFO_1598}
+  _SERVER_INFO_1598 = record
+    sv1598_enableW9xsecuritysignature: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1598}
+  SERVER_INFO_1598 = _SERVER_INFO_1598;
+  {$EXTERNALSYM SERVER_INFO_1598}
+  TServerInfo1598 = SERVER_INFO_1598;
+  PServerInfo1598 = PSERVER_INFO_1598;
+
+  LPSERVER_INFO_1599 = ^SERVER_INFO_1599;
+  {$EXTERNALSYM LPSERVER_INFO_1599}
+  PSERVER_INFO_1599 = ^SERVER_INFO_1599;
+  {$EXTERNALSYM PSERVER_INFO_1599}
+  _SERVER_INFO_1599 = record
+    sv1598_enforcekerberosreauthentication: BOOLEAN;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1599}
+  SERVER_INFO_1599 = _SERVER_INFO_1599;
+  {$EXTERNALSYM SERVER_INFO_1599}
+  TServerInfo1599 = SERVER_INFO_1599;
+  PServerInfo1599 = PSERVER_INFO_1599;
+
+  LPSERVER_INFO_1600 = ^SERVER_INFO_1600;
+  {$EXTERNALSYM LPSERVER_INFO_1600}
+  PSERVER_INFO_1600 = ^SERVER_INFO_1600;
+  {$EXTERNALSYM PSERVER_INFO_1600}
+  _SERVER_INFO_1600 = record
+    sv1598_disabledos: BOOLEAN;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1600}
+  SERVER_INFO_1600 = _SERVER_INFO_1600;
+  {$EXTERNALSYM SERVER_INFO_1600}
+  TServerInfo1600 = SERVER_INFO_1600;
+  PServerInfo1600 = PSERVER_INFO_1600;
+
+  LPSERVER_INFO_1601 = ^SERVER_INFO_1601;
+  {$EXTERNALSYM LPSERVER_INFO_1601}
+  PSERVER_INFO_1601 = ^SERVER_INFO_1601;
+  {$EXTERNALSYM PSERVER_INFO_1601}
+  _SERVER_INFO_1601 = record
+    sv1598_lowdiskspaceminimum: DWORD;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1601}
+  SERVER_INFO_1601 = _SERVER_INFO_1601;
+  {$EXTERNALSYM SERVER_INFO_1601}
+  TServerInfo1601 = SERVER_INFO_1601;
+  PServerInfo1601 = PSERVER_INFO_1601;
+
+  LPSERVER_INFO_1602 = ^SERVER_INFO_1602;
+  {$EXTERNALSYM LPSERVER_INFO_1602}
+  PSERVER_INFO_1602 = ^SERVER_INFO_1602;
+  {$EXTERNALSYM PSERVER_INFO_1602}
+  _SERVER_INFO_1602 = record
+    sv_1598_disablestrictnamechecking: BOOL;
+  end;
+  {$EXTERNALSYM _SERVER_INFO_1602}
+  SERVER_INFO_1602 = _SERVER_INFO_1602;
+  {$EXTERNALSYM SERVER_INFO_1602}
+  TServerInfo1602 = SERVER_INFO_1602;
+  PServerInfo1602 = PSERVER_INFO_1602;
+
+//
+// A special structure definition is required in order for this
+// structure to work with RPC.  The problem is that having addresslength
+// indicate the number of bytes in address means that RPC must know the
+// link between the two.
+//
+
+  LPSERVER_TRANSPORT_INFO_0 = ^SERVER_TRANSPORT_INFO_0;
+  {$EXTERNALSYM LPSERVER_TRANSPORT_INFO_0}
+  PSERVER_TRANSPORT_INFO_0 = ^SERVER_TRANSPORT_INFO_0;
+  {$EXTERNALSYM PSERVER_TRANSPORT_INFO_0}
+  _SERVER_TRANSPORT_INFO_0 = record
+    svti0_numberofvcs: DWORD;
+    svti0_transportname: LMSTR;
+    svti0_transportaddress: LPBYTE;
+    svti0_transportaddresslength: DWORD;
+    svti0_networkaddress: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_TRANSPORT_INFO_0}
+  SERVER_TRANSPORT_INFO_0 = _SERVER_TRANSPORT_INFO_0;
+  {$EXTERNALSYM SERVER_TRANSPORT_INFO_0}
+  TServerTransportInfo0 = SERVER_TRANSPORT_INFO_0;
+  PServerTransportInfo0 = PSERVER_TRANSPORT_INFO_0;
+
+  LPSERVER_TRANSPORT_INFO_1 = ^SERVER_TRANSPORT_INFO_1;
+  {$EXTERNALSYM LPSERVER_TRANSPORT_INFO_1}
+  PSERVER_TRANSPORT_INFO_1 = ^SERVER_TRANSPORT_INFO_1;
+  {$EXTERNALSYM PSERVER_TRANSPORT_INFO_1}
+  _SERVER_TRANSPORT_INFO_1 = record
+    svti1_numberofvcs: DWORD;
+    svti1_transportname: LMSTR;
+    svti1_transportaddress: LPBYTE;
+    svti1_transportaddresslength: DWORD;
+    svti1_networkaddress: LMSTR;
+    svti1_domain: LMSTR;
+  end;
+  {$EXTERNALSYM _SERVER_TRANSPORT_INFO_1}
+  SERVER_TRANSPORT_INFO_1 = _SERVER_TRANSPORT_INFO_1;
+  {$EXTERNALSYM SERVER_TRANSPORT_INFO_1}
+  TServerTransportInfo1 = SERVER_TRANSPORT_INFO_1;
+  PServerTransportInfo1 = PSERVER_TRANSPORT_INFO_1;
+
+  LPSERVER_TRANSPORT_INFO_2 = ^SERVER_TRANSPORT_INFO_2;
+  {$EXTERNALSYM LPSERVER_TRANSPORT_INFO_2}
+  PSERVER_TRANSPORT_INFO_2 = ^SERVER_TRANSPORT_INFO_2;
+  {$EXTERNALSYM PSERVER_TRANSPORT_INFO_2}
+  _SERVER_TRANSPORT_INFO_2 = record
+    svti2_numberofvcs: DWORD;
+    svti2_transportname: LMSTR;
+    svti2_transportaddress: LPBYTE;
+    svti2_transportaddresslength: DWORD;
+    svti2_networkaddress: LMSTR;
+    svti2_domain: LMSTR;
+    svti2_flags: ULONG;
+  end;
+  {$EXTERNALSYM _SERVER_TRANSPORT_INFO_2}
+  SERVER_TRANSPORT_INFO_2 = _SERVER_TRANSPORT_INFO_2;
+  {$EXTERNALSYM SERVER_TRANSPORT_INFO_2}
+  TServerTransportInfo2 = SERVER_TRANSPORT_INFO_2;
+  PServerTransportInfo2 = PSERVER_TRANSPORT_INFO_2;
+
+  LPSERVER_TRANSPORT_INFO_3 = ^SERVER_TRANSPORT_INFO_3;
+  {$EXTERNALSYM LPSERVER_TRANSPORT_INFO_3}
+  PSERVER_TRANSPORT_INFO_3 = ^SERVER_TRANSPORT_INFO_3;
+  {$EXTERNALSYM PSERVER_TRANSPORT_INFO_3}
+  _SERVER_TRANSPORT_INFO_3 = record
+    svti3_numberofvcs: DWORD;
+    svti3_transportname: LMSTR;
+    svti3_transportaddress: LPBYTE;
+    svti3_transportaddresslength: DWORD;
+    svti3_networkaddress: LMSTR;
+    svti3_domain: LMSTR;
+    svti3_flags: ULONG;
+    svti3_passwordlength: DWORD;
+    svti3_password: array [0..256 - 1] of BYTE;
+  end;
+  {$EXTERNALSYM _SERVER_TRANSPORT_INFO_3}
+  SERVER_TRANSPORT_INFO_3 = _SERVER_TRANSPORT_INFO_3;
+  {$EXTERNALSYM SERVER_TRANSPORT_INFO_3}
+  TServerTransportInfo3 = SERVER_TRANSPORT_INFO_3;
+  PServerTransportInfo3 = PSERVER_TRANSPORT_INFO_3;
+
+//
+// Defines - SERVER
+//
+
+//
+// The platform ID indicates the levels to use for platform-specific
+// information.
+//
+
+const
+  SV_PLATFORM_ID_OS2 = 400;
+  {$EXTERNALSYM SV_PLATFORM_ID_OS2}
+  SV_PLATFORM_ID_NT  = 500;
+  {$EXTERNALSYM SV_PLATFORM_ID_NT}
+
+//
+//      Mask to be applied to svX_version_major in order to obtain
+//      the major version number.
+//
+
+  MAJOR_VERSION_MASK = $0F;
+  {$EXTERNALSYM MAJOR_VERSION_MASK}
+
+//
+//      Bit-mapped values for svX_type fields. X = 1, 2 or 3.
+//
+
+  SV_TYPE_WORKSTATION       = $00000001;
+  {$EXTERNALSYM SV_TYPE_WORKSTATION}
+  SV_TYPE_SERVER            = $00000002;
+  {$EXTERNALSYM SV_TYPE_SERVER}
+  SV_TYPE_SQLSERVER         = $00000004;
+  {$EXTERNALSYM SV_TYPE_SQLSERVER}
+  SV_TYPE_DOMAIN_CTRL       = $00000008;
+  {$EXTERNALSYM SV_TYPE_DOMAIN_CTRL}
+  SV_TYPE_DOMAIN_BAKCTRL    = $00000010;
+  {$EXTERNALSYM SV_TYPE_DOMAIN_BAKCTRL}
+  SV_TYPE_TIME_SOURCE       = $00000020;
+  {$EXTERNALSYM SV_TYPE_TIME_SOURCE}
+  SV_TYPE_AFP               = $00000040;
+  {$EXTERNALSYM SV_TYPE_AFP}
+  SV_TYPE_NOVELL            = $00000080;
+  {$EXTERNALSYM SV_TYPE_NOVELL}
+  SV_TYPE_DOMAIN_MEMBER     = $00000100;
+  {$EXTERNALSYM SV_TYPE_DOMAIN_MEMBER}
+  SV_TYPE_PRINTQ_SERVER     = $00000200;
+  {$EXTERNALSYM SV_TYPE_PRINTQ_SERVER}
+  SV_TYPE_DIALIN_SERVER     = $00000400;
+  {$EXTERNALSYM SV_TYPE_DIALIN_SERVER}
+  SV_TYPE_XENIX_SERVER      = $00000800;
+  {$EXTERNALSYM SV_TYPE_XENIX_SERVER}
+  SV_TYPE_SERVER_UNIX       = SV_TYPE_XENIX_SERVER;
+  {$EXTERNALSYM SV_TYPE_SERVER_UNIX}
+  SV_TYPE_NT                = $00001000;
+  {$EXTERNALSYM SV_TYPE_NT}
+  SV_TYPE_WFW               = $00002000;
+  {$EXTERNALSYM SV_TYPE_WFW}
+  SV_TYPE_SERVER_MFPN       = $00004000;
+  {$EXTERNALSYM SV_TYPE_SERVER_MFPN}
+  SV_TYPE_SERVER_NT         = $00008000;
+  {$EXTERNALSYM SV_TYPE_SERVER_NT}
+  SV_TYPE_POTENTIAL_BROWSER = $00010000;
+  {$EXTERNALSYM SV_TYPE_POTENTIAL_BROWSER}
+  SV_TYPE_BACKUP_BROWSER    = $00020000;
+  {$EXTERNALSYM SV_TYPE_BACKUP_BROWSER}
+  SV_TYPE_MASTER_BROWSER    = $00040000;
+  {$EXTERNALSYM SV_TYPE_MASTER_BROWSER}
+  SV_TYPE_DOMAIN_MASTER     = $00080000;
+  {$EXTERNALSYM SV_TYPE_DOMAIN_MASTER}
+  SV_TYPE_SERVER_OSF        = $00100000;
+  {$EXTERNALSYM SV_TYPE_SERVER_OSF}
+  SV_TYPE_SERVER_VMS        = $00200000;
+  {$EXTERNALSYM SV_TYPE_SERVER_VMS}
+  SV_TYPE_WINDOWS           = $00400000; // Windows95 and above
+  {$EXTERNALSYM SV_TYPE_WINDOWS}
+  SV_TYPE_DFS               = $00800000; // Root of a DFS tree
+  {$EXTERNALSYM SV_TYPE_DFS}
+  SV_TYPE_CLUSTER_NT        = $01000000; // NT Cluster
+  {$EXTERNALSYM SV_TYPE_CLUSTER_NT}
+  SV_TYPE_TERMINALSERVER    = $02000000; // Terminal Server(Hydra)
+  {$EXTERNALSYM SV_TYPE_TERMINALSERVER}
+  SV_TYPE_CLUSTER_VS_NT     = $04000000; // NT Cluster Virtual Server Name
+  {$EXTERNALSYM SV_TYPE_CLUSTER_VS_NT}
+  SV_TYPE_DCE               = $10000000; // IBM DSS (Directory and Security Services) or equivalent
+  {$EXTERNALSYM SV_TYPE_DCE}
+  SV_TYPE_ALTERNATE_XPORT   = $20000000; // return list for alternate transport
+  {$EXTERNALSYM SV_TYPE_ALTERNATE_XPORT}
+  SV_TYPE_LOCAL_LIST_ONLY   = $40000000; // Return local list only
+  {$EXTERNALSYM SV_TYPE_LOCAL_LIST_ONLY}
+  SV_TYPE_DOMAIN_ENUM       = DWORD($80000000);
+  {$EXTERNALSYM SV_TYPE_DOMAIN_ENUM}
+  SV_TYPE_ALL               = DWORD($FFFFFFFF); // handy for NetServerEnum2
+  {$EXTERNALSYM SV_TYPE_ALL}
+
+//
+//      Special value for sv102_disc that specifies infinite disconnect
+//      time.
+//
+
+  SV_NODISC = DWORD(-1); // No autodisconnect timeout enforced
+  {$EXTERNALSYM SV_NODISC}
+
+//
+//      Values of svX_security field. X = 2 or 3.
+//
+
+  SV_USERSECURITY  = 1;
+  {$EXTERNALSYM SV_USERSECURITY}
+  SV_SHARESECURITY = 0;
+  {$EXTERNALSYM SV_SHARESECURITY}
+
+//
+//      Values of svX_hidden field. X = 2 or 3.
+//
+
+  SV_HIDDEN  = 1;
+  {$EXTERNALSYM SV_HIDDEN}
+  SV_VISIBLE = 0;
+  {$EXTERNALSYM SV_VISIBLE}
+
+//
+//      Values for ParmError parameter to NetServerSetInfo.
+//
+
+  SV_PLATFORM_ID_PARMNUM   = 101;
+  {$EXTERNALSYM SV_PLATFORM_ID_PARMNUM}
+  SV_NAME_PARMNUM          = 102;
+  {$EXTERNALSYM SV_NAME_PARMNUM}
+  SV_VERSION_MAJOR_PARMNUM = 103;
+  {$EXTERNALSYM SV_VERSION_MAJOR_PARMNUM}
+  SV_VERSION_MINOR_PARMNUM = 104;
+  {$EXTERNALSYM SV_VERSION_MINOR_PARMNUM}
+  SV_TYPE_PARMNUM          = 105;
+  {$EXTERNALSYM SV_TYPE_PARMNUM}
+  SV_COMMENT_PARMNUM       = 5;
+  {$EXTERNALSYM SV_COMMENT_PARMNUM}
+  SV_USERS_PARMNUM         = 107;
+  {$EXTERNALSYM SV_USERS_PARMNUM}
+  SV_DISC_PARMNUM          = 10;
+  {$EXTERNALSYM SV_DISC_PARMNUM}
+  SV_HIDDEN_PARMNUM        = 16;
+  {$EXTERNALSYM SV_HIDDEN_PARMNUM}
+  SV_ANNOUNCE_PARMNUM      = 17;
+  {$EXTERNALSYM SV_ANNOUNCE_PARMNUM}
+  SV_ANNDELTA_PARMNUM      = 18;
+  {$EXTERNALSYM SV_ANNDELTA_PARMNUM}
+  SV_USERPATH_PARMNUM      = 112;
+  {$EXTERNALSYM SV_USERPATH_PARMNUM}
+
+  SV_ULIST_MTIME_PARMNUM   = 401;
+  {$EXTERNALSYM SV_ULIST_MTIME_PARMNUM}
+  SV_GLIST_MTIME_PARMNUM   = 402;
+  {$EXTERNALSYM SV_GLIST_MTIME_PARMNUM}
+  SV_ALIST_MTIME_PARMNUM   = 403;
+  {$EXTERNALSYM SV_ALIST_MTIME_PARMNUM}
+  SV_ALERTS_PARMNUM        = 11;
+  {$EXTERNALSYM SV_ALERTS_PARMNUM}
+  SV_SECURITY_PARMNUM      = 405;
+  {$EXTERNALSYM SV_SECURITY_PARMNUM}
+  SV_NUMADMIN_PARMNUM      = 406;
+  {$EXTERNALSYM SV_NUMADMIN_PARMNUM}
+  SV_LANMASK_PARMNUM       = 407;
+  {$EXTERNALSYM SV_LANMASK_PARMNUM}
+  SV_GUESTACC_PARMNUM      = 408;
+  {$EXTERNALSYM SV_GUESTACC_PARMNUM}
+  SV_CHDEVQ_PARMNUM        = 410;
+  {$EXTERNALSYM SV_CHDEVQ_PARMNUM}
+  SV_CHDEVJOBS_PARMNUM     = 411;
+  {$EXTERNALSYM SV_CHDEVJOBS_PARMNUM}
+  SV_CONNECTIONS_PARMNUM   = 412;
+  {$EXTERNALSYM SV_CONNECTIONS_PARMNUM}
+  SV_SHARES_PARMNUM        = 413;
+  {$EXTERNALSYM SV_SHARES_PARMNUM}
+  SV_OPENFILES_PARMNUM     = 414;
+  {$EXTERNALSYM SV_OPENFILES_PARMNUM}
+  SV_SESSREQS_PARMNUM      = 417;
+  {$EXTERNALSYM SV_SESSREQS_PARMNUM}
+  SV_ACTIVELOCKS_PARMNUM   = 419;
+  {$EXTERNALSYM SV_ACTIVELOCKS_PARMNUM}
+  SV_NUMREQBUF_PARMNUM     = 420;
+  {$EXTERNALSYM SV_NUMREQBUF_PARMNUM}
+  SV_NUMBIGBUF_PARMNUM     = 422;
+  {$EXTERNALSYM SV_NUMBIGBUF_PARMNUM}
+  SV_NUMFILETASKS_PARMNUM  = 423;
+  {$EXTERNALSYM SV_NUMFILETASKS_PARMNUM}
+  SV_ALERTSCHED_PARMNUM    = 37;
+  {$EXTERNALSYM SV_ALERTSCHED_PARMNUM}
+  SV_ERRORALERT_PARMNUM    = 38;
+  {$EXTERNALSYM SV_ERRORALERT_PARMNUM}
+  SV_LOGONALERT_PARMNUM    = 39;
+  {$EXTERNALSYM SV_LOGONALERT_PARMNUM}
+  SV_ACCESSALERT_PARMNUM   = 40;
+  {$EXTERNALSYM SV_ACCESSALERT_PARMNUM}
+  SV_DISKALERT_PARMNUM     = 41;
+  {$EXTERNALSYM SV_DISKALERT_PARMNUM}
+  SV_NETIOALERT_PARMNUM    = 42;
+  {$EXTERNALSYM SV_NETIOALERT_PARMNUM}
+  SV_MAXAUDITSZ_PARMNUM    = 43;
+  {$EXTERNALSYM SV_MAXAUDITSZ_PARMNUM}
+  SV_SRVHEURISTICS_PARMNUM = 431;
+  {$EXTERNALSYM SV_SRVHEURISTICS_PARMNUM}
+
+  SV_SESSOPENS_PARMNUM                       = 501;
+  {$EXTERNALSYM SV_SESSOPENS_PARMNUM}
+  SV_SESSVCS_PARMNUM                         = 502;
+  {$EXTERNALSYM SV_SESSVCS_PARMNUM}
+  SV_OPENSEARCH_PARMNUM                      = 503;
+  {$EXTERNALSYM SV_OPENSEARCH_PARMNUM}
+  SV_SIZREQBUF_PARMNUM                       = 504;
+  {$EXTERNALSYM SV_SIZREQBUF_PARMNUM}
+  SV_INITWORKITEMS_PARMNUM                   = 505;
+  {$EXTERNALSYM SV_INITWORKITEMS_PARMNUM}
+  SV_MAXWORKITEMS_PARMNUM                    = 506;
+  {$EXTERNALSYM SV_MAXWORKITEMS_PARMNUM}
+  SV_RAWWORKITEMS_PARMNUM                    = 507;
+  {$EXTERNALSYM SV_RAWWORKITEMS_PARMNUM}
+  SV_IRPSTACKSIZE_PARMNUM                    = 508;
+  {$EXTERNALSYM SV_IRPSTACKSIZE_PARMNUM}
+  SV_MAXRAWBUFLEN_PARMNUM                    = 509;
+  {$EXTERNALSYM SV_MAXRAWBUFLEN_PARMNUM}
+  SV_SESSUSERS_PARMNUM                       = 510;
+  {$EXTERNALSYM SV_SESSUSERS_PARMNUM}
+  SV_SESSCONNS_PARMNUM                       = 511;
+  {$EXTERNALSYM SV_SESSCONNS_PARMNUM}
+  SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM          = 512;
+  {$EXTERNALSYM SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM}
+  SV_MAXPAGEDMEMORYUSAGE_PARMNUM             = 513;
+  {$EXTERNALSYM SV_MAXPAGEDMEMORYUSAGE_PARMNUM}
+  SV_ENABLESOFTCOMPAT_PARMNUM                = 514;
+  {$EXTERNALSYM SV_ENABLESOFTCOMPAT_PARMNUM}
+  SV_ENABLEFORCEDLOGOFF_PARMNUM              = 515;
+  {$EXTERNALSYM SV_ENABLEFORCEDLOGOFF_PARMNUM}
+  SV_TIMESOURCE_PARMNUM                      = 516;
+  {$EXTERNALSYM SV_TIMESOURCE_PARMNUM}
+  SV_ACCEPTDOWNLEVELAPIS_PARMNUM             = 517;
+  {$EXTERNALSYM SV_ACCEPTDOWNLEVELAPIS_PARMNUM}
+  SV_LMANNOUNCE_PARMNUM                      = 518;
+  {$EXTERNALSYM SV_LMANNOUNCE_PARMNUM}
+  SV_DOMAIN_PARMNUM                          = 519;
+  {$EXTERNALSYM SV_DOMAIN_PARMNUM}
+  SV_MAXCOPYREADLEN_PARMNUM                  = 520;
+  {$EXTERNALSYM SV_MAXCOPYREADLEN_PARMNUM}
+  SV_MAXCOPYWRITELEN_PARMNUM                 = 521;
+  {$EXTERNALSYM SV_MAXCOPYWRITELEN_PARMNUM}
+  SV_MINKEEPSEARCH_PARMNUM                   = 522;
+  {$EXTERNALSYM SV_MINKEEPSEARCH_PARMNUM}
+  SV_MAXKEEPSEARCH_PARMNUM                   = 523;
+  {$EXTERNALSYM SV_MAXKEEPSEARCH_PARMNUM}
+  SV_MINKEEPCOMPLSEARCH_PARMNUM              = 524;
+  {$EXTERNALSYM SV_MINKEEPCOMPLSEARCH_PARMNUM}
+  SV_MAXKEEPCOMPLSEARCH_PARMNUM              = 525;
+  {$EXTERNALSYM SV_MAXKEEPCOMPLSEARCH_PARMNUM}
+  SV_THREADCOUNTADD_PARMNUM                  = 526;
+  {$EXTERNALSYM SV_THREADCOUNTADD_PARMNUM}
+  SV_NUMBLOCKTHREADS_PARMNUM                 = 527;
+  {$EXTERNALSYM SV_NUMBLOCKTHREADS_PARMNUM}
+  SV_SCAVTIMEOUT_PARMNUM                     = 528;
+  {$EXTERNALSYM SV_SCAVTIMEOUT_PARMNUM}
+  SV_MINRCVQUEUE_PARMNUM                     = 529;
+  {$EXTERNALSYM SV_MINRCVQUEUE_PARMNUM}
+  SV_MINFREEWORKITEMS_PARMNUM                = 530;
+  {$EXTERNALSYM SV_MINFREEWORKITEMS_PARMNUM}
+  SV_XACTMEMSIZE_PARMNUM                     = 531;
+  {$EXTERNALSYM SV_XACTMEMSIZE_PARMNUM}
+  SV_THREADPRIORITY_PARMNUM                  = 532;
+  {$EXTERNALSYM SV_THREADPRIORITY_PARMNUM}
+  SV_MAXMPXCT_PARMNUM                        = 533;
+  {$EXTERNALSYM SV_MAXMPXCT_PARMNUM}
+  SV_OPLOCKBREAKWAIT_PARMNUM                 = 534;
+  {$EXTERNALSYM SV_OPLOCKBREAKWAIT_PARMNUM}
+  SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM         = 535;
+  {$EXTERNALSYM SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM}
+  SV_ENABLEOPLOCKS_PARMNUM                   = 536;
+  {$EXTERNALSYM SV_ENABLEOPLOCKS_PARMNUM}
+  SV_ENABLEOPLOCKFORCECLOSE_PARMNUM          = 537;
+  {$EXTERNALSYM SV_ENABLEOPLOCKFORCECLOSE_PARMNUM}
+  SV_ENABLEFCBOPENS_PARMNUM                  = 538;
+  {$EXTERNALSYM SV_ENABLEFCBOPENS_PARMNUM}
+  SV_ENABLERAW_PARMNUM                       = 539;
+  {$EXTERNALSYM SV_ENABLERAW_PARMNUM}
+  SV_ENABLESHAREDNETDRIVES_PARMNUM           = 540;
+  {$EXTERNALSYM SV_ENABLESHAREDNETDRIVES_PARMNUM}
+  SV_MINFREECONNECTIONS_PARMNUM              = 541;
+  {$EXTERNALSYM SV_MINFREECONNECTIONS_PARMNUM}
+  SV_MAXFREECONNECTIONS_PARMNUM              = 542;
+  {$EXTERNALSYM SV_MAXFREECONNECTIONS_PARMNUM}
+  SV_INITSESSTABLE_PARMNUM                   = 543;
+  {$EXTERNALSYM SV_INITSESSTABLE_PARMNUM}
+  SV_INITCONNTABLE_PARMNUM                   = 544;
+  {$EXTERNALSYM SV_INITCONNTABLE_PARMNUM}
+  SV_INITFILETABLE_PARMNUM                   = 545;
+  {$EXTERNALSYM SV_INITFILETABLE_PARMNUM}
+  SV_INITSEARCHTABLE_PARMNUM                 = 546;
+  {$EXTERNALSYM SV_INITSEARCHTABLE_PARMNUM}
+  SV_ALERTSCHEDULE_PARMNUM                   = 547;
+  {$EXTERNALSYM SV_ALERTSCHEDULE_PARMNUM}
+  SV_ERRORTHRESHOLD_PARMNUM                  = 548;
+  {$EXTERNALSYM SV_ERRORTHRESHOLD_PARMNUM}
+  SV_NETWORKERRORTHRESHOLD_PARMNUM           = 549;
+  {$EXTERNALSYM SV_NETWORKERRORTHRESHOLD_PARMNUM}
+  SV_DISKSPACETHRESHOLD_PARMNUM              = 550;
+  {$EXTERNALSYM SV_DISKSPACETHRESHOLD_PARMNUM}
+  SV_MAXLINKDELAY_PARMNUM                    = 552;
+  {$EXTERNALSYM SV_MAXLINKDELAY_PARMNUM}
+  SV_MINLINKTHROUGHPUT_PARMNUM               = 553;
+  {$EXTERNALSYM SV_MINLINKTHROUGHPUT_PARMNUM}
+  SV_LINKINFOVALIDTIME_PARMNUM               = 554;
+  {$EXTERNALSYM SV_LINKINFOVALIDTIME_PARMNUM}
+  SV_SCAVQOSINFOUPDATETIME_PARMNUM           = 555;
+  {$EXTERNALSYM SV_SCAVQOSINFOUPDATETIME_PARMNUM}
+  SV_MAXWORKITEMIDLETIME_PARMNUM             = 556;
+  {$EXTERNALSYM SV_MAXWORKITEMIDLETIME_PARMNUM}
+  SV_MAXRAWWORKITEMS_PARMNUM                 = 557;
+  {$EXTERNALSYM SV_MAXRAWWORKITEMS_PARMNUM}
+  SV_PRODUCTTYPE_PARMNUM                     = 560;
+  {$EXTERNALSYM SV_PRODUCTTYPE_PARMNUM}
+  SV_SERVERSIZE_PARMNUM                      = 561;
+  {$EXTERNALSYM SV_SERVERSIZE_PARMNUM}
+  SV_CONNECTIONLESSAUTODISC_PARMNUM          = 562;
+  {$EXTERNALSYM SV_CONNECTIONLESSAUTODISC_PARMNUM}
+  SV_SHARINGVIOLATIONRETRIES_PARMNUM         = 563;
+  {$EXTERNALSYM SV_SHARINGVIOLATIONRETRIES_PARMNUM}
+  SV_SHARINGVIOLATIONDELAY_PARMNUM           = 564;
+  {$EXTERNALSYM SV_SHARINGVIOLATIONDELAY_PARMNUM}
+  SV_MAXGLOBALOPENSEARCH_PARMNUM             = 565;
+  {$EXTERNALSYM SV_MAXGLOBALOPENSEARCH_PARMNUM}
+  SV_REMOVEDUPLICATESEARCHES_PARMNUM         = 566;
+  {$EXTERNALSYM SV_REMOVEDUPLICATESEARCHES_PARMNUM}
+  SV_LOCKVIOLATIONRETRIES_PARMNUM            = 567;
+  {$EXTERNALSYM SV_LOCKVIOLATIONRETRIES_PARMNUM}
+  SV_LOCKVIOLATIONOFFSET_PARMNUM             = 568;
+  {$EXTERNALSYM SV_LOCKVIOLATIONOFFSET_PARMNUM}
+  SV_LOCKVIOLATIONDELAY_PARMNUM              = 569;
+  {$EXTERNALSYM SV_LOCKVIOLATIONDELAY_PARMNUM}
+  SV_MDLREADSWITCHOVER_PARMNUM               = 570;
+  {$EXTERNALSYM SV_MDLREADSWITCHOVER_PARMNUM}
+  SV_CACHEDOPENLIMIT_PARMNUM                 = 571;
+  {$EXTERNALSYM SV_CACHEDOPENLIMIT_PARMNUM}
+  SV_CRITICALTHREADS_PARMNUM                 = 572;
+  {$EXTERNALSYM SV_CRITICALTHREADS_PARMNUM}
+  SV_RESTRICTNULLSESSACCESS_PARMNUM          = 573;
+  {$EXTERNALSYM SV_RESTRICTNULLSESSACCESS_PARMNUM}
+  SV_ENABLEWFW311DIRECTIPX_PARMNUM           = 574;
+  {$EXTERNALSYM SV_ENABLEWFW311DIRECTIPX_PARMNUM}
+  SV_OTHERQUEUEAFFINITY_PARMNUM              = 575;
+  {$EXTERNALSYM SV_OTHERQUEUEAFFINITY_PARMNUM}
+  SV_QUEUESAMPLESECS_PARMNUM                 = 576;
+  {$EXTERNALSYM SV_QUEUESAMPLESECS_PARMNUM}
+  SV_BALANCECOUNT_PARMNUM                    = 577;
+  {$EXTERNALSYM SV_BALANCECOUNT_PARMNUM}
+  SV_PREFERREDAFFINITY_PARMNUM               = 578;
+  {$EXTERNALSYM SV_PREFERREDAFFINITY_PARMNUM}
+  SV_MAXFREERFCBS_PARMNUM                    = 579;
+  {$EXTERNALSYM SV_MAXFREERFCBS_PARMNUM}
+  SV_MAXFREEMFCBS_PARMNUM                    = 580;
+  {$EXTERNALSYM SV_MAXFREEMFCBS_PARMNUM}
+  SV_MAXFREELFCBS_PARMNUM                    = 581;
+  {$EXTERNALSYM SV_MAXFREELFCBS_PARMNUM}
+  SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM          = 582;
+  {$EXTERNALSYM SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM}
+  SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM           = 583;
+  {$EXTERNALSYM SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM}
+  SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM           = 584;
+  {$EXTERNALSYM SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM}
+  SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM     = 585;
+  {$EXTERNALSYM SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM}
+  SV_MAXTHREADSPERQUEUE_PARMNUM              = 586;
+  {$EXTERNALSYM SV_MAXTHREADSPERQUEUE_PARMNUM}
+  SV_CACHEDDIRECTORYLIMIT_PARMNUM            = 587;
+  {$EXTERNALSYM SV_CACHEDDIRECTORYLIMIT_PARMNUM}
+  SV_MAXCOPYLENGTH_PARMNUM                   = 588;
+  {$EXTERNALSYM SV_MAXCOPYLENGTH_PARMNUM}
+  SV_ENABLECOMPRESSION_PARMNUM               = 590;
+  {$EXTERNALSYM SV_ENABLECOMPRESSION_PARMNUM}
+  SV_AUTOSHAREWKS_PARMNUM                    = 591;
+  {$EXTERNALSYM SV_AUTOSHAREWKS_PARMNUM}
+  SV_AUTOSHARESERVER_PARMNUM                 = 592;
+  {$EXTERNALSYM SV_AUTOSHARESERVER_PARMNUM}
+  SV_ENABLESECURITYSIGNATURE_PARMNUM         = 593;
+  {$EXTERNALSYM SV_ENABLESECURITYSIGNATURE_PARMNUM}
+  SV_REQUIRESECURITYSIGNATURE_PARMNUM        = 594;
+  {$EXTERNALSYM SV_REQUIRESECURITYSIGNATURE_PARMNUM}
+  SV_MINCLIENTBUFFERSIZE_PARMNUM             = 595;
+  {$EXTERNALSYM SV_MINCLIENTBUFFERSIZE_PARMNUM}
+  SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM     = 596;
+  {$EXTERNALSYM SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM}
+  SV_IDLETHREADTIMEOUT_PARMNUM               = 597;
+  {$EXTERNALSYM SV_IDLETHREADTIMEOUT_PARMNUM}
+  SV_ENABLEW9XSECURITYSIGNATURE_PARMNUM      = 598;
+  {$EXTERNALSYM SV_ENABLEW9XSECURITYSIGNATURE_PARMNUM}
+  SV_ENFORCEKERBEROSREAUTHENTICATION_PARMNUM = 599;
+  {$EXTERNALSYM SV_ENFORCEKERBEROSREAUTHENTICATION_PARMNUM}
+  SV_DISABLEDOS_PARMNUM                      = 600;
+  {$EXTERNALSYM SV_DISABLEDOS_PARMNUM}
+  SV_LOWDISKSPACEMINIMUM_PARMNUM             = 601;
+  {$EXTERNALSYM SV_LOWDISKSPACEMINIMUM_PARMNUM}
+  SV_DISABLESTRICTNAMECHECKING_PARMNUM       = 602;
+  {$EXTERNALSYM SV_DISABLESTRICTNAMECHECKING_PARMNUM}
+
+//
+// Single-field infolevels for NetServerSetInfo.
+//
+
+  SV_COMMENT_INFOLEVEL                         = PARMNUM_BASE_INFOLEVEL + SV_COMMENT_PARMNUM;
+  {$EXTERNALSYM SV_COMMENT_INFOLEVEL}
+  SV_USERS_INFOLEVEL                           = PARMNUM_BASE_INFOLEVEL + SV_USERS_PARMNUM;
+  {$EXTERNALSYM SV_USERS_INFOLEVEL}
+  SV_DISC_INFOLEVEL                            = PARMNUM_BASE_INFOLEVEL + SV_DISC_PARMNUM;
+  {$EXTERNALSYM SV_DISC_INFOLEVEL}
+  SV_HIDDEN_INFOLEVEL                          = PARMNUM_BASE_INFOLEVEL + SV_HIDDEN_PARMNUM;
+  {$EXTERNALSYM SV_HIDDEN_INFOLEVEL}
+  SV_ANNOUNCE_INFOLEVEL                        = PARMNUM_BASE_INFOLEVEL + SV_ANNOUNCE_PARMNUM;
+  {$EXTERNALSYM SV_ANNOUNCE_INFOLEVEL}
+  SV_ANNDELTA_INFOLEVEL                        = PARMNUM_BASE_INFOLEVEL + SV_ANNDELTA_PARMNUM;
+  {$EXTERNALSYM SV_ANNDELTA_INFOLEVEL}
+  SV_SESSOPENS_INFOLEVEL                       = PARMNUM_BASE_INFOLEVEL + SV_SESSOPENS_PARMNUM;
+  {$EXTERNALSYM SV_SESSOPENS_INFOLEVEL}
+  SV_SESSVCS_INFOLEVEL                         = PARMNUM_BASE_INFOLEVEL + SV_SESSVCS_PARMNUM;
+  {$EXTERNALSYM SV_SESSVCS_INFOLEVEL}
+  SV_OPENSEARCH_INFOLEVEL                      = PARMNUM_BASE_INFOLEVEL + SV_OPENSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_OPENSEARCH_INFOLEVEL}
+  SV_MAXWORKITEMS_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXWORKITEMS_PARMNUM;
+  {$EXTERNALSYM SV_MAXWORKITEMS_INFOLEVEL}
+  SV_MAXRAWBUFLEN_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXRAWBUFLEN_PARMNUM;
+  {$EXTERNALSYM SV_MAXRAWBUFLEN_INFOLEVEL}
+  SV_SESSUSERS_INFOLEVEL                       = PARMNUM_BASE_INFOLEVEL + SV_SESSUSERS_PARMNUM;
+  {$EXTERNALSYM SV_SESSUSERS_INFOLEVEL}
+  SV_SESSCONNS_INFOLEVEL                       = PARMNUM_BASE_INFOLEVEL + SV_SESSCONNS_PARMNUM;
+  {$EXTERNALSYM SV_SESSCONNS_INFOLEVEL}
+  SV_MAXNONPAGEDMEMORYUSAGE_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + SV_MAXNONPAGEDMEMORYUSAGE_PARMNUM;
+  {$EXTERNALSYM SV_MAXNONPAGEDMEMORYUSAGE_INFOLEVEL}
+  SV_MAXPAGEDMEMORYUSAGE_INFOLEVEL             = PARMNUM_BASE_INFOLEVEL + SV_MAXPAGEDMEMORYUSAGE_PARMNUM;
+  {$EXTERNALSYM SV_MAXPAGEDMEMORYUSAGE_INFOLEVEL}
+  SV_ENABLESOFTCOMPAT_INFOLEVEL                = PARMNUM_BASE_INFOLEVEL + SV_ENABLESOFTCOMPAT_PARMNUM;
+  {$EXTERNALSYM SV_ENABLESOFTCOMPAT_INFOLEVEL}
+  SV_ENABLEFORCEDLOGOFF_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_ENABLEFORCEDLOGOFF_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEFORCEDLOGOFF_INFOLEVEL}
+  SV_TIMESOURCE_INFOLEVEL                      = PARMNUM_BASE_INFOLEVEL + SV_TIMESOURCE_PARMNUM;
+  {$EXTERNALSYM SV_TIMESOURCE_INFOLEVEL}
+  SV_LMANNOUNCE_INFOLEVEL                      = PARMNUM_BASE_INFOLEVEL + SV_LMANNOUNCE_PARMNUM;
+  {$EXTERNALSYM SV_LMANNOUNCE_INFOLEVEL}
+  SV_MAXCOPYREADLEN_INFOLEVEL                  = PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYREADLEN_PARMNUM;
+  {$EXTERNALSYM SV_MAXCOPYREADLEN_INFOLEVEL}
+  SV_MAXCOPYWRITELEN_INFOLEVEL                 = PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYWRITELEN_PARMNUM;
+  {$EXTERNALSYM SV_MAXCOPYWRITELEN_INFOLEVEL}
+  SV_MINKEEPSEARCH_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_MINKEEPSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_MINKEEPSEARCH_INFOLEVEL}
+  SV_MAXKEEPSEARCH_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_MAXKEEPSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_MAXKEEPSEARCH_INFOLEVEL}
+  SV_MINKEEPCOMPLSEARCH_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MINKEEPCOMPLSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_MINKEEPCOMPLSEARCH_INFOLEVEL}
+  SV_MAXKEEPCOMPLSEARCH_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MAXKEEPCOMPLSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_MAXKEEPCOMPLSEARCH_INFOLEVEL}
+  SV_SCAVTIMEOUT_INFOLEVEL                     = PARMNUM_BASE_INFOLEVEL + SV_SCAVTIMEOUT_PARMNUM;
+  {$EXTERNALSYM SV_SCAVTIMEOUT_INFOLEVEL}
+  SV_MINRCVQUEUE_INFOLEVEL                     = PARMNUM_BASE_INFOLEVEL + SV_MINRCVQUEUE_PARMNUM;
+  {$EXTERNALSYM SV_MINRCVQUEUE_INFOLEVEL}
+  SV_MINFREEWORKITEMS_INFOLEVEL                = PARMNUM_BASE_INFOLEVEL + SV_MINFREEWORKITEMS_PARMNUM;
+  {$EXTERNALSYM SV_MINFREEWORKITEMS_INFOLEVEL}
+  SV_MAXMPXCT_INFOLEVEL                        = PARMNUM_BASE_INFOLEVEL + SV_MAXMPXCT_PARMNUM;
+  {$EXTERNALSYM SV_MAXMPXCT_INFOLEVEL}
+  SV_OPLOCKBREAKWAIT_INFOLEVEL                 = PARMNUM_BASE_INFOLEVEL + SV_OPLOCKBREAKWAIT_PARMNUM;
+  {$EXTERNALSYM SV_OPLOCKBREAKWAIT_INFOLEVEL}
+  SV_OPLOCKBREAKRESPONSEWAIT_INFOLEVEL         = PARMNUM_BASE_INFOLEVEL + SV_OPLOCKBREAKRESPONSEWAIT_PARMNUM;
+  {$EXTERNALSYM SV_OPLOCKBREAKRESPONSEWAIT_INFOLEVEL}
+  SV_ENABLEOPLOCKS_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_ENABLEOPLOCKS_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEOPLOCKS_INFOLEVEL}
+  SV_ENABLEOPLOCKFORCECLOSE_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + SV_ENABLEOPLOCKFORCECLOSE_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEOPLOCKFORCECLOSE_INFOLEVEL}
+  SV_ENABLEFCBOPENS_INFOLEVEL                  = PARMNUM_BASE_INFOLEVEL + SV_ENABLEFCBOPENS_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEFCBOPENS_INFOLEVEL}
+  SV_ENABLERAW_INFOLEVEL                       = PARMNUM_BASE_INFOLEVEL + SV_ENABLERAW_PARMNUM;
+  {$EXTERNALSYM SV_ENABLERAW_INFOLEVEL}
+  SV_ENABLESHAREDNETDRIVES_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + SV_ENABLESHAREDNETDRIVES_PARMNUM;
+  {$EXTERNALSYM SV_ENABLESHAREDNETDRIVES_INFOLEVEL}
+  SV_MINFREECONNECTIONS_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MINFREECONNECTIONS_PARMNUM;
+  {$EXTERNALSYM SV_MINFREECONNECTIONS_INFOLEVEL}
+  SV_MAXFREECONNECTIONS_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MAXFREECONNECTIONS_PARMNUM;
+  {$EXTERNALSYM SV_MAXFREECONNECTIONS_INFOLEVEL}
+  SV_INITSESSTABLE_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_INITSESSTABLE_PARMNUM;
+  {$EXTERNALSYM SV_INITSESSTABLE_INFOLEVEL}
+  SV_INITCONNTABLE_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_INITCONNTABLE_PARMNUM;
+  {$EXTERNALSYM SV_INITCONNTABLE_INFOLEVEL}
+  SV_INITFILETABLE_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_INITFILETABLE_PARMNUM;
+  {$EXTERNALSYM SV_INITFILETABLE_INFOLEVEL}
+  SV_INITSEARCHTABLE_INFOLEVEL                 = PARMNUM_BASE_INFOLEVEL + SV_INITSEARCHTABLE_PARMNUM;
+  {$EXTERNALSYM SV_INITSEARCHTABLE_INFOLEVEL}
+  SV_ALERTSCHEDULE_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_ALERTSCHEDULE_PARMNUM;
+  {$EXTERNALSYM SV_ALERTSCHEDULE_INFOLEVEL}
+  SV_ERRORTHRESHOLD_INFOLEVEL                  = PARMNUM_BASE_INFOLEVEL + SV_ERRORTHRESHOLD_PARMNUM;
+  {$EXTERNALSYM SV_ERRORTHRESHOLD_INFOLEVEL}
+  SV_NETWORKERRORTHRESHOLD_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + SV_NETWORKERRORTHRESHOLD_PARMNUM;
+  {$EXTERNALSYM SV_NETWORKERRORTHRESHOLD_INFOLEVEL}
+  SV_DISKSPACETHRESHOLD_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_DISKSPACETHRESHOLD_PARMNUM;
+  {$EXTERNALSYM SV_DISKSPACETHRESHOLD_INFOLEVEL}
+  SV_MAXLINKDELAY_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXLINKDELAY_PARMNUM;
+  {$EXTERNALSYM SV_MAXLINKDELAY_INFOLEVEL}
+  SV_MINLINKTHROUGHPUT_INFOLEVEL               = PARMNUM_BASE_INFOLEVEL + SV_MINLINKTHROUGHPUT_PARMNUM;
+  {$EXTERNALSYM SV_MINLINKTHROUGHPUT_INFOLEVEL}
+  SV_LINKINFOVALIDTIME_INFOLEVEL               = PARMNUM_BASE_INFOLEVEL + SV_LINKINFOVALIDTIME_PARMNUM;
+  {$EXTERNALSYM SV_LINKINFOVALIDTIME_INFOLEVEL}
+  SV_SCAVQOSINFOUPDATETIME_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + SV_SCAVQOSINFOUPDATETIME_PARMNUM;
+  {$EXTERNALSYM SV_SCAVQOSINFOUPDATETIME_INFOLEVEL}
+  SV_MAXWORKITEMIDLETIME_INFOLEVEL             = PARMNUM_BASE_INFOLEVEL + SV_MAXWORKITEMIDLETIME_PARMNUM;
+  {$EXTERNALSYM SV_MAXWORKITEMIDLETIME_INFOLEVEL}
+  SV_MAXRAWWORKITEMS_INFOLOEVEL                = PARMNUM_BASE_INFOLEVEL + SV_MAXRAWWORKITEMS_PARMNUM;
+  {$EXTERNALSYM SV_MAXRAWWORKITEMS_INFOLOEVEL}
+  SV_PRODUCTTYPE_INFOLOEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_PRODUCTTYPE_PARMNUM;
+  {$EXTERNALSYM SV_PRODUCTTYPE_INFOLOEVEL}
+  SV_SERVERSIZE_INFOLOEVEL                     = PARMNUM_BASE_INFOLEVEL + SV_SERVERSIZE_PARMNUM;
+  {$EXTERNALSYM SV_SERVERSIZE_INFOLOEVEL}
+  SV_CONNECTIONLESSAUTODISC_INFOLOEVEL         = PARMNUM_BASE_INFOLEVEL + SV_CONNECTIONLESSAUTODISC_PARMNUM;
+  {$EXTERNALSYM SV_CONNECTIONLESSAUTODISC_INFOLOEVEL}
+  SV_SHARINGVIOLATIONRETRIES_INFOLOEVEL        = PARMNUM_BASE_INFOLEVEL + SV_SHARINGVIOLATIONRETRIES_PARMNUM;
+  {$EXTERNALSYM SV_SHARINGVIOLATIONRETRIES_INFOLOEVEL}
+  SV_SHARINGVIOLATIONDELAY_INFOLOEVEL          = PARMNUM_BASE_INFOLEVEL + SV_SHARINGVIOLATIONDELAY_PARMNUM;
+  {$EXTERNALSYM SV_SHARINGVIOLATIONDELAY_INFOLOEVEL}
+  SV_MAXGLOBALOPENSEARCH_INFOLOEVEL            = PARMNUM_BASE_INFOLEVEL + SV_MAXGLOBALOPENSEARCH_PARMNUM;
+  {$EXTERNALSYM SV_MAXGLOBALOPENSEARCH_INFOLOEVEL}
+  SV_REMOVEDUPLICATESEARCHES_INFOLOEVEL        = PARMNUM_BASE_INFOLEVEL + SV_REMOVEDUPLICATESEARCHES_PARMNUM;
+  {$EXTERNALSYM SV_REMOVEDUPLICATESEARCHES_INFOLOEVEL}
+  SV_LOCKVIOLATIONRETRIES_INFOLOEVEL           = PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONRETRIES_PARMNUM;
+  {$EXTERNALSYM SV_LOCKVIOLATIONRETRIES_INFOLOEVEL}
+  SV_LOCKVIOLATIONOFFSET_INFOLOEVEL            = PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONOFFSET_PARMNUM;
+  {$EXTERNALSYM SV_LOCKVIOLATIONOFFSET_INFOLOEVEL}
+  SV_LOCKVIOLATIONDELAY_INFOLOEVEL             = PARMNUM_BASE_INFOLEVEL + SV_LOCKVIOLATIONDELAY_PARMNUM;
+  {$EXTERNALSYM SV_LOCKVIOLATIONDELAY_INFOLOEVEL}
+  SV_MDLREADSWITCHOVER_INFOLOEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MDLREADSWITCHOVER_PARMNUM;
+  {$EXTERNALSYM SV_MDLREADSWITCHOVER_INFOLOEVEL}
+  SV_CACHEDOPENLIMIT_INFOLOEVEL                = PARMNUM_BASE_INFOLEVEL + SV_CACHEDOPENLIMIT_PARMNUM;
+  {$EXTERNALSYM SV_CACHEDOPENLIMIT_INFOLOEVEL}
+  SV_CRITICALTHREADS_INFOLOEVEL                = PARMNUM_BASE_INFOLEVEL + SV_CRITICALTHREADS_PARMNUM;
+  {$EXTERNALSYM SV_CRITICALTHREADS_INFOLOEVEL}
+  SV_RESTRICTNULLSESSACCESS_INFOLOEVEL         = PARMNUM_BASE_INFOLEVEL + SV_RESTRICTNULLSESSACCESS_PARMNUM;
+  {$EXTERNALSYM SV_RESTRICTNULLSESSACCESS_INFOLOEVEL}
+  SV_ENABLEWFW311DIRECTIPX_INFOLOEVEL          = PARMNUM_BASE_INFOLEVEL + SV_ENABLEWFW311DIRECTIPX_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEWFW311DIRECTIPX_INFOLOEVEL}
+  SV_OTHERQUEUEAFFINITY_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_OTHERQUEUEAFFINITY_PARMNUM;
+  {$EXTERNALSYM SV_OTHERQUEUEAFFINITY_INFOLEVEL}
+  SV_QUEUESAMPLESECS_INFOLEVEL                 = PARMNUM_BASE_INFOLEVEL + SV_QUEUESAMPLESECS_PARMNUM;
+  {$EXTERNALSYM SV_QUEUESAMPLESECS_INFOLEVEL}
+  SV_BALANCECOUNT_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_BALANCECOUNT_PARMNUM;
+  {$EXTERNALSYM SV_BALANCECOUNT_INFOLEVEL}
+  SV_PREFERREDAFFINITY_INFOLEVEL               = PARMNUM_BASE_INFOLEVEL + SV_PREFERREDAFFINITY_PARMNUM;
+  {$EXTERNALSYM SV_PREFERREDAFFINITY_INFOLEVEL}
+  SV_MAXFREERFCBS_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXFREERFCBS_PARMNUM;
+  {$EXTERNALSYM SV_MAXFREERFCBS_INFOLEVEL}
+  SV_MAXFREEMFCBS_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXFREEMFCBS_PARMNUM;
+  {$EXTERNALSYM SV_MAXFREEMFCBS_INFOLEVEL}
+  SV_MAXFREELFCBS_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_MAXFREELFCBS_PARMNUM;
+  {$EXTERNALSYM SV_MAXFREELFCBS_INFOLEVEL}
+  SV_MAXFREEPAGEDPOOLCHUNKS_INFOLEVEL          = PARMNUM_BASE_INFOLEVEL + SV_MAXFREEPAGEDPOOLCHUNKS_PARMNUM;
+  {$EXTERNALSYM SV_MAXFREEPAGEDPOOLCHUNKS_INFOLEVEL}
+  SV_MINPAGEDPOOLCHUNKSIZE_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + SV_MINPAGEDPOOLCHUNKSIZE_PARMNUM;
+  {$EXTERNALSYM SV_MINPAGEDPOOLCHUNKSIZE_INFOLEVEL}
+  SV_MAXPAGEDPOOLCHUNKSIZE_INFOLEVEL           = PARMNUM_BASE_INFOLEVEL + SV_MAXPAGEDPOOLCHUNKSIZE_PARMNUM;
+  {$EXTERNALSYM SV_MAXPAGEDPOOLCHUNKSIZE_INFOLEVEL}
+  SV_SENDSFROMPREFERREDPROCESSOR_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + SV_SENDSFROMPREFERREDPROCESSOR_PARMNUM;
+  {$EXTERNALSYM SV_SENDSFROMPREFERREDPROCESSOR_INFOLEVEL}
+  SV_MAXTHREADSPERQUEUE_INFOLEVEL              = PARMNUM_BASE_INFOLEVEL + SV_MAXTHREADSPERQUEUE_PARMNUM;
+  {$EXTERNALSYM SV_MAXTHREADSPERQUEUE_INFOLEVEL}
+  SV_CACHEDDIRECTORYLIMIT_INFOLEVEL            = PARMNUM_BASE_INFOLEVEL + SV_CACHEDDIRECTORYLIMIT_PARMNUM;
+  {$EXTERNALSYM SV_CACHEDDIRECTORYLIMIT_INFOLEVEL}
+  SV_MAXCOPYLENGTH_INFOLEVEL                   = PARMNUM_BASE_INFOLEVEL + SV_MAXCOPYLENGTH_PARMNUM;
+  {$EXTERNALSYM SV_MAXCOPYLENGTH_INFOLEVEL}
+  SV_ENABLECOMPRESSION_INFOLEVEL               = PARMNUM_BASE_INFOLEVEL + SV_ENABLECOMPRESSION_PARMNUM;
+  {$EXTERNALSYM SV_ENABLECOMPRESSION_INFOLEVEL}
+  SV_AUTOSHAREWKS_INFOLEVEL                    = PARMNUM_BASE_INFOLEVEL + SV_AUTOSHAREWKS_PARMNUM;
+  {$EXTERNALSYM SV_AUTOSHAREWKS_INFOLEVEL}
+  SV_AUTOSHARESERVER_INFOLEVEL                 = PARMNUM_BASE_INFOLEVEL + SV_AUTOSHARESERVER_PARMNUM;
+  {$EXTERNALSYM SV_AUTOSHARESERVER_INFOLEVEL}
+  SV_ENABLESECURITYSIGNATURE_INFOLEVEL         = PARMNUM_BASE_INFOLEVEL + SV_ENABLESECURITYSIGNATURE_PARMNUM;
+  {$EXTERNALSYM SV_ENABLESECURITYSIGNATURE_INFOLEVEL}
+  SV_REQUIRESECURITYSIGNATURE_INFOLEVEL        = PARMNUM_BASE_INFOLEVEL + SV_REQUIRESECURITYSIGNATURE_PARMNUM;
+  {$EXTERNALSYM SV_REQUIRESECURITYSIGNATURE_INFOLEVEL}
+  SV_MINCLIENTBUFFERSIZE_INFOLEVEL             = PARMNUM_BASE_INFOLEVEL + SV_MINCLIENTBUFFERSIZE_PARMNUM;
+  {$EXTERNALSYM SV_MINCLIENTBUFFERSIZE_INFOLEVEL}
+  SV_CONNECTIONNOSESSIONSTIMEOUT_INFOLEVEL     = PARMNUM_BASE_INFOLEVEL + SV_CONNECTIONNOSESSIONSTIMEOUT_PARMNUM;
+  {$EXTERNALSYM SV_CONNECTIONNOSESSIONSTIMEOUT_INFOLEVEL}
+  SV_IDLETHREADTIMEOUT_INFOLEVEL               = PARMNUM_BASE_INFOLEVEL + SV_IDLETHREADTIMEOUT_PARMNUM;
+  {$EXTERNALSYM SV_IDLETHREADTIMEOUT_INFOLEVEL}
+  SV_ENABLEW9XSECURITYSIGNATURE_INFOLEVEL      = PARMNUM_BASE_INFOLEVEL + SV_ENABLEW9XSECURITYSIGNATURE_PARMNUM;
+  {$EXTERNALSYM SV_ENABLEW9XSECURITYSIGNATURE_INFOLEVEL}
+  SV_ENFORCEKERBEROSREAUTHENTICATION_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + SV_ENFORCEKERBEROSREAUTHENTICATION_PARMNUM;
+  {$EXTERNALSYM SV_ENFORCEKERBEROSREAUTHENTICATION_INFOLEVEL}
+  SV_DISABLEDOS_INFOLEVEL                      = PARMNUM_BASE_INFOLEVEL + SV_DISABLEDOS_PARMNUM;
+  {$EXTERNALSYM SV_DISABLEDOS_INFOLEVEL}
+  SV_LOWDISKSPACEMINIMUM_INFOLEVEL             = PARMNUM_BASE_INFOLEVEL + SV_LOWDISKSPACEMINIMUM_PARMNUM;
+  {$EXTERNALSYM SV_LOWDISKSPACEMINIMUM_INFOLEVEL}
+  SV_DISABLESTRICTNAMECHECKING_INFOLEVEL       = PARMNUM_BASE_INFOLEVEL + SV_DISABLESTRICTNAMECHECKING_PARMNUM;
+  {$EXTERNALSYM SV_DISABLESTRICTNAMECHECKING_INFOLEVEL}
+
+  SVI1_NUM_ELEMENTS = 5;
+  {$EXTERNALSYM SVI1_NUM_ELEMENTS}
+  SVI2_NUM_ELEMENTS = 40;
+  {$EXTERNALSYM SVI2_NUM_ELEMENTS}
+  SVI3_NUM_ELEMENTS = 44;
+  {$EXTERNALSYM SVI3_NUM_ELEMENTS}
+
+//
+//      Maxmimum length for command string to NetServerAdminCommand.
+//
+
+  SV_MAX_CMD_LEN = PATHLEN;
+  {$EXTERNALSYM SV_MAX_CMD_LEN}
+
+//
+//      Masks describing AUTOPROFILE parameters
+//
+
+  SW_AUTOPROF_LOAD_MASK = $1;
+  {$EXTERNALSYM SW_AUTOPROF_LOAD_MASK}
+  SW_AUTOPROF_SAVE_MASK = $2;
+  {$EXTERNALSYM SW_AUTOPROF_SAVE_MASK}
+
+//
+//      Max size of svX_srvheuristics.
+//
+
+  SV_MAX_SRV_HEUR_LEN = 32; // Max heuristics info string length.
+  {$EXTERNALSYM SV_MAX_SRV_HEUR_LEN}
+
+//
+//      Equate for use with sv102_licenses.
+//
+
+  SV_USERS_PER_LICENSE = 5;
+  {$EXTERNALSYM SV_USERS_PER_LICENSE}
+
+//
+// Equate for use with svti2_flags in NetServerTransportAddEx.
+//
+
+  SVTI2_REMAP_PIPE_NAMES = $2;
+  {$EXTERNALSYM SVTI2_REMAP_PIPE_NAMES}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetServerEnum: Pointer;
+
+function NetServerEnum;
+begin
+  GetProcedureAddress(_NetServerEnum, netapi32, 'NetServerEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerEnum]
+  end;
+end;
+
+var
+  _NetServerEnumEx: Pointer;
+
+function NetServerEnumEx;
+begin
+  GetProcedureAddress(_NetServerEnumEx, netapi32, 'NetServerEnumEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerEnumEx]
+  end;
+end;
+
+var
+  _NetServerGetInfo: Pointer;
+
+function NetServerGetInfo;
+begin
+  GetProcedureAddress(_NetServerGetInfo, netapi32, 'NetServerGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerGetInfo]
+  end;
+end;
+
+var
+  _NetServerSetInfo: Pointer;
+
+function NetServerSetInfo;
+begin
+  GetProcedureAddress(_NetServerSetInfo, netapi32, 'NetServerSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerSetInfo]
+  end;
+end;
+
+var
+  _NetServerSetInfoCommandLine: Pointer;
+
+function NetServerSetInfoCommandLine;
+begin
+  GetProcedureAddress(_NetServerSetInfoCommandLine, netapi32, 'NetServerSetInfoCommandLine');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerSetInfoCommandLine]
+  end;
+end;
+
+var
+  _NetServerDiskEnum: Pointer;
+
+function NetServerDiskEnum;
+begin
+  GetProcedureAddress(_NetServerDiskEnum, netapi32, 'NetServerDiskEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerDiskEnum]
+  end;
+end;
+
+var
+  _NetServerComputerNameAdd: Pointer;
+
+function NetServerComputerNameAdd;
+begin
+  GetProcedureAddress(_NetServerComputerNameAdd, netapi32, 'NetServerComputerNameAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerComputerNameAdd]
+  end;
+end;
+
+var
+  _NetServerComputerNameDel: Pointer;
+
+function NetServerComputerNameDel;
+begin
+  GetProcedureAddress(_NetServerComputerNameDel, netapi32, 'NetServerComputerNameDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerComputerNameDel]
+  end;
+end;
+
+var
+  _NetServerTransportAdd: Pointer;
+
+function NetServerTransportAdd;
+begin
+  GetProcedureAddress(_NetServerTransportAdd, netapi32, 'NetServerTransportAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerTransportAdd]
+  end;
+end;
+
+var
+  _NetServerTransportAddEx: Pointer;
+
+function NetServerTransportAddEx;
+begin
+  GetProcedureAddress(_NetServerTransportAddEx, netapi32, 'NetServerTransportAddEx');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerTransportAddEx]
+  end;
+end;
+
+var
+  _NetServerTransportDel: Pointer;
+
+function NetServerTransportDel;
+begin
+  GetProcedureAddress(_NetServerTransportDel, netapi32, 'NetServerTransportDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerTransportDel]
+  end;
+end;
+
+var
+  _NetServerTransportEnum: Pointer;
+
+function NetServerTransportEnum;
+begin
+  GetProcedureAddress(_NetServerTransportEnum, netapi32, 'NetServerTransportEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServerTransportEnum]
+  end;
+end;
+
+var
+  _SetServiceBits: Pointer;
+
+function SetServiceBits;
+begin
+  GetProcedureAddress(_SetServiceBits, netapi32, 'SetServiceBits');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetServiceBits]
+  end;
+end;
+
+{$ELSE}
+
+function NetServerEnum; external netapi32 name 'NetServerEnum';
+function NetServerEnumEx; external netapi32 name 'NetServerEnumEx';
+function NetServerGetInfo; external netapi32 name 'NetServerGetInfo';
+function NetServerSetInfo; external netapi32 name 'NetServerSetInfo';
+function NetServerSetInfoCommandLine; external netapi32 name 'NetServerSetInfoCommandLine';
+function NetServerDiskEnum; external netapi32 name 'NetServerDiskEnum';
+function NetServerComputerNameAdd; external netapi32 name 'NetServerComputerNameAdd';
+function NetServerComputerNameDel; external netapi32 name 'NetServerComputerNameDel';
+function NetServerTransportAdd; external netapi32 name 'NetServerTransportAdd';
+function NetServerTransportAddEx; external netapi32 name 'NetServerTransportAddEx';
+function NetServerTransportDel; external netapi32 name 'NetServerTransportDel';
+function NetServerTransportEnum; external netapi32 name 'NetServerTransportEnum';
+function SetServiceBits; external netapi32 name 'SetServiceBits';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 798 - 0
packages/extra/winunits/jwalmshare.pas

@@ -0,0 +1,798 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Shares API interface Unit for Object Pascal                      }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmshare.h, released November 2001. The original Pascal }
+{ code is: LmShare.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmShare;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmshare.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinNT, JwaWinType;
+
+//
+// Function Prototypes - Share
+//
+
+function NetShareAdd(servername: LMSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareAdd}
+
+function NetShareEnum(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareEnum}
+
+function NetShareEnumSticky(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareEnumSticky}
+
+function NetShareGetInfo(servername, netname: LMSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareGetInfo}
+
+function NetShareSetInfo(servername, netname: LMSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareSetInfo}
+
+function NetShareDel(servername, netname: LMSTR; reserved: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareDel}
+
+function NetShareDelSticky(servername, netname: LMSTR; reserved: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareDelSticky}
+
+function NetShareCheck(servername, device: LMSTR; type_: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetShareCheck}
+
+//
+// Data Structures - Share
+//
+
+type
+  LPSHARE_INFO_0 = ^SHARE_INFO_0;
+  {$EXTERNALSYM LPSHARE_INFO_0}
+  PSHARE_INFO_0 = ^SHARE_INFO_0;
+  {$EXTERNALSYM PSHARE_INFO_0}
+  _SHARE_INFO_0 = record
+    shi0_netname: LMSTR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_0}
+  SHARE_INFO_0 = _SHARE_INFO_0;
+  {$EXTERNALSYM SHARE_INFO_0}
+  TShareInfo0 = SHARE_INFO_0;
+  PShareInfo0 = PSHARE_INFO_0;
+
+  LPSHARE_INFO_1 = ^SHARE_INFO_1;
+  {$EXTERNALSYM LPSHARE_INFO_1}
+  PSHARE_INFO_1 = ^SHARE_INFO_1;
+  {$EXTERNALSYM PSHARE_INFO_1}
+  _SHARE_INFO_1 = record
+    shi1_netname: LMSTR;
+    shi1_type: DWORD;
+    shi1_remark: LMSTR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_1}
+  SHARE_INFO_1 = _SHARE_INFO_1;
+  {$EXTERNALSYM SHARE_INFO_1}
+  TShareInfo1 = SHARE_INFO_1;
+  PShareInfo1 = PSHARE_INFO_1;
+
+  LPSHARE_INFO_2 = ^SHARE_INFO_2;
+  {$EXTERNALSYM LPSHARE_INFO_2}
+  PSHARE_INFO_2 = ^SHARE_INFO_2;
+  {$EXTERNALSYM PSHARE_INFO_2}
+  _SHARE_INFO_2 = record
+    shi2_netname: LMSTR;
+    shi2_type: DWORD;
+    shi2_remark: LMSTR;
+    shi2_permissions: DWORD;
+    shi2_max_uses: DWORD;
+    shi2_current_uses: DWORD;
+    shi2_path: LMSTR;
+    shi2_passwd: LMSTR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_2}
+  SHARE_INFO_2 = _SHARE_INFO_2;
+  {$EXTERNALSYM SHARE_INFO_2}
+  TShareInfo2 = SHARE_INFO_2;
+  PShareInfo2 = PSHARE_INFO_2;
+
+  LPSHARE_INFO_501 = ^SHARE_INFO_501;
+  {$EXTERNALSYM LPSHARE_INFO_501}
+  PSHARE_INFO_501 = ^SHARE_INFO_501;
+  {$EXTERNALSYM PSHARE_INFO_501}
+  _SHARE_INFO_501 = record
+    shi501_netname: LMSTR;
+    shi501_type: DWORD;
+    shi501_remark: LMSTR;
+    shi501_flags: DWORD;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_501}
+  SHARE_INFO_501 = _SHARE_INFO_501;
+  {$EXTERNALSYM SHARE_INFO_501}
+  TShareInfo501 = SHARE_INFO_501;
+  PShareInfo501 = PSHARE_INFO_501;
+
+  LPSHARE_INFO_502 = ^SHARE_INFO_502;
+  {$EXTERNALSYM LPSHARE_INFO_502}
+  PSHARE_INFO_502 = ^SHARE_INFO_502;
+  {$EXTERNALSYM PSHARE_INFO_502}
+  _SHARE_INFO_502 = record
+    shi502_netname: LMSTR;
+    shi502_type: DWORD;
+    shi502_remark: LMSTR;
+    shi502_permissions: DWORD;
+    shi502_max_uses: DWORD;
+    shi502_current_uses: DWORD;
+    shi502_path: LMSTR;
+    shi502_passwd: LMSTR;
+    shi502_reserved: DWORD;
+    shi502_security_descriptor: PSECURITY_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_502}
+  SHARE_INFO_502 = _SHARE_INFO_502;
+  {$EXTERNALSYM SHARE_INFO_502}
+  TShareInfo502 = SHARE_INFO_502;
+  PShareInfo502 = PSHARE_INFO_502;
+
+  LPSHARE_INFO_1004 = ^SHARE_INFO_1004;
+  {$EXTERNALSYM LPSHARE_INFO_1004}
+  PSHARE_INFO_1004 = ^SHARE_INFO_1004;
+  {$EXTERNALSYM PSHARE_INFO_1004}
+  _SHARE_INFO_1004 = record
+    shi1004_remark: LMSTR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_1004}
+  SHARE_INFO_1004 = _SHARE_INFO_1004;
+  {$EXTERNALSYM SHARE_INFO_1004}
+  TShareInfo1004 = SHARE_INFO_1004;
+  PShareInfo1004 = PSHARE_INFO_1004;
+
+  LPSHARE_INFO_1005 = ^SHARE_INFO_1005;
+  {$EXTERNALSYM LPSHARE_INFO_1005}
+  PSHARE_INFO_1005 = ^SHARE_INFO_1005;
+  {$EXTERNALSYM PSHARE_INFO_1005}
+  _SHARE_INFO_1005 = record
+    shi1005_flags: DWORD;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_1005}
+  SHARE_INFO_1005 = _SHARE_INFO_1005;
+  {$EXTERNALSYM SHARE_INFO_1005}
+  TShareInfo1005 = SHARE_INFO_1005;
+  PShareInfo1005 = PSHARE_INFO_1005;
+
+  LPSHARE_INFO_1006 = ^SHARE_INFO_1006;
+  {$EXTERNALSYM LPSHARE_INFO_1006}
+  PSHARE_INFO_1006 = ^SHARE_INFO_1006;
+  {$EXTERNALSYM PSHARE_INFO_1006}
+  _SHARE_INFO_1006 = record
+    shi1006_max_uses: DWORD;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_1006}
+  SHARE_INFO_1006 = _SHARE_INFO_1006;
+  {$EXTERNALSYM SHARE_INFO_1006}
+  TShareInfo1006 = SHARE_INFO_1006;
+  PShareInfo1006 = PSHARE_INFO_1006;
+
+  LPSHARE_INFO_1501 = ^SHARE_INFO_1501;
+  {$EXTERNALSYM LPSHARE_INFO_1501}
+  PSHARE_INFO_1501 = ^SHARE_INFO_1501;
+  {$EXTERNALSYM PSHARE_INFO_1501}
+  _SHARE_INFO_1501 = record
+    shi1501_reserved: DWORD;
+    shi1501_security_descriptor: PSECURITY_DESCRIPTOR;
+  end;
+  {$EXTERNALSYM _SHARE_INFO_1501}
+  SHARE_INFO_1501 = _SHARE_INFO_1501;
+  {$EXTERNALSYM SHARE_INFO_1501}
+  TShareInfo1501 = SHARE_INFO_1501;
+  PShareInfo1501 = PSHARE_INFO_1501;
+
+//
+// Special Values and Constants - Share
+//
+
+//
+// Values for parm_err parameter.
+//
+
+const
+  SHARE_NETNAME_PARMNUM      = 1;
+  {$EXTERNALSYM SHARE_NETNAME_PARMNUM}
+  SHARE_TYPE_PARMNUM         = 3;
+  {$EXTERNALSYM SHARE_TYPE_PARMNUM}
+  SHARE_REMARK_PARMNUM       = 4;
+  {$EXTERNALSYM SHARE_REMARK_PARMNUM}
+  SHARE_PERMISSIONS_PARMNUM  = 5;
+  {$EXTERNALSYM SHARE_PERMISSIONS_PARMNUM}
+  SHARE_MAX_USES_PARMNUM     = 6;
+  {$EXTERNALSYM SHARE_MAX_USES_PARMNUM}
+  SHARE_CURRENT_USES_PARMNUM = 7;
+  {$EXTERNALSYM SHARE_CURRENT_USES_PARMNUM}
+  SHARE_PATH_PARMNUM         = 8;
+  {$EXTERNALSYM SHARE_PATH_PARMNUM}
+  SHARE_PASSWD_PARMNUM       = 9;
+  {$EXTERNALSYM SHARE_PASSWD_PARMNUM}
+  SHARE_FILE_SD_PARMNUM      = 501;
+  {$EXTERNALSYM SHARE_FILE_SD_PARMNUM}
+
+//
+// Single-field infolevels for NetShareSetInfo.
+//
+
+  SHARE_REMARK_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM;
+  {$EXTERNALSYM SHARE_REMARK_INFOLEVEL}
+  SHARE_MAX_USES_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM;
+  {$EXTERNALSYM SHARE_MAX_USES_INFOLEVEL}
+  SHARE_FILE_SD_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM;
+  {$EXTERNALSYM SHARE_FILE_SD_INFOLEVEL}
+
+  SHI1_NUM_ELEMENTS = 4;
+  {$EXTERNALSYM SHI1_NUM_ELEMENTS}
+  SHI2_NUM_ELEMENTS = 10;
+  {$EXTERNALSYM SHI2_NUM_ELEMENTS}
+
+//
+// Share types (shi1_type and shi2_type fields).
+//
+
+  STYPE_DISKTREE = 0;
+  {$EXTERNALSYM STYPE_DISKTREE}
+  STYPE_PRINTQ   = 1;
+  {$EXTERNALSYM STYPE_PRINTQ}
+  STYPE_DEVICE   = 2;
+  {$EXTERNALSYM STYPE_DEVICE}
+  STYPE_IPC      = 3;
+  {$EXTERNALSYM STYPE_IPC}
+
+  STYPE_TEMPORARY = $40000000;
+  {$EXTERNALSYM STYPE_TEMPORARY}
+  STYPE_SPECIAL   = DWORD($80000000);
+  {$EXTERNALSYM STYPE_SPECIAL}
+
+  SHI_USES_UNLIMITED = DWORD(-1);
+  {$EXTERNALSYM SHI_USES_UNLIMITED}
+
+//
+// Flags values for the 501 and 1005 levels
+//
+
+  SHI1005_FLAGS_DFS      = $01; // Share is in the DFS
+  {$EXTERNALSYM SHI1005_FLAGS_DFS}
+  SHI1005_FLAGS_DFS_ROOT = $02; // Share is root of DFS
+  {$EXTERNALSYM SHI1005_FLAGS_DFS_ROOT}
+
+  CSC_MASK               = $30; // Used to mask off the following states
+  {$EXTERNALSYM CSC_MASK}
+
+  CSC_CACHE_MANUAL_REINT = $00; // No automatic file by file reintegration
+  {$EXTERNALSYM CSC_CACHE_MANUAL_REINT}
+  CSC_CACHE_AUTO_REINT   = $10; // File by file reintegration is OK
+  {$EXTERNALSYM CSC_CACHE_AUTO_REINT}
+  CSC_CACHE_VDO          = $20; // no need to flow opens
+  {$EXTERNALSYM CSC_CACHE_VDO}
+  CSC_CACHE_NONE         = $30; // no CSC for this share
+  {$EXTERNALSYM CSC_CACHE_NONE}
+
+  SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS = $0100;          // Used to disallow read-deny read behavior
+  {$EXTERNALSYM SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS}
+  SHI1005_FLAGS_FORCE_SHARED_DELETE      = $0200;          // Used to allows force shared delete
+  {$EXTERNALSYM SHI1005_FLAGS_FORCE_SHARED_DELETE}
+  SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING  = $0400;          // The clients may cache the namespace
+  {$EXTERNALSYM SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING}
+
+//
+// The subset of 1005 infolevel flags that can be set via the API
+//
+
+  SHI1005_VALID_FLAGS_SET = CSC_MASK or SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS or SHI1005_FLAGS_FORCE_SHARED_DELETE or SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING;
+  {$EXTERNALSYM SHI1005_VALID_FLAGS_SET}
+
+//
+// SESSION API
+//
+
+//
+// Function Prototypes Session
+//
+
+function NetSessionEnum(servername, UncClientName, username: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetSessionEnum}
+
+function NetSessionDel(servername, UncClientName, username: LMSTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetSessionDel}
+
+function NetSessionGetInfo(servername, UncClientName, username: LMSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetSessionGetInfo}
+
+//
+// Data Structures - Session
+//
+
+type
+  LPSESSION_INFO_0 = ^SESSION_INFO_0;
+  {$EXTERNALSYM LPSESSION_INFO_0}
+  PSESSION_INFO_0 = ^SESSION_INFO_0;
+  {$EXTERNALSYM PSESSION_INFO_0}
+  _SESSION_INFO_0 = record
+    sesi0_cname: LMSTR; // client name (no backslashes)
+  end;
+  {$EXTERNALSYM _SESSION_INFO_0}
+  SESSION_INFO_0 = _SESSION_INFO_0;
+  {$EXTERNALSYM SESSION_INFO_0}
+  TSessionInfo0 = SESSION_INFO_0;
+  PSessionInfo0 = PSESSION_INFO_0;
+
+  LPSESSION_INFO_1 = ^SESSION_INFO_1;
+  {$EXTERNALSYM LPSESSION_INFO_1}
+  PSESSION_INFO_1 = ^SESSION_INFO_1;
+  {$EXTERNALSYM PSESSION_INFO_1}
+  _SESSION_INFO_1 = record
+    sesi1_cname: LMSTR; // client name (no backslashes)
+    sesi1_username: LMSTR;
+    sesi1_num_opens: DWORD;
+    sesi1_time: DWORD;
+    sesi1_idle_time: DWORD;
+    sesi1_user_flags: DWORD;
+  end;
+  {$EXTERNALSYM _SESSION_INFO_1}
+  SESSION_INFO_1 = _SESSION_INFO_1;
+  {$EXTERNALSYM SESSION_INFO_1}
+  TSessionInfo1 = SESSION_INFO_1;
+  PSessionInfo1 = PSESSION_INFO_1;
+
+  LPSESSION_INFO_2 = ^SESSION_INFO_2;
+  {$EXTERNALSYM LPSESSION_INFO_2}
+  PSESSION_INFO_2 = ^SESSION_INFO_2;
+  {$EXTERNALSYM PSESSION_INFO_2}
+  _SESSION_INFO_2 = record
+    sesi2_cname: LMSTR; // client name (no backslashes)
+    sesi2_username: LMSTR;
+    sesi2_num_opens: DWORD;
+    sesi2_time: DWORD;
+    sesi2_idle_time: DWORD;
+    sesi2_user_flags: DWORD;
+    sesi2_cltype_name: LMSTR;
+  end;
+  {$EXTERNALSYM _SESSION_INFO_2}
+  SESSION_INFO_2 = _SESSION_INFO_2;
+  {$EXTERNALSYM SESSION_INFO_2}
+  TSessionInfo2 = SESSION_INFO_2;
+  PSessionInfo2 = PSESSION_INFO_2;
+
+  LPSESSION_INFO_10 = ^SESSION_INFO_10;
+  {$EXTERNALSYM LPSESSION_INFO_10}
+  PSESSION_INFO_10 = ^SESSION_INFO_10;
+  {$EXTERNALSYM PSESSION_INFO_10}
+  _SESSION_INFO_10 = record
+    sesi10_cname: LMSTR; // client name (no backslashes)
+    sesi10_username: LMSTR;
+    sesi10_time: DWORD;
+    sesi10_idle_time: DWORD;
+  end;
+  {$EXTERNALSYM _SESSION_INFO_10}
+  SESSION_INFO_10 = _SESSION_INFO_10;
+  {$EXTERNALSYM SESSION_INFO_10}
+  TSessionInfo10 = SESSION_INFO_10;
+  PSessionInfo10 = PSESSION_INFO_10;
+
+  LPSESSION_INFO_502 = ^SESSION_INFO_502;
+  {$EXTERNALSYM LPSESSION_INFO_502}
+  PSESSION_INFO_502 = ^SESSION_INFO_502;
+  {$EXTERNALSYM PSESSION_INFO_502}
+  _SESSION_INFO_502 = record
+    sesi502_cname: LMSTR; // client name (no backslashes)
+    sesi502_username: LMSTR;
+    sesi502_num_opens: DWORD;
+    sesi502_time: DWORD;
+    sesi502_idle_time: DWORD;
+    sesi502_user_flags: DWORD;
+    sesi502_cltype_name: LMSTR;
+    sesi502_transport: LMSTR;
+  end;
+  {$EXTERNALSYM _SESSION_INFO_502}
+  SESSION_INFO_502 = _SESSION_INFO_502;
+  {$EXTERNALSYM SESSION_INFO_502}
+  TSessionInfo502 = SESSION_INFO_502;
+  PSessionInfo502 = PSESSION_INFO_502;
+
+//
+// Special Values and Constants - Session
+//
+
+//
+// Bits defined in sesi1_user_flags.
+//
+
+const
+  SESS_GUEST        = $00000001; // session is logged on as a guest
+  {$EXTERNALSYM SESS_GUEST}
+  SESS_NOENCRYPTION = $00000002; // session is not using encryption
+  {$EXTERNALSYM SESS_NOENCRYPTION}
+
+  SESI1_NUM_ELEMENTS = 8;
+  {$EXTERNALSYM SESI1_NUM_ELEMENTS}
+  SESI2_NUM_ELEMENTS = 9;
+  {$EXTERNALSYM SESI2_NUM_ELEMENTS}
+
+//
+// CONNECTION API
+//
+
+//
+// Function Prototypes - CONNECTION
+//
+
+function NetConnectionEnum(servername, qualifier: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetConnectionEnum}
+
+//
+// Data Structures - CONNECTION
+//
+
+type
+  LPCONNECTION_INFO_0 = ^CONNECTION_INFO_0;
+  {$EXTERNALSYM LPCONNECTION_INFO_0}
+  PCONNECTION_INFO_0 = ^CONNECTION_INFO_0;
+  {$EXTERNALSYM PCONNECTION_INFO_0}
+  _CONNECTION_INFO_0 = record
+    coni0_id: DWORD;
+  end;
+  {$EXTERNALSYM _CONNECTION_INFO_0}
+  CONNECTION_INFO_0 = _CONNECTION_INFO_0;
+  {$EXTERNALSYM CONNECTION_INFO_0}
+  TConnectionInfo0 = CONNECTION_INFO_0;
+  PConnectionInfo0 = PCONNECTION_INFO_0;
+
+  LPCONNECTION_INFO_1 = ^CONNECTION_INFO_1;
+  {$EXTERNALSYM LPCONNECTION_INFO_1}
+  PCONNECTION_INFO_1 = ^CONNECTION_INFO_1;
+  {$EXTERNALSYM PCONNECTION_INFO_1}
+  _CONNECTION_INFO_1 = record
+    coni1_id: DWORD;
+    coni1_type: DWORD;
+    coni1_num_opens: DWORD;
+    coni1_num_users: DWORD;
+    coni1_time: DWORD;
+    coni1_username: LMSTR;
+    coni1_netname: LMSTR;
+  end;
+  {$EXTERNALSYM _CONNECTION_INFO_1}
+  CONNECTION_INFO_1 = _CONNECTION_INFO_1;
+  {$EXTERNALSYM CONNECTION_INFO_1}
+  TConnectionInfo1 = CONNECTION_INFO_1;
+  PConnectionInfo1 = PCONNECTION_INFO_1;
+
+//
+// FILE API
+//
+
+//
+// Function Prototypes - FILE
+//
+
+function NetFileClose(servername: LMSTR; fileid: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetFileClose}
+
+function NetFileEnum(servername, basepath, username: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: PDWORD_PTR): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetFileEnum}
+
+function NetFileGetInfo(servername: LMSTR; fileid, level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetFileGetInfo}
+
+//
+// Data Structures - File
+//
+
+//  File APIs are available at information levels 2 & 3 only. Levels 0 &
+//  1 are not supported.
+//
+
+type
+  LPFILE_INFO_2 = ^FILE_INFO_2;
+  {$EXTERNALSYM LPFILE_INFO_2}
+  PFILE_INFO_2 = ^FILE_INFO_2;
+  {$EXTERNALSYM PFILE_INFO_2}
+  _FILE_INFO_2 = record
+    fi2_id: DWORD;
+  end;
+  {$EXTERNALSYM _FILE_INFO_2}
+  FILE_INFO_2 = _FILE_INFO_2;
+  {$EXTERNALSYM FILE_INFO_2}
+  TFileInfo2 = FILE_INFO_2;
+  PFileInfo2 = PFILE_INFO_2;
+
+  LPFILE_INFO_3 = ^FILE_INFO_3;
+  {$EXTERNALSYM LPFILE_INFO_3}
+  PFILE_INFO_3 = ^FILE_INFO_3;
+  {$EXTERNALSYM PFILE_INFO_3}
+  _FILE_INFO_3 = record
+    fi3_id: DWORD;
+    fi3_permissions: DWORD;
+    fi3_num_locks: DWORD;
+    fi3_pathname: LMSTR;
+    fi3_username: LMSTR;
+  end;
+  {$EXTERNALSYM _FILE_INFO_3}
+  FILE_INFO_3 = _FILE_INFO_3;
+  {$EXTERNALSYM FILE_INFO_3}
+  TFileInfo3 = FILE_INFO_3;
+  PFileInfo3 = PFILE_INFO_3;
+
+//
+// Special Values and Constants - File
+//
+
+//
+// bit values for permissions
+//
+
+const
+  PERM_FILE_READ   = $1; // user has read access
+  {$EXTERNALSYM PERM_FILE_READ}
+  PERM_FILE_WRITE  = $2; // user has write access
+  {$EXTERNALSYM PERM_FILE_WRITE}
+  PERM_FILE_CREATE = $4; // user has create access
+  {$EXTERNALSYM PERM_FILE_CREATE}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetShareAdd: Pointer;
+
+function NetShareAdd;
+begin
+  GetProcedureAddress(_NetShareAdd, netapi32, 'NetShareAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareAdd]
+  end;
+end;
+
+var
+  _NetShareEnum: Pointer;
+
+function NetShareEnum;
+begin
+  GetProcedureAddress(_NetShareEnum, netapi32, 'NetShareEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareEnum]
+  end;
+end;
+
+var
+  _NetShareEnumSticky: Pointer;
+
+function NetShareEnumSticky;
+begin
+  GetProcedureAddress(_NetShareEnumSticky, netapi32, 'NetShareEnumSticky');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareEnumSticky]
+  end;
+end;
+
+var
+  _NetShareGetInfo: Pointer;
+
+function NetShareGetInfo;
+begin
+  GetProcedureAddress(_NetShareGetInfo, netapi32, 'NetShareGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareGetInfo]
+  end;
+end;
+
+var
+  _NetShareSetInfo: Pointer;
+
+function NetShareSetInfo;
+begin
+  GetProcedureAddress(_NetShareSetInfo, netapi32, 'NetShareSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareSetInfo]
+  end;
+end;
+
+var
+  _NetShareDel: Pointer;
+
+function NetShareDel;
+begin
+  GetProcedureAddress(_NetShareDel, netapi32, 'NetShareDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareDel]
+  end;
+end;
+
+var
+  _NetShareDelSticky: Pointer;
+
+function NetShareDelSticky;
+begin
+  GetProcedureAddress(_NetShareDelSticky, netapi32, 'NetShareDelSticky');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareDelSticky]
+  end;
+end;
+
+var
+  _NetShareCheck: Pointer;
+
+function NetShareCheck;
+begin
+  GetProcedureAddress(_NetShareCheck, netapi32, 'NetShareCheck');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetShareCheck]
+  end;
+end;
+
+var
+  _NetSessionEnum: Pointer;
+
+function NetSessionEnum;
+begin
+  GetProcedureAddress(_NetSessionEnum, netapi32, 'NetSessionEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetSessionEnum]
+  end;
+end;
+
+var
+  _NetSessionDel: Pointer;
+
+function NetSessionDel;
+begin
+  GetProcedureAddress(_NetSessionDel, netapi32, 'NetSessionDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetSessionDel]
+  end;
+end;
+
+var
+  _NetSessionGetInfo: Pointer;
+
+function NetSessionGetInfo;
+begin
+  GetProcedureAddress(_NetSessionGetInfo, netapi32, 'NetSessionGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetSessionGetInfo]
+  end;
+end;
+
+var
+  _NetConnectionEnum: Pointer;
+
+function NetConnectionEnum;
+begin
+  GetProcedureAddress(_NetConnectionEnum, netapi32, 'NetConnectionEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetConnectionEnum]
+  end;
+end;
+
+var
+  _NetFileClose: Pointer;
+
+function NetFileClose;
+begin
+  GetProcedureAddress(_NetFileClose, netapi32, 'NetFileClose');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetFileClose]
+  end;
+end;
+
+var
+  _NetFileEnum: Pointer;
+
+function NetFileEnum;
+begin
+  GetProcedureAddress(_NetFileEnum, netapi32, 'NetFileEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetFileEnum]
+  end;
+end;
+
+var
+  _NetFileGetInfo: Pointer;
+
+function NetFileGetInfo;
+begin
+  GetProcedureAddress(_NetFileGetInfo, netapi32, 'NetFileGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetFileGetInfo]
+  end;
+end;
+
+{$ELSE}
+
+function NetShareAdd; external netapi32 name 'NetShareAdd';
+function NetShareEnum; external netapi32 name 'NetShareEnum';
+function NetShareEnumSticky; external netapi32 name 'NetShareEnumSticky';
+function NetShareGetInfo; external netapi32 name 'NetShareGetInfo';
+function NetShareSetInfo; external netapi32 name 'NetShareSetInfo';
+function NetShareDel; external netapi32 name 'NetShareDel';
+function NetShareDelSticky; external netapi32 name 'NetShareDelSticky';
+function NetShareCheck; external netapi32 name 'NetShareCheck';
+function NetSessionEnum; external netapi32 name 'NetSessionEnum';
+function NetSessionDel; external netapi32 name 'NetSessionDel';
+function NetSessionGetInfo; external netapi32 name 'NetSessionGetInfo';
+function NetConnectionEnum; external netapi32 name 'NetConnectionEnum';
+function NetFileClose; external netapi32 name 'NetFileClose';
+function NetFileEnum; external netapi32 name 'NetFileEnum';
+function NetFileGetInfo; external netapi32 name 'NetFileGetInfo';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 231 - 0
packages/extra/winunits/jwalmsname.pas

@@ -0,0 +1,231 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Service Names API interface Unit for Object Pascal               }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmsname.h, released November 2001. The original Pascal }
+{ code is: LmSName.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmSName;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmsname.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+//
+//  Standard LAN Manager service names.
+//
+
+const
+  SERVICE_WORKSTATION      = TEXT('LanmanWorkstation');
+  {$EXTERNALSYM SERVICE_WORKSTATION}
+  SERVICE_LM20_WORKSTATION = TEXT('WORKSTATION');
+  {$EXTERNALSYM SERVICE_LM20_WORKSTATION}
+  WORKSTATION_DISPLAY_NAME = TEXT('Workstation');
+  {$EXTERNALSYM WORKSTATION_DISPLAY_NAME}
+
+  SERVICE_SERVER      = TEXT('LanmanServer');
+  {$EXTERNALSYM SERVICE_SERVER}
+  SERVICE_LM20_SERVER = TEXT('SERVER');
+  {$EXTERNALSYM SERVICE_LM20_SERVER}
+  SERVER_DISPLAY_NAME = TEXT('Server');
+  {$EXTERNALSYM SERVER_DISPLAY_NAME}
+
+  SERVICE_BROWSER      = TEXT('BROWSER');
+  {$EXTERNALSYM SERVICE_BROWSER}
+  SERVICE_LM20_BROWSER = SERVICE_BROWSER;
+  {$EXTERNALSYM SERVICE_LM20_BROWSER}
+
+  SERVICE_MESSENGER      = TEXT('MESSENGER');
+  {$EXTERNALSYM SERVICE_MESSENGER}
+  SERVICE_LM20_MESSENGER = SERVICE_MESSENGER;
+  {$EXTERNALSYM SERVICE_LM20_MESSENGER}
+
+  SERVICE_NETRUN      = TEXT('NETRUN');
+  {$EXTERNALSYM SERVICE_NETRUN}
+  SERVICE_LM20_NETRUN = SERVICE_NETRUN;
+  {$EXTERNALSYM SERVICE_LM20_NETRUN}
+
+  SERVICE_SPOOLER      = TEXT('SPOOLER');
+  {$EXTERNALSYM SERVICE_SPOOLER}
+  SERVICE_LM20_SPOOLER = SERVICE_SPOOLER;
+  {$EXTERNALSYM SERVICE_LM20_SPOOLER}
+
+  SERVICE_ALERTER      = TEXT('ALERTER');
+  {$EXTERNALSYM SERVICE_ALERTER}
+  SERVICE_LM20_ALERTER = SERVICE_ALERTER;
+  {$EXTERNALSYM SERVICE_LM20_ALERTER}
+
+  SERVICE_NETLOGON      = TEXT('NETLOGON');
+  {$EXTERNALSYM SERVICE_NETLOGON}
+  SERVICE_LM20_NETLOGON = SERVICE_NETLOGON;
+  {$EXTERNALSYM SERVICE_LM20_NETLOGON}
+
+  SERVICE_NETPOPUP      = TEXT('NETPOPUP');
+  {$EXTERNALSYM SERVICE_NETPOPUP}
+  SERVICE_LM20_NETPOPUP = SERVICE_NETPOPUP;
+  {$EXTERNALSYM SERVICE_LM20_NETPOPUP}
+
+  SERVICE_SQLSERVER      = TEXT('SQLSERVER');
+  {$EXTERNALSYM SERVICE_SQLSERVER}
+  SERVICE_LM20_SQLSERVER = SERVICE_SQLSERVER;
+  {$EXTERNALSYM SERVICE_LM20_SQLSERVER}
+
+  SERVICE_REPL      = TEXT('REPLICATOR');
+  {$EXTERNALSYM SERVICE_REPL}
+  SERVICE_LM20_REPL = SERVICE_REPL;
+  {$EXTERNALSYM SERVICE_LM20_REPL}
+
+  SERVICE_RIPL      = TEXT('REMOTEBOOT');
+  {$EXTERNALSYM SERVICE_RIPL}
+  SERVICE_LM20_RIPL = SERVICE_RIPL;
+  {$EXTERNALSYM SERVICE_LM20_RIPL}
+
+  SERVICE_TIMESOURCE      = TEXT('TIMESOURCE');
+  {$EXTERNALSYM SERVICE_TIMESOURCE}
+  SERVICE_LM20_TIMESOURCE = SERVICE_TIMESOURCE;
+  {$EXTERNALSYM SERVICE_LM20_TIMESOURCE}
+
+  SERVICE_AFP      = TEXT('AFP');
+  {$EXTERNALSYM SERVICE_AFP}
+  SERVICE_LM20_AFP = SERVICE_AFP;
+  {$EXTERNALSYM SERVICE_LM20_AFP}
+
+  SERVICE_UPS      = TEXT('UPS');
+  {$EXTERNALSYM SERVICE_UPS}
+  SERVICE_LM20_UPS = SERVICE_UPS;
+  {$EXTERNALSYM SERVICE_LM20_UPS}
+
+  SERVICE_XACTSRV      = TEXT('XACTSRV');
+  {$EXTERNALSYM SERVICE_XACTSRV}
+  SERVICE_LM20_XACTSRV = SERVICE_XACTSRV;
+  {$EXTERNALSYM SERVICE_LM20_XACTSRV}
+
+  SERVICE_TCPIP      = TEXT('TCPIP');
+  {$EXTERNALSYM SERVICE_TCPIP}
+  SERVICE_LM20_TCPIP = SERVICE_TCPIP;
+  {$EXTERNALSYM SERVICE_LM20_TCPIP}
+
+  SERVICE_NBT      = TEXT('NBT');
+  {$EXTERNALSYM SERVICE_NBT}
+  SERVICE_LM20_NBT = SERVICE_NBT;
+  {$EXTERNALSYM SERVICE_LM20_NBT}
+
+  SERVICE_LMHOSTS      = TEXT('LMHOSTS');
+  {$EXTERNALSYM SERVICE_LMHOSTS}
+  SERVICE_LM20_LMHOSTS = SERVICE_LMHOSTS;
+  {$EXTERNALSYM SERVICE_LM20_LMHOSTS}
+
+  SERVICE_TELNET      = TEXT('Telnet');
+  {$EXTERNALSYM SERVICE_TELNET}
+  SERVICE_LM20_TELNET = SERVICE_TELNET;
+  {$EXTERNALSYM SERVICE_LM20_TELNET}
+
+  SERVICE_SCHEDULE      = TEXT('Schedule');
+  {$EXTERNALSYM SERVICE_SCHEDULE}
+  SERVICE_LM20_SCHEDULE = SERVICE_SCHEDULE;
+  {$EXTERNALSYM SERVICE_LM20_SCHEDULE}
+
+  SERVICE_NTLMSSP = TEXT('NtLmSsp');
+  {$EXTERNALSYM SERVICE_NTLMSSP}
+
+  SERVICE_DHCP      = TEXT('DHCP');
+  {$EXTERNALSYM SERVICE_DHCP}
+  SERVICE_LM20_DHCP = SERVICE_DHCP;
+  {$EXTERNALSYM SERVICE_LM20_DHCP}
+
+  SERVICE_NWSAP      = TEXT('NwSapAgent');
+  {$EXTERNALSYM SERVICE_NWSAP}
+  SERVICE_LM20_NWSAP = SERVICE_NWSAP;
+  {$EXTERNALSYM SERVICE_LM20_NWSAP}
+  NWSAP_DISPLAY_NAME = TEXT('NW Sap Agent');
+  {$EXTERNALSYM NWSAP_DISPLAY_NAME}
+
+  SERVICE_NWCS      = TEXT('NWCWorkstation');
+  {$EXTERNALSYM SERVICE_NWCS}
+  SERVICE_DNS_CACHE = TEXT('DnsCache');
+  {$EXTERNALSYM SERVICE_DNS_CACHE}
+
+  SERVICE_W32TIME     = TEXT('w32time');
+  {$EXTERNALSYM SERVICE_W32TIME}
+  SERVCE_LM20_W32TIME = SERVICE_W32TIME;
+  {$EXTERNALSYM SERVCE_LM20_W32TIME}
+
+  SERVICE_KDC      = TEXT('kdc');
+  {$EXTERNALSYM SERVICE_KDC}
+  SERVICE_LM20_KDC = SERVICE_KDC;
+  {$EXTERNALSYM SERVICE_LM20_KDC}
+
+  SERVICE_RPCLOCATOR      = TEXT('RPCLOCATOR');
+  {$EXTERNALSYM SERVICE_RPCLOCATOR}
+  SERVICE_LM20_RPCLOCATOR = SERVICE_RPCLOCATOR;
+  {$EXTERNALSYM SERVICE_LM20_RPCLOCATOR}
+
+  SERVICE_TRKSVR      = TEXT('TrkSvr');
+  {$EXTERNALSYM SERVICE_TRKSVR}
+  SERVICE_LM20_TRKSVR = SERVICE_TRKSVR;
+  {$EXTERNALSYM SERVICE_LM20_TRKSVR}
+
+  SERVICE_TRKWKS      = TEXT('TrkWks');
+  {$EXTERNALSYM SERVICE_TRKWKS}
+  SERVICE_LM20_TRKWKS = SERVICE_TRKWKS;
+  {$EXTERNALSYM SERVICE_LM20_TRKWKS}
+
+  SERVICE_NTFRS      = TEXT('NtFrs');
+  {$EXTERNALSYM SERVICE_NTFRS}
+  SERVICE_LM20_NTFRS = SERVICE_NTFRS;
+  {$EXTERNALSYM SERVICE_LM20_NTFRS}
+
+  SERVICE_ISMSERV      = TEXT('IsmServ');
+  {$EXTERNALSYM SERVICE_ISMSERV}
+  SERVICE_LM20_ISMSERV = SERVICE_ISMSERV;
+  {$EXTERNALSYM SERVICE_LM20_ISMSERV}
+
+implementation
+
+end.

+ 248 - 0
packages/extra/winunits/jwalmstats.pas

@@ -0,0 +1,248 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Statistics API interface Unit for Object Pascal                  }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmstats.h, released November 2001. The original Pascal }
+{ code is: LmStats.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmStats;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmstats.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes - Statistics
+//
+
+function NetStatisticsGet(server: LMSTR; service: LMSTR; level: DWORD; options: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetStatisticsGet}
+
+//
+// Data Structures - Statistics
+//
+
+{$IFDEF LM20_WORKSTATION_STATISTICS}
+
+type
+  _STAT_WORKSTATION_0 = record
+    stw0_start: DWORD;
+    stw0_numNCB_r: DWORD;
+    stw0_numNCB_s: DWORD;
+    stw0_numNCB_a: DWORD;
+    stw0_fiNCB_r: DWORD;
+    stw0_fiNCB_s: DWORD;
+    stw0_fiNCB_a: DWORD;
+    stw0_fcNCB_r: DWORD;
+    stw0_fcNCB_s: DWORD;
+    stw0_fcNCB_a: DWORD;
+    stw0_sesstart: DWORD;
+    stw0_sessfailcon: DWORD;
+    stw0_sessbroke: DWORD;
+    stw0_uses: DWORD;
+    stw0_usefail: DWORD;
+    stw0_autorec: DWORD;
+    stw0_bytessent_r_lo: DWORD;
+    stw0_bytessent_r_hi: DWORD;
+    stw0_bytesrcvd_r_lo: DWORD;
+    stw0_bytesrcvd_r_hi: DWORD;
+    stw0_bytessent_s_lo: DWORD;
+    stw0_bytessent_s_hi: DWORD;
+    stw0_bytesrcvd_s_lo: DWORD;
+    stw0_bytesrcvd_s_hi: DWORD;
+    stw0_bytessent_a_lo: DWORD;
+    stw0_bytessent_a_hi: DWORD;
+    stw0_bytesrcvd_a_lo: DWORD;
+    stw0_bytesrcvd_a_hi: DWORD;
+    stw0_reqbufneed: DWORD;
+    stw0_bigbufneed: DWORD;
+  end;
+  {$EXTERNALSYM _STAT_WORKSTATION_0}
+  STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
+  {$EXTERNALSYM STAT_WORKSTATION_0}
+  PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
+  {$EXTERNALSYM PSTAT_WORKSTATION_0}
+  LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
+  {$EXTERNALSYM LPSTAT_WORKSTATION_0}
+  TStatWorkstation0 = STAT_WORKSTATION_0;
+  PStatWorkstation0 = PSTAT_WORKSTATION_0;
+
+{$ELSE}
+
+//
+// NB: The following structure is REDIR_STATISTICS in sdk\inc\ntddnfs.h. If you
+//     change the structure, change it in both places
+//
+
+type
+  _STAT_WORKSTATION_0 = record
+    StatisticsStartTime: LARGE_INTEGER;
+    BytesReceived: LARGE_INTEGER;
+    SmbsReceived: LARGE_INTEGER;
+    PagingReadBytesRequested: LARGE_INTEGER;
+    NonPagingReadBytesRequested: LARGE_INTEGER;
+    CacheReadBytesRequested: LARGE_INTEGER;
+    NetworkReadBytesRequested: LARGE_INTEGER;
+    BytesTransmitted: LARGE_INTEGER;
+    SmbsTransmitted: LARGE_INTEGER;
+    PagingWriteBytesRequested: LARGE_INTEGER;
+    NonPagingWriteBytesRequested: LARGE_INTEGER;
+    CacheWriteBytesRequested: LARGE_INTEGER;
+    NetworkWriteBytesRequested: LARGE_INTEGER;
+    InitiallyFailedOperations: DWORD;
+    FailedCompletionOperations: DWORD;
+    ReadOperations: DWORD;
+    RandomReadOperations: DWORD;
+    ReadSmbs: DWORD;
+    LargeReadSmbs: DWORD;
+    SmallReadSmbs: DWORD;
+    WriteOperations: DWORD;
+    RandomWriteOperations: DWORD;
+    WriteSmbs: DWORD;
+    LargeWriteSmbs: DWORD;
+    SmallWriteSmbs: DWORD;
+    RawReadsDenied: DWORD;
+    RawWritesDenied: DWORD;
+    NetworkErrors: DWORD;
+    //  Connection/Session counts
+    Sessions: DWORD;
+    FailedSessions: DWORD;
+    Reconnects: DWORD;
+    CoreConnects: DWORD;
+    Lanman20Connects: DWORD;
+    Lanman21Connects: DWORD;
+    LanmanNtConnects: DWORD;
+    ServerDisconnects: DWORD;
+    HungSessions: DWORD;
+    UseCount: DWORD;
+    FailedUseCount: DWORD;
+    //
+    //  Queue Lengths (updates protected by RdrMpxTableSpinLock NOT
+    //  RdrStatisticsSpinlock)
+    //
+    CurrentCommands: DWORD;
+  end;
+  {$EXTERNALSYM _STAT_WORKSTATION_0}
+  STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
+  {$EXTERNALSYM STAT_WORKSTATION_0}
+  PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
+  {$EXTERNALSYM PSTAT_WORKSTATION_0}
+  LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
+  {$EXTERNALSYM LPSTAT_WORKSTATION_0}
+  TStatWorkstation0 = STAT_WORKSTATION_0;
+  PStatWorkstation0 = PSTAT_WORKSTATION_0;
+
+{$ENDIF LM20_WORKSTATION_STATISTICS}
+
+type
+  _STAT_SERVER_0 = record
+    sts0_start: DWORD;
+    sts0_fopens: DWORD;
+    sts0_devopens: DWORD;
+    sts0_jobsqueued: DWORD;
+    sts0_sopens: DWORD;
+    sts0_stimedout: DWORD;
+    sts0_serrorout: DWORD;
+    sts0_pwerrors: DWORD;
+    sts0_permerrors: DWORD;
+    sts0_syserrors: DWORD;
+    sts0_bytessent_low: DWORD;
+    sts0_bytessent_high: DWORD;
+    sts0_bytesrcvd_low: DWORD;
+    sts0_bytesrcvd_high: DWORD;
+    sts0_avresponse: DWORD;
+    sts0_reqbufneed: DWORD;
+    sts0_bigbufneed: DWORD;
+  end;
+  {$EXTERNALSYM _STAT_SERVER_0}
+  STAT_SERVER_0 = _STAT_SERVER_0;
+  {$EXTERNALSYM STAT_SERVER_0}
+  PSTAT_SERVER_0 = ^STAT_SERVER_0;
+  {$EXTERNALSYM PSTAT_SERVER_0}
+  LPSTAT_SERVER_0 = ^STAT_SERVER_0;
+  {$EXTERNALSYM LPSTAT_SERVER_0}
+  TStatServer0 = STAT_SERVER_0;
+  PStatServer0 = PSTAT_SERVER_0;
+
+//
+// Special Values and Constants
+//
+
+const
+  STATSOPT_CLR   = 1;
+  {$EXTERNALSYM STATSOPT_CLR}
+  STATS_NO_VALUE = ULONG(-1);
+  {$EXTERNALSYM STATS_NO_VALUE}
+  STATS_OVERFLOW = ULONG(-2);
+  {$EXTERNALSYM STATS_OVERFLOW}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetStatisticsGet: Pointer;
+
+function NetStatisticsGet;
+begin
+  GetProcedureAddress(_NetStatisticsGet, netapi32, 'NetStatisticsGet');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetStatisticsGet]
+  end;
+end;
+
+{$ELSE}
+
+function NetStatisticsGet; external netapi32 name 'NetStatisticsGet';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 795 - 0
packages/extra/winunits/jwalmsvc.pas

@@ -0,0 +1,795 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Service API interface Unit for Object Pascal                     }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmsvc.h, released November 2001. The original Pascal   }
+{ code is: LmSvc.pas, released Februari 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmSvc;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmsvc.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+//  Data Structures
+//
+
+type
+  LPSERVICE_INFO_0 = ^SERVICE_INFO_0;
+  {$EXTERNALSYM LPSERVICE_INFO_0}
+  PSERVICE_INFO_0 = ^SERVICE_INFO_0;
+  {$EXTERNALSYM PSERVICE_INFO_0}
+  _SERVICE_INFO_0 = record
+    svci0_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _SERVICE_INFO_0}
+  SERVICE_INFO_0 = _SERVICE_INFO_0;
+  {$EXTERNALSYM SERVICE_INFO_0}
+  TServiceInfo0 = SERVICE_INFO_0;
+  PServiceInfo0 = PSERVICE_INFO_0;
+
+  LPSERVICE_INFO_1 = ^SERVICE_INFO_1;
+  {$EXTERNALSYM LPSERVICE_INFO_1}
+  PSERVICE_INFO_1 = ^SERVICE_INFO_1;
+  {$EXTERNALSYM PSERVICE_INFO_1}
+  _SERVICE_INFO_1 = record
+    svci1_name: LPWSTR;
+    svci1_status: DWORD;
+    svci1_code: DWORD;
+    svci1_pid: DWORD;
+  end;
+  {$EXTERNALSYM _SERVICE_INFO_1}
+  SERVICE_INFO_1 = _SERVICE_INFO_1;
+  {$EXTERNALSYM SERVICE_INFO_1}
+  TServiceInfo1 = SERVICE_INFO_1;
+  PServiceInfo1 = PSERVICE_INFO_1;
+
+  LPSERVICE_INFO_2 = ^SERVICE_INFO_2;
+  {$EXTERNALSYM LPSERVICE_INFO_2}
+  PSERVICE_INFO_2 = ^SERVICE_INFO_2;
+  {$EXTERNALSYM PSERVICE_INFO_2}
+  _SERVICE_INFO_2 = record
+    svci2_name: LPWSTR;
+    svci2_status: DWORD;
+    svci2_code: DWORD;
+    svci2_pid: DWORD;
+    svci2_text: LPWSTR;
+    svci2_specific_error: DWORD;
+    svci2_display_name: LPWSTR;
+  end;
+  {$EXTERNALSYM _SERVICE_INFO_2}
+  SERVICE_INFO_2 = _SERVICE_INFO_2;
+  {$EXTERNALSYM SERVICE_INFO_2}
+  TServiceInfo2 = SERVICE_INFO_2;
+  PServiceInfo2 = PSERVICE_INFO_2;
+
+//
+// Function Prototypes
+//
+
+function NetServiceControl(servername, service: LPCWSTR; opcode: DWORD; arg: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServiceControl}
+
+function NetServiceEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServiceEnum}
+
+function NetServiceGetInfo(servername, service: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServiceGetInfo}
+
+function NetServiceInstall(servername, service: LPCWSTR; argc: DWORD; argv: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetServiceInstall}
+
+//
+// Special Values and Constants
+//
+
+//
+//  Bitmask and bit values for svci1_status, and svci2_status
+//  fields.  For each "subfield", there is a mask defined,
+//  and a number of constants representing the value
+//  obtained by doing (status & mask).
+//
+
+// Bits 0,1 -- general status
+
+const
+  SERVICE_INSTALL_STATE     = $03;
+  {$EXTERNALSYM SERVICE_INSTALL_STATE}
+  SERVICE_UNINSTALLED       = $00;
+  {$EXTERNALSYM SERVICE_UNINSTALLED}
+  SERVICE_INSTALL_PENDING   = $01;
+  {$EXTERNALSYM SERVICE_INSTALL_PENDING}
+  SERVICE_UNINSTALL_PENDING = $02;
+  {$EXTERNALSYM SERVICE_UNINSTALL_PENDING}
+  SERVICE_INSTALLED         = $03;
+  {$EXTERNALSYM SERVICE_INSTALLED}
+
+// Bits 2,3 -- paused/active status
+
+  SERVICE_PAUSE_STATE           = $0C;
+  {$EXTERNALSYM SERVICE_PAUSE_STATE}
+  LM20_SERVICE_ACTIVE           = $00;
+  {$EXTERNALSYM LM20_SERVICE_ACTIVE}
+  LM20_SERVICE_CONTINUE_PENDING = $04;
+  {$EXTERNALSYM LM20_SERVICE_CONTINUE_PENDING}
+  LM20_SERVICE_PAUSE_PENDING    = $08;
+  {$EXTERNALSYM LM20_SERVICE_PAUSE_PENDING}
+  LM20_SERVICE_PAUSED           = $0C;
+  {$EXTERNALSYM LM20_SERVICE_PAUSED}
+
+// Bit 4 -- uninstallable indication
+
+  SERVICE_NOT_UNINSTALLABLE = $00;
+  {$EXTERNALSYM SERVICE_NOT_UNINSTALLABLE}
+  SERVICE_UNINSTALLABLE     = $10;
+  {$EXTERNALSYM SERVICE_UNINSTALLABLE}
+
+// Bit 5 -- pausable indication
+
+  SERVICE_NOT_PAUSABLE = $00;
+  {$EXTERNALSYM SERVICE_NOT_PAUSABLE}
+  SERVICE_PAUSABLE     = $20;
+  {$EXTERNALSYM SERVICE_PAUSABLE}
+
+// Workstation service only:
+// Bits 8,9,10 -- redirection paused/active
+
+  SERVICE_REDIR_PAUSED       = $700;
+  {$EXTERNALSYM SERVICE_REDIR_PAUSED}
+  SERVICE_REDIR_DISK_PAUSED  = $100;
+  {$EXTERNALSYM SERVICE_REDIR_DISK_PAUSED}
+  SERVICE_REDIR_PRINT_PAUSED = $200;
+  {$EXTERNALSYM SERVICE_REDIR_PRINT_PAUSED}
+  SERVICE_REDIR_COMM_PAUSED  = $400;
+  {$EXTERNALSYM SERVICE_REDIR_COMM_PAUSED}
+
+//
+//  Additional standard LAN Manager for MS-DOS services
+//
+
+  SERVICE_DOS_ENCRYPTION = WideString('ENCRYPT');
+  {$EXTERNALSYM SERVICE_DOS_ENCRYPTION}
+
+//
+//  NetServiceControl opcodes.
+//
+
+  SERVICE_CTRL_INTERROGATE = 0;
+  {$EXTERNALSYM SERVICE_CTRL_INTERROGATE}
+  SERVICE_CTRL_PAUSE       = 1;
+  {$EXTERNALSYM SERVICE_CTRL_PAUSE}
+  SERVICE_CTRL_CONTINUE    = 2;
+  {$EXTERNALSYM SERVICE_CTRL_CONTINUE}
+  SERVICE_CTRL_UNINSTALL   = 3;
+  {$EXTERNALSYM SERVICE_CTRL_UNINSTALL}
+
+//
+//  Workstation service only:  Bits used in the "arg" parameter
+//  to NetServiceControl in conjunction with the opcode
+//  SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
+//  continue redirection.
+//
+
+  SERVICE_CTRL_REDIR_DISK  = $1;
+  {$EXTERNALSYM SERVICE_CTRL_REDIR_DISK}
+  SERVICE_CTRL_REDIR_PRINT = $2;
+  {$EXTERNALSYM SERVICE_CTRL_REDIR_PRINT}
+  SERVICE_CTRL_REDIR_COMM  = $4;
+  {$EXTERNALSYM SERVICE_CTRL_REDIR_COMM}
+
+//
+//  Values for svci1_code, and svci2_code when status
+//  of the service is SERVICE_INSTALL_PENDING or
+//  SERVICE_UNINSTALL_PENDING.
+//  A service can optionally provide a hint to the installer
+//  that the install is proceeding and how long to wait
+//  (in 0.1 second increments) before querying status again.
+//
+
+  SERVICE_IP_NO_HINT  = $0;
+  {$EXTERNALSYM SERVICE_IP_NO_HINT}
+  SERVICE_CCP_NO_HINT = $0;
+  {$EXTERNALSYM SERVICE_CCP_NO_HINT}
+
+  SERVICE_IP_QUERY_HINT  = $10000;
+  {$EXTERNALSYM SERVICE_IP_QUERY_HINT}
+  SERVICE_CCP_QUERY_HINT = $10000;
+  {$EXTERNALSYM SERVICE_CCP_QUERY_HINT}
+
+//
+// Mask for install proceeding checkpoint number
+//
+
+  SERVICE_IP_CHKPT_NUM  = $0FF;
+  {$EXTERNALSYM SERVICE_IP_CHKPT_NUM}
+  SERVICE_CCP_CHKPT_NUM = $0FF;
+  {$EXTERNALSYM SERVICE_CCP_CHKPT_NUM}
+
+//
+// Mask for wait time hint before querying again
+//
+
+  SERVICE_IP_WAIT_TIME  = $0FF00;
+  {$EXTERNALSYM SERVICE_IP_WAIT_TIME}
+  SERVICE_CCP_WAIT_TIME = $0FF00;
+  {$EXTERNALSYM SERVICE_CCP_WAIT_TIME}
+
+//
+// Shift count for building wait time _code values
+//
+
+  SERVICE_IP_WAITTIME_SHIFT   = 8;
+  {$EXTERNALSYM SERVICE_IP_WAITTIME_SHIFT}
+  SERVICE_NTIP_WAITTIME_SHIFT = 12;
+  {$EXTERNALSYM SERVICE_NTIP_WAITTIME_SHIFT}
+
+//
+// Mask used for upper and lower portions of wait hint time.
+//
+
+  UPPER_HINT_MASK     = $0000FF00;
+  {$EXTERNALSYM UPPER_HINT_MASK}
+  LOWER_HINT_MASK     = $000000FF;
+  {$EXTERNALSYM LOWER_HINT_MASK}
+  UPPER_GET_HINT_MASK = $0FF00000;
+  {$EXTERNALSYM UPPER_GET_HINT_MASK}
+  LOWER_GET_HINT_MASK = $0000FF00;
+  {$EXTERNALSYM LOWER_GET_HINT_MASK}
+  SERVICE_NT_MAXTIME  = $0000FFFF;
+  {$EXTERNALSYM SERVICE_NT_MAXTIME}
+  SERVICE_RESRV_MASK  = $0001FFFF;
+  {$EXTERNALSYM SERVICE_RESRV_MASK}
+  SERVICE_MAXTIME     = $000000FF;
+  {$EXTERNALSYM SERVICE_MAXTIME}
+
+//
+//  SERVICE_BASE is the base of service error codes,
+//  chosen to avoid conflict with OS, redirector,
+//  netapi, and errlog codes.
+//
+// Don't change the comments following the manifest constants without
+// understanding how mapmsg works.
+//
+
+  SERVICE_BASE       = 3050;
+  {$EXTERNALSYM SERVICE_BASE}
+  SERVICE_UIC_NORMAL = 0;
+  {$EXTERNALSYM SERVICE_UIC_NORMAL}
+
+{*
+ *  Uninstall codes, to be used in high byte of 'code' on final NetStatus,
+ *  which sets the status to UNINSTALLED.
+ *}
+
+  SERVICE_UIC_BADPARMVAL = SERVICE_BASE + 1;
+  {$EXTERNALSYM SERVICE_UIC_BADPARMVAL}
+
+{*
+ * The Registry or the information you just typed includes an illegal
+ * value for "%1".
+ *}
+
+  SERVICE_UIC_MISSPARM = SERVICE_BASE + 2;
+  {$EXTERNALSYM SERVICE_UIC_MISSPARM}
+
+{*
+ * The required parameter was not provided on the command
+ * line or in the configuration file.
+ *}
+
+  SERVICE_UIC_UNKPARM = SERVICE_BASE + 3;
+  {$EXTERNALSYM SERVICE_UIC_UNKPARM}
+
+{*
+ * LAN Manager does not recognize "%1" as a valid option.
+ *}
+
+  SERVICE_UIC_RESOURCE = SERVICE_BASE + 4;
+  {$EXTERNALSYM SERVICE_UIC_RESOURCE}
+
+{*
+ * A request for resource could not be satisfied.
+ *}
+
+  SERVICE_UIC_CONFIG = SERVICE_BASE + 5;
+  {$EXTERNALSYM SERVICE_UIC_CONFIG}
+
+{*
+ * A problem exists with the system configuration.
+ *}
+
+  SERVICE_UIC_SYSTEM = SERVICE_BASE + 6;
+  {$EXTERNALSYM SERVICE_UIC_SYSTEM}
+
+{*
+ * A system error has occurred.
+ *}
+
+  SERVICE_UIC_INTERNAL = SERVICE_BASE + 7;
+  {$EXTERNALSYM SERVICE_UIC_INTERNAL}
+
+{*
+ * An internal consistency error has occurred.
+ *}
+
+  SERVICE_UIC_AMBIGPARM = SERVICE_BASE + 8;
+  {$EXTERNALSYM SERVICE_UIC_AMBIGPARM}
+
+{*
+ * The configuration file or the command line has an ambiguous option.
+ *}
+
+  SERVICE_UIC_DUPPARM = SERVICE_BASE + 9;
+  {$EXTERNALSYM SERVICE_UIC_DUPPARM}
+
+{*
+ * The configuration file or the command line has a duplicate parameter.
+ *}
+
+  SERVICE_UIC_KILL = SERVICE_BASE + 10;
+  {$EXTERNALSYM SERVICE_UIC_KILL}
+
+{*
+ * The service did not respond to control and was stopped with
+ * the DosKillProc function.
+ *}
+
+  SERVICE_UIC_EXEC = SERVICE_BASE + 11;
+  {$EXTERNALSYM SERVICE_UIC_EXEC}
+
+{*
+ * An error occurred when attempting to run the service program.
+ *}
+
+  SERVICE_UIC_SUBSERV = SERVICE_BASE + 12;
+  {$EXTERNALSYM SERVICE_UIC_SUBSERV}
+
+{*
+ * The sub-service failed to start.
+ *}
+
+  SERVICE_UIC_CONFLPARM = SERVICE_BASE + 13;
+  {$EXTERNALSYM SERVICE_UIC_CONFLPARM}
+
+{*
+ * There is a conflict in the value or use of these options: %1.
+ *}
+
+  SERVICE_UIC_FILE = SERVICE_BASE + 14;
+  {$EXTERNALSYM SERVICE_UIC_FILE}
+
+{*
+ * There is a problem with the file.
+ *}
+
+//
+//  The modifiers
+//
+
+//
+// General:
+//
+
+  SERVICE_UIC_M_NULL = 0;
+  {$EXTERNALSYM SERVICE_UIC_M_NULL}
+
+//
+//  RESOURCE:
+//
+
+  SERVICE_UIC_M_MEMORY    = SERVICE_BASE + 20; // memory
+  {$EXTERNALSYM SERVICE_UIC_M_MEMORY}
+  SERVICE_UIC_M_DISK      = SERVICE_BASE + 21; // disk space
+  {$EXTERNALSYM SERVICE_UIC_M_DISK}
+  SERVICE_UIC_M_THREADS   = SERVICE_BASE + 22; // thread
+  {$EXTERNALSYM SERVICE_UIC_M_THREADS}
+  SERVICE_UIC_M_PROCESSES = SERVICE_BASE + 23; // process
+  {$EXTERNALSYM SERVICE_UIC_M_PROCESSES}
+
+//
+//  CONFIG:
+//
+
+//
+// Security failure
+//
+
+  SERVICE_UIC_M_SECURITY = SERVICE_BASE + 24;
+  {$EXTERNALSYM SERVICE_UIC_M_SECURITY}
+
+{* Security Failure. %0 *}
+
+  SERVICE_UIC_M_LANROOT = SERVICE_BASE + 25;
+  {$EXTERNALSYM SERVICE_UIC_M_LANROOT}
+
+{*
+ * Bad or missing LAN Manager root directory.
+ *}
+
+  SERVICE_UIC_M_REDIR = SERVICE_BASE + 26;
+  {$EXTERNALSYM SERVICE_UIC_M_REDIR}
+
+{*
+ * The network software is not installed.
+ *}
+
+  SERVICE_UIC_M_SERVER = SERVICE_BASE + 27;
+  {$EXTERNALSYM SERVICE_UIC_M_SERVER}
+
+{*
+ * The server is not started.
+ *}
+
+  SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE + 28;
+  {$EXTERNALSYM SERVICE_UIC_M_SEC_FILE_ERR}
+
+{*
+ * The server cannot access the user accounts database (NET.ACC).
+ *}
+
+  SERVICE_UIC_M_FILES = SERVICE_BASE + 29;
+  {$EXTERNALSYM SERVICE_UIC_M_FILES}
+
+{*
+ * Incompatible files are installed in the LANMAN tree.
+ *}
+
+  SERVICE_UIC_M_LOGS = SERVICE_BASE + 30;
+  {$EXTERNALSYM SERVICE_UIC_M_LOGS}
+
+{*
+ * The LANMAN\LOGS directory is invalid.
+ *}
+
+  SERVICE_UIC_M_LANGROUP = SERVICE_BASE + 31;
+  {$EXTERNALSYM SERVICE_UIC_M_LANGROUP}
+
+{*
+ * The domain specified could not be used.
+ *}
+
+  SERVICE_UIC_M_MSGNAME = SERVICE_BASE + 32;
+  {$EXTERNALSYM SERVICE_UIC_M_MSGNAME}
+
+{*
+ * The computer name is being used as a message alias on another computer.
+ *}
+
+  SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE + 33;
+  {$EXTERNALSYM SERVICE_UIC_M_ANNOUNCE}
+
+{*
+ * The announcement of the server name failed.
+ *}
+
+  SERVICE_UIC_M_UAS = SERVICE_BASE + 34;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS}
+
+{*
+ * The user accounts database is not configured correctly.
+ *}
+
+  SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE + 35;
+  {$EXTERNALSYM SERVICE_UIC_M_SERVER_SEC_ERR}
+
+{*
+ * The server is not running with user-level security.
+ *}
+
+  SERVICE_UIC_M_WKSTA = SERVICE_BASE + 37;
+  {$EXTERNALSYM SERVICE_UIC_M_WKSTA}
+
+{*
+ * The workstation is not configured properly.
+ *}
+
+  SERVICE_UIC_M_ERRLOG = SERVICE_BASE + 38;
+  {$EXTERNALSYM SERVICE_UIC_M_ERRLOG}
+
+{*
+ * View your error log for details.
+ *}
+
+  SERVICE_UIC_M_FILE_UW = SERVICE_BASE + 39;
+  {$EXTERNALSYM SERVICE_UIC_M_FILE_UW}
+
+{*
+ * Unable to write to this file.
+ *}
+
+  SERVICE_UIC_M_ADDPAK = SERVICE_BASE + 40;
+  {$EXTERNALSYM SERVICE_UIC_M_ADDPAK}
+
+{*
+ * ADDPAK file is corrupted.  Delete LANMAN\NETPROG\ADDPAK.SER
+ * and reapply all ADDPAKs.
+ *}
+
+  SERVICE_UIC_M_LAZY = SERVICE_BASE + 41;
+  {$EXTERNALSYM SERVICE_UIC_M_LAZY}
+
+{*
+ * The LM386 server cannot be started because CACHE.EXE is not running.
+ *}
+
+  SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE + 42;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS_MACHINE_ACCT}
+
+{*
+ * There is no account for this computer in the security database.
+ *}
+
+  SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE + 43;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NMEMB}
+
+{*
+ * This computer is not a member of the group SERVERS.
+ *}
+
+  SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE + 44;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NOGRP}
+
+{*
+ * The group SERVERS is not present in the local security database.
+ *}
+
+  SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE + 45;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS_INVALID_ROLE}
+
+{*
+ * This computer is configured as a member of a workgroup, not as
+ * a member of a domain. The Netlogon service does not need to run in this
+ * configuration.
+ *}
+
+  SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE + 46;
+  {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_NO_DC}
+
+{*
+ * The primary Domain Controller for this domain could not be located.
+ *}
+
+  SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE + 47;
+  {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_DC_CFLCT}
+
+{*
+ * This computer is configured to be the primary domain controller of its domain.
+ * However, the computer %1 is currently claiming to be the primary domain controller
+ * of the domain.
+ *}
+
+  SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE + 48;
+  {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_AUTH}
+
+{*
+ * The service failed to authenticate with the primary domain controller.
+ *}
+
+  SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE + 49;
+  {$EXTERNALSYM SERVICE_UIC_M_UAS_PROLOG}
+
+{*
+ * There is a problem with the security database creation date or serial number.
+ *}
+
+  SERVICE2_BASE = 5600;
+  {$EXTERNALSYM SERVICE2_BASE}
+
+{* new SEVICE_UIC messages go here *}
+
+  SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE + 0;
+  {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_MPATH}
+
+{*
+ * Could not share the User or Script path.
+ *}
+
+  SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE + 1;
+  {$EXTERNALSYM SERVICE_UIC_M_LSA_MACHINE_ACCT}
+
+{*
+ * The password for this computer is not found in the local security
+ * database.
+ *}
+
+  SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE + 2;
+  {$EXTERNALSYM SERVICE_UIC_M_DATABASE_ERROR}
+
+{*
+ * An internal error occurred while accessing the computer's
+ * local or network security database.
+ *}
+
+//
+//  End modifiers
+//
+
+//
+// Commonly used Macros:
+//
+
+function SERVICE_IP_CODE(tt, nn: LONG): LONG;
+{$EXTERNALSYM SERVICE_IP_CODE}
+
+function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
+{$EXTERNALSYM SERVICE_CCP_CODE}
+
+function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
+{$EXTERNALSYM SERVICE_UIC_CODE}
+
+//
+// This macro takes a wait hint (tt) which can have a maximum value of
+// 0xFFFF and puts it into the service status code field.
+// 0x0FF1FFnn  (where nn is the checkpoint information).
+//
+
+function SERVICE_NT_CCP_CODE(tt, nn: LONG): LONG;
+{$EXTERNALSYM SERVICE_NT_CCP_CODE}
+
+//
+// This macro takes a status code field, and strips out the wait hint
+// from the upper and lower sections.
+// 0x0FF1FFnn results in 0x0000FFFF.
+//
+
+function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
+{$EXTERNALSYM SERVICE_NT_WAIT_GET}
+
+implementation
+
+// #define SERVICE_IP_CODE(tt,nn) ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
+
+function SERVICE_IP_CODE(tt, nn: LONG): LONG;
+begin
+  Result := SERVICE_IP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
+end;
+
+// #define SERVICE_CCP_CODE(tt,nn) ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
+
+function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
+begin
+  Result := SERVICE_CCP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
+end;
+
+// #define SERVICE_UIC_CODE(cc,mm) ((long)(((long)cc<<16)|(long)(unsigned short)mm))
+
+function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
+begin
+  Result := (cc shl 16) or WORD(mm);
+end;
+
+// #define SERVICE_NT_CCP_CODE(tt,nn)  \
+//   (  \
+//     ((long)SERVICE_CCP_QUERY_HINT)   | \
+//     ((long)(nn))   | \
+//     (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT)   | \
+//     (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT)   \
+//   )
+
+function SERVICE_NT_CCP_CODE(tt, nn: Longint): Longint;
+begin
+  Result := SERVICE_CCP_QUERY_HINT or nn or ((tt and LOWER_HINT_MASK) shl SERVICE_IP_WAITTIME_SHIFT) or ((tt and UPPER_HINT_MASK) shl SERVICE_NTIP_WAITTIME_SHIFT);
+end;
+
+// #define SERVICE_NT_WAIT_GET(code) \
+//     (   \
+//       (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT)  |  \
+//       (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT)  \
+//     )
+
+function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
+begin
+  Result := ((code and UPPER_GET_HINT_MASK) shr SERVICE_NTIP_WAITTIME_SHIFT) or ((code and LOWER_GET_HINT_MASK) shr SERVICE_IP_WAITTIME_SHIFT);
+end;
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetServiceControl: Pointer;
+
+function NetServiceControl;
+begin
+  GetProcedureAddress(_NetServiceControl, netapi32, 'NetServiceControl');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServiceControl]
+  end;
+end;
+
+var
+  _NetServiceEnum: Pointer;
+
+function NetServiceEnum;
+begin
+  GetProcedureAddress(_NetServiceEnum, netapi32, 'NetServiceEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServiceEnum]
+  end;
+end;
+
+var
+  _NetServiceGetInfo: Pointer;
+
+function NetServiceGetInfo;
+begin
+  GetProcedureAddress(_NetServiceGetInfo, netapi32, 'NetServiceGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServiceGetInfo]
+  end;
+end;
+
+var
+  _NetServiceInstall: Pointer;
+
+function NetServiceInstall;
+begin
+  GetProcedureAddress(_NetServiceInstall, netapi32, 'NetServiceInstall');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetServiceInstall]
+  end;
+end;
+
+{$ELSE}
+
+function NetServiceControl; external netapi32 name 'NetServiceControl';
+function NetServiceEnum; external netapi32 name 'NetServiceEnum';
+function NetServiceGetInfo; external netapi32 name 'NetServiceGetInfo';
+function NetServiceInstall; external netapi32 name 'NetServiceInstall';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 286 - 0
packages/extra/winunits/jwalmuse.pas

@@ -0,0 +1,286 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Use API interface Unit for Object Pascal                         }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmuse.h, released November 2001. The original Pascal   }
+{ code is: LmUse.pas, released Februari 2002. The initial developer of the     }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmUse;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmuse.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes
+//
+
+function NetUseAdd(UncServerName: LMSTR; Level: DWORD; Buf: LPBYTE; ParmError: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUseAdd}
+
+function NetUseDel(UncServerName: LMSTR; UseName: LMSTR; ForceCond: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUseDel}
+
+function NetUseEnum(UncServerName: LMSTR; Level: DWORD; var BufPtr: LPBYTE; PreferedMaximumSize: DWORD; EntriesRead: LPDWORD; TotalEntries: LPDWORD; ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUseEnum}
+
+function NetUseGetInfo(UncServerName: LMSTR; UseName: LMSTR; Level: DWORD; var BufPtr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetUseGetInfo}
+
+//
+//  Data Structures
+//
+
+type
+  _USE_INFO_0 = record
+    ui0_local: LMSTR;
+    ui0_remote: LMSTR;
+  end;
+  {$EXTERNALSYM _USE_INFO_0}
+  USE_INFO_0 = _USE_INFO_0;
+  {$EXTERNALSYM USE_INFO_0}
+  PUSE_INFO_0 = ^USE_INFO_0;
+  {$EXTERNALSYM PUSE_INFO_0}
+  LPUSE_INFO_0 = ^USE_INFO_0;
+  {$EXTERNALSYM LPUSE_INFO_0}
+  TUseInfo0 = USE_INFO_0;
+  PUseInfo0 = PUSE_INFO_0;
+
+  _USE_INFO_1 = record
+    ui1_local: LMSTR;
+    ui1_remote: LMSTR;
+    ui1_password: LMSTR;
+    ui1_status: DWORD;
+    ui1_asg_type: DWORD;
+    ui1_refcount: DWORD;
+    ui1_usecount: DWORD;
+  end;
+  {$EXTERNALSYM _USE_INFO_1}
+  USE_INFO_1 = _USE_INFO_1;
+  {$EXTERNALSYM USE_INFO_1}
+  PUSE_INFO_1 = ^USE_INFO_1;
+  {$EXTERNALSYM PUSE_INFO_1}
+  LPUSE_INFO_1 = ^USE_INFO_1;
+  {$EXTERNALSYM LPUSE_INFO_1}
+  TUseInfo1 = USE_INFO_1;
+  PUseInfo1 = PUSE_INFO_1;
+
+  _USE_INFO_2 = record
+    ui2_local: LMSTR;
+    ui2_remote: LMSTR;
+    ui2_password: LMSTR;
+    ui2_status: DWORD;
+    ui2_asg_type: DWORD;
+    ui2_refcount: DWORD;
+    ui2_usecount: DWORD;
+    ui2_username: LMSTR;
+    ui2_domainname: LMSTR;
+  end;
+  {$EXTERNALSYM _USE_INFO_2}
+  USE_INFO_2 = _USE_INFO_2;
+  {$EXTERNALSYM USE_INFO_2}
+  PUSE_INFO_2 = ^USE_INFO_2;
+  {$EXTERNALSYM PUSE_INFO_2}
+  LPUSE_INFO_2 = ^USE_INFO_2;
+  {$EXTERNALSYM LPUSE_INFO_2}
+  TUseInfo2 = USE_INFO_2;
+  PUseInfo2 = PUSE_INFO_2;
+
+  _USE_INFO_3 = record
+    ui3_ui2: USE_INFO_2;
+    ui3_flags: ULONG;
+  end;
+  {$EXTERNALSYM _USE_INFO_3}
+  USE_INFO_3 = _USE_INFO_3;
+  {$EXTERNALSYM USE_INFO_3}
+  PUSE_INFO_3 = ^USE_INFO_3;
+  {$EXTERNALSYM PUSE_INFO_3}
+  LPUSE_INFO_3 = ^USE_INFO_3;
+  {$EXTERNALSYM LPUSE_INFO_3}
+  TUseInfo3 = USE_INFO_3;
+  PUseInfo3 = PUSE_INFO_3;
+
+//
+// Special Values and Constants
+//
+
+//
+// One of these values indicates the parameter within an information
+// structure that is invalid when ERROR_INVALID_PARAMETER is returned by
+// NetUseAdd.
+//
+
+const
+  USE_LOCAL_PARMNUM      = 1;
+  {$EXTERNALSYM USE_LOCAL_PARMNUM}
+  USE_REMOTE_PARMNUM     = 2;
+  {$EXTERNALSYM USE_REMOTE_PARMNUM}
+  USE_PASSWORD_PARMNUM   = 3;
+  {$EXTERNALSYM USE_PASSWORD_PARMNUM}
+  USE_ASGTYPE_PARMNUM    = 4;
+  {$EXTERNALSYM USE_ASGTYPE_PARMNUM}
+  USE_USERNAME_PARMNUM   = 5;
+  {$EXTERNALSYM USE_USERNAME_PARMNUM}
+  USE_DOMAINNAME_PARMNUM = 6;
+  {$EXTERNALSYM USE_DOMAINNAME_PARMNUM}
+
+//
+// Values appearing in the ui1_status field of use_info_1 structure.
+// Note that USE_SESSLOST and USE_DISCONN are synonyms.
+//
+
+  USE_OK       = 0;
+  {$EXTERNALSYM USE_OK}
+  USE_PAUSED   = 1;
+  {$EXTERNALSYM USE_PAUSED}
+  USE_SESSLOST = 2;
+  {$EXTERNALSYM USE_SESSLOST}
+  USE_DISCONN  = 2;
+  {$EXTERNALSYM USE_DISCONN}
+  USE_NETERR   = 3;
+  {$EXTERNALSYM USE_NETERR}
+  USE_CONN     = 4;
+  {$EXTERNALSYM USE_CONN}
+  USE_RECONN   = 5;
+  {$EXTERNALSYM USE_RECONN}
+
+//
+// Values of the ui1_asg_type field of use_info_1 structure
+//
+
+  USE_WILDCARD = DWORD(-1);
+  {$EXTERNALSYM USE_WILDCARD}
+  USE_DISKDEV  = 0;
+  {$EXTERNALSYM USE_DISKDEV}
+  USE_SPOOLDEV = 1;
+  {$EXTERNALSYM USE_SPOOLDEV}
+  USE_CHARDEV  = 2;
+  {$EXTERNALSYM USE_CHARDEV}
+  USE_IPC      = 3;
+  {$EXTERNALSYM USE_IPC}
+
+//
+// Flags defined in the use_info_3 structure
+//
+
+  CREATE_NO_CONNECT = $1; // creation flags
+  {$EXTERNALSYM CREATE_NO_CONNECT}
+  CREATE_BYPASS_CSC = $2; // force connection to server, bypassing CSC
+  {$EXTERNALSYM CREATE_BYPASS_CSC}
+                          //  all ops on this connection go to the server,
+                          //  never to the cache
+  USE_DEFAULT_CREDENTIALS = $4; // No explicit credentials passed to NetUseAdd
+  {$EXTERNALSYM USE_DEFAULT_CREDENTIALS}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetUseAdd: Pointer;
+
+function NetUseAdd;
+begin
+  GetProcedureAddress(_NetUseAdd, netapi32, 'NetUseAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUseAdd]
+  end;
+end;
+
+var
+  _NetUseDel: Pointer;
+
+function NetUseDel;
+begin
+  GetProcedureAddress(_NetUseDel, netapi32, 'NetUseDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUseDel]
+  end;
+end;
+
+var
+  _NetUseEnum: Pointer;
+
+function NetUseEnum;
+begin
+  GetProcedureAddress(_NetUseEnum, netapi32, 'NetUseEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUseEnum]
+  end;
+end;
+
+var
+  _NetUseGetInfo: Pointer;
+
+function NetUseGetInfo;
+begin
+  GetProcedureAddress(_NetUseGetInfo, netapi32, 'NetUseGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetUseGetInfo]
+  end;
+end;
+
+{$ELSE}
+
+function NetUseAdd; external netapi32 name 'NetUseAdd';
+function NetUseDel; external netapi32 name 'NetUseDel';
+function NetUseEnum; external netapi32 name 'NetUseEnum';
+function NetUseGetInfo; external netapi32 name 'NetUseGetInfo';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 71 - 0
packages/extra/winunits/jwalmuseflg.pas

@@ -0,0 +1,71 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Deletion Force Levels API interface Unit for Object Pascal       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmuseflg.h, released November 2001. The original Pascal}
+{ code is: LmUseFlg.pas, released Februari 2002. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmUseFlg;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmuseflg.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+//
+// Definition for NetWkstaTransportDel and NetUseDel deletion force levels
+//
+
+const
+  USE_NOFORCE            = 0;
+  {$EXTERNALSYM USE_NOFORCE}
+  USE_FORCE              = 1;
+  {$EXTERNALSYM USE_FORCE}
+  USE_LOTS_OF_FORCE      = 2;
+  {$EXTERNALSYM USE_LOTS_OF_FORCE}
+
+implementation
+
+end.

+ 1075 - 0
packages/extra/winunits/jwalmwksta.pas

@@ -0,0 +1,1075 @@
+{******************************************************************************}
+{                                                                              }
+{ Lan Manager Workstation API interface Unit for Object Pascal                 }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lmwksta.h, released November 2001. The original Pascal }
+{ code is: LmWkSta.pas, released Februari 2002. The initial developer of the   }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLmWkSta;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lmwksta.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaLmCons, JwaWinType;
+
+//
+// Function Prototypes
+//
+
+function NetWkstaGetInfo(servername: LMSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaGetInfo}
+
+function NetWkstaSetInfo(servername: LMSTR; level: DWORD; buffer: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaSetInfo}
+
+function NetWkstaUserGetInfo(reserved: LMSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaUserGetInfo}
+
+function NetWkstaUserSetInfo(reserved: LMSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaUserSetInfo}
+
+function NetWkstaUserEnum(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread: LPDWORD; totalentries: LPDWORD; resumehandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaUserEnum}
+
+function NetWkstaTransportAdd(servername: LMSTR; level: DWORD; buf: LPBYTE; parm_err: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaTransportAdd}
+
+function NetWkstaTransportDel(servername: LMSTR; transportname: LMSTR; ucond: DWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaTransportDel}
+
+function NetWkstaTransportEnum(servername: LMSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread: LPDWORD; totalentries: LPDWORD; resumehandle: LPDWORD): NET_API_STATUS; stdcall;
+{$EXTERNALSYM NetWkstaTransportEnum}
+
+//
+//  Data Structures
+//
+
+//
+// NetWkstaGetInfo and NetWkstaSetInfo
+//
+
+//
+// NetWkstaGetInfo only.  System information - guest access
+//
+
+type
+  LPWKSTA_INFO_100 = ^WKSTA_INFO_100;
+  {$EXTERNALSYM LPWKSTA_INFO_100}
+  PWKSTA_INFO_100 = ^WKSTA_INFO_100;
+  {$EXTERNALSYM PWKSTA_INFO_100}
+  _WKSTA_INFO_100 = record
+    wki100_platform_id: DWORD;
+    wki100_computername: LMSTR;
+    wki100_langroup: LMSTR;
+    wki100_ver_major: DWORD;
+    wki100_ver_minor: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_100}
+  WKSTA_INFO_100 = _WKSTA_INFO_100;
+  {$EXTERNALSYM WKSTA_INFO_100}
+  TWkstaInfo100 = WKSTA_INFO_100;
+  PWkstaInfo100 = PWKSTA_INFO_100;
+
+//
+// NetWkstaGetInfo only.  System information - user access
+//
+
+  LPWKSTA_INFO_101 = ^WKSTA_INFO_101;
+  {$EXTERNALSYM LPWKSTA_INFO_101}
+  PWKSTA_INFO_101 = ^WKSTA_INFO_101;
+  {$EXTERNALSYM PWKSTA_INFO_101}
+  _WKSTA_INFO_101 = record
+    wki101_platform_id: DWORD;
+    wki101_computername: LMSTR;
+    wki101_langroup: LMSTR;
+    wki101_ver_major: DWORD;
+    wki101_ver_minor: DWORD;
+    wki101_lanroot: LMSTR;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_101}
+  WKSTA_INFO_101 = _WKSTA_INFO_101;
+  {$EXTERNALSYM WKSTA_INFO_101}
+  TWkstaInfo101 = WKSTA_INFO_101;
+  PWkstaInfo101 = PWKSTA_INFO_101;
+
+//
+// NetWkstaGetInfo only.  System information - admin or operator access
+//
+
+  LPWKSTA_INFO_102 = ^WKSTA_INFO_102;
+  {$EXTERNALSYM LPWKSTA_INFO_102}
+  PWKSTA_INFO_102 = ^WKSTA_INFO_102;
+  {$EXTERNALSYM PWKSTA_INFO_102}
+  _WKSTA_INFO_102 = record
+    wki102_platform_id: DWORD;
+    wki102_computername: LMSTR;
+    wki102_langroup: LMSTR;
+    wki102_ver_major: DWORD;
+    wki102_ver_minor: DWORD;
+    wki102_lanroot: LMSTR;
+    wki102_logged_on_users: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_102}
+  WKSTA_INFO_102 = _WKSTA_INFO_102;
+  {$EXTERNALSYM WKSTA_INFO_102}
+  TWkstaInfo102 = WKSTA_INFO_102;
+  PWkstaInfo102 = PWKSTA_INFO_102;
+
+//
+// Down-level NetWkstaGetInfo and NetWkstaSetInfo.
+//
+// DOS specific workstation information -
+//    admin or domain operator access
+//
+
+  LPWKSTA_INFO_302 = ^WKSTA_INFO_302;
+  {$EXTERNALSYM LPWKSTA_INFO_302}
+  PWKSTA_INFO_302 = ^WKSTA_INFO_302;
+  {$EXTERNALSYM PWKSTA_INFO_302}
+  _WKSTA_INFO_302 = record
+    wki302_char_wait: DWORD;
+    wki302_collection_time: DWORD;
+    wki302_maximum_collection_count: DWORD;
+    wki302_keep_conn: DWORD;
+    wki302_keep_search: DWORD;
+    wki302_max_cmds: DWORD;
+    wki302_num_work_buf: DWORD;
+    wki302_siz_work_buf: DWORD;
+    wki302_max_wrk_cache: DWORD;
+    wki302_sess_timeout: DWORD;
+    wki302_siz_error: DWORD;
+    wki302_num_alerts: DWORD;
+    wki302_num_services: DWORD;
+    wki302_errlog_sz: DWORD;
+    wki302_print_buf_time: DWORD;
+    wki302_num_char_buf: DWORD;
+    wki302_siz_char_buf: DWORD;
+    wki302_wrk_heuristics: LMSTR;
+    wki302_mailslots: DWORD;
+    wki302_num_dgram_buf: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_302}
+  WKSTA_INFO_302 = _WKSTA_INFO_302;
+  {$EXTERNALSYM WKSTA_INFO_302}
+  TWkstaInfo302 = WKSTA_INFO_302;
+  PWkstaInfo302 = PWKSTA_INFO_302;
+
+//
+// Down-level NetWkstaGetInfo and NetWkstaSetInfo
+//
+// OS/2 specific workstation information -
+//    admin or domain operator access
+//
+
+  LPWKSTA_INFO_402 = ^WKSTA_INFO_402;
+  {$EXTERNALSYM LPWKSTA_INFO_402}
+  PWKSTA_INFO_402 = ^WKSTA_INFO_402;
+  {$EXTERNALSYM PWKSTA_INFO_402}
+  _WKSTA_INFO_402 = record
+    wki402_char_wait: DWORD;
+    wki402_collection_time: DWORD;
+    wki402_maximum_collection_count: DWORD;
+    wki402_keep_conn: DWORD;
+    wki402_keep_search: DWORD;
+    wki402_max_cmds: DWORD;
+    wki402_num_work_buf: DWORD;
+    wki402_siz_work_buf: DWORD;
+    wki402_max_wrk_cache: DWORD;
+    wki402_sess_timeout: DWORD;
+    wki402_siz_error: DWORD;
+    wki402_num_alerts: DWORD;
+    wki402_num_services: DWORD;
+    wki402_errlog_sz: DWORD;
+    wki402_print_buf_time: DWORD;
+    wki402_num_char_buf: DWORD;
+    wki402_siz_char_buf: DWORD;
+    wki402_wrk_heuristics: LMSTR;
+    wki402_mailslots: DWORD;
+    wki402_num_dgram_buf: DWORD;
+    wki402_max_threads: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_402}
+  WKSTA_INFO_402 = _WKSTA_INFO_402;
+  {$EXTERNALSYM WKSTA_INFO_402}
+  TWkstaInfo402 = WKSTA_INFO_402;
+  PWkstaInfo402 = PWKSTA_INFO_402;
+
+//
+// Same-level NetWkstaGetInfo and NetWkstaSetInfo.
+//
+// NT specific workstation information -
+//    admin or domain operator access
+//
+
+  LPWKSTA_INFO_502 = ^WKSTA_INFO_502;
+  {$EXTERNALSYM LPWKSTA_INFO_502}
+  PWKSTA_INFO_502 = ^WKSTA_INFO_502;
+  {$EXTERNALSYM PWKSTA_INFO_502}
+  _WKSTA_INFO_502 = record
+    wki502_char_wait: DWORD;
+    wki502_collection_time: DWORD;
+    wki502_maximum_collection_count: DWORD;
+    wki502_keep_conn: DWORD;
+    wki502_max_cmds: DWORD;
+    wki502_sess_timeout: DWORD;
+    wki502_siz_char_buf: DWORD;
+    wki502_max_threads: DWORD;
+    wki502_lock_quota: DWORD;
+    wki502_lock_increment: DWORD;
+    wki502_lock_maximum: DWORD;
+    wki502_pipe_increment: DWORD;
+    wki502_pipe_maximum: DWORD;
+    wki502_cache_file_timeout: DWORD;
+    wki502_dormant_file_limit: DWORD;
+    wki502_read_ahead_throughput: DWORD;
+    wki502_num_mailslot_buffers: DWORD;
+    wki502_num_srv_announce_buffers: DWORD;
+    wki502_max_illegal_datagram_events: DWORD;
+    wki502_illegal_datagram_event_reset_frequency: DWORD;
+    wki502_log_election_packets: BOOL;
+    wki502_use_opportunistic_locking: BOOL;
+    wki502_use_unlock_behind: BOOL;
+    wki502_use_close_behind: BOOL;
+    wki502_buf_named_pipes: BOOL;
+    wki502_use_lock_read_unlock: BOOL;
+    wki502_utilize_nt_caching: BOOL;
+    wki502_use_raw_read: BOOL;
+    wki502_use_raw_write: BOOL;
+    wki502_use_write_raw_data: BOOL;
+    wki502_use_encryption: BOOL;
+    wki502_buf_files_deny_write: BOOL;
+    wki502_buf_read_only_files: BOOL;
+    wki502_force_core_create_mode: BOOL;
+    wki502_use_512_byte_max_transfer: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_502}
+  WKSTA_INFO_502 = _WKSTA_INFO_502;
+  {$EXTERNALSYM WKSTA_INFO_502}
+  TWkstaInfo502 = WKSTA_INFO_502;
+  PWkstaInfo502 = PWKSTA_INFO_502;
+
+//
+// The following info-levels are only valid for NetWkstaSetInfo
+//
+
+//
+// The following levels are supported on down-level systems (LAN Man 2.x)
+// as well as NT systems:
+//
+
+  LPWKSTA_INFO_1010 = ^WKSTA_INFO_1010;
+  {$EXTERNALSYM LPWKSTA_INFO_1010}
+  PWKSTA_INFO_1010 = ^WKSTA_INFO_1010;
+  {$EXTERNALSYM PWKSTA_INFO_1010}
+  _WKSTA_INFO_1010 = record
+    wki1010_char_wait: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1010}
+  WKSTA_INFO_1010 = _WKSTA_INFO_1010;
+  {$EXTERNALSYM WKSTA_INFO_1010}
+  TWkstaInfo1010 = WKSTA_INFO_1010;
+  PWkstaInfo1010 = PWKSTA_INFO_1010;
+
+  LPWKSTA_INFO_1011 = ^WKSTA_INFO_1011;
+  {$EXTERNALSYM LPWKSTA_INFO_1011}
+  PWKSTA_INFO_1011 = ^WKSTA_INFO_1011;
+  {$EXTERNALSYM PWKSTA_INFO_1011}
+  _WKSTA_INFO_1011 = record
+    wki1011_collection_time: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1011}
+  WKSTA_INFO_1011 = _WKSTA_INFO_1011;
+  {$EXTERNALSYM WKSTA_INFO_1011}
+  TWkstaInfo1011 = WKSTA_INFO_1011;
+  PWkstaInfo1011 = PWKSTA_INFO_1011;
+
+  LPWKSTA_INFO_1012 = ^WKSTA_INFO_1012;
+  {$EXTERNALSYM LPWKSTA_INFO_1012}
+  PWKSTA_INFO_1012 = ^WKSTA_INFO_1012;
+  {$EXTERNALSYM PWKSTA_INFO_1012}
+  _WKSTA_INFO_1012 = record
+    wki1012_maximum_collection_count: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1012}
+  WKSTA_INFO_1012 = _WKSTA_INFO_1012;
+  {$EXTERNALSYM WKSTA_INFO_1012}
+  TWkstaInfo1012 = WKSTA_INFO_1012;
+  PWkstaInfo1012 = PWKSTA_INFO_1012;
+
+//
+// The following level are supported on down-level systems (LAN Man 2.x)
+// only:
+//
+
+  LPWKSTA_INFO_1027 = ^WKSTA_INFO_1027;
+  {$EXTERNALSYM LPWKSTA_INFO_1027}
+  PWKSTA_INFO_1027 = ^WKSTA_INFO_1027;
+  {$EXTERNALSYM PWKSTA_INFO_1027}
+  _WKSTA_INFO_1027 = record
+    wki1027_errlog_sz: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1027}
+  WKSTA_INFO_1027 = _WKSTA_INFO_1027;
+  {$EXTERNALSYM WKSTA_INFO_1027}
+  TWkstaInfo1027 = WKSTA_INFO_1027;
+  PWkstaInfo1027 = PWKSTA_INFO_1027;
+
+  LPWKSTA_INFO_1028 = ^WKSTA_INFO_1028;
+  {$EXTERNALSYM LPWKSTA_INFO_1028}
+  PWKSTA_INFO_1028 = ^WKSTA_INFO_1028;
+  {$EXTERNALSYM PWKSTA_INFO_1028}
+  _WKSTA_INFO_1028 = record
+    wki1028_print_buf_time: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1028}
+  WKSTA_INFO_1028 = _WKSTA_INFO_1028;
+  {$EXTERNALSYM WKSTA_INFO_1028}
+  TWkstaInfo1028 = WKSTA_INFO_1028;
+  PWkstaInfo1028 = PWKSTA_INFO_1028;
+
+  LPWKSTA_INFO_1032 = ^WKSTA_INFO_1032;
+  {$EXTERNALSYM LPWKSTA_INFO_1032}
+  PWKSTA_INFO_1032 = ^WKSTA_INFO_1032;
+  {$EXTERNALSYM PWKSTA_INFO_1032}
+  _WKSTA_INFO_1032 = record
+    wki1032_wrk_heuristics: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1032}
+  WKSTA_INFO_1032 = _WKSTA_INFO_1032;
+  {$EXTERNALSYM WKSTA_INFO_1032}
+  TWkstaInfo1032 = WKSTA_INFO_1032;
+  PWkstaInfo1032 = PWKSTA_INFO_1032;
+
+//
+// The following levels are settable on NT systems, and have no
+// effect on down-level systems (i.e. LANMan 2.x) since these
+// fields cannot be set on them:
+//
+
+  LPWKSTA_INFO_1013 = ^WKSTA_INFO_1013;
+  {$EXTERNALSYM LPWKSTA_INFO_1013}
+  PWKSTA_INFO_1013 = ^WKSTA_INFO_1013;
+  {$EXTERNALSYM PWKSTA_INFO_1013}
+  _WKSTA_INFO_1013 = record
+    wki1013_keep_conn: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1013}
+  WKSTA_INFO_1013 = _WKSTA_INFO_1013;
+  {$EXTERNALSYM WKSTA_INFO_1013}
+  TWkstaInfo1013 = WKSTA_INFO_1013;
+  PWkstaInfo1013 = PWKSTA_INFO_1013;
+
+  LPWKSTA_INFO_1018 = ^WKSTA_INFO_1018;
+  {$EXTERNALSYM LPWKSTA_INFO_1018}
+  PWKSTA_INFO_1018 = ^WKSTA_INFO_1018;
+  {$EXTERNALSYM PWKSTA_INFO_1018}
+  _WKSTA_INFO_1018 = record
+    wki1018_sess_timeout: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1018}
+  WKSTA_INFO_1018 = _WKSTA_INFO_1018;
+  {$EXTERNALSYM WKSTA_INFO_1018}
+  TWkstaInfo1018 = WKSTA_INFO_1018;
+  PWkstaInfo1018 = PWKSTA_INFO_1018;
+
+  LPWKSTA_INFO_1023 = ^WKSTA_INFO_1023;
+  {$EXTERNALSYM LPWKSTA_INFO_1023}
+  PWKSTA_INFO_1023 = ^WKSTA_INFO_1023;
+  {$EXTERNALSYM PWKSTA_INFO_1023}
+  _WKSTA_INFO_1023 = record
+    wki1023_siz_char_buf: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1023}
+  WKSTA_INFO_1023 = _WKSTA_INFO_1023;
+  {$EXTERNALSYM WKSTA_INFO_1023}
+  TWkstaInfo1023 = WKSTA_INFO_1023;
+  PWkstaInfo1023 = PWKSTA_INFO_1023;
+
+  LPWKSTA_INFO_1033 = ^WKSTA_INFO_1033;
+  {$EXTERNALSYM LPWKSTA_INFO_1033}
+  PWKSTA_INFO_1033 = ^WKSTA_INFO_1033;
+  {$EXTERNALSYM PWKSTA_INFO_1033}
+  _WKSTA_INFO_1033 = record
+    wki1033_max_threads: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1033}
+  WKSTA_INFO_1033 = _WKSTA_INFO_1033;
+  {$EXTERNALSYM WKSTA_INFO_1033}
+  TWkstaInfo1033 = WKSTA_INFO_1033;
+  PWkstaInfo1033 = PWKSTA_INFO_1033;
+
+//
+// The following levels are only supported on NT systems:
+//
+
+  LPWKSTA_INFO_1041 = ^WKSTA_INFO_1041;
+  {$EXTERNALSYM LPWKSTA_INFO_1041}
+  PWKSTA_INFO_1041 = ^WKSTA_INFO_1041;
+  {$EXTERNALSYM PWKSTA_INFO_1041}
+  _WKSTA_INFO_1041 = record
+    wki1041_lock_quota: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1041}
+  WKSTA_INFO_1041 = _WKSTA_INFO_1041;
+  {$EXTERNALSYM WKSTA_INFO_1041}
+  TWkstaInfo1041 = WKSTA_INFO_1041;
+  PWkstaInfo1041 = PWKSTA_INFO_1041;
+
+  LPWKSTA_INFO_1042 = ^WKSTA_INFO_1042;
+  {$EXTERNALSYM LPWKSTA_INFO_1042}
+  PWKSTA_INFO_1042 = ^WKSTA_INFO_1042;
+  {$EXTERNALSYM PWKSTA_INFO_1042}
+  _WKSTA_INFO_1042 = record
+    wki1042_lock_increment: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1042}
+  WKSTA_INFO_1042 = _WKSTA_INFO_1042;
+  {$EXTERNALSYM WKSTA_INFO_1042}
+  TWkstaInfo1042 = WKSTA_INFO_1042;
+  PWkstaInfo1042 = PWKSTA_INFO_1042;
+
+  LPWKSTA_INFO_1043 = ^WKSTA_INFO_1043;
+  {$EXTERNALSYM LPWKSTA_INFO_1043}
+  PWKSTA_INFO_1043 = ^WKSTA_INFO_1043;
+  {$EXTERNALSYM PWKSTA_INFO_1043}
+  _WKSTA_INFO_1043 = record
+    wki1043_lock_maximum: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1043}
+  WKSTA_INFO_1043 = _WKSTA_INFO_1043;
+  {$EXTERNALSYM WKSTA_INFO_1043}
+  TWkstaInfo1043 = WKSTA_INFO_1043;
+  PWkstaInfo1043 = PWKSTA_INFO_1043;
+
+  LPWKSTA_INFO_1044 = ^WKSTA_INFO_1044;
+  {$EXTERNALSYM LPWKSTA_INFO_1044}
+  PWKSTA_INFO_1044 = ^WKSTA_INFO_1044;
+  {$EXTERNALSYM PWKSTA_INFO_1044}
+  _WKSTA_INFO_1044 = record
+    wki1044_pipe_increment: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1044}
+  WKSTA_INFO_1044 = _WKSTA_INFO_1044;
+  {$EXTERNALSYM WKSTA_INFO_1044}
+  TWkstaInfo1044 = WKSTA_INFO_1044;
+  PWkstaInfo1044 = PWKSTA_INFO_1044;
+
+  LPWKSTA_INFO_1045 = ^WKSTA_INFO_1045;
+  {$EXTERNALSYM LPWKSTA_INFO_1045}
+  PWKSTA_INFO_1045 = ^WKSTA_INFO_1045;
+  {$EXTERNALSYM PWKSTA_INFO_1045}
+  _WKSTA_INFO_1045 = record
+    wki1045_pipe_maximum: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1045}
+  WKSTA_INFO_1045 = _WKSTA_INFO_1045;
+  {$EXTERNALSYM WKSTA_INFO_1045}
+  TWkstaInfo1045 = WKSTA_INFO_1045;
+  PWkstaInfo1045 = PWKSTA_INFO_1045;
+
+  LPWKSTA_INFO_1046 = ^WKSTA_INFO_1046;
+  {$EXTERNALSYM LPWKSTA_INFO_1046}
+  PWKSTA_INFO_1046 = ^WKSTA_INFO_1046;
+  {$EXTERNALSYM PWKSTA_INFO_1046}
+  _WKSTA_INFO_1046 = record
+    wki1046_dormant_file_limit: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1046}
+  WKSTA_INFO_1046 = _WKSTA_INFO_1046;
+  {$EXTERNALSYM WKSTA_INFO_1046}
+  TWkstaInfo1046 = WKSTA_INFO_1046;
+  PWkstaInfo1046 = PWKSTA_INFO_1046;
+
+  LPWKSTA_INFO_1047 = ^WKSTA_INFO_1047;
+  {$EXTERNALSYM LPWKSTA_INFO_1047}
+  PWKSTA_INFO_1047 = ^WKSTA_INFO_1047;
+  {$EXTERNALSYM PWKSTA_INFO_1047}
+  _WKSTA_INFO_1047 = record
+    wki1047_cache_file_timeout: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1047}
+  WKSTA_INFO_1047 = _WKSTA_INFO_1047;
+  {$EXTERNALSYM WKSTA_INFO_1047}
+  TWkstaInfo1047 = WKSTA_INFO_1047;
+  PWkstaInfo1047 = PWKSTA_INFO_1047;
+
+  LPWKSTA_INFO_1048 = ^WKSTA_INFO_1048;
+  {$EXTERNALSYM LPWKSTA_INFO_1048}
+  PWKSTA_INFO_1048 = ^WKSTA_INFO_1048;
+  {$EXTERNALSYM PWKSTA_INFO_1048}
+  _WKSTA_INFO_1048 = record
+    wki1048_use_opportunistic_locking: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1048}
+  WKSTA_INFO_1048 = _WKSTA_INFO_1048;
+  {$EXTERNALSYM WKSTA_INFO_1048}
+  TWkstaInfo1048 = WKSTA_INFO_1048;
+  PWkstaInfo1048 = PWKSTA_INFO_1048;
+
+  LPWKSTA_INFO_1049 = ^WKSTA_INFO_1049;
+  {$EXTERNALSYM LPWKSTA_INFO_1049}
+  PWKSTA_INFO_1049 = ^WKSTA_INFO_1049;
+  {$EXTERNALSYM PWKSTA_INFO_1049}
+  _WKSTA_INFO_1049 = record
+    wki1049_use_unlock_behind: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1049}
+  WKSTA_INFO_1049 = _WKSTA_INFO_1049;
+  {$EXTERNALSYM WKSTA_INFO_1049}
+  TWkstaInfo1049 = WKSTA_INFO_1049;
+  PWkstaInfo1049 = PWKSTA_INFO_1049;
+
+  LPWKSTA_INFO_1050 = ^WKSTA_INFO_1050;
+  {$EXTERNALSYM LPWKSTA_INFO_1050}
+  PWKSTA_INFO_1050 = ^WKSTA_INFO_1050;
+  {$EXTERNALSYM PWKSTA_INFO_1050}
+  _WKSTA_INFO_1050 = record
+    wki1050_use_close_behind: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1050}
+  WKSTA_INFO_1050 = _WKSTA_INFO_1050;
+  {$EXTERNALSYM WKSTA_INFO_1050}
+  TWkstaInfo1050 = WKSTA_INFO_1050;
+  PWkstaInfo1050 = PWKSTA_INFO_1050;
+
+  LPWKSTA_INFO_1051 = ^WKSTA_INFO_1051;
+  {$EXTERNALSYM LPWKSTA_INFO_1051}
+  PWKSTA_INFO_1051 = ^WKSTA_INFO_1051;
+  {$EXTERNALSYM PWKSTA_INFO_1051}
+  _WKSTA_INFO_1051 = record
+    wki1051_buf_named_pipes: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1051}
+  WKSTA_INFO_1051 = _WKSTA_INFO_1051;
+  {$EXTERNALSYM WKSTA_INFO_1051}
+  TWkstaInfo1051 = WKSTA_INFO_1051;
+  PWkstaInfo1051 = PWKSTA_INFO_1051;
+
+  LPWKSTA_INFO_1052 = ^WKSTA_INFO_1052;
+  {$EXTERNALSYM LPWKSTA_INFO_1052}
+  PWKSTA_INFO_1052 = ^WKSTA_INFO_1052;
+  {$EXTERNALSYM PWKSTA_INFO_1052}
+  _WKSTA_INFO_1052 = record
+    wki1052_use_lock_read_unlock: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1052}
+  WKSTA_INFO_1052 = _WKSTA_INFO_1052;
+  {$EXTERNALSYM WKSTA_INFO_1052}
+  TWkstaInfo1052 = WKSTA_INFO_1052;
+  PWkstaInfo1052 = PWKSTA_INFO_1052;
+
+  LPWKSTA_INFO_1053 = ^WKSTA_INFO_1053;
+  {$EXTERNALSYM LPWKSTA_INFO_1053}
+  PWKSTA_INFO_1053 = ^WKSTA_INFO_1053;
+  {$EXTERNALSYM PWKSTA_INFO_1053}
+  _WKSTA_INFO_1053 = record
+    wki1053_utilize_nt_caching: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1053}
+  WKSTA_INFO_1053 = _WKSTA_INFO_1053;
+  {$EXTERNALSYM WKSTA_INFO_1053}
+  TWkstaInfo1053 = WKSTA_INFO_1053;
+  PWkstaInfo1053 = PWKSTA_INFO_1053;
+
+  LPWKSTA_INFO_1054 = ^WKSTA_INFO_1054;
+  {$EXTERNALSYM LPWKSTA_INFO_1054}
+  PWKSTA_INFO_1054 = ^WKSTA_INFO_1054;
+  {$EXTERNALSYM PWKSTA_INFO_1054}
+  _WKSTA_INFO_1054 = record
+    wki1054_use_raw_read: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1054}
+  WKSTA_INFO_1054 = _WKSTA_INFO_1054;
+  {$EXTERNALSYM WKSTA_INFO_1054}
+  TWkstaInfo1054 = WKSTA_INFO_1054;
+  PWkstaInfo1054 = PWKSTA_INFO_1054;
+
+  LPWKSTA_INFO_1055 = ^WKSTA_INFO_1055;
+  {$EXTERNALSYM LPWKSTA_INFO_1055}
+  PWKSTA_INFO_1055 = ^WKSTA_INFO_1055;
+  {$EXTERNALSYM PWKSTA_INFO_1055}
+  _WKSTA_INFO_1055 = record
+    wki1055_use_raw_write: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1055}
+  WKSTA_INFO_1055 = _WKSTA_INFO_1055;
+  {$EXTERNALSYM WKSTA_INFO_1055}
+  TWkstaInfo1055 = WKSTA_INFO_1055;
+  PWkstaInfo1055 = PWKSTA_INFO_1055;
+
+  LPWKSTA_INFO_1056 = ^WKSTA_INFO_1056;
+  {$EXTERNALSYM LPWKSTA_INFO_1056}
+  PWKSTA_INFO_1056 = ^WKSTA_INFO_1056;
+  {$EXTERNALSYM PWKSTA_INFO_1056}
+  _WKSTA_INFO_1056 = record
+    wki1056_use_write_raw_data: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1056}
+  WKSTA_INFO_1056 = _WKSTA_INFO_1056;
+  {$EXTERNALSYM WKSTA_INFO_1056}
+  TWkstaInfo1056 = WKSTA_INFO_1056;
+  PWkstaInfo1056 = PWKSTA_INFO_1056;
+
+  LPWKSTA_INFO_1057 = ^WKSTA_INFO_1057;
+  {$EXTERNALSYM LPWKSTA_INFO_1057}
+  PWKSTA_INFO_1057 = ^WKSTA_INFO_1057;
+  {$EXTERNALSYM PWKSTA_INFO_1057}
+  _WKSTA_INFO_1057 = record
+    wki1057_use_encryption: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1057}
+  WKSTA_INFO_1057 = _WKSTA_INFO_1057;
+  {$EXTERNALSYM WKSTA_INFO_1057}
+  TWkstaInfo1057 = WKSTA_INFO_1057;
+  PWkstaInfo1057 = PWKSTA_INFO_1057;
+
+  LPWKSTA_INFO_1058 = ^WKSTA_INFO_1058;
+  {$EXTERNALSYM LPWKSTA_INFO_1058}
+  PWKSTA_INFO_1058 = ^WKSTA_INFO_1058;
+  {$EXTERNALSYM PWKSTA_INFO_1058}
+  _WKSTA_INFO_1058 = record
+    wki1058_buf_files_deny_write: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1058}
+  WKSTA_INFO_1058 = _WKSTA_INFO_1058;
+  {$EXTERNALSYM WKSTA_INFO_1058}
+  TWkstaInfo1058 = WKSTA_INFO_1058;
+  PWkstaInfo1058 = PWKSTA_INFO_1058;
+
+  LPWKSTA_INFO_1059 = ^WKSTA_INFO_1059;
+  {$EXTERNALSYM LPWKSTA_INFO_1059}
+  PWKSTA_INFO_1059 = ^WKSTA_INFO_1059;
+  {$EXTERNALSYM PWKSTA_INFO_1059}
+  _WKSTA_INFO_1059 = record
+    wki1059_buf_read_only_files: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1059}
+  WKSTA_INFO_1059 = _WKSTA_INFO_1059;
+  {$EXTERNALSYM WKSTA_INFO_1059}
+  TWkstaInfo1059 = WKSTA_INFO_1059;
+  PWkstaInfo1059 = PWKSTA_INFO_1059;
+
+  LPWKSTA_INFO_1060 = ^WKSTA_INFO_1060;
+  {$EXTERNALSYM LPWKSTA_INFO_1060}
+  PWKSTA_INFO_1060 = ^WKSTA_INFO_1060;
+  {$EXTERNALSYM PWKSTA_INFO_1060}
+  _WKSTA_INFO_1060 = record
+    wki1060_force_core_create_mode: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1060}
+  WKSTA_INFO_1060 = _WKSTA_INFO_1060;
+  {$EXTERNALSYM WKSTA_INFO_1060}
+  TWkstaInfo1060 = WKSTA_INFO_1060;
+  PWkstaInfo1060 = PWKSTA_INFO_1060;
+
+  LPWKSTA_INFO_1061 = ^WKSTA_INFO_1061;
+  {$EXTERNALSYM LPWKSTA_INFO_1061}
+  PWKSTA_INFO_1061 = ^WKSTA_INFO_1061;
+  {$EXTERNALSYM PWKSTA_INFO_1061}
+  _WKSTA_INFO_1061 = record
+    wki1061_use_512_byte_max_transfer: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1061}
+  WKSTA_INFO_1061 = _WKSTA_INFO_1061;
+  {$EXTERNALSYM WKSTA_INFO_1061}
+  TWkstaInfo1061 = WKSTA_INFO_1061;
+  PWkstaInfo1061 = PWKSTA_INFO_1061;
+
+  LPWKSTA_INFO_1062 = ^WKSTA_INFO_1062;
+  {$EXTERNALSYM LPWKSTA_INFO_1062}
+  PWKSTA_INFO_1062 = ^WKSTA_INFO_1062;
+  {$EXTERNALSYM PWKSTA_INFO_1062}
+  _WKSTA_INFO_1062 = record
+    wki1062_read_ahead_throughput: DWORD;
+  end;
+  {$EXTERNALSYM _WKSTA_INFO_1062}
+  WKSTA_INFO_1062 = _WKSTA_INFO_1062;
+  {$EXTERNALSYM WKSTA_INFO_1062}
+  TWkstaInfo1062 = WKSTA_INFO_1062;
+  PWkstaInfo1062 = PWKSTA_INFO_1062;
+
+//
+// NetWkstaUserGetInfo (local only) and NetWkstaUserEnum -
+//     no access restrictions.
+//
+
+  LPWKSTA_USER_INFO_0 = ^WKSTA_USER_INFO_0;
+  {$EXTERNALSYM LPWKSTA_USER_INFO_0}
+  PWKSTA_USER_INFO_0 = ^WKSTA_USER_INFO_0;
+  {$EXTERNALSYM PWKSTA_USER_INFO_0}
+  _WKSTA_USER_INFO_0 = record
+    wkui0_username: LMSTR;
+  end;
+  {$EXTERNALSYM _WKSTA_USER_INFO_0}
+  WKSTA_USER_INFO_0 = _WKSTA_USER_INFO_0;
+  {$EXTERNALSYM WKSTA_USER_INFO_0}
+  TWkstaUserInfo0 = WKSTA_USER_INFO_0;
+  PWkstaUserInfo0 = PWKSTA_USER_INFO_0;
+
+//
+// NetWkstaUserGetInfo (local only) and NetWkstaUserEnum -
+//     no access restrictions.
+//
+
+  LPWKSTA_USER_INFO_1 = ^WKSTA_USER_INFO_1;
+  {$EXTERNALSYM LPWKSTA_USER_INFO_1}
+  PWKSTA_USER_INFO_1 = ^WKSTA_USER_INFO_1;
+  {$EXTERNALSYM PWKSTA_USER_INFO_1}
+  _WKSTA_USER_INFO_1 = record
+    wkui1_username: LMSTR;
+    wkui1_logon_domain: LMSTR;
+    wkui1_oth_domains: LMSTR;
+    wkui1_logon_server: LMSTR;
+  end;
+  {$EXTERNALSYM _WKSTA_USER_INFO_1}
+  WKSTA_USER_INFO_1 = _WKSTA_USER_INFO_1;
+  {$EXTERNALSYM WKSTA_USER_INFO_1}
+  TWkstaUserInfo1 = WKSTA_USER_INFO_1;
+  PWkstaUserInfo1 = PWKSTA_USER_INFO_1;
+
+//
+// NetWkstaUserSetInfo - local access.
+//
+
+  LPWKSTA_USER_INFO_1101 = ^WKSTA_USER_INFO_1101;
+  {$EXTERNALSYM LPWKSTA_USER_INFO_1101}
+  PWKSTA_USER_INFO_1101 = ^WKSTA_USER_INFO_1101;
+  {$EXTERNALSYM PWKSTA_USER_INFO_1101}
+  _WKSTA_USER_INFO_1101 = record
+    wkui1101_oth_domains: LMSTR;
+  end;
+  {$EXTERNALSYM _WKSTA_USER_INFO_1101}
+  WKSTA_USER_INFO_1101 = _WKSTA_USER_INFO_1101;
+  {$EXTERNALSYM WKSTA_USER_INFO_1101}
+  TWkstaUserInfo1101 = WKSTA_USER_INFO_1101;
+  PWkstaUserInfo1101 = PWKSTA_USER_INFO_1101;
+
+//
+// NetWkstaTransportAdd - admin access
+//
+
+  LPWKSTA_TRANSPORT_INFO_0 = ^WKSTA_TRANSPORT_INFO_0;
+  {$EXTERNALSYM LPWKSTA_TRANSPORT_INFO_0}
+  PWKSTA_TRANSPORT_INFO_0 = ^WKSTA_TRANSPORT_INFO_0;
+  {$EXTERNALSYM PWKSTA_TRANSPORT_INFO_0}
+  _WKSTA_TRANSPORT_INFO_0 = record
+    wkti0_quality_of_service: DWORD;
+    wkti0_number_of_vcs: DWORD;
+    wkti0_transport_name: LMSTR;
+    wkti0_transport_address: LMSTR;
+    wkti0_wan_ish: BOOL;
+  end;
+  {$EXTERNALSYM _WKSTA_TRANSPORT_INFO_0}
+  WKSTA_TRANSPORT_INFO_0 = _WKSTA_TRANSPORT_INFO_0;
+  {$EXTERNALSYM WKSTA_TRANSPORT_INFO_0}
+  TWkstaTransportInfo0 = WKSTA_TRANSPORT_INFO_0;
+  PWkstaTransportInfo0 = PWKSTA_TRANSPORT_INFO_0;
+
+//
+// Special Values and Constants
+//
+
+//
+//  Identifiers for use as NetWkstaSetInfo parmnum parameter
+//
+
+//
+// One of these values indicates the parameter within an information
+// structure that is invalid when ERROR_INVALID_PARAMETER is returned by
+// NetWkstaSetInfo.
+//
+
+const
+  WKSTA_PLATFORM_ID_PARMNUM     = 100;
+  {$EXTERNALSYM WKSTA_PLATFORM_ID_PARMNUM}
+  WKSTA_COMPUTERNAME_PARMNUM    = 1;
+  {$EXTERNALSYM WKSTA_COMPUTERNAME_PARMNUM}
+  WKSTA_LANGROUP_PARMNUM        = 2;
+  {$EXTERNALSYM WKSTA_LANGROUP_PARMNUM}
+  WKSTA_VER_MAJOR_PARMNUM       = 4;
+  {$EXTERNALSYM WKSTA_VER_MAJOR_PARMNUM}
+  WKSTA_VER_MINOR_PARMNUM       = 5;
+  {$EXTERNALSYM WKSTA_VER_MINOR_PARMNUM}
+  WKSTA_LOGGED_ON_USERS_PARMNUM = 6;
+  {$EXTERNALSYM WKSTA_LOGGED_ON_USERS_PARMNUM}
+  WKSTA_LANROOT_PARMNUM         = 7;
+  {$EXTERNALSYM WKSTA_LANROOT_PARMNUM}
+  WKSTA_LOGON_DOMAIN_PARMNUM    = 8;
+  {$EXTERNALSYM WKSTA_LOGON_DOMAIN_PARMNUM}
+  WKSTA_LOGON_SERVER_PARMNUM    = 9;
+  {$EXTERNALSYM WKSTA_LOGON_SERVER_PARMNUM}
+  WKSTA_CHARWAIT_PARMNUM        = 10; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_CHARWAIT_PARMNUM}
+  WKSTA_CHARTIME_PARMNUM        = 11; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_CHARTIME_PARMNUM}
+  WKSTA_CHARCOUNT_PARMNUM       = 12; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_CHARCOUNT_PARMNUM}
+  WKSTA_KEEPCONN_PARMNUM        = 13;
+  {$EXTERNALSYM WKSTA_KEEPCONN_PARMNUM}
+  WKSTA_KEEPSEARCH_PARMNUM      = 14;
+  {$EXTERNALSYM WKSTA_KEEPSEARCH_PARMNUM}
+  WKSTA_MAXCMDS_PARMNUM         = 15;
+  {$EXTERNALSYM WKSTA_MAXCMDS_PARMNUM}
+  WKSTA_NUMWORKBUF_PARMNUM      = 16;
+  {$EXTERNALSYM WKSTA_NUMWORKBUF_PARMNUM}
+  WKSTA_MAXWRKCACHE_PARMNUM     = 17;
+  {$EXTERNALSYM WKSTA_MAXWRKCACHE_PARMNUM}
+  WKSTA_SESSTIMEOUT_PARMNUM     = 18;
+  {$EXTERNALSYM WKSTA_SESSTIMEOUT_PARMNUM}
+  WKSTA_SIZERROR_PARMNUM        = 19;
+  {$EXTERNALSYM WKSTA_SIZERROR_PARMNUM}
+  WKSTA_NUMALERTS_PARMNUM       = 20;
+  {$EXTERNALSYM WKSTA_NUMALERTS_PARMNUM}
+  WKSTA_NUMSERVICES_PARMNUM     = 21;
+  {$EXTERNALSYM WKSTA_NUMSERVICES_PARMNUM}
+  WKSTA_NUMCHARBUF_PARMNUM      = 22;
+  {$EXTERNALSYM WKSTA_NUMCHARBUF_PARMNUM}
+  WKSTA_SIZCHARBUF_PARMNUM      = 23;
+  {$EXTERNALSYM WKSTA_SIZCHARBUF_PARMNUM}
+  WKSTA_ERRLOGSZ_PARMNUM        = 27; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_ERRLOGSZ_PARMNUM}
+  WKSTA_PRINTBUFTIME_PARMNUM    = 28; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_PRINTBUFTIME_PARMNUM}
+  WKSTA_SIZWORKBUF_PARMNUM      = 29;
+  {$EXTERNALSYM WKSTA_SIZWORKBUF_PARMNUM}
+  WKSTA_MAILSLOTS_PARMNUM       = 30;
+  {$EXTERNALSYM WKSTA_MAILSLOTS_PARMNUM}
+  WKSTA_NUMDGRAMBUF_PARMNUM     = 31;
+  {$EXTERNALSYM WKSTA_NUMDGRAMBUF_PARMNUM}
+  WKSTA_WRKHEURISTICS_PARMNUM   = 32; // Supported by down-level.
+  {$EXTERNALSYM WKSTA_WRKHEURISTICS_PARMNUM}
+  WKSTA_MAXTHREADS_PARMNUM      = 33;
+  {$EXTERNALSYM WKSTA_MAXTHREADS_PARMNUM}
+
+  WKSTA_LOCKQUOTA_PARMNUM               = 41;
+  {$EXTERNALSYM WKSTA_LOCKQUOTA_PARMNUM}
+  WKSTA_LOCKINCREMENT_PARMNUM           = 42;
+  {$EXTERNALSYM WKSTA_LOCKINCREMENT_PARMNUM}
+  WKSTA_LOCKMAXIMUM_PARMNUM             = 43;
+  {$EXTERNALSYM WKSTA_LOCKMAXIMUM_PARMNUM}
+  WKSTA_PIPEINCREMENT_PARMNUM           = 44;
+  {$EXTERNALSYM WKSTA_PIPEINCREMENT_PARMNUM}
+  WKSTA_PIPEMAXIMUM_PARMNUM             = 45;
+  {$EXTERNALSYM WKSTA_PIPEMAXIMUM_PARMNUM}
+  WKSTA_DORMANTFILELIMIT_PARMNUM        = 46;
+  {$EXTERNALSYM WKSTA_DORMANTFILELIMIT_PARMNUM}
+  WKSTA_CACHEFILETIMEOUT_PARMNUM        = 47;
+  {$EXTERNALSYM WKSTA_CACHEFILETIMEOUT_PARMNUM}
+  WKSTA_USEOPPORTUNISTICLOCKING_PARMNUM = 48;
+  {$EXTERNALSYM WKSTA_USEOPPORTUNISTICLOCKING_PARMNUM}
+  WKSTA_USEUNLOCKBEHIND_PARMNUM         = 49;
+  {$EXTERNALSYM WKSTA_USEUNLOCKBEHIND_PARMNUM}
+  WKSTA_USECLOSEBEHIND_PARMNUM          = 50;
+  {$EXTERNALSYM WKSTA_USECLOSEBEHIND_PARMNUM}
+  WKSTA_BUFFERNAMEDPIPES_PARMNUM        = 51;
+  {$EXTERNALSYM WKSTA_BUFFERNAMEDPIPES_PARMNUM}
+  WKSTA_USELOCKANDREADANDUNLOCK_PARMNUM = 52;
+  {$EXTERNALSYM WKSTA_USELOCKANDREADANDUNLOCK_PARMNUM}
+  WKSTA_UTILIZENTCACHING_PARMNUM        = 53;
+  {$EXTERNALSYM WKSTA_UTILIZENTCACHING_PARMNUM}
+  WKSTA_USERAWREAD_PARMNUM              = 54;
+  {$EXTERNALSYM WKSTA_USERAWREAD_PARMNUM}
+  WKSTA_USERAWWRITE_PARMNUM             = 55;
+  {$EXTERNALSYM WKSTA_USERAWWRITE_PARMNUM}
+  WKSTA_USEWRITERAWWITHDATA_PARMNUM     = 56;
+  {$EXTERNALSYM WKSTA_USEWRITERAWWITHDATA_PARMNUM}
+  WKSTA_USEENCRYPTION_PARMNUM           = 57;
+  {$EXTERNALSYM WKSTA_USEENCRYPTION_PARMNUM}
+  WKSTA_BUFFILESWITHDENYWRITE_PARMNUM   = 58;
+  {$EXTERNALSYM WKSTA_BUFFILESWITHDENYWRITE_PARMNUM}
+  WKSTA_BUFFERREADONLYFILES_PARMNUM     = 59;
+  {$EXTERNALSYM WKSTA_BUFFERREADONLYFILES_PARMNUM}
+  WKSTA_FORCECORECREATEMODE_PARMNUM     = 60;
+  {$EXTERNALSYM WKSTA_FORCECORECREATEMODE_PARMNUM}
+  WKSTA_USE512BYTESMAXTRANSFER_PARMNUM  = 61;
+  {$EXTERNALSYM WKSTA_USE512BYTESMAXTRANSFER_PARMNUM}
+  WKSTA_READAHEADTHRUPUT_PARMNUM        = 62;
+  {$EXTERNALSYM WKSTA_READAHEADTHRUPUT_PARMNUM}
+
+//
+// One of these values indicates the parameter within an information
+// structure that is invalid when ERROR_INVALID_PARAMETER is returned by
+// NetWkstaUserSetInfo.
+//
+
+  WKSTA_OTH_DOMAINS_PARMNUM = 101;
+  {$EXTERNALSYM WKSTA_OTH_DOMAINS_PARMNUM}
+
+//
+// One of these values indicates the parameter within an information
+// structure that is invalid when ERROR_INVALID_PARAMETER is returned by
+// NetWkstaTransportAdd.
+//
+
+  TRANSPORT_QUALITYOFSERVICE_PARMNUM = 201;
+  {$EXTERNALSYM TRANSPORT_QUALITYOFSERVICE_PARMNUM}
+  TRANSPORT_NAME_PARMNUM             = 202;
+  {$EXTERNALSYM TRANSPORT_NAME_PARMNUM}
+
+implementation
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _NetWkstaGetInfo: Pointer;
+
+function NetWkstaGetInfo;
+begin
+  GetProcedureAddress(_NetWkstaGetInfo, netapi32, 'NetWkstaGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaGetInfo]
+  end;
+end;
+
+var
+  _NetWkstaSetInfo: Pointer;
+
+function NetWkstaSetInfo;
+begin
+  GetProcedureAddress(_NetWkstaSetInfo, netapi32, 'NetWkstaSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaSetInfo]
+  end;
+end;
+
+var
+  _NetWkstaUserGetInfo: Pointer;
+
+function NetWkstaUserGetInfo;
+begin
+  GetProcedureAddress(_NetWkstaUserGetInfo, netapi32, 'NetWkstaUserGetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaUserGetInfo]
+  end;
+end;
+
+var
+  _NetWkstaUserSetInfo: Pointer;
+
+function NetWkstaUserSetInfo;
+begin
+  GetProcedureAddress(_NetWkstaUserSetInfo, netapi32, 'NetWkstaUserSetInfo');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaUserSetInfo]
+  end;
+end;
+
+var
+  _NetWkstaUserEnum: Pointer;
+
+function NetWkstaUserEnum;
+begin
+  GetProcedureAddress(_NetWkstaUserEnum, netapi32, 'NetWkstaUserEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaUserEnum]
+  end;
+end;
+
+var
+  _NetWkstaTransportAdd: Pointer;
+
+function NetWkstaTransportAdd;
+begin
+  GetProcedureAddress(_NetWkstaTransportAdd, netapi32, 'NetWkstaTransportAdd');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaTransportAdd]
+  end;
+end;
+
+var
+  _NetWkstaTransportDel: Pointer;
+
+function NetWkstaTransportDel;
+begin
+  GetProcedureAddress(_NetWkstaTransportDel, netapi32, 'NetWkstaTransportDel');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaTransportDel]
+  end;
+end;
+
+var
+  _NetWkstaTransportEnum: Pointer;
+
+function NetWkstaTransportEnum;
+begin
+  GetProcedureAddress(_NetWkstaTransportEnum, netapi32, 'NetWkstaTransportEnum');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_NetWkstaTransportEnum]
+  end;
+end;
+
+{$ELSE}
+
+function NetWkstaGetInfo; external netapi32 name 'NetWkstaGetInfo';
+function NetWkstaSetInfo; external netapi32 name 'NetWkstaSetInfo';
+function NetWkstaUserGetInfo; external netapi32 name 'NetWkstaUserGetInfo';
+function NetWkstaUserSetInfo; external netapi32 name 'NetWkstaUserSetInfo';
+function NetWkstaUserEnum; external netapi32 name 'NetWkstaUserEnum';
+function NetWkstaTransportAdd; external netapi32 name 'NetWkstaTransportAdd';
+function NetWkstaTransportDel; external netapi32 name 'NetWkstaTransportDel';
+function NetWkstaTransportEnum; external netapi32 name 'NetWkstaTransportEnum';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 382 - 0
packages/extra/winunits/jwaloadperf.pas

@@ -0,0 +1,382 @@
+{******************************************************************************}
+{                                                                              }
+{ Performance Monitoring Installer API interface Unit for Object Pascal        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: loadperf.h, released June 2000. The original Pascal    }
+{ code is: LoadPerf.pas, released December 2000. The initial developer of the  }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLoadPerf;
+
+{$WEAKPACKAGEUNIT}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinType;
+
+// flags for dwFlags Argument
+
+const
+  LOADPERF_FLAGS_DELETE_MOF_ON_EXIT  = ULONG_PTR(1);
+  {$EXTERNALSYM LOADPERF_FLAGS_DELETE_MOF_ON_EXIT}
+  LOADPERF_FLAGS_LOAD_REGISTRY_ONLY  = ULONG_PTR(2);
+  {$EXTERNALSYM LOADPERF_FLAGS_LOAD_REGISTRY_ONLY}
+  LOADPERF_FLAGS_CREATE_MOF_ONLY     = ULONG_PTR(4);
+  {$EXTERNALSYM LOADPERF_FLAGS_CREATE_MOF_ONLY}
+  LOADPERF_FLAGS_DISPLAY_USER_MSGS   = ULONG_PTR(8);
+  {$EXTERNALSYM LOADPERF_FLAGS_DISPLAY_USER_MSGS}
+
+(* removed PSDK XP SP1
+// note: LOADPERF_FLAGS_LOAD_REGISTRY_ONLY is not a valid flag for
+// LoadMofFromInstalledServiceA/W as the service must already be installed
+
+function LoadMofFromInstalledServiceA(szServiceName, szMofFilename: LPCSTR;
+  dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM LoadMofFromInstalledServiceA}
+function LoadMofFromInstalledServiceW(szServiceName, szMofFilename: LPCWSTR;
+  dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM LoadMofFromInstalledServiceW}
+function LoadMofFromInstalledService(szServiceName, szMofFilename: LPCTSTR;
+  dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM LoadMofFromInstalledService}
+*)
+
+function InstallPerfDllA(szComputerName, lpIniFile: LPCSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM InstallPerfDllA}
+function InstallPerfDllW(szComputerName, lpIniFile: LPCWSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM InstallPerfDllW}
+function InstallPerfDll(szComputerName, lpIniFile: LPCTSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM InstallPerfDll}
+
+function LoadPerfCounterTextStringsA(lpCommandLine: LPSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM LoadPerfCounterTextStringsA}
+function LoadPerfCounterTextStringsW(lpCommandLine: LPWSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM LoadPerfCounterTextStringsW}
+function LoadPerfCounterTextStrings(lpCommandLine: LPTSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM LoadPerfCounterTextStrings}
+
+function UnloadPerfCounterTextStringsA(lpCommandLine: LPSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM UnloadPerfCounterTextStringsA}
+function UnloadPerfCounterTextStringsW(lpCommandLine: LPWSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM UnloadPerfCounterTextStringsW}
+function UnloadPerfCounterTextStrings(lpCommandLine: LPTSTR; bQuietModeArg: BOOL): DWORD; stdcall;
+{$EXTERNALSYM UnloadPerfCounterTextStrings}
+
+function UpdatePerfNameFilesA(szNewCtrFilePath, szNewHlpFilePath: LPCSTR;
+  szLanguageID: LPSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM UpdatePerfNameFilesA}
+function UpdatePerfNameFilesW(szNewCtrFilePath, szNewHlpFilePath: LPCWSTR;
+  szLanguageID: LPWSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM UpdatePerfNameFilesW}
+function UpdatePerfNameFiles(szNewCtrFilePath, szNewHlpFilePath: LPCTSTR;
+  szLanguageID: LPTSTR; dwFlags: ULONG_PTR): DWORD; stdcall;
+{$EXTERNALSYM UpdatePerfNameFiles}
+
+function SetServiceAsTrustedA(szReserved, szServiceName: LPCSTR): DWORD; stdcall;
+{$EXTERNALSYM SetServiceAsTrustedA}
+function SetServiceAsTrustedW(szReserved, szServiceName: LPCWSTR): DWORD; stdcall;
+{$EXTERNALSYM SetServiceAsTrustedW}
+function SetServiceAsTrusted(szReserved, szServiceName: LPCTSTR): DWORD; stdcall;
+{$EXTERNALSYM SetServiceAsTrusted}
+
+function BackupPerfRegistryToFileW(szFileName: LPCWSTR; szCommentString: LPCWSTR): DWORD; stdcall;
+{$EXTERNALSYM BackupPerfRegistryToFileW}
+
+function RestorePerfRegistryFromFileW(szFileName: LPCWSTR; szLangId: LPCWSTR): DWORD; stdcall;
+{$EXTERNALSYM RestorePerfRegistryFromFileW}
+
+implementation
+
+const
+  loadperflib = 'loadperf.dll';
+  {$IFDEF UNICODE}
+  AWSuffix = 'W';
+  {$ELSE}
+  AWSuffix = 'A';
+  {$ENDIF UNICODE}
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _InstallPerfDllA: Pointer;
+
+function InstallPerfDllA;
+begin
+  GetProcedureAddress(_InstallPerfDllA, loadperflib, 'InstallPerfDllA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_InstallPerfDllA]
+  end;
+end;
+
+var
+  _InstallPerfDllW: Pointer;
+
+function InstallPerfDllW;
+begin
+  GetProcedureAddress(_InstallPerfDllW, loadperflib, 'InstallPerfDllW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_InstallPerfDllW]
+  end;
+end;
+
+var
+  _InstallPerfDll: Pointer;
+
+function InstallPerfDll;
+begin
+  GetProcedureAddress(_InstallPerfDll, loadperflib, 'InstallPerfDll' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_InstallPerfDll]
+  end;
+end;
+
+var
+  _LoadPerfCounterTextStringsA: Pointer;
+
+function LoadPerfCounterTextStringsA;
+begin
+  GetProcedureAddress(_LoadPerfCounterTextStringsA, loadperflib, 'LoadPerfCounterTextStringsA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LoadPerfCounterTextStringsA]
+  end;
+end;
+
+var
+  _LoadPerfCounterTextStringsW: Pointer;
+
+function LoadPerfCounterTextStringsW;
+begin
+  GetProcedureAddress(_LoadPerfCounterTextStringsW, loadperflib, 'LoadPerfCounterTextStringsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LoadPerfCounterTextStringsW]
+  end;
+end;
+
+var
+  _LoadPerfCounterTextStrings: Pointer;
+
+function LoadPerfCounterTextStrings;
+begin
+  GetProcedureAddress(_LoadPerfCounterTextStrings, loadperflib, 'LoadPerfCounterTextStrings' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LoadPerfCounterTextStrings]
+  end;
+end;
+
+var
+  _UnloadPerfCounterTextStringsA: Pointer;
+
+function UnloadPerfCounterTextStringsA;
+begin
+  GetProcedureAddress(_UnloadPerfCounterTextStringsA, loadperflib, 'UnloadPerfCounterTextStringsA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnloadPerfCounterTextStringsA]
+  end;
+end;
+
+var
+  _UnloadPerfCounterTextStringsW: Pointer;
+
+function UnloadPerfCounterTextStringsW;
+begin
+  GetProcedureAddress(_UnloadPerfCounterTextStringsW, loadperflib, 'UnloadPerfCounterTextStringsW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnloadPerfCounterTextStringsW]
+  end;
+end;
+
+var
+  _UnloadPerfCounterTextStrings: Pointer;
+
+function UnloadPerfCounterTextStrings;
+begin
+  GetProcedureAddress(_UnloadPerfCounterTextStrings, loadperflib, 'UnloadPerfCounterTextStrings' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UnloadPerfCounterTextStrings]
+  end;
+end;
+
+var
+  _UpdatePerfNameFilesA: Pointer;
+
+function UpdatePerfNameFilesA;
+begin
+  GetProcedureAddress(_UpdatePerfNameFilesA, loadperflib, 'UpdatePerfNameFilesA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UpdatePerfNameFilesA]
+  end;
+end;
+
+var
+  _UpdatePerfNameFilesW: Pointer;
+
+function UpdatePerfNameFilesW;
+begin
+  GetProcedureAddress(_UpdatePerfNameFilesW, loadperflib, 'UpdatePerfNameFilesW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UpdatePerfNameFilesW]
+  end;
+end;
+
+var
+  _UpdatePerfNameFiles: Pointer;
+
+function UpdatePerfNameFiles;
+begin
+  GetProcedureAddress(_UpdatePerfNameFiles, loadperflib, 'UpdatePerfNameFiles' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_UpdatePerfNameFiles]
+  end;
+end;
+
+var
+  _SetServiceAsTrustedA: Pointer;
+
+function SetServiceAsTrustedA;
+begin
+  GetProcedureAddress(_SetServiceAsTrustedA, loadperflib, 'SetServiceAsTrustedA');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetServiceAsTrustedA]
+  end;
+end;
+
+var
+  _SetServiceAsTrustedW: Pointer;
+
+function SetServiceAsTrustedW;
+begin
+  GetProcedureAddress(_SetServiceAsTrustedW, loadperflib, 'SetServiceAsTrustedW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetServiceAsTrustedW]
+  end;
+end;
+
+var
+  _SetServiceAsTrusted: Pointer;
+
+function SetServiceAsTrusted;
+begin
+  GetProcedureAddress(_SetServiceAsTrusted, loadperflib, 'SetServiceAsTrusted' + AWSuffix);
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_SetServiceAsTrusted]
+  end;
+end;
+
+var
+  _BackupPerfRegistryToFileW: Pointer;
+
+function BackupPerfRegistryToFileW;
+begin
+  GetProcedureAddress(_BackupPerfRegistryToFileW, loadperflib, 'BackupPerfRegistryToFileW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_BackupPerfRegistryToFileW]
+  end;
+end;
+
+var
+  _RestorePerfRegistryFromFileW: Pointer;
+
+function RestorePerfRegistryFromFileW;
+begin
+  GetProcedureAddress(_RestorePerfRegistryFromFileW, loadperflib, 'RestorePerfRegistryFromFileW');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_RestorePerfRegistryFromFileW]
+  end;
+end;
+
+{$ELSE}
+
+function InstallPerfDllA; external loadperflib name 'InstallPerfDllA';
+function InstallPerfDllW; external loadperflib name 'InstallPerfDllW';
+function InstallPerfDll; external loadperflib name 'InstallPerfDll' + AWSuffix;
+function LoadPerfCounterTextStringsA; external loadperflib name 'LoadPerfCounterTextStringsA';
+function LoadPerfCounterTextStringsW; external loadperflib name 'LoadPerfCounterTextStringsW';
+function LoadPerfCounterTextStrings; external loadperflib name 'LoadPerfCounterTextStrings' + AWSuffix;
+function UnloadPerfCounterTextStringsA; external loadperflib name 'UnloadPerfCounterTextStringsA';
+function UnloadPerfCounterTextStringsW; external loadperflib name 'UnloadPerfCounterTextStringsW';
+function UnloadPerfCounterTextStrings; external loadperflib name 'UnloadPerfCounterTextStrings' + AWSuffix;
+function UpdatePerfNameFilesA; external loadperflib name 'UpdatePerfNameFilesA';
+function UpdatePerfNameFilesW; external loadperflib name 'UpdatePerfNameFilesW';
+function UpdatePerfNameFiles; external loadperflib name 'UpdatePerfNameFiles' + AWSuffix;
+function SetServiceAsTrustedA; external loadperflib name 'SetServiceAsTrustedA';
+function SetServiceAsTrustedW; external loadperflib name 'SetServiceAsTrustedW';
+function SetServiceAsTrusted; external loadperflib name 'SetServiceAsTrusted' + AWSuffix;
+function BackupPerfRegistryToFileW; external loadperflib name 'BackupPerfRegistryToFileW';
+function RestorePerfRegistryFromFileW; external loadperflib name 'RestorePerfRegistryFromFileW';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 1657 - 0
packages/extra/winunits/jwalpmapi.pas

@@ -0,0 +1,1657 @@
+{******************************************************************************}
+{                                                                              }
+{ Winsock2 RSVP/LPM API interface Unit for Object Pascal                       }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: lpmapi.h, released June 2000. The original Pascal      }
+{ code is: LpmApi.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaLpmApi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "lpmapi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+uses
+  JwaWinSock2, JwaWinType;
+
+type
+  FLOAT = Single;
+  {$NODEFINE FLOAT}
+
+(****************************************************************************
+
+            RSVPD -- ReSerVation Protocol Daemon
+
+                USC Information Sciences Institute
+                Marina del Rey, California
+
+        Original Version: Shai Herzog, Nov. 1993.
+        Current Version:  Steven Berson & Bob Braden, may 1996.
+
+  Copyright (c) 1996 by the University of Southern California
+  All rights reserved.
+
+  Permission to use, copy, modify, and distribute this software and its
+  documentation in source and binary forms for any purpose and without
+  fee is hereby granted, provided that both the above copyright notice
+  and this permission notice appear in all copies, and that any
+  documentation, advertising materials, and other materials related to
+  such distribution and use acknowledge that the software was developed
+  in part by the University of Southern California, Information
+  Sciences Institute.  The name of the University may not be used to
+  endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
+  the suitability of this software for any purpose.  THIS SOFTWARE IS
+  PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
+  INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+  Other copyrights might apply to parts of this software and are so
+  noted when applicable.
+
+********************************************************************)
+
+(*
+ *  Standard format of an RSVP object header
+ *)
+
+type
+  RsvpObjHdr = record
+    obj_length: USHORT; (* Length in bytes *)
+    obj_class: UCHAR;   (* Class (values defined below) *)
+    obj_ctype: UCHAR;   (* C-Type (values defined below) *)
+  end;
+  {$EXTERNALSYM RsvpObjHdr}
+  TRsvpObjHdr = RsvpObjHdr;
+  PRsvpObjHdr = ^RsvpObjHdr;
+  PPRsvpObjHdr = ^PRsvpObjHdr;
+
+function ObjLength(const x: TRsvpObjHdr): USHORT;
+{$EXTERNALSYM ObjLength}
+function ObjCType(const x: TRsvpObjHdr): UCHAR;
+{$EXTERNALSYM ObjCType}
+function ObjClass(const x: TRsvpObjHdr): UCHAR;
+{$EXTERNALSYM ObjClass}
+function ObjData(const x: TRsvpObjHdr): Pointer;
+{$EXTERNALSYM ObjData}
+
+(*
+ *  Define object classes: Class-Num values
+ *)
+
+const
+  class_NULL            = 0;
+  {$EXTERNALSYM class_NULL}
+  class_SESSION         = 1;
+  {$EXTERNALSYM class_SESSION}
+  class_SESSION_GROUP   = 2;
+  {$EXTERNALSYM class_SESSION_GROUP}
+  class_RSVP_HOP        = 3;
+  {$EXTERNALSYM class_RSVP_HOP}
+  class_INTEGRITY       = 4;
+  {$EXTERNALSYM class_INTEGRITY}
+  class_TIME_VALUES     = 5;
+  {$EXTERNALSYM class_TIME_VALUES}
+  class_ERROR_SPEC      = 6;
+  {$EXTERNALSYM class_ERROR_SPEC}
+  class_SCOPE           = 7;
+  {$EXTERNALSYM class_SCOPE}
+  class_STYLE           = 8;
+  {$EXTERNALSYM class_STYLE}
+  class_FLOWSPEC        = 9; // these two are the same
+  {$EXTERNALSYM class_FLOWSPEC}
+  class_IS_FLOWSPEC     = 9; // since we added IS in front of the name
+  {$EXTERNALSYM class_IS_FLOWSPEC}
+  class_FILTER_SPEC     = 10;
+  {$EXTERNALSYM class_FILTER_SPEC}
+  class_SENDER_TEMPLATE = 11;
+  {$EXTERNALSYM class_SENDER_TEMPLATE}
+  class_SENDER_TSPEC    = 12;
+  {$EXTERNALSYM class_SENDER_TSPEC}
+  class_ADSPEC          = 13;
+  {$EXTERNALSYM class_ADSPEC}
+  class_POLICY_DATA     = 14;
+  {$EXTERNALSYM class_POLICY_DATA}
+  class_CONFIRM         = 15;
+  {$EXTERNALSYM class_CONFIRM}
+  class_MAX             = 15;
+  {$EXTERNALSYM class_MAX}
+
+(*
+ *  RSVP SESSION object
+ *)
+
+  ctype_SESSION_ipv4    = 1;
+  {$EXTERNALSYM ctype_SESSION_ipv4}
+  ctype_SESSION_ipv4GPI = 3   (* IPSEC: Generalized Port Id *);
+  {$EXTERNALSYM ctype_SESSION_ipv4GPI}
+
+  SESSFLG_E_Police = $01    (* E_Police: Entry policing flag*);
+  {$EXTERNALSYM SESSFLG_E_Police}
+
+type
+  Session_IPv4 = record
+    sess_destaddr: IN_ADDR;  // DestAddress
+    sess_protid: UCHAR;    // Protocol Id
+    sess_flags: UCHAR;     // Use the flags defined above
+    sess_destport: USHORT;  // DestPort
+  end;
+  {$EXTERNALSYM Session_IPv4}
+  TSessionIPv4 = Session_IPv4;
+  PSessionIPv4 = ^Session_IPv4;
+
+(*    GPI versions have virtual dest port instead of dest port; this
+ *    changes the interpretation but not the format, so we do not
+ *    define new structs for GPI.
+ *)
+
+  RSVP_SESSION = record
+    sess_header: RsvpObjHdr;
+    case Integer of
+      0: (sess_ipv4: Session_IPv4);
+  end;
+  {$EXTERNALSYM RSVP_SESSION}
+  TRsvpSession = RSVP_SESSION;
+  PRsvpSession = ^RSVP_SESSION;  
+
+// Useful defines to access components of SESSION obect
+
+//#define Sess4Addr       sess_u.sess_ipv4.sess_destaddr
+//#define Sess4Port       sess_u.sess_ipv4.sess_destport
+//#define Sess4Protocol   sess_u.sess_ipv4.sess_protid
+//#define Sess4Flags      sess_u.sess_ipv4.sess_flags
+
+(*
+ *  RSVP HOP object
+ *)
+
+const
+  ctype_RSVP_HOP_ipv4 = 1;
+  {$EXTERNALSYM ctype_RSVP_HOP_ipv4}
+
+type
+  Rsvp_Hop_IPv4 = record
+    hop_ipaddr: IN_ADDR;   // Next/Previous Hop Address
+    hop_LIH: ULONG;        // Logical Interface Handle
+  end;
+  {$EXTERNALSYM Rsvp_Hop_IPv4}
+  TRsvpHopIPv4 = Rsvp_Hop_IPv4;
+  PRsvpHopIPv4 = ^Rsvp_Hop_IPv4;
+
+  RSVP_HOP = record
+    hop_header: RsvpObjHdr;
+    case Integer of
+      0: (hop_ipv4: Rsvp_Hop_IPv4);
+  end;
+  {$EXTERNALSYM RSVP_HOP}
+  TRsvpHop = RSVP_HOP;
+  PRsvpHop = ^RSVP_HOP;
+
+//#define Hop4LIH    hop_u.hop_ipv4.hop_LIH
+//#define Hop4Addr   hop_u.hop_ipv4.hop_ipaddr
+
+(*
+ *  RSVP STYLE object
+ *)
+
+//  Define values for option vector
+
+const
+  Opt_Share_mask = $00000018; // 2 bits: Sharing control
+  {$EXTERNALSYM Opt_Share_mask}
+  Opt_Distinct   = $00000008; // Distinct reservations
+  {$EXTERNALSYM Opt_Distinct}
+  Opt_Shared     = $00000010; // Shared reservations
+  {$EXTERNALSYM Opt_Shared}
+
+  Opt_SndSel_mask = $00000007; // 3 bits: Sender selection
+  {$EXTERNALSYM Opt_SndSel_mask}
+  Opt_Wildcard    = $00000001; // Wildcard scope
+  {$EXTERNALSYM Opt_Wildcard}
+  Opt_Explicit    = $00000002; // Explicit scope
+  {$EXTERNALSYM Opt_Explicit}
+
+function Style_is_Wildcard(p: DWORD): Boolean;
+{$EXTERNALSYM Style_is_Wildcard}
+function Style_is_Shared(p: DWORD): Boolean;
+{$EXTERNALSYM Style_is_Shared}
+
+//  Define style values
+
+const
+  STYLE_WF = Opt_Shared + Opt_Wildcard;
+  {$EXTERNALSYM STYLE_WF}
+  STYLE_FF = Opt_Distinct + Opt_Explicit;
+  {$EXTERNALSYM STYLE_FF}
+  STYLE_SE = Opt_Shared + Opt_Explicit;
+  {$EXTERNALSYM STYLE_SE}
+
+  ctype_STYLE = 1;
+  {$EXTERNALSYM ctype_STYLE}
+
+type
+  RESV_STYLE = record
+    style_header: RsvpObjHdr;
+    style_word: ULONG;
+  end;
+  {$EXTERNALSYM RESV_STYLE}
+  TResvStyle = RESV_STYLE;
+  PResvStyle = ^RESV_STYLE;
+
+(*
+ *  RSVP FILTER SPEC object
+ *)
+
+const
+  ctype_FILTER_SPEC_ipv4    = 1; // IPv4 FILTER_SPEC
+  {$EXTERNALSYM ctype_FILTER_SPEC_ipv4}
+  ctype_FILTER_SPEC_ipv4GPI = 4; // IPv4/GPI FILTER_SPEC
+  {$EXTERNALSYM ctype_FILTER_SPEC_ipv4GPI}
+
+type
+  Filter_Spec_IPv4 = record
+    filt_ipaddr: IN_ADDR;    // IPv4 SrcAddress
+    filt_unused: USHORT;
+    filt_port: USHORT;       // SrcPort
+  end;
+  {$EXTERNALSYM Filter_Spec_IPv4}
+  TFilterSpecIPv4 = Filter_Spec_IPv4;
+  PFilterSpecIPv4 = ^Filter_Spec_IPv4;
+
+  Filter_Spec_IPv4GPI = record
+    filt_ipaddr: IN_ADDR;    // IPv4 SrcAddress
+    filt_gpi: ULONG;         // Generalized Port Id
+  end;
+  {$EXTERNALSYM Filter_Spec_IPv4GPI}
+  TFilterSpecIPv4GPI = Filter_Spec_IPv4GPI;
+  PFilterSpecIPv4GPI = ^Filter_Spec_IPv4GPI;
+
+  FILTER_SPEC = record
+    filt_header: RsvpObjHdr;
+    case Integer of
+      0: (filt_ipv4: Filter_Spec_IPv4);
+      1: (filt_ipv4gpi: Filter_Spec_IPv4GPI);
+  end;
+  {$EXTERNALSYM FILTER_SPEC}
+  TFilterSpec = FILTER_SPEC;
+  PFilterSpec = ^FILTER_SPEC;  
+
+//#define FilterSrcaddr   filt_u.filt_ipv4.filt_ipaddr
+//#define FilterSrcport   filt_u.filt_ipv4.filt_port
+
+(*
+ *  RSVP SENDER_TEMPLATE object
+ *)
+
+const
+  ctype_SENDER_TEMPLATE_ipv4    = 1; // IPv4 SENDER_TEMPLATE
+  {$EXTERNALSYM ctype_SENDER_TEMPLATE_ipv4}
+  ctype_SENDER_TEMPLATE_ipv4GPI = 4; // IPv4/GPI SENDER_TEMPLATE
+  {$EXTERNALSYM ctype_SENDER_TEMPLATE_ipv4GPI}
+
+type
+  SENDER_TEMPLATE = FILTER_SPEC;       // Identical to FILTER_SPEC
+  {$EXTERNALSYM SENDER_TEMPLATE}
+  TSenderTemplate = SENDER_TEMPLATE;
+  PSenderTemplate = ^SENDER_TEMPLATE;
+
+(*
+ *  RSVP SCOPE object class
+ *)
+
+const
+  ctype_SCOPE_list_ipv4 = 1;
+  {$EXTERNALSYM ctype_SCOPE_list_ipv4}
+
+type
+  Scope_list_ipv4 = record
+    scopl_ipaddr: array [0..0] of IN_ADDR;        // var-len list of IP sender addrs
+  end;
+  {$EXTERNALSYM Scope_list_ipv4}
+  TScopeListIPv4 = Scope_list_ipv4;
+  PScopeListIPv4 = ^Scope_list_ipv4;
+
+  RSVP_SCOPE = record
+    scopl_header: RsvpObjHdr;
+    case Integer of
+      0: (scopl_ipv4: Scope_list_ipv4);
+  end;
+  {$EXTERNALSYM RSVP_SCOPE}
+  TRsvpScope = RSVP_SCOPE;
+  PRsvpScope = ^RSVP_SCOPE;
+
+//#define Scope4Addr      scope_u.scopl_ipv4.scopl_ipaddr
+//#define ScopeCnt(scp)   ((ObjLength(scp)-sizeof(RsvpObjHdr))/sizeof(struct in_addr))
+//#define ScopeLen(cnt)   (cnt*sizeof(struct in_addr)+sizeof(RsvpObjHdr))
+
+(*
+ *  ERROR_SPEC object class
+ *)
+
+const
+  ctype_ERROR_SPEC_ipv4 = 1;
+  {$EXTERNALSYM ctype_ERROR_SPEC_ipv4}
+
+  ERROR_SPECF_InPlace = $01;    (*   Left resv in place     *)
+  {$EXTERNALSYM ERROR_SPECF_InPlace}
+  ERROR_SPECF_NotGuilty = $02;    (*   This rcvr not guilty   *)
+  {$EXTERNALSYM ERROR_SPECF_NotGuilty}
+  ERR_FORWARD_OK  = $8000;      (* Flag: OK to forward state *)
+  {$EXTERNALSYM ERR_FORWARD_OK}
+
+function Error_Usage(x: DWORD): DWORD;
+{$EXTERNALSYM Error_Usage}
+
+const
+  ERR_Usage_globl = $00;        (* Globally-defined sub-code *)
+  {$EXTERNALSYM ERR_Usage_globl}
+  ERR_Usage_local = $10;        (* Locally-defined sub-code *)
+  {$EXTERNALSYM ERR_Usage_local}
+  ERR_Usage_serv  = $11;        (* Service-defined sub-code *)
+  {$EXTERNALSYM ERR_Usage_serv}
+  ERR_global_mask = $0fff;      (* Sub-code bits in Error Val *)
+  {$EXTERNALSYM ERR_global_mask}
+
+type
+  Error_Spec_IPv4 = record
+    errs_errnode: in_addr;   (* Error Node Address       *)
+    errs_flags: u_char;      (* Flags:           *)
+    errs_code: UCHAR;        (* Error Code (def'd below) *)
+    errs_value: USHORT;      (* Error Value      *)
+  end;
+  {$EXTERNALSYM Error_Spec_IPv4}
+  TErrorSpecIPv4 = Error_Spec_IPv4;
+  PErrorSpecIPv4 = ^Error_Spec_IPv4;
+
+type
+  ERROR_SPEC = record
+    errs_header: RsvpObjHdr;
+    case Integer of
+      0: (errs_ipv4: Error_Spec_IPv4);
+  end;
+  {$EXTERNALSYM ERROR_SPEC}
+  TErrorSpec = ERROR_SPEC;
+  PErrorSpec = ^ERROR_SPEC;
+
+//#define errspec4_enode  errs_u.errs_ipv4.errs_errnode
+//#define errspec4_code   errs_u.errs_ipv4.errs_code
+//#define errspec4_value  errs_u.errs_ipv4.errs_value
+//#define errspec4_flags  errs_u.errs_ipv4.errs_flags
+
+(*
+ *  POLICY_DATA object class
+ *
+ *      Contents are Opaque RSVP/SBM
+ *)
+
+const
+  ctype_POLICY_DATA = 1;
+  {$EXTERNALSYM ctype_POLICY_DATA}
+
+type
+  POLICY_DATA = record
+    PolicyObjHdr: RsvpObjHdr;
+    usPeOffset: USHORT;     // Offset to the start of Policy Elements from the begining of Policy Data
+    usReserved: USHORT;
+  end;
+  {$EXTERNALSYM POLICY_DATA}
+  TPolicyData = POLICY_DATA;
+  PPolicyData = ^POLICY_DATA;
+
+const
+  PD_HDR_LEN  = SizeOf(POLICY_DATA);
+  {$EXTERNALSYM PD_HDR_LEN}
+
+type
+  POLICY_ELEMENT = record
+    usPeLength: USHORT;     // Policy Element length
+    usPeType: USHORT;       // Policy Element type
+    ucPeData: array [0..3] of UCHAR;    // Just a place holder to the start of Policy Element data
+  end;
+  {$EXTERNALSYM POLICY_ELEMENT}
+  TPolicyElement = POLICY_ELEMENT;
+  PPolicyElement = ^POLICY_ELEMENT;
+
+const
+  PE_HDR_LEN = 2 * SizeOf(USHORT);
+  {$EXTERNALSYM PE_HDR_LEN}
+
+(**************************************************************************
+ *
+ *  Int-Serv Data Structures
+ *
+ **************************************************************************)
+
+(*
+ *  Service numbers
+ *)
+
+const
+  GENERAL_INFO          = 1;
+  {$EXTERNALSYM GENERAL_INFO}
+  GUARANTEED_SERV       = 2;
+  {$EXTERNALSYM GUARANTEED_SERV}
+  PREDICTIVE_SERV       = 3;
+  {$EXTERNALSYM PREDICTIVE_SERV}
+  CONTROLLED_DELAY_SERV = 4;
+  {$EXTERNALSYM CONTROLLED_DELAY_SERV}
+  CONTROLLED_LOAD_SERV  = 5;
+  {$EXTERNALSYM CONTROLLED_LOAD_SERV}
+  QUALITATIVE_SERV      = 6;
+  {$EXTERNALSYM QUALITATIVE_SERV}
+
+(*
+ *  Well-known parameter IDs
+ *)
+
+const
+  IS_WKP_HOP_CNT =        4;
+  {$EXTERNALSYM IS_WKP_HOP_CNT}
+  IS_WKP_PATH_BW =        6;
+  {$EXTERNALSYM IS_WKP_PATH_BW}
+  IS_WKP_MIN_LATENCY =    8;
+  {$EXTERNALSYM IS_WKP_MIN_LATENCY}
+  IS_WKP_COMPOSED_MTU =   10;
+  {$EXTERNALSYM IS_WKP_COMPOSED_MTU}
+  IS_WKP_TB_TSPEC =       127; (* Token-bucket TSPEC parm *)
+  {$EXTERNALSYM IS_WKP_TB_TSPEC}
+  IS_WKP_Q_TSPEC =        128;
+  {$EXTERNALSYM IS_WKP_Q_TSPEC}
+
+type
+  int_serv_wkp = DWORD;
+  {$EXTERNALSYM int_serv_wkp}
+  TIntServWkp = int_serv_wkp;
+
+(*
+ *  Int-serv Main header
+ *)
+
+  IntServMainHdr = record
+    ismh_version: UCHAR;    // Version
+    ismh_unused: UCHAR;
+    ismh_len32b: USHORT;    // # 32-bit words excluding this hdr
+  end;
+  {$EXTERNALSYM IntServMainHdr}
+  TIntServMainHdr = IntServMainHdr;
+  PIntServMainHdr = ^IntServMainHdr;
+
+const
+  INTSERV_VERS_MASK   = $f0;
+  {$EXTERNALSYM INTSERV_VERS_MASK}
+  INTSERV_VERSION0    = 0;
+  {$EXTERNALSYM INTSERV_VERSION0}
+
+function Intserv_Version(x: DWORD): DWORD;
+{$EXTERNALSYM Intserv_Version}
+function Intserv_Version_OK(const x: TIntServMainHdr): Boolean;
+{$EXTERNALSYM Intserv_Version_OK}
+
+// Convert ishm_length to equivalent RSVP object size, for checking
+
+function Intserv_Obj_size(const x: TIntServMainHdr): DWORD;
+{$EXTERNALSYM Intserv_Obj_size}
+
+(*
+ *  Int-serv Service Element Header
+ *)
+
+// Flag: Break bit
+
+const
+  ISSH_BREAK_BIT = $80;
+  {$EXTERNALSYM ISSH_BREAK_BIT}
+
+type
+  IntServServiceHdr = record
+    issh_service: UCHAR;   // Service number
+    issh_flags: UCHAR;     // Flag byte
+    issh_len32b: USHORT;    // #32-bit words excluding this hdr
+  end;
+  {$EXTERNALSYM IntServServiceHdr}
+  TIntServServiceHdr = IntServServiceHdr;
+  PIntServServiceHdr = ^IntServServiceHdr;
+
+function Issh_len32b(const p: TIntServServiceHdr): USHORT;
+{$EXTERNALSYM Issh_len32b}
+
+(*
+ *  Int-serv Parameter Element Header
+ *)
+
+const
+  ISPH_FLG_INV = $80; // Flag: Invalid
+  {$EXTERNALSYM ISPH_FLG_INV}
+
+type
+  IntServParmHdr = record
+    isph_parm_num: UCHAR;  // Parameter number
+    isph_flags: UCHAR;     // Flags
+    isph_len32b: USHORT;    // #32-bit words excluding this hdr
+  end;
+  {$EXTERNALSYM IntServParmHdr}
+  TIntServParmHdr = IntServParmHdr;
+  PIntServParmHdr = ^IntServParmHdr;
+
+{
+function Next_Main_Hdr(const p: TIntServMainHdr): PIntServMainHdr;
+begin
+   TODO (IntServMainHdr *)((ULONG *)(p)+1+(p)->ismh_len32b)
+end;
+
+function Next_Serv_Hdr(const p: TIntServMainHdr): ULONG;
+begin
+   TODO (IntServServiceHdr *)((ULONG *)(p)+1+(p)->issh_len32b)
+end;
+
+function Next_Parm_Hdr(const p: TIntServParmHdr): ULONG;
+begin
+   TODO (IntServParmHdr *)((ULONG *)(p)+1+(p)->isph_len32b)
+end;
+}
+
+(*
+ *  Generic Tspec Parameters
+ *)
+
+type
+  GenTspecParms = record
+    TB_Tspec_r: FLOAT;     // Token bucket rate (B/sec)
+    TB_Tspec_b: FLOAT;     // Token bucket depth (B)
+    TB_Tspec_p: FLOAT;     // Peak data rate (B/sec)
+    TB_Tspec_m: ULONG;     // Min Policed Unit (B)
+    TB_Tspec_M_: ULONG;     // Max pkt size (B)
+  end;
+  {$EXTERNALSYM GenTspecParms}
+  TGenTspecParms = GenTspecParms;
+  PGenTspecParms = ^GenTspecParms;
+
+(*
+ *  Generic Tspec
+ *)
+
+  GenTspec = record
+    gen_Tspec_serv_hdr: IntServServiceHdr; // (GENERAL_INFO, length)
+    gen_Tspec_parm_hdr: IntServParmHdr; // (IS_WKP_TB_TSPEC)
+    gen_Tspec_parms: GenTspecParms;
+  end;
+  {$EXTERNALSYM GenTspec}
+  TGenTspec = GenTspec;
+  PGenTspec = ^GenTspec;
+
+//#define gtspec_r        gen_Tspec_parms.TB_Tspec_r
+//#define gtspec_b        gen_Tspec_parms.TB_Tspec_b
+//#define gtspec_m        gen_Tspec_parms.TB_Tspec_m
+//#define gtspec_M        gen_Tspec_parms.TB_Tspec_M
+//#define gtspec_p        gen_Tspec_parms.TB_Tspec_p
+//#define gtspec_parmno   gen_Tspec_parm_hdr.isph_parm_num
+//#define gtspec_flags    gen_Tspec_parm_hdr.isph_flags
+
+//#define gtspec_len      (sizeof(GenTspec) - sizeof(IntServServiceHdr))
+
+(* contents of qualitative tspec *)
+
+type
+  QualTspecParms = record
+    TB_Tspec_M: ULONG;     // Max pkt size (M)
+  end;
+  {$EXTERNALSYM QualTspecParms}
+  TQualTspecParms = QualTspecParms;
+  PQualTspecParms = ^QualTspecParms;
+
+  QualTspec = record
+    qual_Tspec_serv_hdr: IntServServiceHdr; // (QUALITATIVE_SERV, length)
+    qual_Tspec_parm_hdr: IntServParmHdr; // (IS_WKP_Q_TSPEC)
+    qual_Tspec_parms: QualTspecParms;
+  end;
+  {$EXTERNALSYM QualTspec}
+  TQualTspec = QualTspec;
+  PQualTspec = ^QualTspec;
+
+  QualAppFlowSpec = record
+    Q_spec_serv_hdr: IntServServiceHdr;    // (QUALITATIVE_SERV,0,len)
+    Q_spec_parm_hdr: IntServParmHdr;    // (IS_WKP_Q_TSPEC)
+    Q_spec_parms: QualTspecParms;       // QUALITATIVE Tspec parameters
+  end;
+  {$EXTERNALSYM QualAppFlowSpec}
+  TQualAppFlowSpec = QualAppFlowSpec;
+  PQualAppFlowSpec = ^QualAppFlowSpec;
+
+//#define QAspec_M        Q_spec_parms.TB_Tspec_M
+
+(*
+ *  Contents of int-serv Tspec
+ *)
+
+  IntServTspecBody = record
+    st_mh: IntServMainHdr;
+    case Integer of
+      0: (gen_stspec: GenTspec); // Generic Tspec
+      1: (qual_stspec: QualTspec);
+  end;
+  {$EXTERNALSYM IntServTspecBody}
+  TIntServTspecBody = IntServTspecBody;
+  PIntServTspecBody = ^IntServTspecBody;
+
+(*
+ *  SENDER_TSPEC class object
+ *)
+
+const
+  ctype_SENDER_TSPEC = 2;
+  {$EXTERNALSYM ctype_SENDER_TSPEC}
+
+type
+  SENDER_TSPEC = record
+    stspec_header: RsvpObjHdr;
+    stspec_body: IntServTspecBody;
+  end;
+  {$EXTERNALSYM SENDER_TSPEC}
+  TSenderTSpec = SENDER_TSPEC;
+  PSenderTSpec = ^SENDER_TSPEC;
+
+(*
+ *  Controlled-Load Flowspec
+ *)
+
+  CtrlLoadFlowspec = record
+    CL_spec_serv_hdr: IntServServiceHdr;    // (CONTROLLED_LOAD_SERV,0,len)
+    CL_spec_parm_hdr: IntServParmHdr;    // (IS_WKP_TB_TSPEC)
+    CL_spec_parms: GenTspecParms;       // GENERIC Tspec parameters
+  end;
+  {$EXTERNALSYM CtrlLoadFlowspec}
+  TCtrlLoadFlowspec = CtrlLoadFlowspec;
+  PCtrlLoadFlowspec = ^CtrlLoadFlowspec;
+
+//#define CLspec_r        CL_spec_parms.TB_Tspec_r
+//#define CLspec_b        CL_spec_parms.TB_Tspec_b
+//#define CLspec_p        CL_spec_parms.TB_Tspec_p
+//#define CLspec_m        CL_spec_parms.TB_Tspec_m
+//#define CLspec_M        CL_spec_parms.TB_Tspec_M
+//#define CLspec_parmno   CL_spec_parm_hdr.isph_parm_num
+//#define CLspec_flags    CL_spec_parm_hdr.isph_flags
+//#define CLspec_len32b   CL_spec_parm_hdr.isph_len32b
+
+//#define CLspec_len      (sizeof(CtrlLoadFlowspec) - sizeof(IntServServiceHdr))
+
+(*  Service-specific Parameter IDs
+ *)
+
+const
+  IS_GUAR_RSPEC     = 130;
+  {$EXTERNALSYM IS_GUAR_RSPEC}
+
+  GUAR_ADSPARM_C    = 131;
+  {$EXTERNALSYM GUAR_ADSPARM_C}
+  GUAR_ADSPARM_D    = 132;
+  {$EXTERNALSYM GUAR_ADSPARM_D}
+  GUAR_ADSPARM_Ctot = 133;
+  {$EXTERNALSYM GUAR_ADSPARM_Ctot}
+  GUAR_ADSPARM_Dtot = 134;
+  {$EXTERNALSYM GUAR_ADSPARM_Dtot}
+  GUAR_ADSPARM_Csum = 135;
+  {$EXTERNALSYM GUAR_ADSPARM_Csum}
+  GUAR_ADSPARM_Dsum = 136;
+  {$EXTERNALSYM GUAR_ADSPARM_Dsum}
+
+(*
+ *  Guaranteed Rspec parameters
+ *)
+
+type
+  GuarRspec = record
+    Guar_R: FLOAT;         //  Guaranteed Rate B/s
+    Guar_S: ULONG;         //  Slack term secs
+  end;
+  {$EXTERNALSYM GuarRspec}
+  TGuarRspec = GuarRspec;
+  PGuarRspec = ^GuarRspec;
+
+(*
+ *  Guaranteed Flowspec
+ *)
+
+  GuarFlowSpec = record
+    Guar_serv_hdr: IntServServiceHdr;      // (GUARANTEED, 0, length)
+    Guar_Tspec_hdr: IntServParmHdr;     // (IS_WKP_TB_TSPEC,)
+    Guar_Tspec_parms: GenTspecParms;   // GENERIC Tspec parms
+    Guar_Rspec_hdr: IntServParmHdr;     // (IS_GUAR_RSPEC)
+    Guar_Rspec: GuarRspec;         // Guaranteed rate (B/sec)
+  end;
+  {$EXTERNALSYM GuarFlowSpec}
+  TGuarFlowSpec = GuarFlowSpec;
+  PGuarFlowSpec = ^GuarFlowSpec;
+
+//#define Gspec_r         Guar_Tspec_parms.TB_Tspec_r
+//#define Gspec_b         Guar_Tspec_parms.TB_Tspec_b
+//#define Gspec_p         Guar_Tspec_parms.TB_Tspec_p
+//#define Gspec_m         Guar_Tspec_parms.TB_Tspec_m
+//#define Gspec_M         Guar_Tspec_parms.TB_Tspec_M
+//#define Gspec_R         Guar_Rspec.Guar_R
+//#define Gspec_S         Guar_Rspec.Guar_S
+//#define Gspec_T_parmno  Guar_Tspec_hdr.isph_parm_num
+//#define Gspec_T_flags   Guar_Tspec_hdr.isph_flags
+//#define Gspec_R_parmno  Guar_Rspec_hdr.isph_parm_num
+//#define Gspec_R_flags   Guar_Rspec_hdr.isph_flags
+
+//#define Gspec_len       (sizeof(GuarFlowSpec) - sizeof(IntServServiceHdr))
+
+(*
+ *  Contents of int-serv flowspec
+ *)
+
+type
+  IntServFlowSpec = record
+    spec_mh: IntServMainHdr;
+    case Integer of
+        0: (CL_spec: CtrlLoadFlowspec);   // Controlled-Load service
+        1: (G_spec: GuarFlowSpec);    // Guaranteed service
+        2: (Q_spec: QualAppFlowSpec);
+  end;
+  {$EXTERNALSYM IntServFlowSpec}
+  TIntServFlowSpec = IntServFlowSpec;
+  PIntServFlowSpec = ^IntServFlowSpec;
+
+//#define ISmh_len32b     spec_mh.ismh_len32b
+//#define ISmh_version    spec_mh.ismh_version
+//#define ISmh_unused     spec_mh.ismh_unused
+
+(*
+ *  Int-Serv FLOWSPEC object
+ *)
+
+const
+  ctype_FLOWSPEC_Intserv0 = 2; // The int-serv flowspec (v.0)
+  {$EXTERNALSYM ctype_FLOWSPEC_Intserv0}
+
+type
+  IS_FLOWSPEC = record
+    flow_header: RsvpObjHdr;
+    flow_body: IntServFlowSpec;
+  end;
+  {$EXTERNALSYM IS_FLOWSPEC}
+  TIsFlowSpec = IS_FLOWSPEC;
+  PIsFlowSpec = ^IS_FLOWSPEC;
+
+(*
+ *  FLOW DESCRIPTOR
+ *)
+
+  FLOW_DESC = record
+    u1: record
+    case Integer of
+      0: (stspec: ^SENDER_TSPEC);
+      1: (isflow: ^IS_FLOWSPEC);
+    end;
+    u2: record
+    case Integer of
+      0: (stemp: ^SENDER_TEMPLATE);
+      1: (fspec: ^FILTER_SPEC);
+    end;
+  end;
+  {$EXTERNALSYM FLOW_DESC}
+  TFlowDesc = FLOW_DESC;
+  PFlowDesc = ^FLOW_DESC;
+
+//#define FdSenderTspec       u1.stspec
+//#define FdIsFlowSpec        u1.isflow
+
+//#define FdSenderTemplate    u2.stemp
+//#define FdFilterSpec        u2.fspec
+
+(*
+ *  ADSPEC class object
+ *
+ *      Opaque to RSVP -- Contents defined in rapi_lib.h
+ *)
+
+const
+  ctype_ADSPEC_INTSERV = 2;
+  {$EXTERNALSYM ctype_ADSPEC_INTSERV}
+
+(*
+ *  Guaranteed service Adspec parameters -- fixed part
+ *)
+
+type
+  Gads_parms_t = record
+    Gads_serv_hdr: IntServServiceHdr;  // GUARANTEED, x, len
+    Gads_Ctot_hdr: IntServParmHdr;  // GUAR_ADSPARM_Ctot
+    Gads_Ctot: ULONG;
+    Gads_Dtot_hdr: IntServParmHdr;  // (GUAR_ADSPARM_Dtot
+    Gads_Dtot: ULONG;
+    Gads_Csum_hdr: IntServParmHdr;  // GUAR_ADSPARM_Csum
+    Gads_Csum: ULONG;
+    Gads_Dsum_hdr: IntServParmHdr;  // GUAR_ADSPARM_Dsum
+    Gads_Dsum: ULONG;
+    (*
+     *  May be followed by override general param values
+     *)
+  end;
+  {$EXTERNALSYM Gads_parms_t}
+  TGadsParmsT = Gads_parms_t;
+  PGadsParmsT = ^Gads_parms_t;
+
+(*
+ *  General Path Characterization Parameters
+ *)
+ 
+  GenAdspecParams = record
+    gen_parm_hdr: IntServServiceHdr;           // GENERAL_INFO, len
+    gen_parm_hopcnt_hdr: IntServParmHdr;    // (IS_WKP_HOP_CNT
+    gen_parm_hopcnt: ULONG;
+    gen_parm_pathbw_hdr: IntServParmHdr;    // IS_WKP_PATH_BW
+    gen_parm_path_bw: FLOAT;
+    gen_parm_minlat_hdr: IntServParmHdr;    // IS_WKP_MIN_LATENCY
+    gen_parm_min_latency: ULONG;
+    gen_parm_compmtu_hdr: IntServParmHdr;   // IS_WKP_COMPOSED_MTU
+    gen_parm_composed_MTU: ULONG;
+  end;
+  {$EXTERNALSYM GenAdspecParams}
+  TGenAdspecParams = GenAdspecParams;
+  PGenAdspecParams = ^GenAdspecParams;
+
+(*
+ *  Contents of (minimal) int-serv Adspec
+ *)
+
+  IS_ADSPEC_BODY = record
+    adspec_mh: IntServMainHdr;      // Main header
+    adspec_genparms: GenAdspecParams;// General char parm fragment
+    (*
+     *  Followed by variable-length fragments for some or all
+     *  services.  These can be minimal length fragments.
+     *)
+  end;
+  {$EXTERNALSYM IS_ADSPEC_BODY}
+  TIsAdSpecBody = IS_ADSPEC_BODY;
+  PIsAdSpecBody = ^IS_ADSPEC_BODY;  
+
+//const TODO Unknown Object_Header
+//  GEN_ADSPEC_LEN = SizeOf(Object_header) + SizeOf(IS_adsbody_t);
+//  {$EXTERNALSYM GEN_ADSPEC_LEN}
+
+type
+  ADSPEC = record
+    adspec_header: RsvpObjHdr;
+    adspec_body: IS_ADSPEC_BODY;    (* Defined in rapi_lib.h *)
+  end;
+  {$EXTERNALSYM ADSPEC}
+  TAdSpec = ADSPEC;
+  PAdSpec = ^ADSPEC;
+
+// RSVP message types
+
+const
+  RSVP_PATH      = 1;
+  {$EXTERNALSYM RSVP_PATH}
+  RSVP_RESV      = 2;
+  {$EXTERNALSYM RSVP_RESV}
+  RSVP_PATH_ERR  = 3;
+  {$EXTERNALSYM RSVP_PATH_ERR}
+  RSVP_RESV_ERR  = 4;
+  {$EXTERNALSYM RSVP_RESV_ERR}
+  RSVP_PATH_TEAR = 5;
+  {$EXTERNALSYM RSVP_PATH_TEAR}
+  RSVP_RESV_TEAR = 6;
+  {$EXTERNALSYM RSVP_RESV_TEAR}
+
+(*  RSVP error codes
+ *)
+
+  RSVP_Err_NONE  = 0;   (* No error (CONFIRM)       *)
+  {$EXTERNALSYM RSVP_Err_NONE}
+  RSVP_Erv_Nonev = 0;   (*    No-error Error Value  *)
+  {$EXTERNALSYM RSVP_Erv_Nonev}
+
+(* Admission Control failure    *)
+
+  RSVP_Err_ADMISSION = 1;
+  {$EXTERNALSYM RSVP_Err_ADMISSION}
+
+(* Globally-defined sub-codes for : Admission Control failure *)
+
+  RSVP_Erv_Other     = 0;   (* Unspecified cause        *)
+  {$EXTERNALSYM RSVP_Erv_Other}
+  RSVP_Erv_DelayBnd  = 1;   (* Cannot meet delay bound req  *)
+  {$EXTERNALSYM RSVP_Erv_DelayBnd}
+  RSVP_Erv_Bandwidth = 2;   (* Insufficient bandwidth   *)
+  {$EXTERNALSYM RSVP_Erv_Bandwidth}
+  RSVP_Erv_MTU       = 3;   (* MTU in flowspec too large    *)
+  {$EXTERNALSYM RSVP_Erv_MTU}
+
+// Microsoft specific error values
+
+  RSVP_Erv_Flow_Rate         = $8001;
+  {$EXTERNALSYM RSVP_Erv_Flow_Rate}
+  RSVP_Erv_Bucket_szie       = $8002;
+  {$EXTERNALSYM RSVP_Erv_Bucket_szie}
+  RSVP_Erv_Peak_Rate         = $8003;
+  {$EXTERNALSYM RSVP_Erv_Peak_Rate}
+  RSVP_Erv_Min_Policied_size = $8004;
+  {$EXTERNALSYM RSVP_Erv_Min_Policied_size}
+
+(* Policy control failure   *)
+
+  RSVP_Err_POLICY = 2;
+  {$EXTERNALSYM RSVP_Err_POLICY}
+
+// Policy error values from Identity draft
+
+  POLICY_ERRV_NO_MORE_INFO                = 1;
+  {$EXTERNALSYM POLICY_ERRV_NO_MORE_INFO}
+  POLICY_ERRV_UNSUPPORTED_CREDENTIAL_TYPE = 2;
+  {$EXTERNALSYM POLICY_ERRV_UNSUPPORTED_CREDENTIAL_TYPE}
+  POLICY_ERRV_INSUFFICIENT_PRIVILEGES     = 3;
+  {$EXTERNALSYM POLICY_ERRV_INSUFFICIENT_PRIVILEGES}
+  POLICY_ERRV_EXPIRED_CREDENTIALS         = 4;
+  {$EXTERNALSYM POLICY_ERRV_EXPIRED_CREDENTIALS}
+  POLICY_ERRV_IDENTITY_CHANGED            = 5;
+  {$EXTERNALSYM POLICY_ERRV_IDENTITY_CHANGED}
+
+// Microsoft specific policy error values
+
+  POLICY_ERRV_UNKNOWN = 0;
+  {$EXTERNALSYM POLICY_ERRV_UNKNOWN}
+
+  POLICY_ERRV_GLOBAL_DEF_FLOW_COUNT         = 1;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_FLOW_COUNT}
+  POLICY_ERRV_GLOBAL_GRP_FLOW_COUNT         = 2;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_FLOW_COUNT}
+  POLICY_ERRV_GLOBAL_USER_FLOW_COUNT        = 3;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_FLOW_COUNT}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_COUNT = 4;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_COUNT}
+  POLICY_ERRV_SUBNET_DEF_FLOW_COUNT         = 5;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_FLOW_COUNT}
+  POLICY_ERRV_SUBNET_GRP_FLOW_COUNT         = 6;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_FLOW_COUNT}
+  POLICY_ERRV_SUBNET_USER_FLOW_COUNT        = 7;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_FLOW_COUNT}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_COUNT = 8;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_COUNT}
+
+  POLICY_ERRV_GLOBAL_DEF_FLOW_DURATION         = 9;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_FLOW_DURATION}
+  POLICY_ERRV_GLOBAL_GRP_FLOW_DURATION         = 10;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_FLOW_DURATION}
+  POLICY_ERRV_GLOBAL_USER_FLOW_DURATION        = 11;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_FLOW_DURATION}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_DURATION = 12;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_DURATION}
+  POLICY_ERRV_SUBNET_DEF_FLOW_DURATION         = 13;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_FLOW_DURATION}
+  POLICY_ERRV_SUBNET_GRP_FLOW_DURATION         = 14;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_FLOW_DURATION}
+  POLICY_ERRV_SUBNET_USER_FLOW_DURATION        = 15;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_FLOW_DURATION}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_DURATION = 16;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_DURATION}
+
+  POLICY_ERRV_GLOBAL_DEF_FLOW_RATE         = 17;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_GRP_FLOW_RATE         = 18;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_USER_FLOW_RATE        = 19;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_RATE = 20;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_FLOW_RATE}
+  POLICY_ERRV_SUBNET_DEF_FLOW_RATE         = 21;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_FLOW_RATE}
+  POLICY_ERRV_SUBNET_GRP_FLOW_RATE         = 22;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_FLOW_RATE}
+  POLICY_ERRV_SUBNET_USER_FLOW_RATE        = 23;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_FLOW_RATE}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_RATE = 24;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_FLOW_RATE}
+
+  POLICY_ERRV_GLOBAL_DEF_PEAK_RATE         = 25;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_GRP_PEAK_RATE         = 26;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_USER_PEAK_RATE        = 27;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_PEAK_RATE = 28;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_PEAK_RATE}
+  POLICY_ERRV_SUBNET_DEF_PEAK_RATE         = 29;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_PEAK_RATE}
+  POLICY_ERRV_SUBNET_GRP_PEAK_RATE         = 30;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_PEAK_RATE}
+  POLICY_ERRV_SUBNET_USER_PEAK_RATE        = 31;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_PEAK_RATE}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_PEAK_RATE = 32;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_PEAK_RATE}
+
+  POLICY_ERRV_GLOBAL_DEF_SUM_FLOW_RATE         = 33;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_SUM_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_GRP_SUM_FLOW_RATE         = 34;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_SUM_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_USER_SUM_FLOW_RATE        = 35;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_SUM_FLOW_RATE}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_FLOW_RATE = 36;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_FLOW_RATE}
+  POLICY_ERRV_SUBNET_DEF_SUM_FLOW_RATE         = 37;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_SUM_FLOW_RATE}
+  POLICY_ERRV_SUBNET_GRP_SUM_FLOW_RATE         = 38;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_SUM_FLOW_RATE}
+  POLICY_ERRV_SUBNET_USER_SUM_FLOW_RATE        = 39;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_SUM_FLOW_RATE}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_FLOW_RATE = 40;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_FLOW_RATE}
+
+  POLICY_ERRV_GLOBAL_DEF_SUM_PEAK_RATE         = 41;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_DEF_SUM_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_GRP_SUM_PEAK_RATE         = 42;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_GRP_SUM_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_USER_SUM_PEAK_RATE        = 43;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_USER_SUM_PEAK_RATE}
+  POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_PEAK_RATE = 44;
+  {$EXTERNALSYM POLICY_ERRV_GLOBAL_UNAUTH_USER_SUM_PEAK_RATE}
+  POLICY_ERRV_SUBNET_DEF_SUM_PEAK_RATE         = 45;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_DEF_SUM_PEAK_RATE}
+  POLICY_ERRV_SUBNET_GRP_SUM_PEAK_RATE         = 46;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_GRP_SUM_PEAK_RATE}
+  POLICY_ERRV_SUBNET_USER_SUM_PEAK_RATE        = 47;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_USER_SUM_PEAK_RATE}
+  POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_PEAK_RATE = 48;
+  {$EXTERNALSYM POLICY_ERRV_SUBNET_UNAUTH_USER_SUM_PEAK_RATE}
+
+  POLICY_ERRV_UNKNOWN_USER       = 49;
+  {$EXTERNALSYM POLICY_ERRV_UNKNOWN_USER}
+  POLICY_ERRV_NO_PRIVILEGES      = 50;
+  {$EXTERNALSYM POLICY_ERRV_NO_PRIVILEGES}
+  POLICY_ERRV_EXPIRED_USER_TOKEN = 51;
+  {$EXTERNALSYM POLICY_ERRV_EXPIRED_USER_TOKEN}
+  POLICY_ERRV_NO_RESOURCES       = 52;
+  {$EXTERNALSYM POLICY_ERRV_NO_RESOURCES}
+  POLICY_ERRV_PRE_EMPTED         = 53;
+  {$EXTERNALSYM POLICY_ERRV_PRE_EMPTED}
+  POLICY_ERRV_USER_CHANGED       = 54;
+  {$EXTERNALSYM POLICY_ERRV_USER_CHANGED}
+  POLICY_ERRV_NO_ACCEPTS         = 55;
+  {$EXTERNALSYM POLICY_ERRV_NO_ACCEPTS}
+  POLICY_ERRV_NO_MEMORY          = 56;
+  {$EXTERNALSYM POLICY_ERRV_NO_MEMORY}
+  POLICY_ERRV_CRAZY_FLOWSPEC     = 57;
+  {$EXTERNALSYM POLICY_ERRV_CRAZY_FLOWSPEC}
+
+// Other RSVP defined Error codes
+
+  RSVP_Err_NO_PATH       = 3;   (* No path state for Resv   *)
+  {$EXTERNALSYM RSVP_Err_NO_PATH}
+  RSVP_Err_NO_SENDER     = 4;   (* No sender info for Resv  *)
+  {$EXTERNALSYM RSVP_Err_NO_SENDER}
+  RSVP_Err_BAD_STYLE     = 5;   (* Conflicting style        *)
+  {$EXTERNALSYM RSVP_Err_BAD_STYLE}
+  RSVP_Err_UNKNOWN_STYLE = 6;   (* Unknown reservation style    *)
+  {$EXTERNALSYM RSVP_Err_UNKNOWN_STYLE}
+  RSVP_Err_BAD_DSTPORT   = 7;   (* Conflicting DstPort in Sess  *)
+  {$EXTERNALSYM RSVP_Err_BAD_DSTPORT}
+  RSVP_Err_BAD_SNDPORT   = 8;   (* Conflicting Sender port  *)
+  {$EXTERNALSYM RSVP_Err_BAD_SNDPORT}
+  RSVP_Err_AMBIG_FILTER  = 9;   (* Ambiguous Filter spec in Resv*)
+  {$EXTERNALSYM RSVP_Err_AMBIG_FILTER}
+
+  RSVP_Err_PREEMPTED     = 12;  (* Service Preempted        *)
+  {$EXTERNALSYM RSVP_Err_PREEMPTED}
+
+(* Unknown object Class-Num *)
+
+  RSVP_Err_UNKN_OBJ_CLASS = 13;
+  {$EXTERNALSYM RSVP_Err_UNKN_OBJ_CLASS}
+
+(*   ErrVal = Class_num, CType  *)
+
+ (* Unknown object C-Type    *)
+
+  RSVP_Err_UNKNOWN_CTYPE = 14;
+  {$EXTERNALSYM RSVP_Err_UNKNOWN_CTYPE}
+
+(*   ErrVal = Class_num, CType  *)
+
+  RSVP_Err_API_ERROR = 20;  (* API client error     *)
+  {$EXTERNALSYM RSVP_Err_API_ERROR}
+
+(*   ErrVal = API error code    *)
+
+(* Traffic Control error    *)
+
+  RSVP_Err_TC_ERROR = 21;
+  {$EXTERNALSYM RSVP_Err_TC_ERROR}
+
+(* Globally-defined sub-codes for : Traffic Control errors *)
+
+  RSVP_Erv_Conflict_Serv  = 01;  (* Service Conflict     *)
+  {$EXTERNALSYM RSVP_Erv_Conflict_Serv}
+  RSVP_Erv_No_Serv        = 02;  (* Unknown Service      *)
+  {$EXTERNALSYM RSVP_Erv_No_Serv}
+  RSVP_Erv_Crazy_Flowspec = 03;  (* Unreasonable Flowspec    *)
+  {$EXTERNALSYM RSVP_Erv_Crazy_Flowspec}
+  RSVP_Erv_Crazy_Tspec    = 04;  (* Unreasonable Tspec       *)
+  {$EXTERNALSYM RSVP_Erv_Crazy_Tspec}
+
+  RSVP_Err_TC_SYS_ERROR = 22;  (* Traffic control system error *)
+  {$EXTERNALSYM RSVP_Err_TC_SYS_ERROR}
+
+(* ErrVal = kernel error code   *)
+
+(* RSVP System error      *)
+
+  RSVP_Err_RSVP_SYS_ERROR = 23;
+  {$EXTERNALSYM RSVP_Err_RSVP_SYS_ERROR}
+
+(* Globally-defined sub-codes for : RSVP system errors *)
+
+  RSVP_Erv_MEMORY = 1;   (* Out of memory *)
+  {$EXTERNALSYM RSVP_Erv_MEMORY}
+  RSVP_Erv_API    = 2;   (* API logic error *)
+  {$EXTERNALSYM RSVP_Erv_API}
+
+// Identity Policy elements related defines
+
+// Reseved Identity PE types
+
+  LPM_PE_USER_IDENTITY = 2;
+  {$EXTERNALSYM LPM_PE_USER_IDENTITY}
+  LPM_PE_APP_IDENTITY  = 3;
+  {$EXTERNALSYM LPM_PE_APP_IDENTITY}
+
+// Defines for Identity error values
+
+  ERROR_NO_MORE_INFO          = 1;
+  {$EXTERNALSYM ERROR_NO_MORE_INFO}
+  UNSUPPORTED_CREDENTIAL_TYPE = 2;
+  {$EXTERNALSYM UNSUPPORTED_CREDENTIAL_TYPE}
+  INSUFFICIENT_PRIVILEGES     = 3;
+  {$EXTERNALSYM INSUFFICIENT_PRIVILEGES}
+  EXPIRED_CREDENTIAL          = 4;
+  {$EXTERNALSYM EXPIRED_CREDENTIAL}
+  IDENTITY_CHANGED            = 5;
+  {$EXTERNALSYM IDENTITY_CHANGED}
+
+type
+  ID_ERROR_OBJECT = record
+    usIdErrLength: USHORT;
+    ucAType: UCHAR;
+    ucSubType: UCHAR;
+    usReserved: USHORT;
+    usIdErrorValue: USHORT;
+    ucIdErrData: array [0..3] of UCHAR;
+  end;
+  {$EXTERNALSYM ID_ERROR_OBJECT}
+  TIdErrorObject = ID_ERROR_OBJECT;
+  PIdErrorObject = ^ID_ERROR_OBJECT;
+
+const
+  ID_ERR_OBJ_HDR_LEN = SizeOf(ID_ERROR_OBJECT) - 4 * SizeOf(UCHAR);
+  {$EXTERNALSYM ID_ERR_OBJ_HDR_LEN}
+
+(*
+
+    LPM API specific definitions
+
+*)
+
+(**************************************
+
+    LPM_Initialize
+
+***************************************)
+
+type
+  LPM_HANDLE = HANDLE;
+  {$EXTERNALSYM LPM_HANDLE}
+
+  RHANDLE = HANDLE;
+  {$EXTERNALSYM RHANDLE}
+
+  LPV = ULONG;
+  {$EXTERNALSYM LPV}
+
+  PETYPE = USHORT;
+  {$EXTERNALSYM PETYPE}
+
+const
+  LPM_OK = 0;
+  {$EXTERNALSYM LPM_OK}
+
+type
+  MSG_TYPE = Integer;
+  {$EXTERNALSYM MSG_TYPE}
+  TMsgType = MSG_TYPE;
+
+  rsvpmsgobjs = record
+    RsvpMsgType: TMsgType;
+    pRsvpSession: PRsvpSession;
+    pRsvpFromHop: PRsvpHop;
+    pRsvpToHop: PRsvpHop;
+    pResvStyle: PResvStyle;
+    pRsvpScope: PRsvpScope;
+    FlowDescCount: Integer;
+    pFlowDescs: PFlowDesc;
+    PdObjectCount: Integer;
+    ppPdObjects: ^PPolicyData;
+    pErrorSpec: PErrorSpec;
+    pAdspec: PADSpec;
+  end;
+  {$EXTERNALSYM rsvpmsgobjs}
+  RSVP_MSG_OBJS = rsvpmsgobjs;
+  {$EXTERNALSYM RSVP_MSG_OBJS}
+  TRsvpMsgObjs = RSVP_MSG_OBJS;
+  PRsvpMsgObjs = ^RSVP_MSG_OBJS;
+  
+  PALLOCMEM = function(Size: DWORD): Pointer; stdcall;
+  {$EXTERNALSYM PALLOCMEM}
+  TAllocMem = PALLOCMEM;
+
+  PFREEMEM = procedure(pv: Pointer); stdcall;
+  {$EXTERNALSYM PFREEMEM}
+  TFreeMem = PFREEMEM;
+
+  policy_decision = record
+    lpvResult: LPV;        // Use the LPV values from above
+    wPolicyErrCode: WORD;   // RSVP defined error codes
+    wPolicyErrValue: WORD;  // RSVP defined error values
+  end;
+  {$EXTERNALSYM policy_decision}
+  TPolicyDecision = policy_decision;
+  PPolicyDecision = ^policy_decision;
+
+  CBADMITRESULT = function(LpmHandle: LPM_HANDLE; RequestHandle: RHANDLE;
+    ulPcmActionFlags: ULONG; LpmError: Integer; PolicyDecisionsCount: Integer;
+    pPolicyDecisions: PPolicyDecision): ULONG; stdcall;
+  {$EXTERNALSYM CBADMITRESULT}
+  TCbAdmitResult = CBADMITRESULT;
+
+  CBGETRSVPOBJECTS = function(LpmHandle: LPM_HANDLE; RequestHandle: RHANDLE;
+    LpmError: Integer; RsvpObjectsCount: Integer; ppRsvpObjects: PPRsvpObjHdr): ULONG; stdcall;
+  {$EXTERNALSYM CBGETRSVPOBJECTS}
+  TCbGetRsvpObjects = CBGETRSVPOBJECTS;
+
+// The above 2 call backs can return the following errors
+
+const
+  INV_LPM_HANDLE = 1; // Supplied LpmHandle is invalid
+  {$EXTERNALSYM INV_LPM_HANDLE}
+  LPM_TIME_OUT   = 2; // LPM has returned results after the time limit
+  {$EXTERNALSYM LPM_TIME_OUT}
+  INV_REQ_HANDLE = 3; // Supplied Request handle is invalid
+  {$EXTERNALSYM INV_REQ_HANDLE}
+  DUP_RESULTS    = 4; // LPM has already returned results for this request
+  {$EXTERNALSYM DUP_RESULTS}
+  INV_RESULTS    = 5; // Results supplied are invalid
+  {$EXTERNALSYM INV_RESULTS}
+
+type
+  lpminitinfo = record
+    PcmVersionNumber: DWORD;
+    ResultTimeLimit: DWORD;
+    ConfiguredLpmCount: Integer;
+    AllocMemory: PALLOCMEM;
+    FreeMemory: PFREEMEM;
+    PcmAdmitResultCallback: CBADMITRESULT;
+    GetRsvpObjectsCallback: CBGETRSVPOBJECTS;
+  end;
+  {$EXTERNALSYM lpminitinfo}
+  LPM_INIT_INFO = lpminitinfo;
+  {$EXTERNALSYM LPM_INIT_INFO}
+  TLpmInitInfo = LPM_INIT_INFO;
+  PLpmInitInfo = ^LPM_INIT_INFO;  
+
+// Valid PE types
+// XXX ISSUE - Is 0xFFFF a better choice?
+
+const
+  LPM_PE_ALL_TYPES = 0;
+  {$EXTERNALSYM LPM_PE_ALL_TYPES}
+
+// Current LPM API version number
+
+  LPM_API_VERSION_1 = 1;
+  {$EXTERNALSYM LPM_API_VERSION_1}
+
+// Current PCM version number
+
+  PCM_VERSION_1 = 1;
+  {$EXTERNALSYM PCM_VERSION_1}
+
+function LPM_Initialize(LpmHandle: LPM_HANDLE; const pLpmInitInfo: LPM_INIT_INFO;
+  var pLpmVersionNumber: DWORD; var pSupportedPeType: PETYPE; Reserved: Pointer): ULONG; stdcall;
+{$EXTERNALSYM LPM_Initialize}
+
+(**************************************
+
+    LPM_Deinitialize
+
+***************************************)
+
+function LPM_Deinitialize(LpmHandle: LPM_HANDLE): ULONG; stdcall;
+{$EXTERNALSYM LPM_Deinitialize}
+
+(**************************************
+
+    LPM_AdmitRsvpMsg
+
+***************************************)
+
+// Valid LPV - LPM Priority Values
+
+const
+  LPV_RESERVED     = 0;
+  {$EXTERNALSYM LPV_RESERVED}
+  LPV_MIN_PRIORITY = 1;
+  {$EXTERNALSYM LPV_MIN_PRIORITY}
+  LPV_MAX_PRIORITY = $FF00;
+  {$EXTERNALSYM LPV_MAX_PRIORITY}
+  LPV_DROP_MSG     = $FFFD;
+  {$EXTERNALSYM LPV_DROP_MSG}
+  LPV_DONT_CARE    = $FFFE;
+  {$EXTERNALSYM LPV_DONT_CARE}
+  LPV_REJECT       = $FFFF;
+  {$EXTERNALSYM LPV_REJECT}
+
+// Valid values for PcmActionFlags
+
+  FORCE_IMMEDIATE_REFRESH = 1;
+  {$EXTERNALSYM FORCE_IMMEDIATE_REFRESH}
+
+// Function return values for LPM_AdmitResvMsg
+
+  LPM_RESULT_READY = 0;
+  {$EXTERNALSYM LPM_RESULT_READY}
+  LPM_RESULT_DEFER = 1;
+  {$EXTERNALSYM LPM_RESULT_DEFER}
+
+function LPM_AdmitRsvpMsg(PcmReqHandle: RHANDLE; const pRecvdIntf: RSVP_HOP;
+  const pRsvpMsgObjs: RSVP_MSG_OBJS; RcvdRsvpMsgLength: Integer; RcvdRsvpMsg: PUCHAR;
+  var pulPcmActionFlags: ULONG; pPolicyDecisions: PPolicyDecision; Reserved: Pointer): ULONG; stdcall;
+{$EXTERNALSYM LPM_AdmitRsvpMsg}
+
+(**************************************
+
+    LPM_GetRsvpObjects
+
+***************************************)
+
+// Function return values are defined in LPM_AdmitResvMsg section
+
+function LPM_GetRsvpObjects(PcmReqHandle: RHANDLE; MaxPdSize: ULONG;
+  SendingIntfAddr: PRsvpHop; pRsvpMsgObjs: PRsvpMsgObjs; var pRsvpObjectsCount: Integer;
+  var pppRsvpObjects: PRsvpObjHdr; Reserved: Pointer): ULONG; stdcall;
+{$EXTERNALSYM LPM_GetRsvpObjects}
+
+(**************************************
+
+    LPM_DeleteState
+
+***************************************)
+
+// TearDown reasons
+
+const
+  RCVD_PATH_TEAR  = 1;
+  {$EXTERNALSYM RCVD_PATH_TEAR}
+  RCVD_RESV_TEAR  = 2;
+  {$EXTERNALSYM RCVD_RESV_TEAR}
+  ADM_CTRL_FAILED = 3;
+  {$EXTERNALSYM ADM_CTRL_FAILED}
+  STATE_TIMEOUT   = 4;
+  {$EXTERNALSYM STATE_TIMEOUT}
+  FLOW_DURATION   = 5;
+  {$EXTERNALSYM FLOW_DURATION}
+
+procedure LPM_DeleteState(pRcvdIfAddr: PRsvpHop; RsvpMsgType: TMsgType;
+  pRsvpSession: PRsvpSession; pRsvpFromHop: PRsvpHop; pResvStyle: PResvStyle;
+  FilterSpecCount: Integer; ppFilterSpecList: PFilterSpec; TearDownReason: Integer); stdcall;
+{$EXTERNALSYM LPM_DeleteState}
+
+(**************************************
+
+    LPM_IpAddrTable
+
+***************************************)
+
+type
+  lpmiptable = record
+    ulIfIndex: ULONG;    // SNMP index for this interface
+    MediaType: ULONG;    // As defined in IPIFCONS.H
+    IfIpAddr: IN_ADDR;   // Interface IP address
+    IfNetMask: IN_ADDR;  // Interface subnet mask
+  end;
+  {$EXTERNALSYM lpmiptable}
+  TLpmIpTable = lpmiptable;
+  PLpmIpTable = ^lpmiptable;
+
+function LPM_IpAddressTable(cIpAddrTable: ULONG; pIpAddrTable: PLpmIpTable): BOOL; stdcall;
+{$EXTERNALSYM LPM_IpAddressTable}
+
+(**************************************
+
+    LPM_CommitResv
+
+***************************************)
+
+// CommitDecision values
+
+const
+  RESOURCES_ALLOCATED = 1;
+  {$EXTERNALSYM RESOURCES_ALLOCATED}
+  RESOURCES_MODIFIED  = 2;
+  {$EXTERNALSYM RESOURCES_MODIFIED}
+
+procedure LPM_CommitResv(RsvpSession: PRsvpSession; FlowInstalledIntf: PRsvpHop;
+  RsvpStyle: PResvStyle; FilterSpecCount: Integer; ppFilterSpecList: PFilterSpec;
+  pMergedFlowSpec: PIsFlowSpec; CommitDecision: ULONG); stdcall;
+{$EXTERNALSYM LPM_CommitResv}
+
+implementation
+
+const
+  lpmlib = 'msidlpm.dll';
+
+function ObjLength(const x: TRsvpObjHdr): USHORT;
+begin
+  Result := x.obj_length;
+end;
+
+function ObjCType(const x: TRsvpObjHdr): UCHAR;
+begin
+  Result := x.obj_ctype;
+end;
+
+function ObjClass(const x: TRsvpObjHdr): UCHAR;
+begin
+  Result := x.obj_class;
+end;
+
+function ObjData(const x: TRsvpObjHdr): Pointer;
+begin
+  Result := Pointer(Integer(@x) + SizeOf(x));
+end;
+
+function Style_is_Wildcard(p: DWORD): Boolean;
+begin
+  Result := (p and Opt_SndSel_mask) = Opt_Wildcard;
+end;
+
+function Style_is_Shared(p: DWORD): Boolean;
+begin
+  Result := (p and Opt_Share_mask) = Opt_Shared;
+end;
+
+function Error_Usage(x: DWORD): DWORD;
+begin
+  Result := (x shr 12) and 3;
+end;
+
+function Intserv_Version(x: DWORD): DWORD;
+begin
+  Result := (x and INTSERV_VERS_MASK) shr 4;
+end;
+
+function Intserv_Version_OK(const x: TIntServMainHdr): Boolean;
+begin
+  Result := (x.ismh_version and INTSERV_VERS_MASK) = INTSERV_VERSION0;
+end;
+
+function Intserv_Obj_size(const x: TIntServMainHdr): DWORD;
+begin
+  Result := x.ismh_len32b * 4 + SizeOf(IntServMainHdr) + SizeOf(RsvpObjHdr);
+end;
+
+function Issh_len32b(const p: TIntServServiceHdr): USHORT;
+begin
+  Result := p.issh_len32b;
+end;
+
+{$IFDEF DYNAMIC_LINK}
+
+var
+  _LPM_Initialize: Pointer;
+
+function LPM_Initialize;
+begin
+  GetProcedureAddress(_LPM_Initialize, lpmlib, 'LPM_Initialize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_Initialize]
+  end;
+end;
+
+var
+  _LPM_Deinitialize: Pointer;
+
+function LPM_Deinitialize;
+begin
+  GetProcedureAddress(_LPM_Deinitialize, lpmlib, 'LPM_Deinitialize');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_Deinitialize]
+  end;
+end;
+
+var
+  _LPM_AdmitRsvpMsg: Pointer;
+
+function LPM_AdmitRsvpMsg;
+begin
+  GetProcedureAddress(_LPM_AdmitRsvpMsg, lpmlib, 'LPM_AdmitRsvpMsg');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_AdmitRsvpMsg]
+  end;
+end;
+
+var
+  _LPM_GetRsvpObjects: Pointer;
+
+function LPM_GetRsvpObjects;
+begin
+  GetProcedureAddress(_LPM_GetRsvpObjects, lpmlib, 'LPM_GetRsvpObjects');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_GetRsvpObjects]
+  end;
+end;
+
+var
+  _LPM_DeleteState: Pointer;
+
+procedure LPM_DeleteState;
+begin
+  GetProcedureAddress(_LPM_DeleteState, lpmlib, 'LPM_DeleteState');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_DeleteState]
+  end;
+end;
+
+var
+  _LPM_IpAddressTable: Pointer;
+
+function LPM_IpAddressTable;
+begin
+  GetProcedureAddress(_LPM_IpAddressTable, lpmlib, 'LPM_IpAddressTable');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_IpAddressTable]
+  end;
+end;
+
+var
+  _LPM_CommitResv: Pointer;
+
+procedure LPM_CommitResv;
+begin
+  GetProcedureAddress(_LPM_CommitResv, lpmlib, 'LPM_CommitResv');
+  asm
+        MOV     ESP, EBP
+        POP     EBP
+        JMP     [_LPM_CommitResv]
+  end;
+end;
+
+{$ELSE}
+
+function LPM_Initialize; external lpmlib name 'LPM_Initialize';
+function LPM_Deinitialize; external lpmlib name 'LPM_Deinitialize';
+function LPM_AdmitRsvpMsg; external lpmlib name 'LPM_AdmitRsvpMsg';
+function LPM_GetRsvpObjects; external lpmlib name 'LPM_GetRsvpObjects';
+procedure LPM_DeleteState; external lpmlib name 'LPM_DeleteState';
+function LPM_IpAddressTable; external lpmlib name 'LPM_IpAddressTable';
+procedure LPM_CommitResv; external lpmlib name 'LPM_CommitResv';
+
+{$ENDIF DYNAMIC_LINK}
+
+end.

+ 150 - 0
packages/extra/winunits/jwamciavi.pas

@@ -0,0 +1,150 @@
+{******************************************************************************}
+{                                                                              }
+{ Multimedia Systems Media Control API interface Unit for Object Pascal        }
+{                                                                              }
+{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
+{ Corporation. All Rights Reserved.                                            }
+{                                                                              }
+{ The original file is: MciAvi.h, released June 2000. The original Pascal      }
+{ code is: MciAvi.pas, released December 2000. The initial developer of the    }
+{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
+{                                                                              }
+{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
+{ Marcel van Brakel. All Rights Reserved.                                      }
+{                                                                              }
+{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
+{                                                                              }
+{ You may retrieve the latest version of this file at the Project JEDI         }
+{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
+{                                                                              }
+{ The contents of this file are used with permission, subject to the Mozilla   }
+{ Public License Version 1.1 (the "License"); you may not use this file except }
+{ in compliance with the License. You may obtain a copy of the License at      }
+{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
+{                                                                              }
+{ Software distributed under the License is distributed on an "AS IS" basis,   }
+{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
+{ the specific language governing rights and limitations under the License.    }
+{                                                                              }
+{ Alternatively, the contents of this file may be used under the terms of the  }
+{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
+{ provisions of the LGPL License are applicable instead of those above.        }
+{ If you wish to allow use of your version of this file only under the terms   }
+{ of the LGPL License and not to allow others to use your version of this file }
+{ under the MPL, indicate your decision by deleting  the provisions above and  }
+{ replace  them with the notice and other provisions required by the LGPL      }
+{ License.  If you do not delete the provisions above, a recipient may use     }
+{ your version of this file under either the MPL or the LGPL License.          }
+{                                                                              }
+{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
+{                                                                              }
+{******************************************************************************}
+
+// $Id$
+
+unit JwaMciAvi;
+
+{$WEAKPACKAGEUNIT}
+
+{$HPPEMIT ''}
+{$HPPEMIT '#include "MciAvi.h"'}
+{$HPPEMIT ''}
+
+{$I jediapilib.inc}
+
+interface
+
+(*
+** These three flags apply to the 'play' command:
+**      play <alias> window             Play in normal window
+**      play <alias> fullscreen         Play in 320x240 full-screen mode
+**      play <alias> fullscreen by 2    Play fullscreen, zoomed by 2
+*)
+
+const
+  MCI_MCIAVI_PLAY_WINDOW     = $01000000;
+  {$EXTERNALSYM MCI_MCIAVI_PLAY_WINDOW}
+  MCI_MCIAVI_PLAY_FULLSCREEN = $02000000;
+  {$EXTERNALSYM MCI_MCIAVI_PLAY_FULLSCREEN}
+  MCI_MCIAVI_PLAY_FULLBY2    = $04000000;
+  {$EXTERNALSYM MCI_MCIAVI_PLAY_FULLBY2}
+
+(*
+** Debugging constants for AVI diagnostics
+*)
+
+(*
+** Returns number of frames not drawn during last play.  If this number
+** is more than a small fraction of the number of frames that should have
+** been displayed, things aren't looking good.
+*)
+
+  MCI_AVI_STATUS_FRAMES_SKIPPED = $8001;
+  {$EXTERNALSYM MCI_AVI_STATUS_FRAMES_SKIPPED}
+
+(*
+** Returns a number representing how well the last AVI play worked.
+** A result of 1000 indicates that the AVI sequence took the amount
+** of time to play that it should have; a result of 2000, for instance,
+** would indicate that a 5-second AVI sequence took 10 seconds to play,
+** implying that the audio and video were badly broken up.
+*)
+
+  MCI_AVI_STATUS_LAST_PLAY_SPEED = $8002;
+  {$EXTERNALSYM MCI_AVI_STATUS_LAST_PLAY_SPEED}
+
+(*
+** Returns the number of times that the audio definitely broke up.
+** (We count one for every time we're about to write some audio data
+** to the driver, and we notice that it's already played all of the
+** data we have.
+*)
+
+  MCI_AVI_STATUS_AUDIO_BREAKS = $8003;
+  {$EXTERNALSYM MCI_AVI_STATUS_AUDIO_BREAKS}
+
+  MCI_AVI_SETVIDEO_DRAW_PROCEDURE = $8000;
+  {$EXTERNALSYM MCI_AVI_SETVIDEO_DRAW_PROCEDURE}
+
+  MCI_AVI_SETVIDEO_PALETTE_COLOR = $8100;
+  {$EXTERNALSYM MCI_AVI_SETVIDEO_PALETTE_COLOR}
+
+(*
+** This constant specifies that the "halftone" palette should be
+** used, rather than the default palette.
+*)
+
+  MCI_AVI_SETVIDEO_PALETTE_HALFTONE = $0000FFFF;
+  {$EXTERNALSYM MCI_AVI_SETVIDEO_PALETTE_HALFTONE}
+
+(*
+** Custom error return values
+*)
+
+  // TODO FROM MMSystem.h
+
+  MCIERR_BASE               = 256;
+  MCIERR_CUSTOM_DRIVER_BASE = MCIERR_BASE + 256;
+
+  MCIERR_AVI_OLDAVIFORMAT       = MCIERR_CUSTOM_DRIVER_BASE + 100;
+  {$EXTERNALSYM MCIERR_AVI_OLDAVIFORMAT}
+  MCIERR_AVI_NOTINTERLEAVED     = MCIERR_CUSTOM_DRIVER_BASE + 101;
+  {$EXTERNALSYM MCIERR_AVI_NOTINTERLEAVED}
+  MCIERR_AVI_NODISPDIB          = MCIERR_CUSTOM_DRIVER_BASE + 102;
+  {$EXTERNALSYM MCIERR_AVI_NODISPDIB}
+  MCIERR_AVI_CANTPLAYFULLSCREEN = MCIERR_CUSTOM_DRIVER_BASE + 103;
+  {$EXTERNALSYM MCIERR_AVI_CANTPLAYFULLSCREEN}
+  MCIERR_AVI_TOOBIGFORVGA       = MCIERR_CUSTOM_DRIVER_BASE + 104;
+  {$EXTERNALSYM MCIERR_AVI_TOOBIGFORVGA}
+  MCIERR_AVI_NOCOMPRESSOR       = MCIERR_CUSTOM_DRIVER_BASE + 105;
+  {$EXTERNALSYM MCIERR_AVI_NOCOMPRESSOR}
+  MCIERR_AVI_DISPLAYERROR       = MCIERR_CUSTOM_DRIVER_BASE + 106;
+  {$EXTERNALSYM MCIERR_AVI_DISPLAYERROR}
+  MCIERR_AVI_AUDIOERROR         = MCIERR_CUSTOM_DRIVER_BASE + 107;
+  {$EXTERNALSYM MCIERR_AVI_AUDIOERROR}
+  MCIERR_AVI_BADPALETTE         = MCIERR_CUSTOM_DRIVER_BASE + 108;
+  {$EXTERNALSYM MCIERR_AVI_BADPALETTE}
+
+implementation
+
+end.

Some files were not shown because too many files changed in this diff