Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wldap32.dll access violation

Status
Not open for further replies.

bracinik

Programmer
Feb 20, 2003
1
SK
Hi,
I am using VC++ 6.0 and I have a problem with ldap.

I call ldap_init. Returned value is LDAP_SUCCESS, but next operation ( for example ldap_connect, or ldap_set_options ) is giving me this error: Access violation 0xC0000005.

Please help me ...
I need it very much.

Marian Bracinik.


THIS IS MY SOURCE CODE:

LDAP *ld;
int ldap_default_port, version;

if ( ( ld = ldap_init( "ldap.itd.umich.edu", LDAP_PORT ) ) == NULL ) {
AfxMessageBox("Error ldap_init");
return;
}

version = LDAP_VERSION3;
ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version );
 
I've hit this same problem today and can't find a solution. Have you found an answer yet?

--Geoff
 
Same problem here...

ldap_init() works fine. Subsequently a call to
ldap_connect() throws an access violation.

ldap_simple_bind_s() fails too after ldap_init()

anyone has an answer to this?? I tried searching the MS Knowledge base...no luck!

Was this LDAP stuff ever tested at MS before releasing it?
 
Hi bracinik and mdlinud,

Great news! After a lot of playing, a lot of hair pulling, and a lot of swearing, i figured it out.

To start with, look here:
You can see that there are many versions of wldap32.dll. Many different things install them, and the version on my box (win2k server with all the latest service packs and stuff) isn't even listed (5.0.2195.5944).

The lib file that you link against (wldap32.lib) that comes with VC++ is timestamped 1998. This got me to wondering about versioning. If you open your compiled programs up in Dependency walker, and follow the references to different function calls into wldap32.dll, you'll see that they don't actually line up with the functions you _think_ you are calling.

The answer? (And i still can't find this documented anywhere...i guess it's implicit in the section of the doco for ldap on the MSDN website) Get the latest libfile from the Platform SDK.
Rather than install the full platform sdk, which i dont' need right now, i pulled the wldap32.lib from one of the cabfiles in the installer :)
I used the August 2002 release of the platform sdk provided on a universal subscription to MSDN. anything later than that should be fine too - i've tested my code on win2k, win98, and winXP, and all successfully chatted to the ldap server.

Hope this helps you guys, i know it was a big relief for me!

--Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top