ReactOS  0.4.15-dev-2985-g54406bf
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 106 of file livecd.c.

107 {
108  HKEY ControlKey = NULL;
109  LPWSTR SystemStartOptions = NULL;
110  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
111  LONG rc;
112  BOOL ret = FALSE;
113 
114  TRACE("IsLiveCD()\n");
115 
118  0,
120  &ControlKey);
121  if (rc != ERROR_SUCCESS)
122  {
123  WARN("RegOpenKeyEx() failed with error %lu\n", rc);
124  goto cleanup;
125  }
126 
127  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
128  if (rc != ERROR_SUCCESS)
129  {
130  WARN("ReadRegSzKey() failed with error %lu\n", rc);
131  goto cleanup;
132  }
133 
134  /* Check for CONSOLE switch in SystemStartOptions */
135  CurrentOption = SystemStartOptions;
136  while (CurrentOption)
137  {
138  NextOption = wcschr(CurrentOption, L' ');
139  if (NextOption)
140  *NextOption = L'\0';
141  if (_wcsicmp(CurrentOption, L"MININT") == 0)
142  {
143  TRACE("Found 'MININT' boot option\n");
144  ret = TRUE;
145  goto cleanup;
146  }
147  CurrentOption = NextOption ? NextOption + 1 : NULL;
148  }
149 
150 cleanup:
151  if (ControlKey != NULL)
152  RegCloseKey(ControlKey);
153  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
154 
155  TRACE("IsLiveCD() returning %d\n", ret);
156 
157  return ret;
158 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:234
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
_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 NULL
Definition: types.h:112
#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:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
_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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
PWCHAR pValue
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
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:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define REG_SZ
Definition: layer.c:22

Referenced by IsConsoleShell().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  State)

Definition at line 883 of file livecd.c.

885 {
886  LIVECD_UNATTEND Unattend = {0};
887  WCHAR UnattendInf[MAX_PATH];
888 
889  InitLogo(&pState->ImageInfo, NULL);
890 
891  GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
892  wcscat(UnattendInf, L"\\unattend.inf");
893  ParseUnattend(UnattendInf, &Unattend);
894  pState->Unattend = &Unattend;
895 
896  while (pState->NextPage != DONE)
897  {
898  switch (pState->NextPage)
899  {
900  case LOCALEPAGE:
903  NULL,
905  (LPARAM)pState);
906  break;
907 
908  case STARTPAGE:
911  NULL,
912  StartDlgProc,
913  (LPARAM)pState);
914  break;
915 
916  default:
917  break;
918  }
919  }
920 
921  DeleteObject(pState->ImageInfo.hBitmap);
922 }
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)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
HINSTANCE hInstance
Definition: charmap.c:20
LONG_PTR LPARAM
Definition: windef.h:208
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:843
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:25
static const WCHAR L[]
Definition: oid.c:1250
#define IDD_LOCALEPAGE
Definition: resource.h:13
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:757
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
#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:622

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.