Package com.sun.jna

Examples of com.sun.jna.Pointer


      return;
    String current = currentUser();
    System.out.println("current user" + current);
    if (current != null && !current.equals(name))
    {
      Pointer p = CLibrary.INSTANCE.getpwnam(name);
      int newUid = new CLibrary.passwd(p).getUid();
      if (newUid == 0)
        System.out.println("could not get user " + name);
      int res = CLibrary.INSTANCE.setreuid(newUid, newUid);
      if (res != 0)
View Full Code Here


    public String  lpDisplayName;

    public String[] getDependencies()
    {
      List<String> result = new ArrayList<String>();
      Pointer ptr = lpDependencies;
      int offset = 0;
      String s = "";
      if (ptr != null)
        do
        {
          s = ptr.getString(offset, true);
          if (s != null && !"".equals(s))
          {
            result.add(s);
            offset += s.getBytes().length * 2 + 2;
          }
View Full Code Here

  public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command,
      String startType, boolean interactive)
  {
    Advapi32 advapi32;
    Advapi32.SERVICE_DESCRIPTION desc;
    Pointer serviceManager, service;
    boolean success = false;
    String dep = "";

    if (dependencies != null)
    {
View Full Code Here

   * @return true on success
   */
  public boolean uninstall()
  {
    Advapi32 advapi32;
    Pointer serviceManager, service;
    boolean success = false;

    advapi32 = Advapi32.INSTANCE;
    serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);

View Full Code Here

  {
    ServiceInfoImpl result = new ServiceInfoImpl();
    result.setName(name);

    Advapi32 advapi32;
    Pointer serviceManager, service;
    int state = Service.STATE_UNKNOWN;

    advapi32 = Advapi32.INSTANCE;

    serviceManager = openServiceControlManager(null, WINNT.GENERIC_READ);
View Full Code Here

  }

  public int state()
  {
    Advapi32 advapi32;
    Pointer serviceManager, service;
    int result = Service.STATE_UNKNOWN;

    advapi32 = Advapi32.INSTANCE;

    serviceManager = openServiceControlManager(null, WINNT.GENERIC_READ);
View Full Code Here

   * @return true on success
   */
  public boolean start()
  {
    Advapi32 advapi32;
    Pointer serviceManager, service;
    boolean success = false;

    advapi32 = Advapi32.INSTANCE;

    serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
View Full Code Here

   * @return true on success
   */
  public boolean stop() throws Exception
  {
    Advapi32 advapi32;
    Pointer serviceManager, service;
    Advapi32.SERVICE_STATUS serviceStatus;
    boolean success = false;

    advapi32 = Advapi32.INSTANCE;

View Full Code Here

   *            access flags
   * @return handle to ServiceControlManager or null when failed
   */
  static private Pointer openServiceControlManager(String machine, int access)
  {
    Pointer handle = null;
    Advapi32 advapi32;

    advapi32 = Advapi32.INSTANCE;
    handle = advapi32.OpenSCManager(machine, null, access);
    if (handle == null)
View Full Code Here

  static public Map<String, ENUM_SERVICE_STATUS_PROCESS> enumerateServices(String machine)
  {
    Map<String, ENUM_SERVICE_STATUS_PROCESS> result = new HashMap();
    // Open the Service Control Manager
    Pointer sc = openServiceControlManager(machine, WINSVC.SC_MANAGER_ENUMERATE_SERVICE);

    // Check if OpenSCManager returns NULL. Otherwise proceed
    if (sc != null && !sc.equals(null))
    {
      Memory service_data = null;
      int service_data_size = 0;
      int infoLevel = WINSVC.SC_ENUM_PROCESS_INFO;
      boolean retVal;
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.