2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
7 * PROGRAMMERS: Magnus Olsen (greatlord@reactos.org)
12 #define MAX_BUFFER_SIZE 4096
14 typedef struct _COMMAND
17 INT (*func
)(INT
, WCHAR
**);
18 // VOID (*help)(INT, WCHAR**);
23 {L
"accounts", cmdAccounts
},
24 {L
"computer", unimplemented
},
25 {L
"config", unimplemented
},
26 {L
"continue", cmdContinue
},
27 {L
"file", unimplemented
},
28 {L
"group", unimplemented
},
30 {L
"helpmsg", cmdHelpMsg
},
31 {L
"localgroup", cmdLocalGroup
},
32 {L
"name", unimplemented
},
34 {L
"print", unimplemented
},
35 {L
"send", unimplemented
},
36 {L
"session", unimplemented
},
37 {L
"share", unimplemented
},
39 {L
"statistics", unimplemented
},
41 {L
"time", unimplemented
},
42 {L
"use", unimplemented
},
44 {L
"view", unimplemented
},
54 WCHAR szMsgBuffer
[MAX_BUFFER_SIZE
];
55 WCHAR szOutBuffer
[MAX_BUFFER_SIZE
];
58 va_start(arg_ptr
, resID
);
59 LoadStringW(GetModuleHandle(NULL
), resID
, szMsgBuffer
, MAX_BUFFER_SIZE
);
60 _vsnwprintf(szOutBuffer
, MAX_BUFFER_SIZE
, szMsgBuffer
, arg_ptr
);
63 WriteToConsole(szOutBuffer
);
68 PrintPaddedResourceString(
72 WCHAR szMsgBuffer
[MAX_BUFFER_SIZE
];
75 nLength
= LoadStringW(GetModuleHandle(NULL
), resID
, szMsgBuffer
, MAX_BUFFER_SIZE
);
76 if (nLength
< nPaddedLength
)
78 for (i
= nLength
; i
< nPaddedLength
; i
++)
79 szMsgBuffer
[i
] = L
' ';
80 szMsgBuffer
[nPaddedLength
] = UNICODE_NULL
;
83 WriteToConsole(szMsgBuffer
);
92 WCHAR szBuffer
[MAX_BUFFER_SIZE
];
95 va_start(arg_ptr
, lpFormat
);
96 _vsnwprintf(szBuffer
, MAX_BUFFER_SIZE
, lpFormat
, arg_ptr
);
99 WriteToConsole(szBuffer
);
107 CHAR szOemBuffer
[MAX_BUFFER_SIZE
* 2];
111 dwLength
= wcslen(lpString
);
113 hOutput
= GetStdHandle(STD_OUTPUT_HANDLE
);
114 if ((GetFileType(hOutput
) & ~FILE_TYPE_REMOTE
) == FILE_TYPE_CHAR
)
116 WriteConsoleW(hOutput
,
124 dwLength
= WideCharToMultiByte(CP_OEMCP
,
153 pBuf
= HeapAlloc(GetProcessHeap(), 0, dwLength
- 1);
154 ZeroMemory(lpInput
, dwLength
* sizeof(WCHAR
));
155 hFile
= GetStdHandle(STD_INPUT_HANDLE
);
156 GetConsoleMode(hFile
, &dwOldMode
);
158 SetConsoleMode(hFile
, ENABLE_LINE_INPUT
| (bEcho
? ENABLE_ECHO_INPUT
: 0));
160 ReadFile(hFile
, (PVOID
)pBuf
, dwLength
- 1, &dwRead
, NULL
);
162 MultiByteToWideChar(CP_OEMCP
, 0, pBuf
, dwRead
, lpInput
, dwLength
- 1);
163 HeapFree(GetProcessHeap(), 0, pBuf
);
165 for (p
= lpInput
; *p
; p
++)
174 SetConsoleMode(hFile
, dwOldMode
);
178 int wmain(int argc
, WCHAR
**argv
)
184 PrintResourceString(IDS_NET_SYNTAX
);
188 /* Scan the command table */
189 for (cmdptr
= cmds
; cmdptr
->name
; cmdptr
++)
191 if (_wcsicmp(argv
[1], cmdptr
->name
) == 0)
193 return cmdptr
->func(argc
, argv
);
197 PrintResourceString(IDS_NET_SYNTAX
);
202 INT
unimplemented(INT argc
, WCHAR
**argv
)
204 puts("This command is not implemented yet");