ReactOS 0.4.16-dev-2546-g56481e1
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 1349 of file ipconfig.c.

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