userInfo.usri1_password = new WString("!JNAP$$Wrd0");
userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
try {
assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserAdd(
null, 1, userInfo, null));
HANDLEByReference phUser = new HANDLEByReference();
try {
assertTrue(Advapi32.INSTANCE.LogonUser(userInfo.usri1_name.toString(),
null, userInfo.usri1_password.toString(), WinBase.LOGON32_LOGON_NETWORK,
WinBase.LOGON32_PROVIDER_DEFAULT, phUser));
Account[] groups = Advapi32Util.getTokenGroups(phUser.getValue());
assertTrue(groups.length > 0);
for(Account group : groups) {
assertTrue(group.name.length() > 0);
assertTrue(group.sidString.length() > 0);
assertTrue(group.sid.length > 0);
}
} finally {
if (phUser.getValue() != WinBase.INVALID_HANDLE_VALUE) {
Kernel32.INSTANCE.CloseHandle(phUser.getValue());
}
}
} finally {
assertEquals(LMErr.NERR_Success, Netapi32.INSTANCE.NetUserDel(
null, userInfo.usri1_name.toString()));