ReactOS  0.4.12-dev-720-g6accaef
net.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <wincon.h>
#include <winsvc.h>
#include <winnetwk.h>
#include <lm.h>
#include <ndk/rtlfuncs.h>
#include <conutils.h>
#include <net_msg.h>
#include "resource.h"
Include dependency graph for net.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 

Functions

VOID PrintPaddedResourceString (UINT uID, INT nPaddedLength)
 
VOID PrintPadding (WCHAR chr, INT nPaddedLength)
 
VOID PrintErrorMessage (DWORD dwError)
 
VOID PrintNetMessage (DWORD dwMessage)
 
VOID ReadFromConsole (LPWSTR lpInput, DWORD dwLength, BOOL bEcho)
 
VOID help (VOID)
 
INT unimplemented (INT argc, WCHAR **argv)
 
INT cmdAccounts (INT argc, WCHAR **argv)
 
INT cmdComputer (INT argc, WCHAR **argv)
 
INT cmdConfig (INT argc, WCHAR **argv)
 
INT cmdContinue (INT argc, WCHAR **argv)
 
INT cmdGroup (INT argc, WCHAR **argv)
 
INT cmdHelp (INT argc, WCHAR **argv)
 
INT cmdHelpMsg (INT argc, WCHAR **argv)
 
INT cmdLocalGroup (INT argc, WCHAR **argv)
 
INT cmdPause (INT argc, WCHAR **argv)
 
INT cmdStart (INT argc, WCHAR **argv)
 
INT cmdStatistics (INT argc, WCHAR **argv)
 
INT cmdStop (INT argc, WCHAR **argv)
 
INT cmdUse (INT argc, WCHAR **argv)
 
INT cmdUser (INT argc, WCHAR **argv)
 

Variables

HMODULE hModuleNetMsg
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 15 of file net.h.

Function Documentation

◆ cmdAccounts()

INT cmdAccounts ( INT  argc,
WCHAR **  argv 
)

Definition at line 13 of file cmdAccounts.c.

16 {
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;
21  LPWSTR p;
22  LPWSTR endptr;
23  DWORD ParamErr;
24  ULONG value;
25  INT i;
26  BOOL Modified = FALSE;
27 #if 0
28  BOOL Domain = FALSE;
29 #endif
30  INT nPaddedLength = 58;
32  INT result = 0;
33 
34  for (i = 2; i < argc; i++)
35  {
36  if (_wcsicmp(argv[i], L"help") == 0)
37  {
38  /* Print short syntax help */
40  PrintNetMessage(MSG_ACCOUNTS_SYNTAX);
41  return 0;
42  }
43 
44  if (_wcsicmp(argv[i], L"/help") == 0)
45  {
46  /* Print full help text*/
48  PrintNetMessage(MSG_ACCOUNTS_SYNTAX);
49  PrintNetMessage(MSG_ACCOUNTS_HELP);
51  return 0;
52  }
53 
54  if (_wcsicmp(argv[i], L"/domain") == 0)
55  {
57 #if 0
58  Domain = TRUE;
59 #endif
60  }
61  }
62 
63  Status = NetUserModalsGet(NULL, 0, (LPBYTE*)&Info0);
64  if (Status != NERR_Success)
65  goto done;
66 
67  for (i = 2; i < argc; i++)
68  {
69  if (_wcsnicmp(argv[i], L"/forcelogoff:", 13) == 0)
70  {
71  p = &argv[i][13];
72  if (wcsicmp(p, L"no"))
73  {
75  Modified = TRUE;
76  }
77  else
78  {
79  value = wcstoul(p, &endptr, 10);
80  if (*endptr != 0)
81  {
83  result = 1;
84  goto done;
85  }
86 
87  Info0->usrmod0_force_logoff = value * 60;
88  Modified = TRUE;
89  }
90  }
91  else if (_wcsnicmp(argv[i], L"/minpwlen:", 10) == 0)
92  {
93  p = &argv[i][10];
94  value = wcstoul(p, &endptr, 10);
95  if (*endptr != 0)
96  {
98  result = 1;
99  goto done;
100  }
101 
102  Info0->usrmod0_min_passwd_len = value;
103  Modified = TRUE;
104  }
105  else if (_wcsnicmp(argv[i], L"/maxpwage:", 10) == 0)
106  {
107  p = &argv[i][10];
108 
109  if (wcsicmp(p, L"unlimited"))
110  {
112  Modified = TRUE;
113  }
114  else
115  {
116  value = wcstoul(p, &endptr, 10);
117  if (*endptr != 0)
118  {
120  result = 1;
121  goto done;
122  }
123 
124  Info0->usrmod0_max_passwd_age = value * 86400;
125  Modified = TRUE;
126  }
127  }
128  else if (_wcsnicmp(argv[i], L"/minpwage:", 10) == 0)
129  {
130  p = &argv[i][10];
131  value = wcstoul(p, &endptr, 10);
132  if (*endptr != 0)
133  {
135  result = 1;
136  goto done;
137  }
138 
139  Info0->usrmod0_min_passwd_age = value * 86400;
140  Modified = TRUE;
141  }
142  else if (_wcsnicmp(argv[i], L"/uniquepw:", 10) == 0)
143  {
144  p = &argv[i][10];
145  value = wcstoul(p, &endptr, 10);
146  if (*endptr != 0)
147  {
149  result = 1;
150  goto done;
151  }
152 
154  Modified = TRUE;
155  }
156  }
157 
158  if (Modified == TRUE)
159  {
160  Status = NetUserModalsSet(NULL, 0, (LPBYTE)Info0, &ParamErr);
161  if (Status != NERR_Success)
162  goto done;
163  }
164  else
165  {
166  Status = NetUserModalsGet(NULL, 1, (LPBYTE*)&Info1);
167  if (Status != NERR_Success)
168  goto done;
169 
170  Status = NetUserModalsGet(NULL, 3, (LPBYTE*)&Info3);
171  if (Status != NERR_Success)
172  goto done;
173 
174  RtlGetNtProductType(&ProductType);
175 
177  if (Info0->usrmod0_force_logoff == TIMEQ_FOREVER)
179  else
181  ConPuts(StdOut, L"\n");
182 
184  ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_min_passwd_age / 86400);
185 
187  ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_max_passwd_age / 86400);
188 
190  ConPrintf(StdOut, L"%lu\n", Info0->usrmod0_min_passwd_len);
191 
193  if (Info0->usrmod0_password_hist_len == 0)
195  else
197  ConPuts(StdOut, L"\n");
198 
200  if (Info3->usrmod3_lockout_threshold == 0)
202  else
204  ConPuts(StdOut, L"\n");
205 
207  ConPrintf(StdOut, L"%lu\n", Info3->usrmod3_lockout_duration / 60);
208 
211 
213  if (Info1->usrmod1_role == UAS_ROLE_PRIMARY)
214  {
215  if (ProductType == NtProductLanManNt)
216  {
218  }
219  else if (ProductType == NtProductServer)
220  {
222  }
223  else
224  {
226  }
227  }
228  else
229  {
231  }
232  ConPuts(StdOut, L"\n");
233  }
234 
235 done:
236  if (Info3 != NULL)
237  NetApiBufferFree(Info3);
238 
239  if (Info1 != NULL)
240  NetApiBufferFree(Info1);
241 
242  if (Info0 != NULL)
243  NetApiBufferFree(Info0);
244 
245  return result;
246 }
static int argc
Definition: ServiceArgs.c:12
#define IDS_ACCOUNTS_LOGOFF_SECONDS
Definition: resource.h:4
#define IDS_ACCOUNTS_PRIMARY_SERVER
Definition: resource.h:13
#define TRUE
Definition: types.h:120
#define IDS_ACCOUNTS_WORKSTATION
Definition: resource.h:16
#define IDS_ACCOUNTS_MIN_PW_LENGTH
Definition: resource.h:7
#define IDS_ACCOUNTS_MAX_PW_AGE
Definition: resource.h:6
#define IDS_ACCOUNTS_LOCKOUT_WINDOW
Definition: resource.h:11
DWORD usrmod3_lockout_threshold
Definition: lmaccess.h:450
_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)
#define IDS_ERROR_INVALID_OPTION_VALUE
Definition: resource.h:122
#define IDS_ACCOUNTS_STANDALONE_SERVER
Definition: resource.h:15
DWORD usrmod3_lockout_duration
Definition: lmaccess.h:448
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define IDS_ACCOUNTS_LOCKOUT_DURATION
Definition: resource.h:10
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
DWORD usrmod0_min_passwd_len
Definition: lmaccess.h:433
#define IDS_ACCOUNTS_BACKUP_SERVER
Definition: resource.h:14
#define IDS_GENERIC_NEVER
Definition: resource.h:113
BOOLEAN NTAPI RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType)
Definition: version.c:96
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD usrmod0_max_passwd_age
Definition: lmaccess.h:434
NET_API_STATUS WINAPI NetUserModalsGet(LPCWSTR servername, DWORD level, LPBYTE *bufptr)
Definition: user.c:3261
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
#define IDS_GENERIC_PAGE
Definition: resource.h:119
smooth NULL
Definition: ftsmooth.c:416
#define IDS_ACCOUNTS_PW_HIST_LENGTH
Definition: resource.h:8
#define IDS_ACCOUNTS_FORCE_LOGOFF
Definition: resource.h:3
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
unsigned int BOOL
Definition: ntddk_ex.h:94
NET_API_STATUS WINAPI NetUserModalsSet(IN LPCWSTR servername, IN DWORD level, IN LPBYTE buf, OUT LPDWORD parm_err)
Definition: user.c:3545
#define UAS_ROLE_PRIMARY
Definition: lmaccess.h:53
#define IDS_ACCOUNTS_COMPUTER_ROLE
Definition: resource.h:12
unsigned long DWORD
Definition: ntddk_ex.h:95
#define StdErr
Definition: stream.h:77
DWORD usrmod0_password_hist_len
Definition: lmaccess.h:437
DWORD usrmod0_min_passwd_age
Definition: lmaccess.h:435
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
#define IDS_ERROR_OPTION_NOT_SUPPORTED
Definition: resource.h:121
static const WCHAR L[]
Definition: oid.c:1250
GLsizei const GLfloat * value
Definition: glext.h:6069
#define wcsicmp
Definition: string.h:1152
Status
Definition: gdiplustypes.h:24
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
VOID PrintPaddedResourceString(UINT uID, INT nPaddedLength)
Definition: main.c:52
DWORD usrmod0_force_logoff
Definition: lmaccess.h:436
DWORD usrmod3_lockout_observation_window
Definition: lmaccess.h:449
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define IDS_ACCOUNTS_LOCKOUT_THRESHOLD
Definition: resource.h:9
#define TIMEQ_FOREVER
Definition: lmaccess.h:110
#define StdOut
Definition: stream.h:76
enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
unsigned int ULONG
Definition: retypes.h:1
#define IDS_GENERIC_NONE
Definition: resource.h:114
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ULONG_MAX
Definition: limits.h:44
#define IDS_ACCOUNTS_MIN_PW_AGE
Definition: resource.h:5

◆ cmdComputer()

INT cmdComputer ( INT  argc,
WCHAR **  argv 
)

Definition at line 11 of file cmdComputer.c.

14 {
15  WCHAR ComputerAccountName[MAX_PATH + 2];
16  WCHAR ComputerPassword[LM20_PWLEN + 1];
17  USER_INFO_1 UserInfo;
18  INT i, result = 0;
19  BOOL bAdd = FALSE;
20  BOOL bDelete = FALSE;
21  PWSTR pComputerName = NULL;
23 /*
24  OSVERSIONINFOEX VersionInfo;
25 
26  VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
27  if (!GetVersionEx((LPOSVERSIONINFO)&VersionInfo))
28  {
29  PrintErrorMessage(GetLastError());
30  return 1;
31  }
32 
33  if (VersionInfo.wProductType != VER_NT_DOMAIN_CONTROLLER)
34  {
35  PrintErrorMessage(3515);
36  return 1;
37  }
38 */
39 
40  i = 2;
41  if (argc > 2 && argv[i][0] == L'\\' && argv[i][1] == L'\\')
42  {
43  pComputerName = argv[i];
44  i++;
45  }
46 
47  for (; i < argc; i++)
48  {
49  if (_wcsicmp(argv[i], L"help") == 0)
50  {
51  /* Print short syntax help */
53  PrintNetMessage(MSG_COMPUTER_SYNTAX);
54  return 0;
55  }
56 
57  if (_wcsicmp(argv[i], L"/help") == 0)
58  {
59  /* Print full help text*/
61  PrintNetMessage(MSG_COMPUTER_SYNTAX);
62  PrintNetMessage(MSG_COMPUTER_HELP);
63  return 0;
64  }
65 
66  if (_wcsicmp(argv[i], L"/add") == 0)
67  {
68  bAdd = TRUE;
69  continue;
70  }
71  else if (_wcsicmp(argv[i], L"/del") == 0)
72  {
73  bDelete = TRUE;
74  continue;
75  }
76  else
77  {
78  PrintErrorMessage(3506/*, argv[i]*/);
79  return 1;
80  }
81  }
82 
83  if (pComputerName == NULL ||
84  (bAdd == FALSE && bDelete == FALSE) ||
85  (bAdd == TRUE && bDelete == TRUE))
86  {
88  PrintNetMessage(MSG_COMPUTER_SYNTAX);
89  return 1;
90  }
91 
92  /*
93  * Create the computer account name:
94  * Skip the leading '\\' and appand a '$'.
95  */
96  wcscpy(ComputerAccountName, &pComputerName[2]);
97  wcscat(ComputerAccountName, L"$");
98 
99  if (bAdd)
100  {
101  /*
102  * Create the computer password:
103  * Skip the leading '\\', shorten to a maximum of 14 characters
104  * and convert to lower case
105  */
106  wcsncpy(ComputerPassword, &pComputerName[2], LM20_PWLEN);
107  ComputerPassword[LM20_PWLEN] = UNICODE_NULL;
108  _wcslwr(ComputerPassword);
109 
110  /* Set the account data */
111  UserInfo.usri1_name = ComputerAccountName;
112  UserInfo.usri1_password = ComputerPassword;
113  UserInfo.usri1_password_age = 0;
114  UserInfo.usri1_priv = USER_PRIV_USER;
115  UserInfo.usri1_home_dir = NULL;
116  UserInfo.usri1_comment = NULL;
118  UserInfo.usri1_script_path = NULL;
119 
120  /* Add the computer account */
122  1,
123  (LPBYTE)&UserInfo,
124  NULL);
125  }
126  else if (bDelete)
127  {
128  /* Delete the coputer account */
130  ComputerAccountName);
131  }
132 
133  if (Status == NERR_Success)
134  {
136  }
137  else
138  {
140  result = 1;
141  }
142 
143  return result;
144 }
DWORD usri1_password_age
Definition: lmaccess.h:205
static int argc
Definition: ServiceArgs.c:12
LPWSTR usri1_password
Definition: lmaccess.h:204
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint16_t * PWSTR
Definition: typedefs.h:54
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
#define USER_PRIV_USER
Definition: lmaccess.h:117
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
unsigned char * LPBYTE
Definition: typedefs.h:52
#define UNICODE_NULL
NET_API_STATUS WINAPI NetUserAdd(LPCWSTR servername, DWORD level, LPBYTE bufptr, LPDWORD parm_err)
Definition: user.c:2046
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR usri1_comment
Definition: lmaccess.h:208
#define MAX_PATH
Definition: compat.h:26
LPWSTR usri1_name
Definition: lmaccess.h:203
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username)
Definition: user.c:2312
static const WCHAR L[]
Definition: oid.c:1250
#define UF_WORKSTATION_TRUST_ACCOUNT
Definition: lmaccess.h:32
LPWSTR usri1_script_path
Definition: lmaccess.h:210
Status
Definition: gdiplustypes.h:24
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
DWORD usri1_priv
Definition: lmaccess.h:206
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define LM20_PWLEN
Definition: lmcons.h:38
#define StdOut
Definition: stream.h:76
DWORD usri1_flags
Definition: lmaccess.h:209
GLuint64EXT * result
Definition: glext.h:11304
LPWSTR usri1_home_dir
Definition: lmaccess.h:207
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define UF_SCRIPT
Definition: lmaccess.h:23

◆ cmdConfig()

INT cmdConfig ( INT  argc,
WCHAR **  argv 
)

Definition at line 151 of file cmdConfig.c.

154 {
155  INT i, result = 0;
156  BOOL bServer = FALSE;
157  BOOL bWorkstation = FALSE;
158  PWSTR p, endptr;
159  BOOL bModify = FALSE;
160  LONG lValue;
161  PSERVER_INFO_102 ServerInfo = NULL;
163 
164  for (i = 2; i < argc; i++)
165  {
166  if (_wcsicmp(argv[i], L"server") == 0)
167  {
168  if (bWorkstation == FALSE)
169  bServer = TRUE;
170  continue;
171  }
172 
173  if (_wcsicmp(argv[i], L"workstation") == 0)
174  {
175  if (bServer == FALSE)
176  bWorkstation = TRUE;
177  continue;
178  }
179 
180  if (_wcsicmp(argv[i], L"help") == 0)
181  {
182  /* Print short syntax help */
183  if (bServer == TRUE)
184  {
186  PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
187  }
188  else
189  {
191  PrintNetMessage(MSG_CONFIG_SYNTAX);
192  }
193  return 0;
194  }
195 
196  if (_wcsicmp(argv[i], L"/help") == 0)
197  {
198  /* Print full help text*/
199  if (bServer == TRUE)
200  {
202  PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
203  PrintNetMessage(MSG_CONFIG_SERVER_HELP);
205  }
206  else
207  {
209  PrintNetMessage(MSG_CONFIG_SYNTAX);
210  PrintNetMessage(MSG_CONFIG_HELP);
211  }
212  return 0;
213  }
214  }
215 
216  if (bServer)
217  {
218  Status = NetServerGetInfo(NULL, 102, (PBYTE*)&ServerInfo);
219  if (Status != NERR_Success)
220  goto done;
221 
222  for (i = 2; i < argc; i++)
223  {
224  if (argv[i][0] != L'/')
225  continue;
226 
227  if (_wcsnicmp(argv[i], L"/autodisconnect:", 16) == 0)
228  {
229  p = &argv[i][16];
230  lValue = wcstol(p, &endptr, 10);
231  if (*endptr != 0)
232  {
234  result = 1;
235  goto done;
236  }
237 
238  if (lValue < -1 || lValue > 65535)
239  {
241  result = 1;
242  goto done;
243  }
244 
245  ServerInfo->sv102_disc = lValue;
246  bModify = TRUE;
247  }
248  else if (_wcsnicmp(argv[i], L"/srvcomment:", 12) == 0)
249  {
250  ServerInfo->sv102_comment = &argv[i][12];
251  bModify = TRUE;
252  }
253  else if (_wcsnicmp(argv[i], L"/hidden:", 8) == 0)
254  {
255  p = &argv[i][8];
256  if (_wcsicmp(p, L"yes") != 0 && _wcsicmp(p, L"no") != 0)
257  {
259  result = 1;
260  goto done;
261  }
262 
263  ServerInfo->sv102_hidden = (_wcsicmp(p, L"yes") == 0) ? TRUE : FALSE;
264  bModify = TRUE;
265  }
266  else
267  {
269  PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
270  result = 1;
271  goto done;
272  }
273  }
274 
275  if (bModify)
276  {
277  Status = NetServerSetInfo(NULL, 102, (PBYTE)&ServerInfo, NULL);
278  if (Status != NERR_Success)
279  result = 1;
280  }
281  else
282  {
283  result = DisplayServerConfig(ServerInfo);
284  }
285  }
286  else if (bWorkstation)
287  {
289  }
290  else
291  {
293  }
294 
295 done:
296  if (ServerInfo != NULL)
297  NetApiBufferFree(ServerInfo);
298 
299  if (result == 0)
301 
302  return result;
303 }
static int argc
Definition: ServiceArgs.c:12
NET_API_STATUS WINAPI NetServerSetInfo(_In_ LPWSTR servername, _In_ DWORD level, _In_ LPBYTE buf, _Out_ LPDWORD parm_err)
Definition: srvsvc.c:399
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
uint16_t * PWSTR
Definition: typedefs.h:54
_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)
LPWSTR sv102_comment
Definition: lmserver.h:31
#define IDS_ERROR_INVALID_OPTION_VALUE
Definition: resource.h:122
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
static INT DisplayServerConfig(PSERVER_INFO_102 ServerInfo)
Definition: cmdConfig.c:12
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
long LONG
Definition: pedump.c:60
BOOL sv102_hidden
Definition: lmserver.h:34
#define IDS_GENERIC_PAGE
Definition: resource.h:119
smooth NULL
Definition: ftsmooth.c:416
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define IDS_CONFIG_TEXT
Definition: resource.h:18
unsigned int BOOL
Definition: ntddk_ex.h:94
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE *bufptr)
Definition: srvsvc.c:369
Status
Definition: gdiplustypes.h:24
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define StdOut
Definition: stream.h:76
static INT DisplayWorkstationConfig(VOID)
Definition: cmdConfig.c:75
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
BYTE * PBYTE
Definition: pedump.c:66
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ cmdContinue()

INT cmdContinue ( INT  argc,
WCHAR **  argv 
)

Definition at line 12 of file cmdContinue.c.

13 {
14  SC_HANDLE hManager = NULL;
15  SC_HANDLE hService = NULL;
17  INT nError = 0;
18  INT i;
19 
20  if (argc != 3)
21  {
23  PrintNetMessage(MSG_CONTINUE_SYNTAX);
24  return 1;
25  }
26 
27  for (i = 2; i < argc; i++)
28  {
29  if (_wcsicmp(argv[i], L"/help") == 0)
30  {
32  PrintNetMessage(MSG_CONTINUE_SYNTAX);
33  PrintNetMessage(MSG_CONTINUE_HELP);
35  return 1;
36  }
37  }
38 
40  if (hManager == NULL)
41  {
42  ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError());
43  nError = 1;
44  goto done;
45  }
46 
47  hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
48  if (hService == NULL)
49  {
50  ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError());
51  nError = 1;
52  goto done;
53  }
54 
56  {
57  ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError());
58  nError = 1;
59  }
60 
61 done:
62  if (hService != NULL)
63  CloseServiceHandle(hService);
64 
65  if (hManager != NULL)
66  CloseServiceHandle(hManager);
67 
68  return nError;
69 }
static int argc
Definition: ServiceArgs.c:12
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICES_ACTIVE_DATABASE
Definition: winsvc.h:564
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define OpenService
Definition: winsvc.h:576
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
#define IDS_GENERIC_PAGE
Definition: resource.h:119
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
#define OpenSCManager
Definition: winsvc.h:575
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
#define StdOut
Definition: stream.h:76
static SERVICE_STATUS status
Definition: service.c:31
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:59
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: ps.c:97

◆ cmdGroup()

INT cmdGroup ( INT  argc,
WCHAR **  argv 
)

Definition at line 154 of file cmdGroup.c.

157 {
158  INT i, j;
159  INT result = 0;
160  ULONG dwUserCount = 0;
161  BOOL bAdd = FALSE;
162  BOOL bDelete = FALSE;
163 #if 0
164  BOOL bDomain = FALSE;
165 #endif
166  PWSTR pGroupName = NULL;
167  PWSTR pComment = NULL;
168  PWSTR *pUsers = NULL;
169  GROUP_INFO_0 Info0;
170  GROUP_INFO_1 Info1;
171  GROUP_INFO_1002 Info1002;
173 
174  if (argc == 2)
175  {
177  ConPrintf(StdOut, L"Status: %lu\n", Status);
178  return 0;
179  }
180  else if (argc == 3)
181  {
182  Status = DisplayGroup(argv[2]);
183  ConPrintf(StdOut, L"Status: %lu\n", Status);
184  return 0;
185  }
186 
187  i = 2;
188  if (argv[i][0] != L'/')
189  {
190  pGroupName = argv[i];
191  i++;
192  }
193 
194  for (j = i; j < argc; j++)
195  {
196  if (argv[j][0] == L'/')
197  break;
198 
199  dwUserCount++;
200  }
201 
202  if (dwUserCount > 0)
203  {
204  pUsers = RtlAllocateHeap(RtlGetProcessHeap(),
206  dwUserCount * sizeof(PGROUP_USERS_INFO_0));
207  if (pUsers == NULL)
208  return 0;
209  }
210 
211  j = 0;
212  for (; i < argc; i++)
213  {
214  if (argv[i][0] == L'/')
215  break;
216 
217  pUsers[j] = argv[i];
218  j++;
219  }
220 
221  for (; i < argc; i++)
222  {
223  if (_wcsicmp(argv[i], L"/help") == 0)
224  {
226  PrintNetMessage(MSG_GROUP_SYNTAX);
227  PrintNetMessage(MSG_GROUP_HELP);
229  return 0;
230  }
231  else if (_wcsicmp(argv[i], L"/add") == 0)
232  {
233  bAdd = TRUE;
234  }
235  else if (_wcsicmp(argv[i], L"/delete") == 0)
236  {
237  bDelete = TRUE;
238  }
239  else if (_wcsnicmp(argv[i], L"/comment:", 9) == 0)
240  {
241  pComment = &argv[i][9];
242  }
243  else if (_wcsicmp(argv[i], L"/domain") == 0)
244  {
246 #if 0
247  bDomain = TRUE;
248 #endif
249  }
250  else
251  {
252  PrintErrorMessage(3506/*, argv[i]*/);
253  result = 1;
254  goto done;
255  }
256  }
257 
258  if (pGroupName == NULL)
259  {
260  result = 1;
261  goto done;
262  }
263 
264  if (bAdd && bDelete)
265  {
266  result = 1;
267  goto done;
268  }
269 
270  if (pUsers == NULL)
271  {
272  if (!bAdd && !bDelete && pComment != NULL)
273  {
274  /* Set group comment */
275  Info1002.grpi1002_comment = pComment;
277  pGroupName,
278  1002,
279  (LPBYTE)&Info1002,
280  NULL);
281  ConPrintf(StdOut, L"Status: %lu\n", Status);
282  }
283  else if (bAdd && !bDelete)
284  {
285  /* Add the group */
286  if (pComment == NULL)
287  {
288  Info0.grpi0_name = pGroupName;
289  }
290  else
291  {
292  Info1.grpi1_name = pGroupName;
293  Info1.grpi1_comment = pComment;
294  }
295 
297  (pComment == NULL) ? 0 : 1,
298  (pComment == NULL) ? (LPBYTE)&Info0 : (LPBYTE)&Info1,
299  NULL);
300  ConPrintf(StdOut, L"Status: %lu\n", Status);
301  }
302  else if (!bAdd && bDelete && pComment == NULL)
303  {
304  /* Delete the group */
306  pGroupName);
307  ConPrintf(StdOut, L"Status: %lu\n", Status);
308  }
309  else
310  {
311  result = 1;
312  }
313  }
314  else
315  {
316  if (bAdd && !bDelete && pComment == NULL)
317  {
318  /* Add group user */
319  for (i = 0; i < dwUserCount; i++)
320  {
322  pGroupName,
323  pUsers[i]);
324  if (Status != NERR_Success)
325  break;
326  }
327  ConPrintf(StdOut, L"Status: %lu\n", Status);
328  }
329  else if (!bAdd && bDelete && pComment == NULL)
330  {
331  /* Delete group members */
332  for (i = 0; i < dwUserCount; i++)
333  {
335  pGroupName,
336  pUsers[i]);
337  if (Status != NERR_Success)
338  break;
339  }
340  ConPrintf(StdOut, L"Status: %lu\n", Status);
341  }
342  else
343  {
344  result = 1;
345  }
346  }
347 
348 done:
349  if (pUsers != NULL)
350  RtlFreeHeap(RtlGetProcessHeap(), 0, pUsers);
351 
352  if (result != 0)
353  {
355  PrintNetMessage(MSG_GROUP_SYNTAX);
356  }
357 
358  return result;
359 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:54
LPWSTR grpi0_name
Definition: lmaccess.h:474
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
LPWSTR grpi1002_comment
Definition: lmaccess.h:493
_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)
NET_API_STATUS WINAPI NetGroupSetInfo(_In_opt_ LPCWSTR servername, _In_ LPCWSTR groupname, _In_ DWORD level, _In_ LPBYTE buf, _Out_opt_ LPDWORD parm_err)
Definition: group_new.c:1379
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
static NET_API_STATUS EnumerateGroups(VOID)
Definition: cmdGroup.c:23
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
unsigned char * LPBYTE
Definition: typedefs.h:52
static NET_API_STATUS DisplayGroup(LPWSTR lpGroupName)
Definition: cmdGroup.c:75
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
#define IDS_GENERIC_PAGE
Definition: resource.h:119
smooth NULL
Definition: ftsmooth.c:416
NET_API_STATUS WINAPI NetGroupAddUser(_In_opt_ LPCWSTR servername, _In_ LPCWSTR groupname, _In_ LPCWSTR username)
Definition: group_new.c:463
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
Definition: glfuncs.h:250
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
unsigned int BOOL
Definition: ntddk_ex.h:94
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
#define IDS_ERROR_OPTION_NOT_SUPPORTED
Definition: resource.h:121
static const WCHAR L[]
Definition: oid.c:1250
LPWSTR grpi1_comment
Definition: lmaccess.h:478
LPWSTR grpi1_name
Definition: lmaccess.h:477
Status
Definition: gdiplustypes.h:24
NET_API_STATUS WINAPI NetGroupAdd(_In_opt_ LPCWSTR servername, _In_ DWORD level, _In_ LPBYTE buf, _Out_opt_ LPDWORD parm_err)
Definition: group_new.c:286
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
NET_API_STATUS WINAPI NetGroupDelUser(_In_opt_ LPCWSTR servername, _In_ LPCWSTR groupname, _In_ LPCWSTR username)
Definition: group_new.c:662
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define StdOut
Definition: stream.h:76
unsigned int ULONG
Definition: retypes.h:1
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
NET_API_STATUS WINAPI NetGroupDel(_In_opt_ LPCWSTR servername, _In_ IN LPCWSTR groupname)
Definition: group_new.c:579

◆ cmdHelp()

INT cmdHelp ( INT  argc,
WCHAR **  argv 
)

Definition at line 12 of file cmdHelp.c.

13 {
15 
16 /*
17  if (argc != 3)
18  {
19  ConResPuts(StdOut, IDS_HELP_SYNTAX);
20  return 0;
21  }
22 */
23  if (_wcsicmp(argv[2], L"ACCOUNTS") == 0)
24  {
25  PrintNetMessage(MSG_ACCOUNTS_SYNTAX);
26  PrintNetMessage(MSG_ACCOUNTS_HELP);
28  return 0;
29  }
30 
31  if (_wcsicmp(argv[2], L"COMPUTER") == 0)
32  {
33  PrintNetMessage(MSG_COMPUTER_SYNTAX);
34  PrintNetMessage(MSG_COMPUTER_HELP);
35  return 0;
36  }
37 
38  if (_wcsicmp(argv[2], L"CONFIG") == 0)
39  {
40  if ((argc > 3) && (_wcsicmp(argv[3], L"SERVER") == 0))
41  {
42  PrintNetMessage(MSG_CONFIG_SERVER_SYNTAX);
43  PrintNetMessage(MSG_CONFIG_SERVER_HELP);
45  return 0;
46  }
47  else
48  {
49  PrintNetMessage(MSG_CONFIG_SYNTAX);
50  PrintNetMessage(MSG_CONFIG_HELP);
52  return 0;
53  }
54  }
55 
56  if (_wcsicmp(argv[2], L"CONTINUE") == 0)
57  {
58  PrintNetMessage(MSG_CONTINUE_SYNTAX);
59  PrintNetMessage(MSG_CONTINUE_HELP);
60  return 0;
61  }
62 
63  if (_wcsicmp(argv[2], L"FILE") == 0)
64  {
65  PrintNetMessage(MSG_FILE_SYNTAX);
66  PrintNetMessage(MSG_FILE_HELP);
67  return 0;
68  }
69 
70  if (_wcsicmp(argv[2], L"GROUP") == 0)
71  {
72  PrintNetMessage(MSG_GROUP_SYNTAX);
73  PrintNetMessage(MSG_GROUP_HELP);
75  return 0;
76  }
77 
78  if (_wcsicmp(argv[2], L"HELPMSG") == 0)
79  {
80  PrintNetMessage(MSG_HELPMSG_SYNTAX);
81  PrintNetMessage(MSG_HELPMSG_HELP);
82  return 0;
83  }
84 
85  if (_wcsicmp(argv[2], L"LOCALGROUP") == 0)
86  {
87  PrintNetMessage(MSG_LOCALGROUP_SYNTAX);
88  PrintNetMessage(MSG_LOCALGROUP_HELP);
90  return 0;
91  }
92 
93  if (_wcsicmp(argv[2], L"NAME") == 0)
94  {
95  PrintNetMessage(MSG_NAME_SYNTAX);
96  PrintNetMessage(MSG_NAME_HELP);
97  return 0;
98  }
99 
100  if (_wcsicmp(argv[2], L"PAUSE") == 0)
101  {
102  PrintNetMessage(MSG_PAUSE_SYNTAX);
103  PrintNetMessage(MSG_PAUSE_HELP);
104  return 0;
105  }
106 
107  if (_wcsicmp(argv[2], L"PRINT") == 0)
108  {
109  PrintNetMessage(MSG_PRINT_SYNTAX);
110  PrintNetMessage(MSG_PRINT_HELP);
111  return 0;
112  }
113 
114  if (_wcsicmp(argv[2], L"SEND") == 0)
115  {
116  PrintNetMessage(MSG_SEND_SYNTAX);
117  PrintNetMessage(MSG_SEND_HELP);
118  return 0;
119  }
120 
121  if (_wcsicmp(argv[2], L"SESSION") == 0)
122  {
123  PrintNetMessage(MSG_SESSION_SYNTAX);
124  PrintNetMessage(MSG_SESSION_HELP);
125  return 0;
126  }
127 
128  if (_wcsicmp(argv[2], L"SHARE") == 0)
129  {
130  PrintNetMessage(MSG_SHARE_SYNTAX);
131  PrintNetMessage(MSG_SHARE_HELP);
132  return 0;
133  }
134 
135  if (_wcsicmp(argv[2], L"START") == 0)
136  {
137  PrintNetMessage(MSG_START_SYNTAX);
138  PrintNetMessage(MSG_START_HELP);
139  return 0;
140  }
141 
142  if (_wcsicmp(argv[2], L"STATISTICS") == 0)
143  {
144  PrintNetMessage(MSG_STATISTICS_SYNTAX);
145  PrintNetMessage(MSG_STATISTICS_HELP);
146  return 0;
147  }
148 
149  if (_wcsicmp(argv[2], L"STOP") == 0)
150  {
151  PrintNetMessage(MSG_STOP_SYNTAX);
152  PrintNetMessage(MSG_STOP_HELP);
153  return 0;
154  }
155 
156  if (_wcsicmp(argv[2], L"TIME") == 0)
157  {
158  PrintNetMessage(MSG_TIME_SYNTAX);
159  PrintNetMessage(MSG_TIME_HELP);
160  return 0;
161  }
162 
163  if (_wcsicmp(argv[2], L"USE") == 0)
164  {
165  PrintNetMessage(MSG_USE_SYNTAX);
166  PrintNetMessage(MSG_USE_HELP);
167  return 0;
168  }
169 
170  if (_wcsicmp(argv[2], L"USER") == 0)
171  {
172  PrintNetMessage(MSG_USER_SYNTAX);
173  PrintNetMessage(MSG_USER_HELP);
174  return 0;
175  }
176 
177  if (_wcsicmp(argv[2], L"VIEW") == 0)
178  {
179  PrintNetMessage(MSG_VIEW_SYNTAX);
180  PrintNetMessage(MSG_VIEW_HELP);
181  return 0;
182  }
183 
184 #if 0
185  if (_wcsicmp(argv[2], L"SERVICES") == 0)
186  {
187  return 0;
188  }
189 
190  if (_wcsicmp(argv[2], L"SYNTAX") == 0)
191  {
192  return 0;
193  }
194 #endif
195 
196  PrintNetMessage(MSG_HELP_SYNTAX);
197  PrintNetMessage(MSG_HELP_HELP);
198 
199  return 0;
200 }
static int argc
Definition: ServiceArgs.c:12
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
#define IDS_GENERIC_PAGE
Definition: resource.h:119
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
#define StdOut
Definition: stream.h:76
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ cmdHelpMsg()

INT cmdHelpMsg ( INT  argc,
WCHAR **  argv 
)

Definition at line 14 of file cmdHelpMsg.c.

15 {
16  INT i;
17  LONG errNum;
18  PWSTR endptr;
19  PWSTR pBuffer;
20  PWSTR pInserts[10] = {L"***", L"***", L"***", L"***",
21  L"***", L"***", L"***", L"***",
22  L"***", NULL};
23 
24  if (argc < 3)
25  {
27  PrintNetMessage(MSG_HELPMSG_SYNTAX);
28  return 1;
29  }
30 
31  for (i = 2; i < argc; i++)
32  {
33  if (_wcsicmp(argv[i], L"/help") == 0)
34  {
36  PrintNetMessage(MSG_HELPMSG_SYNTAX);
37  PrintNetMessage(MSG_HELPMSG_HELP);
38  return 1;
39  }
40  }
41 
42  errNum = wcstol(argv[2], &endptr, 10);
43  if (*endptr != 0)
44  {
46  PrintNetMessage(MSG_HELPMSG_SYNTAX);
47  return 1;
48  }
49 
50  if (errNum >= MIN_LANMAN_MESSAGE_ID && errNum <= MAX_LANMAN_MESSAGE_ID)
51  {
55  errNum,
57  (LPWSTR)&pBuffer,
58  0,
59  (va_list *)pInserts);
60  if (pBuffer)
61  {
62  ConPrintf(StdOut, L"\n%s\n", pBuffer);
64  }
65  else
66  {
67  PrintErrorMessage(3871);
68  }
69  }
70  else
71  {
72  /* Retrieve the message string without appending extra newlines */
75  NULL,
76  errNum,
78  (LPWSTR)&pBuffer,
79  0,
80  (va_list *)pInserts);
81  if (pBuffer)
82  {
83  ConPrintf(StdOut, L"\n%s\n", pBuffer);
85  }
86  else
87  {
88  PrintErrorMessage(3871);
89  }
90  }
91 
92  return 0;
93 }
static int argc
Definition: ServiceArgs.c:12
uint16_t * PWSTR
Definition: typedefs.h:54
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:405
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
long LONG
Definition: pedump.c:60
#define MIN_LANMAN_MESSAGE_ID
Definition: lmcons.h:10
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
char * va_list
Definition: acmsvcex.h:78
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
#define MAX_LANMAN_MESSAGE_ID
Definition: lmcons.h:11
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define StdOut
Definition: stream.h:76
HMODULE hModuleNetMsg
Definition: main.c:48
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

◆ cmdLocalGroup()

INT cmdLocalGroup ( INT  argc,
WCHAR **  argv 
)

Definition at line 172 of file cmdLocalGroup.c.

175 {
176  INT i, j;
177  INT result = 0;
178  ULONG dwMemberCount = 0;
179  BOOL bAdd = FALSE;
180  BOOL bDelete = FALSE;
181 #if 0
182  BOOL bDomain = FALSE;
183 #endif
184  LPWSTR lpGroupName = NULL;
185  LPWSTR lpComment = NULL;
186  LPLOCALGROUP_MEMBERS_INFO_3 lpMembers = NULL;
187  LOCALGROUP_INFO_0 Info0;
188  LOCALGROUP_INFO_1 Info1;
189  LOCALGROUP_INFO_1002 Info1002;
191 
192  if (argc == 2)
193  {
195  ConPrintf(StdOut, L"Status: %lu\n", Status);
196  return 0;
197  }
198  else if (argc == 3)
199  {
201  ConPrintf(StdOut, L"Status: %lu\n", Status);
202  return 0;
203  }
204 
205  i = 2;
206  if (argv[i][0] != L'/')
207  {
208  lpGroupName = argv[i];
209  i++;
210  }
211 
212  for (j = i; j < argc; j++)
213  {
214  if (argv[j][0] == L'/')
215  break;
216 
217  dwMemberCount++;
218  }
219 
220  ConPrintf(StdOut, L"Member count: %lu\n", dwMemberCount);
221 
222  if (dwMemberCount > 0)
223  {
224  lpMembers = RtlAllocateHeap(RtlGetProcessHeap(),
226  dwMemberCount * sizeof(LPLOCALGROUP_MEMBERS_INFO_3));
227  if (lpMembers == NULL)
228  return 0;
229  }
230 
231  j = 0;
232  for (; i < argc; i++)
233  {
234  if (argv[i][0] == L'/')
235  break;
236 
237  lpMembers[j].lgrmi3_domainandname = argv[i];
238  j++;
239  }
240 
241  for (; i < argc; i++)
242  {
243  if (_wcsicmp(argv[i], L"/help") == 0)
244  {
246  PrintNetMessage(MSG_LOCALGROUP_SYNTAX);
247  PrintNetMessage(MSG_LOCALGROUP_HELP);
249  return 0;
250  }
251  else if (_wcsicmp(argv[i], L"/add") == 0)
252  {
253  bAdd = TRUE;
254  }
255  else if (_wcsicmp(argv[i], L"/delete") == 0)
256  {
257  bDelete = TRUE;
258  }
259  else if (_wcsnicmp(argv[i], L"/comment:", 9) == 0)
260  {
261  lpComment = &argv[i][9];
262  }
263  else if (_wcsicmp(argv[i], L"/domain") == 0)
264  {
266 #if 0
267  bDomain = TRUE;
268 #endif
269  }
270  else
271  {
272  PrintErrorMessage(3506/*, argv[i]*/);
273  result = 1;
274  goto done;
275  }
276  }
277 
278  if (lpGroupName == NULL)
279  {
280  result = 1;
281  goto done;
282  }
283 
284  if (bAdd && bDelete)
285  {
286  result = 1;
287  goto done;
288  }
289 
290 #if 0
291  ConPrintf(StdOut, L"Group:\n %s\n", lpGroupName);
292 
293  if (lpMembers != NULL)
294  {
295  ConPuts(StdOut, L"\nMembers:\n");
296  for (i = 0; i < dwMemberCount; i++)
297  ConPrintf(StdOut, L" %s\n", lpMembers[i].lgrmi3_domainandname);
298  }
299 
300  if (lpComment != NULL)
301  {
302  ConPrintf(StdOut, L"\nComment:\n %s\n", lpComment);
303  }
304 #endif
305 
306  if (lpMembers == NULL)
307  {
308  if (!bAdd && !bDelete && lpComment != NULL)
309  {
310  /* Set group comment */
311  Info1002.lgrpi1002_comment = lpComment;
313  lpGroupName,
314  1002,
315  (LPBYTE)&Info1002,
316  NULL);
317  ConPrintf(StdOut, L"Status: %lu\n", Status);
318  }
319  else if (bAdd && !bDelete)
320  {
321  /* Add the group */
322  if (lpComment == NULL)
323  {
324  Info0.lgrpi0_name = lpGroupName;
325  }
326  else
327  {
328  Info1.lgrpi1_name = lpGroupName;
329  Info1.lgrpi1_comment = lpComment;
330  }
331 
333  (lpComment == NULL) ? 0 : 1,
334  (lpComment == NULL) ? (LPBYTE)&Info0 : (LPBYTE)&Info1,
335  NULL);
336  ConPrintf(StdOut, L"Status: %lu\n", Status);
337  }
338  else if (!bAdd && bDelete && lpComment == NULL)
339  {
340  /* Delete the group */
342  lpGroupName);
343  ConPrintf(StdOut, L"Status: %lu\n", Status);
344  }
345  else
346  {
347  result = 1;
348  }
349  }
350  else
351  {
352  if (bAdd && !bDelete && lpComment == NULL)
353  {
354  /* Add group members */
356  lpGroupName,
357  3,
358  (LPBYTE)lpMembers,
359  dwMemberCount);
360  ConPrintf(StdOut, L"Status: %lu\n", Status);
361  }
362  else if (!bAdd && bDelete && lpComment == NULL)
363  {
364  /* Delete group members */
366  lpGroupName,
367  3,
368  (LPBYTE)lpMembers,
369  dwMemberCount);
370  ConPrintf(StdOut, L"Status: %lu\n", Status);
371  }
372  else
373  {
374  result = 1;
375  }
376  }
377 
378 done:
379  if (lpMembers != NULL)
380  RtlFreeHeap(RtlGetProcessHeap(), 0, lpMembers);
381 
382  if (result != 0)
383  {
385  PrintNetMessage(MSG_LOCALGROUP_SYNTAX);
386  }
387 
388  return result;
389 }
NET_API_STATUS WINAPI NetLocalGroupDelMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:814
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
NET_API_STATUS WINAPI NetLocalGroupAddMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:517
NET_API_STATUS WINAPI NetLocalGroupAdd(LPCWSTR servername, DWORD level, LPBYTE buf, LPDWORD parm_err)
Definition: local_group.c:334
static NET_API_STATUS EnumerateLocalGroups(VOID)
Definition: cmdLocalGroup.c:25
static NET_API_STATUS DisplayLocalGroup(LPWSTR lpGroupName)
Definition: cmdLocalGroup.c:78
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
_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)
LPWSTR lgrpi1_comment
Definition: lmaccess.h:510
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
NET_API_STATUS WINAPI NetLocalGroupSetInfo(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, LPDWORD parm_err)
Definition: local_group.c:1729
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
unsigned char * LPBYTE
Definition: typedefs.h:52
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
#define IDS_GENERIC_PAGE
Definition: resource.h:119
smooth NULL
Definition: ftsmooth.c:416
LPWSTR lgrpi1002_comment
Definition: lmaccess.h:513
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
Definition: glfuncs.h:250
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
unsigned int BOOL
Definition: ntddk_ex.h:94
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
LPWSTR lgrpi0_name
Definition: lmaccess.h:506
#define IDS_ERROR_OPTION_NOT_SUPPORTED
Definition: resource.h:121
static const WCHAR L[]
Definition: oid.c:1250
LPWSTR lgrpi1_name
Definition: lmaccess.h:509
Status
Definition: gdiplustypes.h:24
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76
NET_API_STATUS WINAPI NetLocalGroupDel(LPCWSTR servername, LPCWSTR groupname)
Definition: local_group.c:674
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ cmdPause()

INT cmdPause ( INT  argc,
WCHAR **  argv 
)

Definition at line 12 of file cmdPause.c.

13 {
14  SC_HANDLE hManager = NULL;
15  SC_HANDLE hService = NULL;
17  INT nError = 0;
18  INT i;
19 
20  if (argc != 3)
21  {
23  PrintNetMessage(MSG_PAUSE_SYNTAX);
24  return 1;
25  }
26 
27  for (i = 2; i < argc; i++)
28  {
29  if (_wcsicmp(argv[i], L"/help") == 0)
30  {
32  PrintNetMessage(MSG_PAUSE_SYNTAX);
33  PrintNetMessage(MSG_PAUSE_HELP);
34  return 1;
35  }
36  }
37 
39  if (hManager == NULL)
40  {
41  ConPrintf(StdErr, L"[OpenSCManager] Error: %ld\n", GetLastError());
42  nError = 1;
43  goto done;
44  }
45 
46  hService = OpenService(hManager, argv[2], SERVICE_PAUSE_CONTINUE);
47  if (hService == NULL)
48  {
49  ConPrintf(StdErr, L"[OpenService] Error: %ld\n", GetLastError());
50  nError = 1;
51  goto done;
52  }
53 
55  {
56  ConPrintf(StdErr, L"[ControlService] Error: %ld\n", GetLastError());
57  }
58 
59 done:
60  if (hService != NULL)
61  CloseServiceHandle(hService);
62 
63  if (hManager != NULL)
64  CloseServiceHandle(hManager);
65 
66  return nError;
67 }
static int argc
Definition: ServiceArgs.c:12
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define SERVICES_ACTIVE_DATABASE
Definition: winsvc.h:564
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define OpenService
Definition: winsvc.h:576
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
#define OpenSCManager
Definition: winsvc.h:575
#define StdErr
Definition: stream.h:77
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
#define StdOut
Definition: stream.h:76
static SERVICE_STATUS status
Definition: service.c:31
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:59
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
Definition: ps.c:97

◆ cmdStart()

INT cmdStart ( INT  argc,
WCHAR **  argv 
)

Definition at line 163 of file cmdStart.c.

164 {
165  INT i;
166 
167  if (argc == 2)
168  {
169  return EnumerateRunningServices();
170  }
171 
172  for (i = 2; i < argc; i++)
173  {
174  if (_wcsicmp(argv[i], L"/help") == 0)
175  {
177  PrintNetMessage(MSG_START_SYNTAX);
178  PrintNetMessage(MSG_START_HELP);
179  return 1;
180  }
181  }
182 
183  return StartOneService(argc, argv);
184 }
static int argc
Definition: ServiceArgs.c:12
static INT StartOneService(INT argc, WCHAR **argv)
Definition: cmdStart.c:91
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
static INT EnumerateRunningServices(VOID)
Definition: cmdStart.c:15
#define StdOut
Definition: stream.h:76
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by CommandShell().

◆ cmdStatistics()

INT cmdStatistics ( INT  argc,
WCHAR **  argv 
)

Definition at line 240 of file cmdStatistics.c.

243 {
244  INT i, result = 0;
245  BOOL bServer = FALSE;
246  BOOL bWorkstation = FALSE;
247 
248  for (i = 2; i < argc; i++)
249  {
250  if (_wcsicmp(argv[i], L"server") == 0)
251  {
252  if (bWorkstation == FALSE)
253  bServer = TRUE;
254  continue;
255  }
256 
257  if (_wcsicmp(argv[i], L"workstation") == 0)
258  {
259  if (bServer == FALSE)
260  bWorkstation = TRUE;
261  continue;
262  }
263 
264  if (_wcsicmp(argv[i], L"help") == 0)
265  {
266  /* Print short syntax help */
268  PrintNetMessage(MSG_STATISTICS_SYNTAX);
269  return 0;
270  }
271 
272  if (_wcsicmp(argv[i], L"/help") == 0)
273  {
274  /* Print full help text*/
276  PrintNetMessage(MSG_STATISTICS_SYNTAX);
277  PrintNetMessage(MSG_STATISTICS_HELP);
278  return 0;
279  }
280  }
281 
282  if (bServer)
283  {
285  }
286  else if (bWorkstation)
287  {
289  }
290  else
291  {
293  }
294 
295  if (result == 0)
297 
298  return result;
299 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDS_STATISTICS_TEXT
Definition: resource.h:45
static INT DisplayWorkstationStatistics(VOID)
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
unsigned int BOOL
Definition: ntddk_ex.h:94
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
static INT DisplayServerStatistics(VOID)
Definition: cmdStatistics.c:14
#define StdOut
Definition: stream.h:76
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ cmdStop()

INT cmdStop ( INT  argc,
WCHAR **  argv 
)

Definition at line 12 of file cmdStop.c.

13 {
14  SC_HANDLE hManager = NULL;
15  SC_HANDLE hService = NULL;
17  DWORD dwError = ERROR_SUCCESS;
18  INT nError = 0;
19  INT i;
20 
21  if (argc != 3)
22  {
24  PrintNetMessage(MSG_STOP_SYNTAX);
25  return 1;
26  }
27 
28  for (i = 2; i < argc; i++)
29  {
30  if (_wcsicmp(argv[i], L"/help") == 0)
31  {
33  PrintNetMessage(MSG_STOP_SYNTAX);
34  PrintNetMessage(MSG_STOP_HELP);
35  return 1;
36  }
37  }
38 
39  hManager = OpenSCManagerW(NULL,
42  if (hManager == NULL)
43  {
44  dwError = GetLastError();
45  nError = 1;
46  goto done;
47  }
48 
49  hService = OpenServiceW(hManager,
50  argv[2],
51  SERVICE_STOP);
52  if (hService == NULL)
53  {
54  dwError = GetLastError();
55  nError = 1;
56  goto done;
57  }
58 
60  {
61  dwError = GetLastError();
62  nError = 1;
63  goto done;
64  }
65 
66 done:
67  if (hService != NULL)
68  CloseServiceHandle(hService);
69 
70  if (hManager != NULL)
71  CloseServiceHandle(hManager);
72 
73  if (dwError != ERROR_SUCCESS)
74  {
75  /* FIXME: Print proper error message */
76  ConPrintf(StdErr, L"Error: %lu\n", dwError);
77  }
78 
79  return nError;
80 }
static int argc
Definition: ServiceArgs.c:12
#define SC_MANAGER_ENUMERATE_SERVICE
Definition: winsvc.h:16
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SERVICES_ACTIVE_DATABASE
Definition: winsvc.h:564
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
#define SERVICE_STOP
Definition: winsvc.h:58
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
SERVICE_STATUS ServiceStatus
Definition: dhcpcsvc.c:18
#define StdOut
Definition: stream.h:76
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by CommandShell().

◆ cmdUse()

INT cmdUse ( INT  argc,
WCHAR **  argv 
)

Definition at line 102 of file cmdUse.c.

105 {
107 
108  if (argc == 2)
109  {
111  if (Status == NO_ERROR)
113  else
115 
116  return 0;
117  }
118  else if (argc == 3)
119  {
120  if (!ValidateDeviceName(argv[2]))
121  {
123  return 1;
124  }
125 
127  if (Status == NO_ERROR)
129  else
131 
132  return 0;
133  }
134 
135  Delete = 0;
136  if (wcsicmp(argv[2], L"/DELETE") == 0)
137  {
138  Delete = 3;
139  }
140  else
141  {
142  if ((argv[2][0] != '*' && argv[2][1] != 0) &&
144  {
146  return 1;
147  }
148  }
149 
150  if (wcsicmp(argv[3], L"/DELETE") == 0)
151  {
152  Delete = 2;
153  }
154 
155  if (Delete != 0)
156  {
157  if (!ValidateDeviceName(argv[Delete]) || argv[Delete][0] == L'*')
158  {
160  return 1;
161  }
162 
164  if (Status != NO_ERROR)
166 
167  return Status;
168  }
169  else
170  {
171  BOOL Persist = FALSE;
172  NETRESOURCE lpNet;
173  WCHAR Access[256];
174  DWORD OutFlags = 0, Size = ARRAYSIZE(Access);
175 
176  Len = wcslen(argv[3]);
177  if (Len < 4)
178  {
180  return 1;
181  }
182 
183  if (argv[3][0] != L'\\' || argv[3][1] != L'\\')
184  {
186  return 1;
187  }
188 
189  if (argc > 4)
190  {
191  LPWSTR Cpy;
192  Len = wcslen(argv[4]);
193  if (Len > 12)
194  {
195  Cpy = HeapAlloc(GetProcessHeap(), 0, (Len + 1) * sizeof(WCHAR));
196  if (Cpy)
197  {
198  INT i;
199  for (i = 0; i < Len; ++i)
200  Cpy[i] = towupper(argv[4][i]);
201 
202  if (wcsstr(Cpy, L"/PERSISTENT:") == Cpy)
203  {
204  LPWSTR Arg = Cpy + 12;
205  if (Len == 14 && Arg[0] == 'N' && Arg[1] == 'O')
206  {
207  Persist = FALSE;
208  }
209  else if (Len == 15 && Arg[0] == 'Y' && Arg[1] == 'E' && Arg[2] == 'S')
210  {
211  Persist = TRUE;
212  }
213  else
214  {
215  HeapFree(GetProcessHeap(), 0, Cpy);
217  return 1;
218  }
219  }
220  HeapFree(GetProcessHeap(), 0, Cpy);
221  }
222  }
223 
224  }
225 
226  lpNet.dwType = RESOURCETYPE_DISK;
227  lpNet.lpLocalName = (argv[2][0] != L'*') ? argv[2] : NULL;
228  lpNet.lpRemoteName = argv[3];
229  lpNet.lpProvider = NULL;
230 
231  Status = WNetUseConnection(NULL, &lpNet, NULL, NULL, CONNECT_REDIRECT | (Persist ? CONNECT_UPDATE_PROFILE : 0), Access, &Size, &OutFlags);
232  if (argv[2][0] == L'*' && Status == NO_ERROR && OutFlags == CONNECT_LOCALDRIVE)
234  else if (Status != NO_ERROR)
236 
237  return Status;
238  }
239 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
DWORD dwType
Definition: winnetwk.h:168
#define CONNECT_UPDATE_PROFILE
Definition: winnetwk.h:87
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define WNetCancelConnection2
Definition: winnetwk.h:607
#define IDS_ERROR_INVALID_OPTION_VALUE
Definition: resource.h:122
LPSTR lpLocalName
Definition: winnetwk.h:171
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define WNetUseConnection
Definition: winnetwk.h:609
#define argv
Definition: mplay32.c:18
#define NO_ERROR
Definition: dderror.h:5
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
static IPersist Persist
Definition: atl.c:503
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpProvider
Definition: winnetwk.h:174
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
static DWORD EnumerateConnections(LPCWSTR Local)
Definition: cmdUse.c:14
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CONNECT_REDIRECT
Definition: winnetwk.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID PrintError(DWORD Status)
Definition: cmdUse.c:68
#define Len
Definition: deflate.h:82
#define StdErr
Definition: stream.h:77
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_USE_NOW_CONNECTED
Definition: resource.h:109
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define wcsicmp
Definition: string.h:1152
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
Status
Definition: gdiplustypes.h:24
static BOOL ValidateDeviceName(PWSTR DevName)
Definition: cmdUse.c:83
static VOID PrintErrorMessage(DWORD dwError)
Definition: at.c:308
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define CONNECT_LOCALDRIVE
Definition: winnetwk.h:95
#define StdOut
Definition: stream.h:76
#define towupper(c)
Definition: wctype.h:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ cmdUser()

INT cmdUser ( INT  argc,
WCHAR **  argv 
)

Definition at line 616 of file cmdUser.c.

619 {
620  INT i, j;
621  INT result = 0;
622  BOOL bAdd = FALSE;
623  BOOL bDelete = FALSE;
624 #if 0
625  BOOL bDomain = FALSE;
626 #endif
627  BOOL bRandomPassword = FALSE;
628  LPWSTR lpUserName = NULL;
629  LPWSTR lpPassword = NULL;
630  PUSER_INFO_4 pUserInfo = NULL;
631  USER_INFO_4 UserInfo;
632  LPWSTR pWorkstations = NULL;
633  LPWSTR p;
634  LPWSTR endptr;
635  DWORD value;
636  BOOL bPasswordAllocated = FALSE;
638 
639  i = 2;
640  if (argv[i][0] != L'/')
641  {
642  lpUserName = argv[i];
643 // ConPrintf(StdOut, L"User: %s\n", lpUserName);
644  i++;
645  }
646 
647  if (argv[i][0] != L'/')
648  {
649  lpPassword = argv[i];
650 // ConPrintf(StdOut, L"Password: %s\n", lpPassword);
651  i++;
652  }
653 
654  for (j = i; j < argc; j++)
655  {
656  if (_wcsicmp(argv[j], L"/help") == 0)
657  {
658  PrintNetMessage(MSG_USER_HELP);
659  return 0;
660  }
661  else if (_wcsicmp(argv[j], L"/add") == 0)
662  {
663  bAdd = TRUE;
664  }
665  else if (_wcsicmp(argv[j], L"/delete") == 0)
666  {
667  bDelete = TRUE;
668  }
669  else if (_wcsicmp(argv[j], L"/domain") == 0)
670  {
672 #if 0
673  bDomain = TRUE;
674 #endif
675  }
676  else if (_wcsicmp(argv[j], L"/random") == 0)
677  {
678  bRandomPassword = TRUE;
679  GenerateRandomPassword(&lpPassword,
680  &bPasswordAllocated);
681  }
682  }
683 
684  if (lpUserName == NULL && lpPassword == NULL)
685  {
687  ConPrintf(StdOut, L"Status: %lu\n", Status);
688  return 0;
689  }
690  else if (lpUserName != NULL && lpPassword == NULL)
691  {
692  Status = DisplayUser(lpUserName);
693  ConPrintf(StdOut, L"Status: %lu\n", Status);
694  return 0;
695  }
696 
697  if (bAdd && bDelete)
698  {
699  result = 1;
700  goto done;
701  }
702 
703  /* Interactive password input */
704  if (lpPassword != NULL && wcscmp(lpPassword, L"*") == 0)
705  {
706  ReadPassword(&lpPassword,
707  &bPasswordAllocated);
708  }
709 
710  if (!bAdd && !bDelete)
711  {
712  /* Modify the user */
714  lpUserName,
715  4,
716  (LPBYTE*)&pUserInfo);
717  if (Status != NERR_Success)
718  {
719  ConPrintf(StdOut, L"Status: %lu\n", Status);
720  result = 1;
721  goto done;
722  }
723  }
724  else if (bAdd && !bDelete)
725  {
726  /* Add the user */
727  ZeroMemory(&UserInfo, sizeof(USER_INFO_4));
728 
729  UserInfo.usri4_name = lpUserName;
730  UserInfo.usri4_password = lpPassword;
734 
735  pUserInfo = &UserInfo;
736  }
737 
738  for (j = i; j < argc; j++)
739  {
740  if (_wcsnicmp(argv[j], L"/active:", 8) == 0)
741  {
742  p = &argv[i][8];
743  if (_wcsicmp(p, L"yes") == 0)
744  {
745  pUserInfo->usri4_flags &= ~UF_ACCOUNTDISABLE;
746  }
747  else if (_wcsicmp(p, L"no") == 0)
748  {
749  pUserInfo->usri4_flags |= UF_ACCOUNTDISABLE;
750  }
751  else
752  {
754  result = 1;
755  goto done;
756  }
757  }
758  else if (_wcsnicmp(argv[j], L"/comment:", 9) == 0)
759  {
760  pUserInfo->usri4_comment = &argv[j][9];
761  }
762  else if (_wcsnicmp(argv[j], L"/countrycode:", 13) == 0)
763  {
764  p = &argv[i][13];
765  value = wcstoul(p, &endptr, 10);
766  if (*endptr != 0)
767  {
769  result = 1;
770  goto done;
771  }
772 
773  /* FIXME: verify the country code */
774 
775  pUserInfo->usri4_country_code = value;
776  }
777  else if (_wcsnicmp(argv[j], L"/expires:", 9) == 0)
778  {
779  p = &argv[i][9];
780  if (_wcsicmp(p, L"never") == 0)
781  {
782  pUserInfo->usri4_acct_expires = TIMEQ_FOREVER;
783  }
784  else if (!ParseDate(p, &pUserInfo->usri4_acct_expires))
785  {
787  result = 1;
788  goto done;
789 
790  /* FIXME: Parse the date */
791 // ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/EXPIRES");
792  }
793  }
794  else if (_wcsnicmp(argv[j], L"/fullname:", 10) == 0)
795  {
796  pUserInfo->usri4_full_name = &argv[j][10];
797  }
798  else if (_wcsnicmp(argv[j], L"/homedir:", 9) == 0)
799  {
800  pUserInfo->usri4_home_dir = &argv[j][9];
801  }
802  else if (_wcsnicmp(argv[j], L"/passwordchg:", 13) == 0)
803  {
804  p = &argv[i][13];
805  if (_wcsicmp(p, L"yes") == 0)
806  {
807  pUserInfo->usri4_flags &= ~UF_PASSWD_CANT_CHANGE;
808  }
809  else if (_wcsicmp(p, L"no") == 0)
810  {
811  pUserInfo->usri4_flags |= UF_PASSWD_CANT_CHANGE;
812  }
813  else
814  {
816  result = 1;
817  goto done;
818  }
819  }
820  else if (_wcsnicmp(argv[j], L"/passwordreq:", 13) == 0)
821  {
822  p = &argv[i][13];
823  if (_wcsicmp(p, L"yes") == 0)
824  {
825  pUserInfo->usri4_flags &= ~UF_PASSWD_NOTREQD;
826  }
827  else if (_wcsicmp(p, L"no") == 0)
828  {
829  pUserInfo->usri4_flags |= UF_PASSWD_NOTREQD;
830  }
831  else
832  {
834  result = 1;
835  goto done;
836  }
837  }
838  else if (_wcsnicmp(argv[j], L"/profilepath:", 13) == 0)
839  {
840  pUserInfo->usri4_profile = &argv[j][13];
841  }
842  else if (_wcsnicmp(argv[j], L"/scriptpath:", 12) == 0)
843  {
844  pUserInfo->usri4_script_path = &argv[j][12];
845  }
846  else if (_wcsnicmp(argv[j], L"/times:", 7) == 0)
847  {
848  /* FIXME */
850  }
851  else if (_wcsnicmp(argv[j], L"/usercomment:", 13) == 0)
852  {
853  pUserInfo->usri4_usr_comment = &argv[j][13];
854  }
855  else if (_wcsnicmp(argv[j], L"/workstations:", 14) == 0)
856  {
857  p = &argv[i][14];
858  if (wcscmp(p, L"*") == 0 || wcscmp(p, L"") == 0)
859  {
860  pUserInfo->usri4_workstations = NULL;
861  }
862  else
863  {
864  Status = BuildWorkstationsList(&pWorkstations, p);
865  if (Status == NERR_Success)
866  {
867  pUserInfo->usri4_workstations = pWorkstations;
868  }
869  else
870  {
871  ConPrintf(StdOut, L"Status %lu\n\n", Status);
872  result = 1;
873  goto done;
874  }
875  }
876  }
877  }
878 
879  if (!bAdd && !bDelete)
880  {
881  /* Modify the user */
883  lpUserName,
884  4,
885  (LPBYTE)pUserInfo,
886  NULL);
887  ConPrintf(StdOut, L"Status: %lu\n", Status);
888  }
889  else if (bAdd && !bDelete)
890  {
891  /* Add the user */
893  4,
894  (LPBYTE)pUserInfo,
895  NULL);
896  ConPrintf(StdOut, L"Status: %lu\n", Status);
897  }
898  else if (!bAdd && bDelete)
899  {
900  /* Delete the user */
902  lpUserName);
903  ConPrintf(StdOut, L"Status: %lu\n", Status);
904  }
905 
906  if (Status == NERR_Success &&
907  lpPassword != NULL &&
908  bRandomPassword == TRUE)
909  {
910  ConPrintf(StdOut, L"The password for %s is: %s\n", lpUserName, lpPassword);
911  }
912 
913 done:
914  if (pWorkstations != NULL)
915  HeapFree(GetProcessHeap(), 0, pWorkstations);
916 
917  if ((bPasswordAllocated == TRUE) && (lpPassword != NULL))
918  HeapFree(GetProcessHeap(), 0, lpPassword);
919 
920  if (!bAdd && !bDelete && pUserInfo != NULL)
921  NetApiBufferFree(pUserInfo);
922 
923  if (result != 0)
924  {
926  PrintNetMessage(MSG_USER_SYNTAX);
927  }
928 
929  return result;
930 }
static NET_API_STATUS DisplayUser(LPWSTR lpUserName)
Definition: cmdUser.c:135
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
_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)
#define IDS_ERROR_INVALID_OPTION_VALUE
Definition: resource.h:122
LPWSTR usri4_home_dir
Definition: lmaccess.h:274
#define ZeroMemory
Definition: winbase.h:1635
VOID PrintNetMessage(DWORD dwMessage)
Definition: main.c:149
DWORD usri4_flags
Definition: lmaccess.h:276
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
DWORD usri4_country_code
Definition: lmaccess.h:292
#define UF_PASSWD_CANT_CHANGE
Definition: lmaccess.h:28
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
Definition: glfuncs.h:248
#define IDS_GENERIC_SYNTAX
Definition: resource.h:118
static NET_API_STATUS EnumerateUsers(VOID)
Definition: cmdUser.c:26
unsigned char * LPBYTE
Definition: typedefs.h:52
LPWSTR usri4_workstations
Definition: lmaccess.h:282
LPWSTR usri4_full_name
Definition: lmaccess.h:279
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
NET_API_STATUS WINAPI NetUserAdd(LPCWSTR servername, DWORD level, LPBYTE bufptr, LPDWORD parm_err)
Definition: user.c:2046
DWORD usri4_primary_group_id
Definition: lmaccess.h:295
LPWSTR usri4_password
Definition: lmaccess.h:271
smooth NULL
Definition: ftsmooth.c:416
#define UF_PASSWD_NOTREQD
Definition: lmaccess.h:27
NET_API_STATUS WINAPI NetUserGetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE *bufptr)
Definition: user.c:2803
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
Definition: glfuncs.h:250
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
DWORD usri4_acct_expires
Definition: lmaccess.h:285
static VOID ReadPassword(LPWSTR *lpPassword, LPBOOL lpAllocated)
Definition: cmdUser.c:316
LPWSTR usri4_profile
Definition: lmaccess.h:296
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL ParseDate(PWSTR s, PULONG pSeconds)
Definition: cmdUser.c:527
#define StdErr
Definition: stream.h:77
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username)
Definition: user.c:2312
#define IDS_ERROR_OPTION_NOT_SUPPORTED
Definition: resource.h:121
static const WCHAR L[]
Definition: oid.c:1250
LPWSTR usri4_comment
Definition: lmaccess.h:275
GLsizei const GLfloat * value
Definition: glext.h:6069
static NET_API_STATUS BuildWorkstationsList(_Out_ PWSTR *pWorkstationsList, _In_ PWSTR pRaw)
Definition: cmdUser.c:392
Status
Definition: gdiplustypes.h:24
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
NET_API_STATUS WINAPI NetUserSetInfo(LPCWSTR servername, LPCWSTR username, DWORD level, LPBYTE buf, LPDWORD parm_err)
Definition: user.c:3577
static VOID GenerateRandomPassword(LPWSTR *lpPassword, LPBOOL lpAllocated)
Definition: cmdUser.c:363
LPWSTR usri4_usr_comment
Definition: lmaccess.h:280
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define UF_ACCOUNTDISABLE
Definition: lmaccess.h:24
#define DOMAIN_GROUP_RID_USERS
Definition: setypes.h:612
#define UF_NORMAL_ACCOUNT
Definition: lmaccess.h:30
#define TIMEQ_FOREVER
Definition: lmaccess.h:110
#define StdOut
Definition: stream.h:76
LPWSTR usri4_name
Definition: lmaccess.h:270
LPWSTR usri4_script_path
Definition: lmaccess.h:277
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define UF_SCRIPT
Definition: lmaccess.h:23

◆ help()

VOID help ( VOID  )

Definition at line 27 of file cat.c.

28 {
30  "\n"
31  "ReactOS File Concatenation Tool\n"
32  "\n"
33  "Usage: cat [options] [file [...]]\n"
34  "options - Currently ignored\n");
35 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

Referenced by main().

◆ PrintErrorMessage()

VOID PrintErrorMessage ( DWORD  dwError)

Definition at line 123 of file common.c.

124 {
125  TCHAR * String;
126 
127  /* Try to get textual error */
129  NULL, Error, 0, (TCHAR *)&String, 0, NULL) != 0)
130  {
131  /* And print it */
132  _ftprintf(stderr, _T("Error: %s\n"), String);
133  LocalFree(String);
134  }
135  else
136  {
137  /* Otherwise, just print the error number */
138  _ftprintf(stderr, _T("Error: %d\n"), Error);
139  }
140 
141  return Error;
142 }
static WCHAR String[]
Definition: stringtable.c:55
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define _ftprintf
Definition: tchar.h:518
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
BOOL Error
Definition: chkdsk.c:66
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
FILE * stderr

Referenced by OpenVolume().

◆ PrintNetMessage()

VOID PrintNetMessage ( DWORD  dwMessage)

Definition at line 149 of file main.c.

151 {
152  PWSTR pBuffer;
153 
158  dwMessage,
160  (LPWSTR)&pBuffer,
161  0,
162  NULL);
163  if (pBuffer)
164  {
165  ConPrintf(StdOut, L"%s\n", pBuffer);
167  pBuffer = NULL;
168  }
169 }
uint16_t * PWSTR
Definition: typedefs.h:54
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
static const WCHAR L[]
Definition: oid.c:1250
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define StdOut
Definition: stream.h:76
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

Referenced by cmdAccounts(), cmdComputer(), cmdConfig(), cmdContinue(), cmdGroup(), cmdHelp(), cmdHelpMsg(), cmdLocalGroup(), cmdPause(), cmdStart(), cmdStatistics(), cmdStop(), cmdUser(), and wmain().

◆ PrintPaddedResourceString()

VOID PrintPaddedResourceString ( UINT  uID,
INT  nPaddedLength 
)

Definition at line 52 of file main.c.

55 {
56  INT nLength;
57 
58  nLength = ConResPuts(StdOut, uID);
59  if (nLength < nPaddedLength)
60  PrintPadding(L' ', nPaddedLength - nLength);
61 }
_In_ DWORD nLength
Definition: wincon.h:461
int32_t INT
Definition: typedefs.h:56
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
VOID PrintPadding(WCHAR chr, INT nPaddedLength)
Definition: main.c:65
#define StdOut
Definition: stream.h:76

Referenced by cmdAccounts(), DisplayGroup(), DisplayLocalGroup(), DisplayServerConfig(), DisplayServerStatistics(), DisplayUser(), DisplayWorkstationConfig(), and DisplayWorkstationStatistics().

◆ PrintPadding()

VOID PrintPadding ( WCHAR  chr,
INT  nPaddedLength 
)

Definition at line 65 of file main.c.

68 {
69  INT i;
70  WCHAR szMsgBuffer[MAX_BUFFER_SIZE];
71 
72  for (i = 0; i < nPaddedLength; i++)
73  szMsgBuffer[i] = chr;
74  szMsgBuffer[nPaddedLength] = UNICODE_NULL;
75 
76  ConPuts(StdOut, szMsgBuffer);
77 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
int32_t INT
Definition: typedefs.h:56
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
Definition: glfuncs.h:248
#define UNICODE_NULL
#define MAX_BUFFER_SIZE
Definition: main.c:12
int chr(char *serport)
Definition: gdblib.c:152
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

Referenced by DisplayGroup(), DisplayLocalGroup(), DisplayUser(), EnumerateGroups(), EnumerateLocalGroups(), EnumerateUsers(), and PrintPaddedResourceString().

◆ ReadFromConsole()

VOID ReadFromConsole ( LPWSTR  lpInput,
DWORD  dwLength,
BOOL  bEcho 
)

Definition at line 173 of file main.c.

177 {
178  DWORD dwOldMode;
179  DWORD dwRead = 0;
180  HANDLE hFile;
181  LPWSTR p;
182  PCHAR pBuf;
183 
184  pBuf = HeapAlloc(GetProcessHeap(), 0, dwLength - 1);
185  ZeroMemory(lpInput, dwLength * sizeof(WCHAR));
187  GetConsoleMode(hFile, &dwOldMode);
188 
190 
191  ReadFile(hFile, (PVOID)pBuf, dwLength - 1, &dwRead, NULL);
192 
193  MultiByteToWideChar(CP_OEMCP, 0, pBuf, dwRead, lpInput, dwLength - 1);
194  HeapFree(GetProcessHeap(), 0, pBuf);
195 
196  for (p = lpInput; *p; p++)
197  {
198  if (*p == L'\x0d')
199  {
200  *p = L'\0';
201  break;
202  }
203  }
204 
205  SetConsoleMode(hFile, dwOldMode);
206 }
signed char * PCHAR
Definition: retypes.h:7
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
Definition: console.c:1571
BOOL bEcho
Definition: batch.c:68
#define ZeroMemory
Definition: winbase.h:1635
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:152
#define ENABLE_ECHO_INPUT
Definition: wincon.h:77
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1608
smooth NULL
Definition: ftsmooth.c:416
#define STD_INPUT_HANDLE
Definition: winbase.h:264
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD DWORD * dwLength
Definition: fusion.c:83
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ENABLE_LINE_INPUT
Definition: wincon.h:76
static const WCHAR L[]
Definition: oid.c:1250
_In_ HANDLE hFile
Definition: mswsock.h:90
#define MultiByteToWideChar
Definition: compat.h:100
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define CP_OEMCP
Definition: winnls.h:228
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ReadPassword().

◆ unimplemented()

INT unimplemented ( INT  argc,
WCHAR **  argv 
)

Definition at line 257 of file main.c.

258 {
259  ConPuts(StdOut, L"This command is not implemented yet\n");
260  return 1;
261 }
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

Variable Documentation

◆ hModuleNetMsg

HMODULE hModuleNetMsg

Definition at line 48 of file main.c.

Referenced by cmdHelpMsg(), PrintErrorMessage(), and wmain().