ReactOS 0.4.15-dev-7953-g1f49173
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{
37 DONE
38} PAGESTATE;
PAGESTATE
Definition: userinit.h:34
@ LOCALEPAGE
Definition: userinit.h:35
@ DONE
Definition: userinit.h:37
@ STARTPAGE
Definition: userinit.h:36

◆ RUN

Enumerator
SHELL 
INSTALLER 
REBOOT 

Definition at line 40 of file userinit.h.

41{
42 SHELL,
44 REBOOT
45} RUN;
RUN
Definition: userinit.h:41
@ REBOOT
Definition: userinit.h:44
@ INSTALLER
Definition: userinit.h:43
@ SHELL
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
150cleanup:
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}
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:253
#define WARN(fmt,...)
Definition: debug.h:112
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
static void cleanup(void)
Definition: main.c:1335
unsigned int BOOL
Definition: ntddk_ex.h:94
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define REGSTR_PATH_CURRENT_CONTROL_SET
Definition: regstr.h:564
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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;
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);
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_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define HeapAlloc
Definition: compat.h:733
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PWCHAR pValue
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
unsigned char * LPBYTE
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
__wchar_t WCHAR
Definition: xmlstorage.h:180

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,
913 (LPARAM)pState);
914 break;
915
916 default:
917 break;
918 }
919 }
920
921 DeleteObject(pState->ImageInfo.hBitmap);
922}
#define IDD_STARTPAGE
Definition: resource.h:18
#define IDD_LOCALEPAGE
Definition: resource.h:13
HINSTANCE hInstance
Definition: charmap.c:19
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
pKey DeleteObject()
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:622
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:843
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:757
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:25
#define DONE
Definition: rnr20lib.h:14
_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 _countof(array)
Definition: sndvol32.h:68
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by wWinMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( userinit  )

Variable Documentation

◆ hInstance

HINSTANCE hInstance
extern

Definition at line 19 of file charmap.c.