ReactOS  0.4.12-dev-102-g4b7f1e0
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.

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

34 {
36  NULL, dwError, LANG_USER_DEFAULT);
37  ConPrintf(StdErr, L"Error code: %lu\n", dwError);
38 }
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN LPWSTR szStr,...)
Definition: outstream.c:520
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
INT ConMsgPuts(IN PCON_STREAM Stream, IN DWORD dwFlags, IN LPCVOID lpSource OPTIONAL, IN DWORD dwMessageId, IN DWORD dwLanguageId)
Definition: outstream.c:837
#define StdErr
Definition: stream.h:77
static const WCHAR L[]
Definition: oid.c:1087
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50

◆ ParseReasonCode()

DWORD ParseReasonCode ( LPCWSTR  )

Definition at line 55 of file misc.c.

Referenced by ParseArguments().

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 }
int minor
Definition: precomp.h:29
smooth NULL
Definition: ftsmooth.c:416
__kernel_size_t size_t
Definition: linux.h:237
REASON shutdownReason[]
Definition: misc.c:15
static const WCHAR L[]
Definition: oid.c:1087
LPWSTR prefix
Definition: precomp.h:27
int major
Definition: precomp.h:28
DWORD flag
Definition: precomp.h:30
WCHAR * LPWSTR
Definition: xmlstorage.h:184
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)
const DWORD defaultReason
Definition: misc.c:13

◆ ShutdownGuiMain()

BOOL ShutdownGuiMain ( struct CommandLineOptions  opts)

Definition at line 45 of file gui.c.

Referenced by wmain().

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 TRUE
Definition: types.h:120
int32_t INT_PTR
Definition: typedefs.h:62
smooth NULL
Definition: ftsmooth.c:416
#define IDC_CANCEL
Definition: resource.h:60
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
#define IDD_GUI
Definition: resource.h:56
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1087
#define GetModuleHandle
Definition: winbase.h:3641
#define MB_OK
Definition: winuser.h:784
INT_PTR CALLBACK ShutdownGuiProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: gui.c:11
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLuint64EXT * result
Definition: glext.h:11304
#define IDC_OK
Definition: resource.h:59

Variable Documentation

◆ defaultReason

const DWORD defaultReason

Definition at line 13 of file misc.c.

Referenced by ParseReasonCode().