Package com.sun.jna

Examples of com.sun.jna.NativeLong


       
        public DATA_BLOB(byte[] bytes) {
            if (bytes != null) {
                cbData = new Memory(bytes.length);
                cbData.write(0, bytes, 0, bytes.length);
                cbSize = new NativeLong(bytes.length);
            } else {
                cbSize = new NativeLong(0);
                cbData = Pointer.NULL;
            }
        }
View Full Code Here


        SecHandle newContext = null;
        SecHandle pContext = params.myCtxHandle;
        if (pContext == null) {
            newContext = new SecHandle();
            newContext.dwLower = new NativeLong(0);
            newContext.dwUpper = new NativeLong(0);
            newContext.write();
            params.myCtxHandle = newContext;
        } else {
            newContext = pContext;
        }
       
        SecBuffer outSecBuffer = new SecBuffer();
        outSecBuffer.cbBuffer = new NativeLong(512);
        outSecBuffer.BufferType = new NativeLong(ISVNSecurityLibrary.SECBUFFER_TOKEN);
        outSecBuffer.pvBuffer = new Memory(512);
        outSecBuffer.write();
       
        SecBufferDesc outBufferDescription = new SecBufferDesc();
        outBufferDescription.ulVersion = new NativeLong(0);
        outBufferDescription.cBuffers = new NativeLong(1);
        outBufferDescription.pBuffers = outSecBuffer.getPointer();

        outBufferDescription.write();
       
        SecBufferDesc inBufferDescription = null;
        SecBuffer inSecBuffer = null;
        if (lastToken != null) {
            inSecBuffer = new SecBuffer();
            inSecBuffer.cbBuffer = new NativeLong(lastToken.length);
            inSecBuffer.BufferType = new NativeLong(ISVNSecurityLibrary.SECBUFFER_TOKEN);
            inSecBuffer.pvBuffer = new Memory(lastToken.length);
            inSecBuffer.pvBuffer.write(0, lastToken, 0, lastToken.length);
            inSecBuffer.write();
               
            inBufferDescription = new SecBufferDesc();
            inBufferDescription.ulVersion = new NativeLong(0);
            inBufferDescription.cBuffers = new NativeLong(1);
            inBufferDescription.pBuffers = inSecBuffer.getPointer();
            inBufferDescription.write();
        }
       
        Pointer contextAttributes = new Memory(NativeLong.SIZE);
        TimeStamp ltime = new TimeStamp();
        ltime.HighPart = new NativeLong(0);
        ltime.LowPart = new NativeLong(0);
        ltime.write();
       
        int securityStatus = library.InitializeSecurityContextW(params.myCrdHandle.getPointer(),
                pContext != null ? pContext.getPointer() : Pointer.NULL,
                        null,
                        new NativeLong(0),
                        new NativeLong(0),
                        new NativeLong(ISVNSecurityLibrary.SECURITY_NATIVE_DREP),
                        lastToken != null ? inBufferDescription.getPointer() : Pointer.NULL,
                                new NativeLong(0),
                                newContext.getPointer(),
                                outBufferDescription.getPointer(),
                                contextAttributes,
                                ltime.getPointer());
View Full Code Here

        SEC_WINNT_AUTH_IDENTITY authIdentity = null;
        if (user != null || password != null || domain != null) {
            authIdentity = new SEC_WINNT_AUTH_IDENTITY();
            if (user != null) {
                authIdentity.User = new WString(user);
                authIdentity.UserLength = new NativeLong(user.length());
            }
           
            if (password != null) {
                authIdentity.Password = new WString(password);
                authIdentity.PasswordLength = new NativeLong(password.length());
            }
           
            if (domain != null) {
                authIdentity.Domain = new WString(domain);
                authIdentity.DomainLength = new NativeLong(domain.length());
            }
            authIdentity.Flags = new NativeLong(ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY_UNICODE);
            authIdentity.write();
        }
       
        SecHandle pCred = new SecHandle();
        pCred.dwLower = new NativeLong(0);
        pCred.dwUpper = new NativeLong(0);
        pCred.write();

        ISVNSecurityLibrary.TimeStamp ltime = new ISVNSecurityLibrary.TimeStamp();
        ltime.HighPart = new NativeLong(0);
        ltime.LowPart = new NativeLong(0);
        ltime.write();
       
        int securityStatus = library.AcquireCredentialsHandleW(null, new WString("NTLM"),
                new NativeLong(ISVNSecurityLibrary.SECPKG_CRED_OUTBOUND), Pointer.NULL,
                authIdentity != null ? authIdentity.getPointer() : Pointer.NULL,
                        Pointer.NULL, Pointer.NULL, pCred.getPointer(), ltime.getPointer());
        if (securityStatus == 0) {
            pCred.read();
            return pCred;
View Full Code Here

  public void memoryMove(long src, long dest, long len) {
    final Pointer srcPointer = new Pointer(src);
    final Pointer destPointer = new Pointer(dest);

    if (memmove != null)
      memmove.invoke(Pointer.class, new Object[] { destPointer, srcPointer, new NativeLong(len) });
    else if (bcopy != null)
      bcopy.invokeVoid(new Object[] { srcPointer, destPointer, new NativeLong(len) });
    else {
      if (src > dest)
        for (long n = 0; n < len; n++)
          destPointer.setByte(n, srcPointer.getByte(n));
      else
View Full Code Here

    Native.register(Platform.C_LIBRARY_NAME);
  }

  @Override
  public void memoryMove(long src, long dest, long len) {
    memmove(new Pointer(dest), new Pointer(src), new NativeLong(len));
  }
View Full Code Here

   */
  public static DomainTrust[] getDomainTrusts(String serverName) {
      NativeLongByReference domainCount = new NativeLongByReference();
      PDS_DOMAIN_TRUSTS.ByReference domains = new PDS_DOMAIN_TRUSTS.ByReference();
      int rc = Netapi32.INSTANCE.DsEnumerateDomainTrusts(
          serverName, new NativeLong(DsGetDC.DS_DOMAIN_VALID_FLAGS), domains, domainCount);
      if(W32Errors.NO_ERROR != rc) {
        throw new Win32Exception(rc);
      }
      try {
        int domainCountValue = domainCount.getValue().intValue();
View Full Code Here

     
      /**
       * Create a new SECBUFFER_EMPTY buffer.
       */
      public SecBuffer() {
        cbBuffer = new NativeLong(0);
        pvBuffer = null;
        BufferType = new NativeLong(SECBUFFER_EMPTY);
      }
View Full Code Here

     *  Buffer type, one of SECBUFFER_EMTPY, etc.
     * @param size
     *  Buffer size, eg. MAX_TOKEN_SIZE.
     */
      public SecBuffer(int type, int size) {
        cbBuffer = new NativeLong(size);       
        pvBuffer = new Memory(size);
        BufferType = new NativeLong(type);
        allocateMemory();
      }
View Full Code Here

     *  Buffer type, one of SECBUFFER_EMTPY, etc.
       * @param token
       *  Existing token.
       */
      public SecBuffer(int type, byte[] token) {
        cbBuffer = new NativeLong(token.length);       
        pvBuffer = new Memory(token.length);
        pvBuffer.write(0, token, 0, token.length);
        BufferType = new NativeLong(type);
        allocateMemory();
      }
View Full Code Here

      /**
       * Create a new SecBufferDesc with one SECBUFFER_EMPTY buffer.
       */
      public SecBufferDesc() {
        ulVersion = new NativeLong(SECBUFFER_VERSION);
        cBuffers = new NativeLong(1);
        SecBuffer.ByReference secBuffer = new SecBuffer.ByReference();
        pBuffers = (SecBuffer.ByReference[]) secBuffer.toArray(1);
        allocateMemory();
      }
View Full Code Here

TOP

Related Classes of com.sun.jna.NativeLong

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.