Package com.sun.jna.platform.win32.LMAccess

Examples of com.sun.jna.platform.win32.LMAccess.USER_INFO_1


      PointerByReference bufptr = new PointerByReference();
      IntByReference entriesread = new IntByReference();
      IntByReference totalentries = new IntByReference();
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserEnum(         
          null, 1, 0, bufptr, LMCons.MAX_PREFERRED_LENGTH, entriesread, totalentries, null));     
      USER_INFO_1 userinfo = new USER_INFO_1(bufptr.getValue());     
      USER_INFO_1[] userinfos = (USER_INFO_1[]) userinfo.toArray(entriesread.getValue());
        for (USER_INFO_1 ui : userinfos) {
          assertTrue(ui.usri1_name.length() > 0);
        }
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()));
    }   
View Full Code Here


        }
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()));
    }   
   
    public void testNetUserAdd() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
        // ignore test if not able to add user (need to be administrator to do this).
        if (LMErr.NERR_Success != Netapi32.INSTANCE.NetUserAdd(Kernel32Util.getComputerName(), 1, userInfo, null)) {
View Full Code Here

      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserDel(
          Kernel32Util.getComputerName(), userInfo.usri1_name.toString()));
    }
   
    public void testNetUserChangePassword() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
        // ignore test if not able to add user (need to be administrator to do this).
        if (LMErr.NERR_Success != Netapi32.INSTANCE.NetUserAdd(Kernel32Util.getComputerName(), 1, userInfo, null)) {
View Full Code Here

      assertTrue(group.sid.length > 0);
    }
  }
 
  public void testGetUserGroups() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
    try {
        assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(
View Full Code Here

            null, userInfo.usri1_name.toString()));     
    }
  }
 
  public void testGetUserAccount() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
    try {
        assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(
View Full Code Here

      PointerByReference bufptr = new PointerByReference();
      IntByReference entriesread = new IntByReference();
      IntByReference totalentries = new IntByReference();
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserEnum(         
          null, 1, 0, bufptr, LMCons.MAX_PREFERRED_LENGTH, entriesread, totalentries, null));     
      USER_INFO_1 userinfo = new USER_INFO_1(bufptr.getValue());     
      USER_INFO_1[] userinfos = (USER_INFO_1[]) userinfo.toArray(entriesread.getValue());
        for (USER_INFO_1 ui : userinfos) {
          assertTrue(ui.usri1_name.length() > 0);
        }
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()));
    }   
View Full Code Here

        }
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetApiBufferFree(bufptr.getValue()));
    }   
   
    public void testNetUserAdd() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(
          Kernel32Util.getComputerName(), 1, userInfo, null));
View Full Code Here

      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserDel(
          Kernel32Util.getComputerName(), userInfo.usri1_name.toString()));
    }
   
    public void testNetUserChangePassword() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNANetapi32TestUser");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(
          Kernel32Util.getComputerName(), 1, userInfo, null));
View Full Code Here

      }
        assertTrue(Kernel32.INSTANCE.CloseHandle(phToken.getValue()));
    }
   
    public void testImpersonateLoggedOnUser() {
      USER_INFO_1 userInfo = new USER_INFO_1();
      userInfo.usri1_name = new WString("JNAAdvapi32TestImp");
      userInfo.usri1_password = new WString("!JNAP$$Wrd0");
      userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
      assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(null, 1, userInfo, null));
    try {
View Full Code Here

        PointerByReference bufptr = new PointerByReference();
        int rc = -1;
        try {
            rc = Netapi32.INSTANCE.NetUserGetInfo(domainName, accountName, (short)23, bufptr);
            if (rc == LMErr.NERR_Success) {
                USER_INFO_23 info_23 = new USER_INFO_23(bufptr.getValue());
                UserInfo userInfo = new UserInfo();
                if (info_23.usri23_comment != null) {
                  userInfo.comment = info_23.usri23_comment.toString();
                }
                userInfo.flags = info_23.usri23_flags;
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.LMAccess.USER_INFO_1

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.