dc.name = pdci.dci.DomainControllerName.toString(); rc = Netapi32.INSTANCE.NetApiBufferFree(pdci.dci.getPointer()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue());
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
rc = Netapi32.INSTANCE.NetApiBufferFree(domainsPointerRef.getValue()); if(W32Errors.NO_ERROR != rc) { throw new Win32Exception(rc);
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
/** * Return the domain/workgroup join status for a computer. * @param computerName Computer name. * @return Join status. */ public static int getJoinStatus(String computerName) { PointerByReference lpNameBuffer = new PointerByReference(); IntByReference bufferType = new IntByReference(); try { int rc = Netapi32.INSTANCE.NetGetJoinInformation(computerName, lpNameBuffer, bufferType); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } return bufferType.getValue(); } finally { if (lpNameBuffer.getPointer() != null) { int rc = Netapi32.INSTANCE.NetApiBufferFree(lpNameBuffer.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } } } }
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
/** * Returns the name of the primary domain controller (PDC). * @param serverName * Specifies the DNS or NetBIOS name of the remote server on which the function is * to execute. * @param domainName * Specifies the name of the domain. * @return * Name of the primary domain controller. */ public static String getDCName(String serverName, String domainName) { PointerByReference bufptr = new PointerByReference(); try { int rc = Netapi32.INSTANCE.NetGetDCName(domainName, serverName, bufptr); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } return bufptr.getValue().getWideString(0); } finally { if (W32Errors.ERROR_SUCCESS != Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue())) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } } }
/** * Return the domain/workgroup join status for a computer. * @param computerName Computer name. * @return Join status. */ public static int getJoinStatus(String computerName) { PointerByReference lpNameBuffer = new PointerByReference(); IntByReference bufferType = new IntByReference(); try { int rc = Netapi32.INSTANCE.NetGetJoinInformation(computerName, lpNameBuffer, bufferType); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } return bufferType.getValue(); } finally { if (lpNameBuffer.getPointer() != null) { int rc = Netapi32.INSTANCE.NetApiBufferFree(lpNameBuffer.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } } } }
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
/** * Returns the name of the primary domain controller (PDC). * @param serverName * Specifies the DNS or NetBIOS name of the remote server on which the function is * to execute. * @param domainName * Specifies the name of the domain. * @return * Name of the primary domain controller. */ public static String getDCName(String serverName, String domainName) { PointerByReference bufptr = new PointerByReference(); try { int rc = Netapi32.INSTANCE.NetGetDCName(domainName, serverName, bufptr); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } return bufptr.getValue().getString(0, true); } finally { if (W32Errors.ERROR_SUCCESS != Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue())) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } } }
} finally { if (bufptr.getValue() != Pointer.NULL) { int rc = Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
/** * Get information about a computer. * @param computerName * @return Domain or workgroup name. */ public static String getDomainName(String computerName) { PointerByReference lpNameBuffer = new PointerByReference(); IntByReference bufferType = new IntByReference(); try { int rc = Netapi32.INSTANCE.NetGetJoinInformation(computerName, lpNameBuffer, bufferType); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } // type of domain: bufferType.getValue() return lpNameBuffer.getValue().getString(0, true); } finally { if (lpNameBuffer.getPointer() != null) { int rc = Netapi32.INSTANCE.NetApiBufferFree(lpNameBuffer.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } } } }
/** * Get information about a computer. * @param computerName computer name * @return Domain or workgroup name. */ public static String getDomainName(String computerName) { PointerByReference lpNameBuffer = new PointerByReference(); IntByReference bufferType = new IntByReference(); try { int rc = Netapi32.INSTANCE.NetGetJoinInformation(computerName, lpNameBuffer, bufferType); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } // type of domain: bufferType.getValue() return lpNameBuffer.getValue().getWideString(0); } finally { if (lpNameBuffer.getPointer() != null) { int rc = Netapi32.INSTANCE.NetApiBufferFree(lpNameBuffer.getValue()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc); } } } }
dc.name = pdci.dci.DomainControllerName.toString(); rc = Netapi32.INSTANCE.NetApiBufferFree(pdci.dci.getPointer()); if (LMErr.NERR_Success != rc) { throw new Win32Exception(rc);
Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue());