Based it on this article:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa367016(v=vs.85).aspx

But fiddled with it a bit so (hardcoded the attribs instead of retrieving them via one by one in function calls)

I should probably check and perform the following cleanup. 

    //----------------------------------------------------------
    // Normal cleanup and exit.
    //----------------------------------------------------------
    ldap_unbind(pLdapConnection);
    ldap_msgfree(pSearchResult);
    ldap_value_free(ppValue);