ReactOS 0.4.17-dev-523-gf6fcb59
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
char *CDECL fgets(char *s, int size, FILE *file)
Definition: file.c:3903
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
Definition: fci.c:127
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

◆ main()

int main ( int  argc,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

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}
MonoAssembly int argc
Definition: metahost.c:107
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 1351 of file ipconfig.c.

1352{
1353 BOOL DoUsage=FALSE;
1354 BOOL DoAll=FALSE;
1355 BOOL DoRelease=FALSE;
1356 BOOL DoRenew=FALSE;
1357 BOOL DoFlushdns=FALSE;
1358 BOOL DoRegisterdns=FALSE;
1359 BOOL DoDisplaydns=FALSE;
1360 BOOL DoShowclassid=FALSE;
1361 BOOL DoSetclassid=FALSE;
1362
1363 /* Initialize the Console Standard Streams */
1365
1368
1369 /* Parse command line for options we have been given. */
1370 if ((argc > 1) && (argv[1][0] == L'/' || argv[1][0] == L'-'))
1371 {
1372 if (!_wcsicmp(&argv[1][1], L"?"))
1373 {
1374 DoUsage = TRUE;
1375 }
1376 else if (!_wcsnicmp(&argv[1][1], L"ALL", wcslen(&argv[1][1])))
1377 {
1378 DoAll = TRUE;
1379 }
1380 else if (!_wcsnicmp(&argv[1][1], L"RELEASE", wcslen(&argv[1][1])))
1381 {
1382 DoRelease = TRUE;
1383 }
1384 else if (!_wcsnicmp(&argv[1][1], L"RENEW", wcslen(&argv[1][1])))
1385 {
1386 DoRenew = TRUE;
1387 }
1388 else if (!_wcsnicmp(&argv[1][1], L"FLUSHDNS", wcslen(&argv[1][1])))
1389 {
1390 DoFlushdns = TRUE;
1391 }
1392 else if (!_wcsnicmp(&argv[1][1], L"FLUSHREGISTERDNS", wcslen(&argv[1][1])))
1393 {
1394 DoRegisterdns = TRUE;
1395 }
1396 else if (!_wcsnicmp(&argv[1][1], L"DISPLAYDNS", wcslen(&argv[1][1])))
1397 {
1398 DoDisplaydns = TRUE;
1399 }
1400 else if (!_wcsnicmp(&argv[1][1], L"SHOWCLASSID", wcslen(&argv[1][1])))
1401 {
1402 DoShowclassid = TRUE;
1403 }
1404 else if (!_wcsnicmp(&argv[1][1], L"SETCLASSID", wcslen(&argv[1][1])))
1405 {
1406 DoSetclassid = TRUE;
1407 }
1408 }
1409
1410 switch (argc)
1411 {
1412 case 1: /* Default behaviour if no options are given*/
1414 break;
1415 case 2: /* Process all the options that take no parameters */
1416 if (DoUsage)
1417 Usage(FALSE);
1418 else if (DoAll)
1419 ShowInfo(TRUE, TRUE);
1420 else if (DoRelease)
1421 Release(NULL);
1422 else if (DoRenew)
1423 Renew(NULL);
1424 else if (DoFlushdns)
1425 FlushDns();
1426 else if (DoRegisterdns)
1427 RegisterDns();
1428 else if (DoDisplaydns)
1429 DisplayDns();
1430 else
1431 Usage(TRUE);
1432 break;
1433 case 3: /* Process all the options that can have 1 parameter */
1434 if (DoRelease)
1435 Release(argv[2]);
1436 else if (DoRenew)
1437 Renew(argv[2]);
1438 else if (DoShowclassid)
1439 ShowClassId(argv[2]);
1440 else if (DoSetclassid)
1441 SetClassId(argv[2], NULL);
1442 else
1443 Usage(TRUE);
1444 break;
1445 case 4: /* Process all the options that can have 2 parameters */
1446 if (DoSetclassid)
1447 SetClassId(argv[2], argv[3]);
1448 else
1449 Usage(TRUE);
1450 break;
1451 default:
1452 Usage(TRUE);
1453 }
1454
1455 return 0;
1456}
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define ConInitStdStreams()
Definition: conutils_noros.h:5
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
#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
VOID RegisterDns(VOID)
Definition: ipconfig.c:1041
VOID ShowInfo(BOOL bShowHeader, BOOL bAll)
Definition: ipconfig.c:539
VOID FlushDns(VOID)
Definition: ipconfig.c:1025
VOID Renew(PWSTR pszAdapterName)
Definition: ipconfig.c:927
HANDLE ProcessHeap
Definition: ipconfig.c:42
VOID ShowClassId(PWSTR pszAdapterName)
Definition: ipconfig.c:1212
HINSTANCE hInstance
Definition: ipconfig.c:41
VOID SetClassId(PWSTR pszAdapterName, PWSTR pszClassId)
Definition: ipconfig.c:1219
VOID DisplayDns(VOID)
Definition: ipconfig.c:1177
#define GetModuleHandle
Definition: winbase.h:3548