www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17248] New: Multiple wrong function definitions in

https://issues.dlang.org/show_bug.cgi?id=17248

          Issue ID: 17248
           Summary: Multiple wrong function definitions in
                    core.sys.windows.winldap (causing runtime issues)
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: d.bugs webfreak.org

PCHAR[] and PWCHAR[] have been used in function definitions where they should
have been PCHAR* and PWCHAR*. This doesn't cause the linker to fail but the
windows api will throw LDAP_PARAM_ERROR on runtime because it is not possible
to pass a valid argument there.

For example in ldap_search_s you should be able to pass null to receive all
attributes, however it will always crash when the function definition argument
uses []. Replacing it with a definition using a pointer will fix the issue and
it will properly call it. Passing a list of arguments (null terminated) doesn't
work either (same issue).

Functions I have checked that are affected by this and get fixed by replacing
the [] with * (always both A and W version):
ldap_search_ext
ldap_search_ext_s
ldap_search
ldap_search_s
ldap_search_st

Functions that are probably affected by this (but untested):
ldap_modify_ext
ldap_modify_ext_s
ldap_modify
ldap_modify_s
ldap_add_ext
ldap_add_ext_s
ldap_add
ldap_add_s
ldap_search_init_page

--
Mar 09 2017