I have created a new version of JwaAdsTlb by hand because the typelib import from Delphi is unable to produce a good file.
I was hoping that Cherry and/or Alter Mann can test the new
unit as the conversion was a lot of (boring) work and it's not unimaginable that I made errors. Please let me know...
The problem with the AdsValue record is alignment: I found it in the file IADS.h from the
SDK which has the following options:
Delphi-Quellcode:
/* Compiler settings
for ads.odl:
Oicf, W1, Zp8, env=
Win32 (32b run), target_arch=X86 7.00.0555
It means that record will be aligned at 8 byte boundaries and Delphi doesn't have an option for that. I was able to solve it by declaring it with a nested case statement:
Delphi-Quellcode:
ADSVALUE = packed record
case Byte of // Padding
0: (
dwType: ADSTYPE;
case _DoNotUse: ADSTYPE of // Padding
ADSTYPE_DN_STRING: (DNString: ADS_DN_STRING);
ADSTYPE_CASE_EXACT_STRING: (CaseExactString: ADS_CASE_EXACT_STRING);
ADSTYPE_CASE_IGNORE_STRING: (CaseIgnoreString: ADS_CASE_IGNORE_STRING);
ADSTYPE_PRINTABLE_STRING: (PrintableString: ADS_PRINTABLE_STRING);
ADSTYPE_NUMERIC_STRING: (NumericString: ADS_NUMERIC_STRING);
ADSTYPE_BOOLEAN: (Boolean: ADS_BOOLEAN);
ADSTYPE_INTEGER: (Integer: ADS_INTEGER);
ADSTYPE_OCTET_STRING: (OctetString: ADS_OCTET_STRING);
ADSTYPE_UTC_TIME: (UTCTime: ADS_UTC_TIME);
ADSTYPE_LARGE_INTEGER: (LargeInteger: ADS_LARGE_INTEGER);
ADSTYPE_OBJECT_CLASS: (ClassName: ADS_PROV_SPECIFIC);
ADSTYPE_PROV_SPECIFIC: (ProviderSpecific: ADS_PROV_SPECIFIC);
ADSTYPE_CASEIGNORE_LIST: (pCaseIgnoreList: PADS_CASEIGNORE_LIST);
ADSTYPE_OCTET_LIST: (pOctetList: PADS_OCTET_LIST);
ADSTYPE_PATH: (pPath: PADS_PATH);
ADSTYPE_POSTALADDRESS: (pPostalAddress: PADS_POSTALADDRESS);
ADSTYPE_TIMESTAMP: (Timestamp: ADS_TIMESTAMP);
ADSTYPE_BACKLINK: (BackLink: ADS_BACKLINK);
ADSTYPE_TYPEDNAME: (pTypedName: PADS_TYPEDNAME);
ADSTYPE_HOLD: (Hold: ADS_HOLD);
ADSTYPE_NETADDRESS: (pNetAddress: PADS_NETADDRESS);
ADSTYPE_REPLICAPOINTER: (pReplicaPointer: PADS_REPLICAPOINTER);
ADSTYPE_FAXNUMBER: (pFaxNumber: PADS_FAXNUMBER);
ADSTYPE_EMAIL: (Email: ADS_EMAIL);
ADSTYPE_NT_SECURITY_DESCRIPTOR: (SecurityDescriptor: ADS_NT_SECURITY_DESCRIPTOR);
ADSTYPE_DN_WITH_BINARY: (pDNWithBinary: PADS_DN_WITH_BINARY);
ADSTYPE_DN_WITH_STRING: (pDNWithString: PADS_DN_WITH_STRING)
);
end;
_adsvalue = ADSVALUE;
PADSVALUE = ^ADSVALUE;
LPADSVALUE = PADSVALUE;