Examples of IntByReference


Examples of com.sun.jna.ptr.IntByReference

      final AVPacket packet = nextPacket(audioStreamIndex);
        if (packet != null)
        {
          synchronized (AV_SYNC_OBJ)
          {
              final IntByReference frameSize = new IntByReference();
              // It is not very clear from the documentation, but it appears that we set the initial frame size to be the size of this.buffer in bytes, not in "shorts".
              frameSize.setValue(this.bufferSize);
                // Decode
              AVCODEC.avcodec_decode_audio2(codecCtx, this.buffer, frameSize, packet.data, packet.size);
 
                // Did we get a audio data?
              if (frameSize.getValue() < 0)
              {  throw new RuntimeException("Failed to read audio frame")// TODO: how to handle this error?
              }
              else if (frameSize.getValue() > 0)
                {
                  if (frameSize.getValue() > this.bufferSize)
                  {  // realloc buffer to make room:
                    // we already allocate the maximum size, so this should never happen.
                    AVUTIL.av_free(this.buffer);
                    this.bufferSize = frameSize.getValue();
                     this.buffer = AVUTIL.av_malloc(this.bufferSize);
                  }
                 
                    final byte[] data = this.buffer.getByteArray(0, frameSize.getValue());
                    buffer.setData(data);
                    buffer.setLength(data.length);
                    buffer.setOffset(0);
                    buffer.setEOM(false);
                    buffer.setDiscard(false);
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

                arg.setString(0, args[i], false);
                argsCopy[i + 1] = arg;
            }
            argvMemory.write(0, argsCopy, 0, argsCopy.length);
            argvRef = new PointerByReference(argvMemory);
            argcRef = new IntByReference(args.length + 1);
        }
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

    PointerByReference hToken = new PointerByReference();
    HANDLE hp = new HANDLE();
    hp.setPointer(hProcess.getPointer());
    if (MyAdvapi.INSTANCE.OpenProcessToken(hp, MyAdvapi.TOKEN_READ, hToken))
    {
      IntByReference dwSize = new IntByReference();
      MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenUser, null, 0, dwSize);
      {
        Memory pTokenUser = new Memory(dwSize.getValue());
        if (MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenUser, pTokenUser, dwSize.getValue(), dwSize))
        {
          MyAdvapi.TOKEN_USER tokenUser = new MyAdvapi.TOKEN_USER(pTokenUser);
          Pointer lpSid = tokenUser.User.Sid;
          Memory lpName = new Memory(256);
          IntByReference cchName = new IntByReference();
          cchName.setValue(256);
          Memory lpReferencedDomainName = new Memory(256);
          IntByReference cchReferencedDomainName = new IntByReference();
          cchReferencedDomainName.setValue(256);
          IntByReference peUse = new IntByReference();
          if (MyAdvapi.INSTANCE.LookupAccountSidW(null, lpSid, lpName, cchName, lpReferencedDomainName, cchReferencedDomainName, peUse))

            result._user = lpReferencedDomainName.getString(0, true) + "\\" + lpName.getString(0, true);
          ;
          // System.out.println(result._user);
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

   */
  private int getProcessAffinity()
  {
    if (_cpuAffinity <= 0)
      return 0;
    IntByReference lpProcessAffinityMask = new IntByReference();
    IntByReference lpSystemAffinityMask = new IntByReference();
    if (MyKernel32.INSTANCE.GetProcessAffinityMask(_processInformation.hProcess, lpProcessAffinityMask, lpSystemAffinityMask))
      return lpSystemAffinityMask.getValue() & _cpuAffinity;
    else
    {
      log("could not get process affinity mask -> not setting");
      return 0;
    }
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

   *
   * @return the exit code internal
   */
  private int getExitCodeInternal()
  {
    IntByReference code = new IntByReference();
    if (_processInformation == null)
      return -1;
    boolean result = MyKernel32.INSTANCE.GetExitCodeProcess(_processInformation.hProcess, code);
    try
    {
      // if server overloaded windows may need some time to set the exit
      // code.
      Thread.sleep(100);
    }
    catch (InterruptedException e)
    {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // System.out.println("get exit code internal " + result + " " +
    // code.getValue());
    if (result)
    {
      if (_debug)
        log("GetExitCodeProcess returned " + code.getValue());
      return code.getValue();
    }
    else
    {
      log("Error in GetExitCodeProcess OS Error #" + MyKernel32.INSTANCE.GetLastError());
      return -3;
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

    {
      // lParam is the pid of our process
      public boolean callback(Pointer wnd, int lParam)
      {
        // get the pid of the window
        IntByReference dwID = new IntByReference();
        MyUser32.INSTANCE.GetWindowThreadProcessId(wnd, dwID);
        // if this windows belongs to our process
        if (dwID.getValue() == lParam)
        {
          // System.out.println("post message a: " + wnd);
          MyUser32.INSTANCE.PostMessageA(wnd, MyUser32.WM_CLOSE, null, null);
          // MyUser32.INSTANCE.PostMessageA(wnd, MyUser32.WM_QUIT,
          // null, null) ;
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

    // System.out.println("get command internal "+getPid());
    String result = "?";
    PROCESS_BASIC_INFORMATION pbi = null;

    pbi = new PROCESS_BASIC_INFORMATION();
    IntByReference returnLength = new IntByReference();
    HANDLE hProcess = _processInformation.hProcess;
    int pbiSize = pbi.size(); // x64 = 48 bytes, x32 = 24
    int ret = Ntdll.INSTANCE.ZwQueryInformationProcess(hProcess, (byte) 0, pbi.getPointer(), pbiSize, returnLength);
    if (ret == 0)
    {
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

    log("get command internal 64 " + getPid());
    String result = "?";
    PROCESS_BASIC_INFORMATION pbi = null;

    pbi = new PROCESS_BASIC_INFORMATION();
    IntByReference returnLength = new IntByReference();
    HANDLE hProcess = _processInformation.hProcess;
    int size = pbi.size();
    int ret = Ntdll.INSTANCE.ZwQueryInformationProcess(hProcess, (byte) 0, pbi.getPointer(), size, returnLength);
    if (ret == 0)
    {
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

   * @return the int
   */
  public static int processIdOfActiveWindow()
  {
    Pointer w = MyUser32.INSTANCE.GetForegroundWindow();
    IntByReference result = new IntByReference();
    MyUser32.INSTANCE.GetWindowThreadProcessId(w, result);
    return result.getValue();
  }
View Full Code Here

Examples of com.sun.jna.ptr.IntByReference

  boolean doesUserHavePrivilege(String lpPrivilegeName)

  {
    PointerByReference hToken = new PointerByReference();
    IntByReference dwSize = new IntByReference();
    Memory lpPrivileges;
    MyAdvapi.LUID PrivilegeLuid = new MyAdvapi.LUID();
    int i;
    boolean bResult = false;

    if (!MyAdvapi.INSTANCE.OpenProcessToken(MyKernel32.INSTANCE.GetCurrentProcess(), MyAdvapi.INSTANCE.TOKEN_QUERY, hToken))
      return false;

    MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenPrivileges, null, 0, dwSize);

    lpPrivileges = new Memory(dwSize.getValue());

    if (!MyAdvapi.INSTANCE.GetTokenInformation(hToken.getValue(), MyAdvapi.TokenPrivileges, lpPrivileges, dwSize.getValue(), dwSize))
    {
      return false;
    }

    MyKernel32.INSTANCE.CloseHandle(hToken.getValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.