ReactOS 0.4.16-dev-1946-g52006dd
wmain.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
Include dependency graph for wmain.c:

Go to the source code of this file.

Functions

int wmain (int argc, wchar_t *argv[])
 
wchar_ta2w (char *a, wchar_t *w)
 
wchar_tfgetws (wchar_t *buf, int bufsize, FILE *file)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ a2w()

wchar_t * a2w ( char a,
wchar_t w 
)

Definition at line 13 of file wmain.c.

14{
15 wchar_t * ww = w;
16 while (*a) *w++ = (wchar_t) *a++;
17 *w = 0;
18 return ww;
19}
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define wchar_t
Definition: wchar.h:102

Referenced by fgetws(), main(), and START_TEST().

◆ fgetws()

wchar_t * fgetws ( wchar_t buf,
int  bufsize,
FILE file 
)

Definition at line 22 of file wmain.c.

23{
24 char * abuf = GlobalAlloc(bufsize,0);
25 if (!buf)return NULL;
26 fgets(abuf,bufsize,file);
27 a2w(abuf,buf);
28 GlobalFree(abuf);
29 return buf;
30}
#define NULL
Definition: types.h:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
Definition: fci.c:127
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

Referenced by DosBIOSInitialize(), FindString(), InterpretInteractive(), InterpretMain(), LoadBootIni(), LoadIniFile(), LoadSystemIni(), ReadFromFile(), RunScript(), test_fgetwc(), test_file_put_get(), test_fileops(), test_fwprintf(), wmain(), and XCOPY_ProcessExcludeFile().

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 32 of file wmain.c.

33{
34 wchar_t ** wargv;
35 int i;
36 int ec;
37
38 wargv = (wchar_t **) GlobalAlloc(
39 sizeof(void*) * argc,
40 0
41 );
42 for(i=0;i<argc;++i)
43 {
44 wargv[i] = (wchar_t*) GlobalAlloc(
45 sizeof(wchar_t) * (1+lstrlenA(argv[i])),
46 0
47 );
48 a2w(argv[i],wargv[i]);
49 }
50 wargv[i] = NULL;
51 ec = wmain(argc,wargv);
52 for (i=0;wargv[i];++i) GlobalFree(wargv[i]);
53 return ec;
54}
static int argc
Definition: ServiceArgs.c:12
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
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define argv
Definition: mplay32.c:18
int wmain()

◆ wmain()

int wmain ( int  argc,
wchar_t argv[] 
)

Main entry point

Definition at line 1340 of file ipconfig.c.

1341{
1342 BOOL DoUsage=FALSE;
1343 BOOL DoAll=FALSE;
1344 BOOL DoRelease=FALSE;
1345 BOOL DoRenew=FALSE;
1346 BOOL DoFlushdns=FALSE;
1347 BOOL DoRegisterdns=FALSE;
1348 BOOL DoDisplaydns=FALSE;
1349 BOOL DoShowclassid=FALSE;
1350 BOOL DoSetclassid=FALSE;
1351
1352 /* Initialize the Console Standard Streams */
1354
1357
1358 /* Parse command line for options we have been given. */
1359 if ((argc > 1) && (argv[1][0] == L'/' || argv[1][0] == L'-'))
1360 {
1361 if (!_wcsicmp(&argv[1][1], L"?"))
1362 {
1363 DoUsage = TRUE;
1364 }
1365 else if (!_wcsnicmp(&argv[1][1], L"ALL", wcslen(&argv[1][1])))
1366 {
1367 DoAll = TRUE;
1368 }
1369 else if (!_wcsnicmp(&argv[1][1], L"RELEASE", wcslen(&argv[1][1])))
1370 {
1371 DoRelease = TRUE;
1372 }
1373 else if (!_wcsnicmp(&argv[1][1], L"RENEW", wcslen(&argv[1][1])))
1374 {
1375 DoRenew = TRUE;
1376 }
1377 else if (!_wcsnicmp(&argv[1][1], L"FLUSHDNS", wcslen(&argv[1][1])))
1378 {
1379 DoFlushdns = TRUE;
1380 }
1381 else if (!_wcsnicmp(&argv[1][1], L"FLUSHREGISTERDNS", wcslen(&argv[1][1])))
1382 {
1383 DoRegisterdns = TRUE;
1384 }
1385 else if (!_wcsnicmp(&argv[1][1], L"DISPLAYDNS", wcslen(&argv[1][1])))
1386 {
1387 DoDisplaydns = TRUE;
1388 }
1389 else if (!_wcsnicmp(&argv[1][1], L"SHOWCLASSID", wcslen(&argv[1][1])))
1390 {
1391 DoShowclassid = TRUE;
1392 }
1393 else if (!_wcsnicmp(&argv[1][1], L"SETCLASSID", wcslen(&argv[1][1])))
1394 {
1395 DoSetclassid = TRUE;
1396 }
1397 }
1398
1399 switch (argc)
1400 {
1401 case 1: /* Default behaviour if no options are given*/
1403 break;
1404 case 2: /* Process all the options that take no parameters */
1405 if (DoUsage)
1406 Usage(FALSE);
1407 else if (DoAll)
1408 ShowInfo(TRUE, TRUE);
1409 else if (DoRelease)
1410 Release(NULL);
1411 else if (DoRenew)
1412 Renew(NULL);
1413 else if (DoFlushdns)
1414 FlushDns();
1415 else if (DoRegisterdns)
1416 RegisterDns();
1417 else if (DoDisplaydns)
1418 DisplayDns();
1419 else
1420 Usage(TRUE);
1421 break;
1422 case 3: /* Process all the options that can have 1 parameter */
1423 if (DoRelease)
1424 Release(argv[2]);
1425 else if (DoRenew)
1426 Renew(argv[2]);
1427 else if (DoShowclassid)
1428 ShowClassId(argv[2]);
1429 else if (DoSetclassid)
1430 SetClassId(argv[2], NULL);
1431 else
1432 Usage(TRUE);
1433 break;
1434 case 4: /* Process all the options that can have 2 parameters */
1435 if (DoSetclassid)
1436 SetClassId(argv[2], argv[3]);
1437 else
1438 Usage(TRUE);
1439 break;
1440 default:
1441 Usage(TRUE);
1442 }
1443
1444 return 0;
1445}
#define ConInitStdStreams()
Definition: fc.c:13
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
VOID Renew(LPWSTR pszAdapterName)
Definition: ipconfig.c:944
VOID RegisterDns(VOID)
Definition: ipconfig.c:1059
VOID ShowInfo(BOOL bShowHeader, BOOL bAll)
Definition: ipconfig.c:557
VOID FlushDns(VOID)
Definition: ipconfig.c:1043
HANDLE ProcessHeap
Definition: ipconfig.c:47
VOID SetClassId(LPWSTR pszAdapterName, LPWSTR pszClassId)
Definition: ipconfig.c:1237
HINSTANCE hInstance
Definition: ipconfig.c:46
VOID ShowClassId(LPWSTR pszAdapterName)
Definition: ipconfig.c:1230
VOID DisplayDns(VOID)
Definition: ipconfig.c:1195
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define GetModuleHandle
Definition: winbase.h:3576