Package com.sun.jna.platform.win32.WinNT

Examples of com.sun.jna.platform.win32.WinNT.PSID


    if (pSid.getValue() == 0 || rc != W32Errors.ERROR_INSUFFICIENT_BUFFER) {
      throw new Win32Exception(rc);
    }

    Memory sidMemory = new Memory(pSid.getValue());
    PSID result = new PSID(sidMemory);
    char[] referencedDomainName = new char[cchDomainName.getValue() + 1];

    if (!Advapi32.INSTANCE.LookupAccountName(systemName, accountName,
        result, pSid, referencedDomainName, cchDomainName, peUse)) {
      throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
    }

    Account account = new Account();
    account.accountType = peUse.getPointer().getInt(0);
    account.name = accountName;

    String[] accountNamePartsBs = accountName.split("\\\\", 2);
    String[] accountNamePartsAt = accountName.split("@", 2);

    if (accountNamePartsBs.length == 2) {
      account.name = accountNamePartsBs[1];
    } else if (accountNamePartsAt.length == 2) {
      account.name = accountNamePartsAt[0];
    } else {
      account.name = accountName;
    }

    if (cchDomainName.getValue() > 0) {
      account.domain = Native.toString(referencedDomainName);
      account.fqn = account.domain + "\\" + account.name;
    } else {
      account.fqn = account.name;
    }

    account.sid = result.getBytes();
    account.sidString = convertSidToStringSid(new PSID(account.sid));
    return account;
  }
View Full Code Here


   *            Member of the WELL_KNOWN_SID_TYPE enumeration to compare with
   *            the SID at pSid.
   * @return True if the SID is of the well-known type, false otherwise.
   */
  public static boolean isWellKnownSid(byte[] sidBytes, int wellKnownSidType) {
    PSID pSID = new PSID(sidBytes);
    return Advapi32.INSTANCE.IsWellKnownSid(pSID, wellKnownSidType);
  }
View Full Code Here

   * @param sidString
   *            SID.
   * @return Account.
   */
  public static Account getAccountBySid(String systemName, String sidString) {
    return getAccountBySid(systemName, new PSID(
        convertStringSidToSid(sidString)));
  }
View Full Code Here

        this.createPackageName(packagename);
        this.createClassName(this.name);
        this.setFilename(this.name);

        // Get the TypeAttributes
        TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
        TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();

        this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);

        int cFuncs = typeAttr.cFuncs.intValue();
        for (int i = 0; i < cFuncs; i++) {
            // Get the function description
            FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);

            // Get the member ID
            MEMBERID memberID = funcDesc.memid;

            // Get the name of the method
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            String methodName = typeInfoDoc2.getName();
            TlbAbstractMethod method = null;

            if (!isReservedMethod(methodName)) {
                if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
                    method = new TlbFunctionStub(index, typeLibUtil, funcDesc,
                            typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYGET)) {
                    method = new TlbPropertyGetStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYPUT)) {
                    method = new TlbPropertyPutStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYPUTREF)) {
                    method = new TlbPropertyPutStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                }

                this.content += method.getClassBuffer();

                if (i < cFuncs - 1)
                    this.content += CR;
            }

            // Release our function description stuff
            typeInfoUtil.ReleaseFuncDesc(funcDesc);
        }

        this.createContent(this.content);
    }
View Full Code Here

            // Get the member ID
            MEMBERID memberID = varDesc.memid;

            // Get the name of the property
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            this.content += TABTAB + "//" + typeInfoDoc2.getName() + CR;
            this.content += TABTAB + "public static final int "
                    + typeInfoDoc2.getName() + " = " + value.toString() + ";";

            if (i < cVars - 1)
                this.content += CR;
        }
View Full Code Here

            // Get the member ID
            MEMBERID memberID = funcDesc.memid;

            // Get the name of the method
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            String methodName = typeInfoDoc2.getName();
            TlbAbstractMethod method = null;

            if (!isReservedMethod(methodName)) {
                if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
                    method = new TlbFunctionStub(index, typeLibUtil, funcDesc,
View Full Code Here

     *            the type lib util
     */
    public TlbInterface(int index, String packagename, TypeLibUtil typeLibUtil) {
        super(index, typeLibUtil, null);

        TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
        String docString = typeLibDoc.getDocString();

        if (typeLibDoc.getName().length() > 0)
            this.name = typeLibDoc.getName();

        this.logInfo("Type of kind 'Interface' found: " + this.name);

        this.createPackageName(packagename);
        this.createClassName(this.name);
View Full Code Here

     */
    public TlbDispInterface(int index, String packagename,
            TypeLibUtil typeLibUtil) {
        super(index, typeLibUtil, null);

        TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
        String docString = typeLibDoc.getDocString();

        if(typeLibDoc.getName().length() > 0)
            this.name = typeLibDoc.getName();
       
        this.logInfo("Type of kind 'DispInterface' found: " + this.name);

        this.createPackageName(packagename);
        this.createClassName(this.name);
View Full Code Here

                DsGetDC.DS_DOMAIN_VALID_FLAGS, domainsPointerRef, domainTrustCount);
      if(W32Errors.NO_ERROR != rc) {
            throw new Win32Exception(rc);
      }
      try {
            DS_DOMAIN_TRUSTS domainTrustRefs = new DS_DOMAIN_TRUSTS(domainsPointerRef.getValue());
            DS_DOMAIN_TRUSTS[] domainTrusts = (DS_DOMAIN_TRUSTS[]) domainTrustRefs.toArray(new DS_DOMAIN_TRUSTS[domainTrustCount.getValue()]);
            ArrayList<DomainTrust> trusts = new ArrayList<DomainTrust>(domainTrustCount.getValue());
            for(DS_DOMAIN_TRUSTS domainTrust : domainTrusts) {
                DomainTrust t = new DomainTrust();
                if (domainTrust.DnsDomainName != null) {
                  t.DnsDomainName = domainTrust.DnsDomainName.toString();
View Full Code Here

     * Return the domain controller for a current computer.
     * @return
     *  Domain controller information.
     */
    public static DomainController getDC() {
        PDOMAIN_CONTROLLER_INFO pdci = new PDOMAIN_CONTROLLER_INFO();
        int rc = Netapi32.INSTANCE.DsGetDcName(null, null, null, null, 0, pdci);
      if (W32Errors.ERROR_SUCCESS != rc) {
            throw new Win32Exception(rc);
      }
      DomainController dc = new DomainController();
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.WinNT.PSID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.