2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
7 * PROGRAMMERS: Eric Kohl
17 PUSER_MODALS_INFO_0 Info0
= NULL
;
18 PUSER_MODALS_INFO_1 Info1
= NULL
;
19 PUSER_MODALS_INFO_3 Info3
= NULL
;
20 NT_PRODUCT_TYPE ProductType
;
25 BOOL Modified
= FALSE
;
26 // BOOL Domain = FALSE;
27 NET_API_STATUS Status
;
29 for (i
= 3; i
< argc
; i
++)
31 if (wcsicmp(argv
[i
], L
"help") == 0)
33 /* Print short syntax help */
34 puts("NET ACCOUNTS [/FORCELOGOFF:{Minutes|NO}] [/MINPWLEN:Length]");
35 puts(" [/MAXPWAGE:{Days|UNLIMITED}] [/MINPWAGE:Days]");
36 puts(" [/UNIQUEPW:Count] [/DOMAIN]");
40 if (wcsicmp(argv
[i
], L
"/help") == 0)
42 /* FIXME: Print long help text*/
47 if (wcsicmp(argv[i], L"/domain") == 0)
54 Status
= NetUserModalsGet(NULL
, 0, (LPBYTE
*)&Info0
);
55 if (Status
!= NERR_Success
)
58 for (i
= 3; i
< argc
; i
++)
60 if (_wcsnicmp(argv
[i
], L
"/forcelogoff:", 13) == 0)
63 if (wcsicmp(p
, L
"no"))
65 Info0
->usrmod0_force_logoff
= TIMEQ_FOREVER
;
70 value
= wcstoul(p
, &perr
, 10);
72 Info0
->usrmod0_force_logoff
= value
* 60;
76 else if (_wcsnicmp(argv
[i
], L
"/minpwlen:", 10) == 0)
79 value
= wcstoul(p
, &perr
, 10);
80 Info0
->usrmod0_min_passwd_len
= value
;
83 else if (_wcsnicmp(argv
[i
], L
"/maxpwage:", 10) == 0)
87 if (wcsicmp(p
, L
"unlimited"))
89 Info0
->usrmod0_max_passwd_age
= ULONG_MAX
;
94 value
= wcstoul(p
, &perr
, 10);
96 Info0
->usrmod0_max_passwd_age
= value
* 86400;
100 else if (_wcsnicmp(argv
[i
], L
"/minpwage:", 10) == 0)
103 value
= wcstoul(p
, &perr
, 10);
105 Info0
->usrmod0_min_passwd_age
= value
* 86400;
108 else if (_wcsnicmp(argv
[i
], L
"/uniquepw:", 10) == 0)
111 value
= wcstoul(p
, &perr
, 10);
113 Info0
->usrmod0_password_hist_len
= value
;
118 if (Modified
== TRUE
)
120 Status
= NetUserModalsSet(NULL
, 0, (LPBYTE
)Info0
, &ParamErr
);
121 if (Status
!= NERR_Success
)
126 Status
= NetUserModalsGet(NULL
, 1, (LPBYTE
*)&Info1
);
127 if (Status
!= NERR_Success
)
130 Status
= NetUserModalsGet(NULL
, 3, (LPBYTE
*)&Info3
);
131 if (Status
!= NERR_Success
)
134 RtlGetNtProductType(&ProductType
);
136 printf("Force logoff after: ");
137 if (Info0
->usrmod0_force_logoff
== TIMEQ_FOREVER
)
140 printf("%lu seconds\n", Info0
->usrmod0_force_logoff
);
142 printf("Minimum password age (in days): %lu\n", Info0
->usrmod0_min_passwd_age
/ 86400);
143 printf("Maximum password age (in days): %lu\n", Info0
->usrmod0_max_passwd_age
/ 86400);
144 printf("Minimum password length: %lu\n", Info0
->usrmod0_min_passwd_len
);
146 printf("Password history length: ");
147 if (Info0
->usrmod0_password_hist_len
== 0)
150 printf("%lu\n", Info0
->usrmod0_password_hist_len
);
152 printf("Lockout threshold: %lu\n", Info3
->usrmod3_lockout_threshold
);
153 printf("Lockout duration (in minutes): %lu\n", Info3
->usrmod3_lockout_duration
/ 60);
154 printf("Lockout observation window (in minutes): %lu\n", Info3
->usrmod3_lockout_observation_window
/ 60);
156 printf("Computer role: ");
158 if (Info1
->usrmod1_role
== UAS_ROLE_PRIMARY
)
160 if (ProductType
== NtProductLanManNt
)
162 printf("Primary server\n");
164 else if (ProductType
== NtProductServer
)
166 printf("Standalone server\n");
170 printf("Workstation\n");
175 printf("Backup server\n");
181 NetApiBufferFree(Info3
);
184 NetApiBufferFree(Info1
);
187 NetApiBufferFree(Info0
);