3 * Copyright (C) 2001, 2002 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS Userinit Logon Application
23 * FILE: subsys/system/userinit/userinit.c
24 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
30 /* GLOBALS ******************************************************************/
32 /* FUNCTIONS ****************************************************************/
35 BOOL
GetShell(WCHAR
*CommandLine
)
39 WCHAR Shell
[MAX_PATH
];
42 if(RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
43 L
"SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\Winlogon",
44 0, KEY_QUERY_VALUE
, &hKey
) == ERROR_SUCCESS
)
46 Size
= MAX_PATH
* sizeof(WCHAR
);
47 if(RegQueryValueEx(hKey
,
52 &Size
) == ERROR_SUCCESS
)
54 if((Type
== REG_SZ
) || (Type
== REG_EXPAND_SZ
))
56 wcscpy(CommandLine
, Shell
);
65 if(GetWindowsDirectory(CommandLine
, MAX_PATH
- 13))
66 wcscat(CommandLine
, L
"\\explorer.exe");
68 wcscpy(CommandLine
, L
"explorer.exe");
78 PROCESS_INFORMATION pi
;
79 WCHAR Shell
[MAX_PATH
];
80 WCHAR ExpandedShell
[MAX_PATH
];
81 TCHAR szMsg
[RC_STRING_MAX_SIZE
];
85 ZeroMemory(&si
, sizeof(STARTUPINFO
));
86 si
.cb
= sizeof(STARTUPINFO
);
87 ZeroMemory(&pi
, sizeof(PROCESS_INFORMATION
));
89 ExpandEnvironmentStrings(Shell
, ExpandedShell
, MAX_PATH
);
91 if(CreateProcess(NULL
,
96 NORMAL_PRIORITY_CLASS
,
102 WaitForSingleObject(pi
.hProcess
, INFINITE
);
103 CloseHandle(pi
.hProcess
);
104 CloseHandle(pi
.hThread
);
108 LoadString( GetModuleHandle(NULL
), STRING_USERINIT_FAIL
, szMsg
, sizeof(szMsg
) / sizeof(szMsg
[0]));
109 MessageBox(0, szMsg
, NULL
, 0);
114 void SetUserSettings(void)
118 WCHAR szWallpaper
[MAX_PATH
+ 1];
120 if(RegOpenKeyEx(HKEY_CURRENT_USER
,
121 L
"Control Panel\\Desktop",
122 0, KEY_QUERY_VALUE
, &hKey
) == ERROR_SUCCESS
)
124 Size
= sizeof(szWallpaper
);
125 if(RegQueryValueEx(hKey
,
130 &Size
) == ERROR_SUCCESS
133 /* Load and change the wallpaper */
134 SystemParametersInfo(SPI_SETDESKWALLPAPER
, 0, szWallpaper
, SPIF_SENDCHANGE
);
138 /* remove the wallpaper */
139 SystemParametersInfo(SPI_SETDESKWALLPAPER
, 0, NULL
, SPIF_SENDCHANGE
);
146 #pragma warning(disable : 4100)
147 #endif /* _MSC_VER */
150 WinMain(HINSTANCE hInst
,
151 HINSTANCE hPrevInstance
,