ReactOS 0.4.16-dev-297-gc569aee
logoff.c File Reference
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <conutils.h>
#include "resource.h"
Include dependency graph for logoff.c:

Go to the source code of this file.

Functions

VOID DisplayError (DWORD dwError)
 
BOOL ParseCommandLine (int argc, WCHAR *argv[])
 
int wmain (int argc, WCHAR *argv[])
 

Variables

LPWSTR szRemoteServerName = NULL
 
BOOL bVerbose
 

Function Documentation

◆ DisplayError()

VOID DisplayError ( DWORD  dwError)

Definition at line 33 of file logoff.c.

34{
36 NULL, dwError, LANG_USER_DEFAULT);
37 ConPrintf(StdErr, L"Error code: %lu\n", dwError);
38}
void ConPrintf(FILE *fp, LPCWSTR psz,...)
Definition: fc.c:20
#define StdErr
Definition: fc.c:15
#define NULL
Definition: types.h:112
#define L(x)
Definition: ntvdm.h:50
INT ConMsgPuts(IN PCON_STREAM Stream, IN DWORD dwFlags, IN LPCVOID lpSource OPTIONAL, IN DWORD dwMessageId, IN DWORD dwLanguageId)
Definition: outstream.c:837
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:449

Referenced by DriveDlgProc(), EnablePrivilege(), GetListOfTestExes(), GetNumberOfExesInFolder(), MoreOptDlgProc(), and wmain().

◆ ParseCommandLine()

BOOL ParseCommandLine ( int  argc,
WCHAR argv[] 
)

Definition at line 45 of file logoff.c.

46{
47 int i;
48
49 // FIXME: Add handling of command-line arguments to select
50 // the session number and name, and also name of remote machine.
51 // Example: logoff.exe 4 /SERVER:Master
52 // should logoff session number 4 on remote machine called Master.
53
54 for (i = 1; i < argc; i++)
55 {
56 switch (argv[i][0])
57 {
58 case L'-':
59 case L'/':
60 // -v (verbose)
61 if (argv[i][1] == L'v')
62 {
63 bVerbose = TRUE;
64 break;
65 }
66 // -? (usage)
67 else if (argv[i][1] == L'?')
68 {
69 /* Will display the Usage */
70 return FALSE;
71 }
72 /* Fall through */
73 default:
74 /* Invalid parameter detected */
76 return FALSE;
77 }
78 }
79
80 return TRUE;
81}
static int argc
Definition: ServiceArgs.c:12
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define IDS_ILLEGAL_PARAM
Definition: resource.h:6
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
BOOL bVerbose
Definition: logoff.c:26
#define argv
Definition: mplay32.c:18

Referenced by wmain().

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 88 of file logoff.c.

89{
90 /* Initialize the Console Standard Streams */
92
93 /* Parse command line */
95 {
97 return 1;
98 }
99
100 /* Should we log off session on remote server? */
102 {
103 if (bVerbose)
105
106 // FIXME: Add Remote Procedure Call to logoff user on a remote machine
107 ConPuts(StdErr, L"Remote Procedure Call in logoff.exe has not been implemented");
108 }
109 /* Perform logoff of current session on local machine instead */
110 else
111 {
112 if (bVerbose)
113 {
114 /* Get resource string and print it */
116 }
117
118 /* Actual logoff */
119 if (!ExitWindowsEx(EWX_LOGOFF, 0))
120 {
122 return 1;
123 }
124 }
125
126 return 0;
127}
#define IDS_USAGE
Definition: resource.h:3
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define ConInitStdStreams()
Definition: fc.c:13
#define StdOut
Definition: fc.c:14
#define IDS_LOGOFF_REMOTE
Definition: resource.h:4
#define IDS_LOGOFF_LOCAL
Definition: resource.h:5
BOOL ParseCommandLine(int argc, WCHAR *argv[])
Definition: logoff.c:45
LPWSTR szRemoteServerName
Definition: logoff.c:25
VOID DisplayError(DWORD dwError)
Definition: logoff.c:33
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define EWX_LOGOFF
Definition: winuser.h:636
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)

Variable Documentation

◆ bVerbose

BOOL bVerbose

Definition at line 26 of file logoff.c.

Referenced by ParseCommandLine(), and wmain().

◆ szRemoteServerName

LPWSTR szRemoteServerName = NULL

Definition at line 25 of file logoff.c.

Referenced by wmain().