ReactOS 0.4.15-dev-8138-g1e75ea8
precomp.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <conutils.h>
#include "resource.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _REASON
 
struct  CommandLineOptions
 

Macros

#define MAX_MESSAGE_SIZE   512
 
#define MAX_MAJOR_CODE   256
 
#define MAX_MINOR_CODE   65536
 
#define MAX_TIMEOUT   315360000
 

Typedefs

typedef struct _REASON REASON
 
typedef struct _REASONPREASON
 

Functions

DWORD ParseReasonCode (LPCWSTR)
 
VOID DisplayError (DWORD dwError)
 
BOOL ShutdownGuiMain (struct CommandLineOptions opts)
 

Variables

const DWORD defaultReason
 

Macro Definition Documentation

◆ MAX_MAJOR_CODE

#define MAX_MAJOR_CODE   256

Definition at line 20 of file precomp.h.

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   512

Definition at line 19 of file precomp.h.

◆ MAX_MINOR_CODE

#define MAX_MINOR_CODE   65536

Definition at line 21 of file precomp.h.

◆ MAX_TIMEOUT

#define MAX_TIMEOUT   315360000

Definition at line 22 of file precomp.h.

Typedef Documentation

◆ PREASON

typedef struct _REASON * PREASON

◆ REASON

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:423

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

◆ ParseReasonCode()

DWORD ParseReasonCode ( LPCWSTR  code)

Definition at line 55 of file misc.c.

56{
57 PREASON reasonptr;
58 int majorCode = 0;
59 int minorCode = 0;
60 LPWSTR tmpPrefix = NULL;
61 size_t codeSize;
62
63 /* If no reason code is specified, use "Other (Unplanned)" as the default option */
64 if(code == NULL)
65 {
66 return defaultReason;
67 }
68 else
69 {
70 /* Store the size of the code so we can use it later */
71 codeSize = (size_t)wcslen(code);
72
73 /* A colon cannot be the first or last character in the reason code */
74 if ((code[0] == L':') || (code[codeSize] == L':'))
75 {
76 return defaultReason;
77 }
78
79 /* The minimum length that a reason code can be is 5-7 characters in length */
80 if ((codeSize < 5) || (codeSize > 7))
81 {
82 return defaultReason;
83 }
84
85 /* TODO: Add code for reason parsing here. */
86
87 /* Make sure that the major and minor codes are within size limits */
88 if ((majorCode > 7 ) || (majorCode < 0) ||
89 (minorCode > 20) || (minorCode < 0))
90 {
91 return defaultReason;
92 }
93
94 /* Figure out what flags to return */
95 for (reasonptr = shutdownReason ; reasonptr->prefix ; reasonptr++)
96 {
97 if ((majorCode == reasonptr->major) &&
98 (minorCode == reasonptr->minor) &&
99 (_wcsicmp(tmpPrefix, reasonptr->prefix) != 0))
100 {
101 return reasonptr->flag;
102 }
103 }
104 }
105
106 return defaultReason;
107}
const DWORD defaultReason
Definition: misc.c:13
REASON shutdownReason[]
Definition: misc.c:15
__kernel_size_t size_t
Definition: linux.h:237
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
int major
Definition: precomp.h:28
DWORD flag
Definition: precomp.h:30
LPWSTR prefix
Definition: precomp.h:27
int minor
Definition: precomp.h:29
Definition: inflate.c:139
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ParseArguments().

◆ ShutdownGuiMain()

BOOL ShutdownGuiMain ( struct CommandLineOptions  opts)

Definition at line 45 of file gui.c.

46{
49 NULL,
51
52 switch (result)
53 {
54 case IDC_OK:
55 MessageBoxW(NULL, L"This function is unimplemented.", L"Unimplemented", MB_OK);
56 break;
57
58 case IDC_CANCEL:
59 /* Exits the program */
60 break;
61
62 default:
63 MessageBoxW(NULL, L"Dialog Error!", L"Message", MB_OK);
64 return FALSE;
65 }
66
67 return TRUE;
68}
#define IDC_OK
Definition: resource.h:59
#define IDC_CANCEL
Definition: resource.h:60
INT_PTR CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: gui.c:11
#define IDD_GUI
Definition: resource.h:56
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint64EXT * result
Definition: glext.h:11304
int32_t INT_PTR
Definition: typedefs.h:64
#define GetModuleHandle
Definition: winbase.h:3827
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:790
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by wmain().

Variable Documentation

◆ defaultReason

const DWORD defaultReason
extern

Definition at line 13 of file misc.c.

Referenced by ParseReasonCode().