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
);
72 WCHAR szBuffer
[MAX_BUFFER_SIZE
];
75 va_start(arg_ptr
, lpFormat
);
76 _vsnwprintf(szBuffer
, MAX_BUFFER_SIZE
, lpFormat
, arg_ptr
);
79 WriteToConsole(szBuffer
);
87 CHAR szOemBuffer
[MAX_BUFFER_SIZE
* 2];
91 dwLength
= wcslen(lpString
);
93 hOutput
= GetStdHandle(STD_OUTPUT_HANDLE
);
94 if ((GetFileType(hOutput
) & ~FILE_TYPE_REMOTE
) == FILE_TYPE_CHAR
)
96 WriteConsoleW(hOutput
,
104 dwLength
= WideCharToMultiByte(CP_OEMCP
,
133 pBuf
= HeapAlloc(GetProcessHeap(), 0, dwLength
- 1);
134 ZeroMemory(lpInput
, dwLength
* sizeof(WCHAR
));
135 hFile
= GetStdHandle(STD_INPUT_HANDLE
);
136 GetConsoleMode(hFile
, &dwOldMode
);
138 SetConsoleMode(hFile
, ENABLE_LINE_INPUT
| (bEcho
? ENABLE_ECHO_INPUT
: 0));
140 ReadFile(hFile
, (PVOID
)pBuf
, dwLength
- 1, &dwRead
, NULL
);
142 MultiByteToWideChar(CP_OEMCP
, 0, pBuf
, dwRead
, lpInput
, dwLength
- 1);
143 HeapFree(GetProcessHeap(), 0, pBuf
);
145 for (p
= lpInput
; *p
; p
++)
154 SetConsoleMode(hFile
, dwOldMode
);
158 int wmain(int argc
, WCHAR
**argv
)
164 PrintResourceString(IDS_NET_SYNTAX
);
168 /* Scan the command table */
169 for (cmdptr
= cmds
; cmdptr
->name
; cmdptr
++)
171 if (_wcsicmp(argv
[1], cmdptr
->name
) == 0)
173 return cmdptr
->func(argc
, argv
);
177 PrintResourceString(IDS_NET_SYNTAX
);
182 INT
unimplemented(INT argc
, WCHAR
**argv
)
184 puts("This command is not implemented yet");