OPTIONS "C_CALL WINFUNC"
FUNCDEF("NetUserGetInfo", "32, wstr, wstr, 32u, void stor", "Netapi32")
FUNCDEF("NetApiBufferFree", "32, void", "Netapi32")
FUNCDEF("USER_INFO_3", "wstr *, wstr *, 32u, 32u, wstr *, wstr *, 32u, wstr *, 32u, wstr *, wstr *, wstr *, wstr *, 32u, 32u, 32u, 32u, 32u, char *, 32u, 32u, wstr *, 32u, 32u, 32u, 32u, wstr *, wstr *, 32u")
status = netusergetinfo(, convertstr("Administrator", 'Z'), 3, address)
IF status == 0 THEN DO
CONVERTDATA(ADDRESS, 'MyInfo', 'struct USER_INFO_3')
netapibufferfree(address)
SAY "09"x || "Account: " convertstr('MyInfo.1', 'UV')
SAY "09"x || "Password: " convertstr('MyInfo.2', 'UV')
SAY "09"x || "Password age:" myinfo.3
SAY "09"x || "Priv: " myinfo.4
SAY "09"x || "Home dir: " convertstr('MyInfo.5', 'UV')
SAY "09"x || "Comment: " convertstr('MyInfo.6', 'UV')
SAY "09"x || "Flags: " myinfo.7
SAY "09"x || "Script path: " convertstr('MyInfo.8', 'UV')
SAY "09"x || "Auth. Flags: " myinfo.9
SAY "09"x || "Full name: " convertstr('MyInfo.10', 'UV')
SAY "09"x || "user comment:" convertstr('MyInfo.11', 'UV')
SAY "09"x || "Parms: " convertstr('MyInfo.12', 'UV')
SAY "09"x || "Workstations:" convertstr('MyInfo.13', 'UV')
SAY "09"x || "Last logon: " myinfo.14
SAY "09"x || "Last logoff: " myinfo.15
SAY "09"x || "Expires: " myinfo.16
SAY "09"x || "Max storage: " myinfo.17
SAY "09"x || "Weekly units:" myinfo.18
SAY "09"x || "Logon hours: " myinfo.19
SAY "09"x || "PW count: " myinfo.20
SAY "09"x || "Num logons: " myinfo.21
SAY "09"x || "Logon server:" convertstr('MyInfo.22', 'UV')
SAY "09"x || "Country code:" myinfo.23
SAY "09"x || "Code page: " myinfo.24
SAY "09"x || "User ID: " myinfo.25
SAY "09"x || "Group ID: " myinfo.26
SAY "09"x || "Profile: " convertstr('MyInfo.27', 'UV')
SAY "09"x || "Home drive: " convertstr('MyInfo.28', 'UV')
SAY "09"x || "Password exp:" myinfo.29
END
ELSE DO
SELECT status
WHEN 5 THEN str = "This script is being run under an account that has insufficient privilege for this operation."
WHEN 50 THEN str = "This network request isn't supported."
WHEN 53 THEN str = "The network path wasn't found."
WHEN 65 THEN str = "Network access is denied."
WHEN 124 THEN str = "Invalid level parameter."
WHEN 234 THEN str = "More data available. Supplied buffer too small."
WHEN 2102 THEN str = "Device driver not installed."
WHEN 2106 THEN str = "This operation can be performed only on a server."
WHEN 2123 THEN str = "Buffer too small for fixed-length data."
WHEN 2138 THEN str = "The Workstation service isn't started."
WHEN 2141 THEN str = "The server isn't configured for this transaction; IPC$ is not shared."
WHEN 2219 THEN str = "LAN Manager can't find the user accounts database file accounts.lmx."
WHEN 2221 THEN str = "Account not found."
WHEN 2227 THEN str = "Server not running in user-level security."
WHEN 2229 THEN str = "Error encountered in accessing accounts database."
WHEN 2247 THEN str = "The user accounts database file accounts.lmx is corrupted."
WHEN 2351 THEN str = "Invalid server name specified."
OTHERWISE
str = "Unknown error."
END
SAY "NetUserGetInfo() ERROR" status || ':' str
END
RETURN |
|