Skip to content

Correct use of data types? #536

@1Dragoon

Description

@1Dragoon

I'm trying to use ADSI, and I'm stumbling at the basics. Although I'm passing just a null pointer to ADsGetObject, at this point it shouldn't matter as the pointer gets overwritten. Nonetheless, it returns an error code:

    let mut p_ads: *mut c_void = ptr::null_mut();
    let pp_ads = &mut p_ads as *mut *mut c_void;

    unsafe {
        let mut ldap_root: Vec<u16> = "LDAP://rootDSE".encode_utf16().collect();
        ldap_root.push(0);
        let hr = ADsGetObject(
            ldap_root.as_mut_ptr() as _,
            & IADs::IID,
            pp_ads,
        );
        println!("{}", hr.is_err());
    }

Am I passing something incorrectly? Based on my understanding this should be 16-bit null terminated strings, GUID of the desired interface, and a pointer to the pointer of the struct. The powershell analog of this would be [adsi]'LDAP://rootDSE', which works on this machine, so I'm not sure why this wouldn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions