ReactOS  0.4.13-dev-39-g8b6696f
userinit.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winreg.h>
#include <regstr.h>
#include <winnls.h>
#include <winuser.h>
#include <undocuser.h>
#include <strsafe.h>
#include <ndk/exfuncs.h>
#include <wine/debug.h>
#include "resource.h"
Include dependency graph for userinit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IMGINFO
 
struct  STATE
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Typedefs

typedef struct _IMGINFO IMGINFO
 
typedef struct _IMGINFOPIMGINFO
 
typedef struct STATEPSTATE
 

Enumerations

enum  PAGESTATE { LOCALEPAGE, STARTPAGE, DONE }
 
enum  RUN { SHELL, INSTALLER, REBOOT }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (userinit)
 
LONG ReadRegSzKey (IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
 
BOOL IsLiveCD (VOID)
 
VOID RunLiveCD (PSTATE State)
 

Variables

HINSTANCE hInstance
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 12 of file userinit.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 13 of file userinit.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file userinit.h.

Typedef Documentation

◆ IMGINFO

◆ PIMGINFO

◆ PSTATE

typedef struct STATE * PSTATE

Enumeration Type Documentation

◆ PAGESTATE

Enumerator
LOCALEPAGE 
STARTPAGE 
DONE 

Definition at line 33 of file userinit.h.

34 {
35  LOCALEPAGE,
36  STARTPAGE,
37  DONE
38 } PAGESTATE;
PAGESTATE
Definition: userinit.h:33
Definition: userinit.h:37

◆ RUN

Enumerator
SHELL 
INSTALLER 
REBOOT 

Definition at line 40 of file userinit.h.

41 {
42  SHELL,
43  INSTALLER,
44  REBOOT
45 } RUN;
RUN
Definition: userinit.h:40
Definition: userinit.h:42

Function Documentation

◆ IsLiveCD()

BOOL IsLiveCD ( VOID  )

Definition at line 92 of file livecd.c.

93 {
94  HKEY ControlKey = NULL;
95  LPWSTR SystemStartOptions = NULL;
96  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
97  LONG rc;
98  BOOL ret = FALSE;
99 
100  TRACE("IsLiveCD()\n");
101 
104  0,
106  &ControlKey);
107  if (rc != ERROR_SUCCESS)
108  {
109  WARN("RegOpenKeyEx() failed with error %lu\n", rc);
110  goto cleanup;
111  }
112 
113  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
114  if (rc != ERROR_SUCCESS)
115  {
116  WARN("ReadRegSzKey() failed with error %lu\n", rc);
117  goto cleanup;
118  }
119 
120  /* Check for CONSOLE switch in SystemStartOptions */
121  CurrentOption = SystemStartOptions;
122  while (CurrentOption)
123  {
124  NextOption = wcschr(CurrentOption, L' ');
125  if (NextOption)
126  *NextOption = L'\0';
127  if (_wcsicmp(CurrentOption, L"MININT") == 0)
128  {
129  TRACE("Found 'MININT' boot option\n");
130  ret = TRUE;
131  goto cleanup;
132  }
133  CurrentOption = NextOption ? NextOption + 1 : NULL;
134  }
135 
136 cleanup:
137  if (ControlKey != NULL)
138  RegCloseKey(ControlKey);
139  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
140 
141  TRACE("IsLiveCD() returning %d\n", ret);
142 
143  return ret;
144 }
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: umpnpmgr.c:3985
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:111
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REGSTR_PATH_CURRENT_CONTROL_SET
Definition: regstr.h:564
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by wWinMain().

◆ ReadRegSzKey()

LONG ReadRegSzKey ( IN HKEY  hKey,
IN LPCWSTR  pszKey,
OUT LPWSTR pValue 
)

Definition at line 39 of file userinit.c.

43 {
44  LONG rc;
45  DWORD dwType;
46  DWORD cbData = 0;
47  LPWSTR Value;
48 
49  TRACE("(%p, %s, %p)\n", hKey, debugstr_w(pszKey), pValue);
50 
51  rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
52  if (rc != ERROR_SUCCESS)
53  {
54  WARN("RegQueryValueEx(%s) failed with error %lu\n", debugstr_w(pszKey), rc);
55  return rc;
56  }
57  if (dwType != REG_SZ)
58  {
59  WARN("Wrong registry data type (%u vs %u)\n", dwType, REG_SZ);
60  return ERROR_FILE_NOT_FOUND;
61  }
62  Value = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
63  if (!Value)
64  {
65  WARN("No memory\n");
67  }
68  rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData);
69  if (rc != ERROR_SUCCESS)
70  {
71  WARN("RegQueryValueEx(%s) failed with error %lu\n", debugstr_w(pszKey), rc);
73  return rc;
74  }
75  /* NULL-terminate the string */
76  Value[cbData / sizeof(WCHAR)] = L'\0';
77 
78  *pValue = Value;
79  return ERROR_SUCCESS;
80 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define REG_SZ
Definition: layer.c:22

Referenced by IsConsoleShell().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  State)

Definition at line 810 of file livecd.c.

812 {
813  InitLogo(&pState->ImageInfo, NULL);
814 
815  while (pState->NextPage != DONE)
816  {
817  switch (pState->NextPage)
818  {
819  case LOCALEPAGE:
822  NULL,
824  (LPARAM)pState);
825  break;
826 
827  case STARTPAGE:
830  NULL,
831  StartDlgProc,
832  (LPARAM)pState);
833  break;
834 
835  default:
836  break;
837  }
838  }
839 
840  DeleteObject(pState->ImageInfo.hBitmap);
841 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_STARTPAGE
Definition: resource.h:18
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:18
#define IDD_LOCALEPAGE
Definition: resource.h:13
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:729
#define DONE
Definition: rnr20lib.h:14
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:599

Referenced by wWinMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( userinit  )

Variable Documentation

◆ hInstance

HINSTANCE hInstance

Definition at line 20 of file charmap.c.