Package com.sun.jna

Examples of com.sun.jna.Pointer


    public static final boolean isGType(Pointer p, long type) {
        return getGType(p).longValue() == type;
    }
    public static final GType getGType(Pointer ptr) {       
        // Retrieve ptr->g_class
        Pointer g_class = ptr.getPointer(0);
        // Now return g_class->gtype
        return GType.valueOf(g_class.getNativeLong(0).longValue());
    }
View Full Code Here


        Pointer g_class = ptr.getPointer(0);
        // Now return g_class->gtype
        return GType.valueOf(g_class.getNativeLong(0).longValue());
    }
    public static final Class<? extends NativeObject> classFor(Pointer ptr) {
        Pointer g_class = ptr.getPointer(0);
        Class<? extends NativeObject> cls;
        cls = gTypeInstanceMap.get(g_class);
        if (cls != null) {
            return cls;
        }

        GType type = GType.valueOf(g_class.getNativeLong(0).longValue());
        logger.finer("Type of " + ptr + " = " + type);
        while (cls == null && !type.equals(GType.OBJECT) && !type.equals(GType.INVALID)) {
            cls = getTypeMap().get(type);
            if (cls != null) {
                logger.finer("Found type of " + ptr + " = " + cls);
View Full Code Here

      {
        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();
View Full Code Here

    Map processMap = new HashMap();
    Map childrenMap = new MultiHashMap();
    Map[] result = new Map[]
    { processMap, childrenMap };

    Pointer processes = MyKernel32.INSTANCE.CreateToolhelp32Snapshot(MyKernel32.TH32CS_SNAPPROCESS, 0);
    if (processes == null)
    {
      System.out.println("note: task list is empty ");
      return result;
    }
View Full Code Here

   *
   * @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

  {
    String activeNode = null;

    try
    {
      Pointer cluster = Clusapi.INSTANCE.OpenCluster(null);
      Pointer hEnum = Clusapi.INSTANCE.ClusterOpenEnum(cluster, Clusapi.CLUSTER_ENUM_GROUP);
      int dwIndex = 0;
      IntByReference lpdwType = new IntByReference();
      IntByReference lpcchName = new IntByReference();
      Memory lpszName = new Memory(256);
      lpszName.clear();
View Full Code Here

  private ClusterGroupInfo getGroupNodeInfo(Pointer cluster, String groupName)
  {
    ClusterGroupInfo result = null;
    try
    {
      Pointer hGroup = Clusapi.INSTANCE.OpenClusterGroup(cluster, new WString(groupName));

      if (hGroup == null)
        throw new RuntimeException("Clusapi call to OpenClusterGroup returned err code " + MyKernel32.INSTANCE.GetLastError());

      IntByReference lpcchNodeName = new IntByReference();
View Full Code Here

    return result;
  }

  public Set<ClusterGroupInfo> getGroupInfo()
  {
    Pointer hCluster = Clusapi.INSTANCE.OpenCluster(null);
    if (hCluster == null)
      throw new RuntimeException("Clusapi call to OpenClusterGroup returned err code " + MyKernel32.INSTANCE.GetLastError());

    Pointer hEnum = Clusapi.INSTANCE.ClusterOpenEnum(hCluster, Clusapi.CLUSTER_ENUM_GROUP);
    if (hEnum == null)
      throw new RuntimeException("Clusapi call to ClusterOpenEnum returned err code " + MyKernel32.INSTANCE.GetLastError());

    Set<ClusterGroupInfo> result = new LinkedHashSet<ClusterGroupInfo>();
View Full Code Here

            IntByReference lpdwNotifyKey = new IntByReference();
            IntByReference lpdwFilterType = new IntByReference();
            IntByReference lpcchName = new IntByReference();
            IntByReference dwNotifyKey = new IntByReference();
            Memory lpszName = new Memory(256);
            Pointer minusOne = Pointer.createConstant(-1);
            int dwMilliseconds = 300 * 1000;
            final int dwFilter = Clusapi.CLUSTER_CHANGE_GROUP_STATE | Clusapi.CLUSTER_CHANGE_HANDLE_CLOSE
                | Clusapi.CLUSTER_CHANGE_GROUP_DELETED | Clusapi.CLUSTER_CHANGE_CLUSTER_STATE
                | Clusapi.CLUSTER_CHANGE_CLUSTER_RECONNECT | Clusapi.CLUSTER_CHANGE_GROUP_ADDED;

            while (!_stopped)
            {
              Pointer hCluster = null;
              Pointer hChange = null;

              long started = System.currentTimeMillis();

              try
              {
View Full Code Here

  }

  public static String currentUser()
  {
    int euid = CLibrary.INSTANCE.geteuid();
    Pointer p = CLibrary.INSTANCE.getpwuid(euid);
    if (p == null)
      System.out.println("could not get current user");
    return new CLibrary.passwd(p).getName();

  }
View Full Code Here

TOP

Related Classes of com.sun.jna.Pointer

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.