The following code can only work in SWFKit Pro 3
Code:
dllimport "netapi32.dll" stdcall long NetQueryDisplayInformation(
short*, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int*, int*) as netQInfo;
dllimport "netapi32.dll" stdcall long NetApiBufferFree(pointer) as netFree;
// WIN API constants
ERROR_SUCCESS = 0;
ERROR_MORE_DATA = 234;
var i = 0;
do // begin do
{
//
// Call the NetQueryDisplayInformation function;
// specify information level 1 (user account information).
//
// dwRec is used to receive the number of user information
var dwRec = new Object;
dwRec.value = 0;
// pBuff is used to receive a pointer
var pBuff = new Object;
pBuff.value = 0;
res = netQInfo(null, 1, i, 1000, 0xFFFFFFFF, dwRec, pBuff);
//
// If the call succeeds,
//
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
// The count variable contains the count of the user information
// returned by the above call
var count = dwRec.value;
// The data variable is a stringstream that contains a list of
// user information. The size of each user information
// is 24. The structure of the user information is shown as follows
/*
struct {
short*usri1_name;
short*usri1_comment;
unsigned longusri1_flags;
short*usri1_full_name;
unsigned longusri1_user_id;
unsigned longusri1_next_index;
} NET_DISPLAY_USER;
*/
var data = Dll.getPointerValue(pBuff.value, 24 * count);
for (var j = count; j > 0; j--)
{
//
// Print the retrieved group information.
//
// read usri1_name
var pusri1_name = data.getLong();
var username = Dll.getPointerWideStringValue(pusri1_name);
trace("username: ", username);
// read usri1_comment
var pusri1_comment = data.getLong();
var comment = Dll.getPointerWideStringValue(pusri1_comment);
trace("comment: ", comment);
// read usri1_flags
data.getLong();
// read usri1_full_name
var pusri1_full_name = data.getLong();
var fullname = Dll.getPointerWideStringValue(pusri1_full_name);
trace("full name: ", fullname);
// read usri1_user_id
data.getLong();
// read usri1_next_index
i = data.getLong();
}
//
// Free the allocated memory.
//
netFree(pBuff.value);
}
else
{
trace("Error");
}
//
// Continue while there is more data.
//
} while (res == ERROR_MORE_DATA);