ReactOS  0.4.15-dev-488-gc7a1924
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 103 of file livecd.c.

104 {
105  HKEY ControlKey = NULL;
106  LPWSTR SystemStartOptions = NULL;
107  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
108  LONG rc;
109  BOOL ret = FALSE;
110 
111  TRACE("IsLiveCD()\n");
112 
115  0,
117  &ControlKey);
118  if (rc != ERROR_SUCCESS)
119  {
120  WARN("RegOpenKeyEx() failed with error %lu\n", rc);
121  goto cleanup;
122  }
123 
124  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
125  if (rc != ERROR_SUCCESS)
126  {
127  WARN("ReadRegSzKey() failed with error %lu\n", rc);
128  goto cleanup;
129  }
130 
131  /* Check for CONSOLE switch in SystemStartOptions */
132  CurrentOption = SystemStartOptions;
133  while (CurrentOption)
134  {
135  NextOption = wcschr(CurrentOption, L' ');
136  if (NextOption)
137  *NextOption = L'\0';
138  if (_wcsicmp(CurrentOption, L"MININT") == 0)
139  {
140  TRACE("Found 'MININT' boot option\n");
141  ret = TRUE;
142  goto cleanup;
143  }
144  CurrentOption = NextOption ? NextOption + 1 : NULL;
145  }
146 
147 cleanup:
148  if (ControlKey != NULL)
149  RegCloseKey(ControlKey);
150  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
151 
152  TRACE("IsLiveCD() returning %d\n", ret);
153 
154  return ret;
155 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:112
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:232
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:404
_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:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403
_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
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
IN UCHAR Value
Definition: halp.h:394
unsigned char * LPBYTE
Definition: typedefs.h:53
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:404
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
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:403
#define REG_SZ
Definition: layer.c:22

Referenced by IsConsoleShell().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  State)

Definition at line 880 of file livecd.c.

882 {
883  LIVECD_UNATTEND Unattend = {0};
884  WCHAR UnattendInf[MAX_PATH];
885 
886  InitLogo(&pState->ImageInfo, NULL);
887 
888  GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
889  wcscat(UnattendInf, L"\\unattend.inf");
890  ParseUnattend(UnattendInf, &Unattend);
891  pState->Unattend = &Unattend;
892 
893  while (pState->NextPage != DONE)
894  {
895  switch (pState->NextPage)
896  {
897  case LOCALEPAGE:
900  NULL,
902  (LPARAM)pState);
903  break;
904 
905  case STARTPAGE:
908  NULL,
909  StartDlgProc,
910  (LPARAM)pState);
911  break;
912 
913  default:
914  break;
915  }
916  }
917 
918  DeleteObject(pState->ImageInfo.hBitmap);
919 }
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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:840
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:26
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:754
_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 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:619

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.