Search in sources :

Example 6 with USER_INFO_1

use of com.sun.jna.platform.win32.LMAccess.USER_INFO_1 in project jna by java-native-access.

the class Netapi32Test method testNetUserAdd.

public void testNetUserAdd() {
    USER_INFO_1 userInfo = new USER_INFO_1();
    userInfo.usri1_name = "JNANetapi32TestUser";
    userInfo.usri1_password = "!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)) {
        return;
    }
    assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserDel(Kernel32Util.getComputerName(), userInfo.usri1_name.toString()));
}
Also used : USER_INFO_1(com.sun.jna.platform.win32.LMAccess.USER_INFO_1)

Aggregations

USER_INFO_1 (com.sun.jna.platform.win32.LMAccess.USER_INFO_1)6 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)3 HANDLEByReference (com.sun.jna.platform.win32.WinNT.HANDLEByReference)3 Account (com.sun.jna.platform.win32.Advapi32Util.Account)2 SC_HANDLE (com.sun.jna.platform.win32.Winsvc.SC_HANDLE)1 IntByReference (com.sun.jna.ptr.IntByReference)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1