So, so
@oki danke für die Hartnäckigkeit.
Ich hatte den Code mal dahin gehend geändert, aber danach kam die bekante Zugriffsverletzung in WLDAP32.dll.
Also noch mal ein Blick in das
SDK:
Zitat:
HRESULT ExecuteSearch(
LPWSTR pszSearchFilter,
LPWSTR* pAttributeNames,
DWORD dwNumberAttributes,
PADS_SEARCH_HANDLE phSearchHandle
);
Parameters
pszSearchFilter
[in] A search filter string in LDAP format, such as "(objectClass=user)".
pAttributeNames
[in] An array of attribute names for which data is requested. If NULL, all attributes are requested and dwNumberAttributes must be -1.
dwNumberAttributes
[in] The size of the pAttributeNames array. If -1, all attributes are requested and pAttributeNames must be NULL.
phSearchHandle
[out] The address of a method-allocated
handle to the search context. The caller passes this
handle to other methods of IDirectorySearch to examine the search result. If NULL, the search cannot be executed.
Dort steht nun mal nicht
[in/out] LPWSTR* pAttributeNames sondern nur
LPWSTR* pAttributeNames.
Also liegt (mal wieder) am falschen Typlib-Import.
Delphi-Quellcode:
function ExecuteSearch(pszSearchFilter: PWideChar; var pAttributeNames: PWideChar;
dwNumberAttributes: LongWord; out phSearchResult: Pointer): HResult; stdcall;
ist einfach verkehrt. Es muss richtig so aussehen:
Delphi-Quellcode:
function ExecuteSearch(pszSearchFilter: PWideChar; pAttributeNames: PWideChar;
dwNumberAttributes: LongWord; out phSearchResult: THandle): HResult; stdcall;
Warum das nun so ist, keine Ahnung, war aber schon mit D7 so.
Danke.