简体   繁体   中英

JNA - DsGetDcNameA

I am new to JNA, I want to convert DsGetDcName method to JNA.

DWORD DsGetDcName(
  __in   LPCTSTR ComputerName,
  __in   LPCTSTR DomainName,
  __in   GUID *DomainGuid,
  __in   LPCTSTR SiteName,
  __in   ULONG Flags,
  __out  PDOMAIN_CONTROLLER_INFO *DomainControllerInfo
);

I have converted the above function to JNA I replaced above parameters as follows

public static class GUID extends Structure {
    public int Data1;
    public short  Data2;
    public short  Data3;
    public byte  Data4[]= new byte[8];
}

public static class DOMAIN_CONTROLLER_INFO extends Structure { 
    public String DomainControllerName;
    public String DomainControllerAddress;
    public int DomainControllerAddressType;
    public GUID DomainGuid; // created Structure above
    public String DomainName;
    public String DnsForestName;
    public int Flags;
    public String DcSiteName;
    public String ClientSiteName;
}

int DsGetDCName(
    String strComputerName,
    String strDomainName,
    GUID DomainGuid, // static class created extending with structure
    String strSiteName,
    int iFlags,
    DOMAIN_CONTROLLER_INFO  DomainControllerInfo // static class created extending with structure
);

The above function returns 997 Error (ERROR IO PENDING) . The method declaration is correct. Can any help on this issue? Thanks in Advance.

Regards

Pavan Kumar A.

This is implemented in JNA 3.2.7 as com.sun.jna.platform.win32.Netapi32.DsGetDcName. Use Netapi32Util.DsGetDcName which is a simplified wrapper.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM