13#define SECONDS_PER_DAY (60 * 60 * 24)
14#define SECONDS_PER_HOUR (60 * 60)
15#define HOURS_PER_DAY 24
16#define DAYS_PER_WEEK 7
69 DWORD dwRead = 0, dwTotal = 0;
71 DWORD ResumeHandle = 0;
106 for (
i = 0;
i < dwRead;
i++)
128 WCHAR DateBuffer[80];
129 WCHAR TimeBuffer[80];
162 WCHAR TimeBuffer[80];
210 if (szCountryBuffer !=
NULL && dwCountryLength > 0)
235 DWORD dwIndex = dwBitNumber / 8;
238 return ((pBitmap[dwIndex] &
Mask) != 0);
248 DWORD dwIndex = dwBitNumber / 8;
251 pBitmap[dwIndex] |=
Mask;
258 DWORD dwUnitsPerWeek,
262 DWORD dwUnitsPerDay, dwBitNumber, dwSecondsPerUnit;
263 DWORD dwStartTime, dwEndTime, dwStartDay, dwEndDay, dwBias;
270 if ((dwUnitsPerWeek == 0) ||
271 ((dwUnitsPerWeek %7) != 0))
274 dwUnitsPerDay = dwUnitsPerWeek / 7;
276 if (((dwUnitsPerDay % 24) != 0) ||
277 ((dwUnitsPerDay / 24) > 6))
282 for (dwBitNumber = 0; dwBitNumber < dwUnitsPerWeek; dwBitNumber++)
287 dwStartTime = dwSecondsPerUnit * dwBitNumber;
289 while (bBitValue != 0 && dwBitNumber < dwUnitsPerWeek)
292 if (dwBitNumber < dwUnitsPerWeek)
296 dwEndTime = dwSecondsPerUnit * dwBitNumber;
318 if (dwStartDay != dwEndDay)
350 DWORD dwLocalGroupRead, dwLocalGroupTotal;
351 DWORD dwGroupRead, dwGroupTotal;
355 INT nPaddedLength = 36;
376 (
LPBYTE*)&pLocalGroupInfo,
488 if (dwLocalGroupTotal != 0 && pLocalGroupInfo !=
NULL)
490 for (
i = 0;
i < dwLocalGroupTotal;
i++)
503 if (dwGroupTotal != 0 && pGroupInfo !=
NULL)
505 for (
i = 0;
i < dwGroupTotal;
i++)
518 if (pGroupInfo !=
NULL)
521 if (pLocalGroupInfo !=
NULL)
524 if (pUserModals !=
NULL)
527 if (pUserInfo !=
NULL)
544 *lpAllocated =
FALSE;
557 wcscmp(szPassword1, szPassword2) == 0)
594 if (pPassword ==
NULL)
604 *lpPassword = pPassword;
615 BOOL isLastSep, isSep;
631 nRawLength =
wcslen(pRaw);
632 for (
i = 0;
i < nRawLength;
i++)
635 if (
c ==
L',' ||
c ==
L';')
640 if ((isLastSep ==
FALSE) && (
i != 0) && (
i != nRawLength - 1))
647 if (isLastSep ==
TRUE || (isLastSep ==
FALSE &&
i == 0))
660 pWorkstationsList =
NULL;
676 nRawLength =
wcslen(pRaw);
677 for (
i = 0,
j = 0;
i < nRawLength;
i++)
680 if (
c ==
L',' ||
c ==
L';')
685 if ((isLastSep ==
FALSE) && (
i != 0) && (
i != nRawLength - 1))
696 if (isLastSep ==
TRUE || (isLastSep ==
FALSE &&
i == 0))
704 *pWorkstationsList =
pList;
721 *pwValue = *pwValue * 10 + **
s -
L'0';
734 if (**
s ==
L'/' || **
s ==
L'.')
810 if (SystemTime.
wYear <= 99)
812 if (SystemTime.
wYear >= 80)
813 SystemTime.
wYear += 1900;
815 SystemTime.
wYear += 2000;
850 lHour = lHour * 10 + *pChar -
L'0';
864 if ((
_wcsicmp(pChar, AmPmArray[0]) == 0) ||
865 (
_wcsicmp(pChar, AmPmArray[1]) == 0))
870 else if ((
_wcsicmp(pChar, AmPmArray[2]) == 0) ||
871 (
_wcsicmp(pChar, AmPmArray[3]) == 0))
898 for (
i = 0;
i < 7;
i++)
920 lGmtHour = lLocalHour + lBias;
926 return (
DWORD)lGmtHour;
934 PBYTE *ppLogonBitmap,
942 WCHAR prevSep, nextSep;
943 DWORD dwStartDay, dwEndDay,
i,
j;
944 LONG lStartHour, lEndHour, lBias;
952 lBias = TimeZoneInformation.
Bias / 60;
957 if (pLogonBitmap ==
NULL)
965 if (
wcsicmp(pszParams,
L"all") == 0)
971 for (
i = 0;
i < 7;
i++)
994 for (
i = 0;
i < 4;
i++)
1017 if (*ptr1 !=
L'-' && *ptr1 !=
L',' && *ptr1 !=
L';' && *ptr1 !=
UNICODE_NULL)
1027 if (prevSep !=
L'-')
1033 if (!
ParseHour(szBuffer, AmPmArray, &lStartHour))
1044 if (!
ParseDay(szBuffer, ShortDays, LongDays, &dwStartDay))
1059 if (!
ParseHour(szBuffer, AmPmArray, &lEndHour))
1065 if (lEndHour <= lStartHour)
1074 if (!
ParseDay(szBuffer, ShortDays, LongDays, &dwEndDay))
1080 if (dwEndDay <= dwStartDay)
1083 for (
i = dwStartDay;
i <= dwEndDay;
i++)
1095 for (
j = 0;
j < 48;
j++)
1119 for (
i = 0;
i < 7;
i++)
1125 for (
i = 0;
i < 4;
i++)
1132 *ppLogonBitmap = pLogonBitmap;
1137 if (pLogonBitmap !=
NULL)
1139 *ppLogonBitmap =
NULL;
1140 *pdwUnitsPerWeek = 0;
1170 DWORD dwUnitsPerWeek;
1176 lpUserName =
argv[
i];
1183 lpPassword =
argv[
i];
1212 bRandomPassword =
TRUE;
1214 &bPasswordAllocated);
1218 if (lpUserName ==
NULL && lpPassword ==
NULL)
1224 else if (lpUserName !=
NULL && lpPassword ==
NULL &&
argc == 3)
1231 if (bAdd && bDelete)
1238 if (lpPassword !=
NULL &&
wcscmp(lpPassword,
L"*") == 0)
1241 &bPasswordAllocated);
1244 if (!bAdd && !bDelete)
1269 pUserInfo = &UserInfo;
1421 if (!bAdd && !bDelete)
1448 lpPassword !=
NULL &&
1449 bRandomPassword ==
TRUE)
1455 if (pLogonHours !=
NULL)
1458 if (pWorkstations !=
NULL)
1461 if ((bPasswordAllocated ==
TRUE) && (lpPassword !=
NULL))
1464 if (!bAdd && !bDelete && pUserInfo !=
NULL)
void ConPuts(FILE *fp, LPCWSTR psz)
void ConPrintf(FILE *fp, LPCWSTR psz,...)
VOID PrintNetMessage(DWORD dwMessage)
DWORD TranslateAppMessage(DWORD dwMessage)
VOID PrintPaddedMessageString(DWORD dwMessage, INT nPaddedLength)
VOID PrintMessageStringV(DWORD dwMessage,...)
VOID PrintPadding(WCHAR chr, INT nPaddedLength)
VOID PrintMessageString(DWORD dwMessage)
VOID ReadFromConsole(LPWSTR lpInput, DWORD dwLength, BOOL bEcho)
static DWORD LocalToGmtHour(LONG lLocalHour, LONG lBias)
static BOOL ParseHour(PWSTR pszString, PWSTR *AmPmArray, PLONG plHour)
static VOID SetBitValue(PBYTE pBitmap, DWORD dwBitNumber)
static VOID PrintLocalTime(DWORD dwSeconds)
static VOID PrintLogonHours(DWORD dwUnitsPerWeek, PBYTE pLogonHours, INT nPaddedLength)
static WCHAR szPasswordChars[]
static int CompareInfo(const void *a, const void *b)
static BOOL ParseDate(PWSTR s, PULONG pSeconds)
static VOID GenerateRandomPassword(LPWSTR *lpPassword, LPBOOL lpAllocated)
static NET_API_STATUS BuildWorkstationsList(_Out_ PWSTR *pWorkstationsList, _In_ PWSTR pRaw)
static BOOL ReadNumber(PWSTR *s, PWORD pwValue)
struct _COUNTY_TABLE * PCOUNTRY_TABLE
static BOOL GetCountryFromCountryCode(_In_ DWORD dwCountryCode, _In_ DWORD dwCountryLength, _Out_ PWSTR szCountryBuffer)
static VOID ReadPassword(LPWSTR *lpPassword, LPBOOL lpAllocated)
static DWORD ParseLogonHours(PWSTR pszParams, PBYTE *ppLogonBitmap, PDWORD pdwUnitsPerWeek)
static COUNTRY_TABLE CountryTable[]
static NET_API_STATUS EnumerateUsers(VOID)
static BOOL GetBitValue(PBYTE pBitmap, DWORD dwBitNumber)
static NET_API_STATUS DisplayUser(LPWSTR lpUserName)
struct _COUNTY_TABLE COUNTRY_TABLE
static DWORD GetTimeInSeconds(VOID)
INT cmdUser(INT argc, WCHAR **argv)
static BOOL ReadSeparator(PWSTR *s)
static BOOL ParseDay(PWSTR pszString, PWSTR *ShortDays, PWSTR *LongDays, PDWORD pdwDay)
static VOID PrintDateTime(DWORD dwSeconds)
#define ERROR_NOT_ENOUGH_MEMORY
#define HeapFree(x, y, z)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
DWORD WINAPI GetTickCount(VOID)
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE *bufptr)
NET_API_STATUS WINAPI NetUserEnum(LPCWSTR servername, DWORD level, DWORD filter, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle)
NET_API_STATUS WINAPI NetUserAdd(LPCWSTR servername, DWORD level, LPBYTE bufptr, LPDWORD parm_err)
NET_API_STATUS WINAPI NetUserGetGroups(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE *bufptr, DWORD prefixmaxlen, LPDWORD entriesread, LPDWORD totalentries)
NET_API_STATUS WINAPI NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE *bufptr)
NET_API_STATUS WINAPI NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level, DWORD flags, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries)
NET_API_STATUS WINAPI NetUserSetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE buf, LPDWORD parm_err)
NET_API_STATUS WINAPI NetUserModalsGet(LPCWSTR servername, DWORD level, LPBYTE *bufptr)
NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username)
#define FillMemory(BUF, SIZ, MASK)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
HLOCAL NTAPI LocalFree(HLOCAL hMem)
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_Check_return_ int __cdecl rand(void)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOLEAN NTAPI RtlTimeToSecondsSince1970(PLARGE_INTEGER Time, PULONG ElapsedSeconds)
#define UF_ACCOUNTDISABLE
#define UF_DONT_EXPIRE_PASSWD
#define UF_PASSWD_CANT_CHANGE
#define UF_PASSWD_NOTREQD
#define UF_NORMAL_ACCOUNT
#define MAX_PREFERRED_LENGTH
static PLARGE_INTEGER Time
NTSYSAPI VOID NTAPI RtlSecondsSince1970ToTime(_In_ ULONG SecondsSince1970, _Out_ PLARGE_INTEGER Time)
#define LOCALE_USER_DEFAULT
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
Deprecated header file that includes net_sockets.h.
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
LPWSTR usri4_workstations
DWORD usri4_primary_group_id
DWORD usri4_units_per_week
DWORD usrmod0_min_passwd_age
DWORD usrmod0_max_passwd_age
#define LANG_USER_DEFAULT
struct _LARGE_INTEGER::@2299 u
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define FORMAT_MESSAGE_FROM_HMODULE
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
#define DOMAIN_GROUP_RID_USERS