From 2be74a0eb2294bbd6976abb334e4315e7f440b43 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 7 Dec 2003 01:12:58 +0000 Subject: [PATCH] added userinit application svn path=/trunk/; revision=6877 --- reactos/Makefile | 4 +- reactos/lib/msgina/Makefile | 5 +- reactos/subsys/system/userinit/.cvsignore | 6 ++ reactos/subsys/system/userinit/Makefile | 21 ++++ reactos/subsys/system/userinit/userinit.c | 106 +++++++++++++++++++++ reactos/subsys/system/userinit/userinit.rc | 37 +++++++ 6 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 reactos/subsys/system/userinit/.cvsignore create mode 100644 reactos/subsys/system/userinit/Makefile create mode 100644 reactos/subsys/system/userinit/userinit.c create mode 100644 reactos/subsys/system/userinit/userinit.rc diff --git a/reactos/Makefile b/reactos/Makefile index 1f04be200c4..e2c1579841a 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.187 2003/12/06 23:22:30 mf Exp $ +# $Id: Makefile,v 1.188 2003/12/07 01:12:58 weiden Exp $ # # Global makefile # @@ -88,7 +88,7 @@ STORAGE_DRIVERS = atapi cdrom class2 disk scsiport diskdump # System applications # autochk cmd format services setup usetup welcome winlogon -SYS_APPS = autochk cmd format services setup usetup welcome winlogon +SYS_APPS = autochk cmd format services setup usetup welcome winlogon userinit # System services # rpcss eventlog diff --git a/reactos/lib/msgina/Makefile b/reactos/lib/msgina/Makefile index 622e945eb9a..395e7200c8b 100644 --- a/reactos/lib/msgina/Makefile +++ b/reactos/lib/msgina/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.5 2003/12/01 18:21:04 weiden Exp $ +# $Id: Makefile,v 1.6 2003/12/07 01:12:58 weiden Exp $ PATH_TO_TOP = ../.. @@ -6,11 +6,14 @@ TARGET_TYPE = dynlink TARGET_NAME = msgina +TARGET_INSTALLDIR = system32 + TARGET_BASE = 0x75970000 TARGET_CFLAGS = \ -I./include \ -DUNICODE \ + -D_UNICODE \ -D__REACTOS__ \ -Wall \ -Werror \ diff --git a/reactos/subsys/system/userinit/.cvsignore b/reactos/subsys/system/userinit/.cvsignore new file mode 100644 index 00000000000..e24713815a0 --- /dev/null +++ b/reactos/subsys/system/userinit/.cvsignore @@ -0,0 +1,6 @@ +*.o +*.d +*.exe +*.coff +*.sym +*.map \ No newline at end of file diff --git a/reactos/subsys/system/userinit/Makefile b/reactos/subsys/system/userinit/Makefile new file mode 100644 index 00000000000..98fa4ac4d10 --- /dev/null +++ b/reactos/subsys/system/userinit/Makefile @@ -0,0 +1,21 @@ +# $Id: Makefile,v 1.1 2003/12/07 01:12:58 weiden Exp $ + +PATH_TO_TOP = ../../.. + +TARGET_TYPE = program + +TARGET_APPTYPE = windows + +TARGET_NAME = userinit + +TARGET_INSTALLDIR = system32 + +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE + +TARGET_SDKLIBS = kernel32.a gdi32.a user32.a advapi32.a ntdll.a + +TARGET_OBJECTS = $(TARGET_NAME).o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk diff --git a/reactos/subsys/system/userinit/userinit.c b/reactos/subsys/system/userinit/userinit.c new file mode 100644 index 00000000000..fb848ae6128 --- /dev/null +++ b/reactos/subsys/system/userinit/userinit.c @@ -0,0 +1,106 @@ +/* + * ReactOS applications + * Copyright (C) 2001, 2002 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: userinit.c,v 1.1 2003/12/07 01:12:58 weiden Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Userinit Logon Application + * FILE: subsys/system/userinit/userinit.c + * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net) + */ +#include + + +/* GLOBALS ******************************************************************/ + +/* FUNCTIONS ****************************************************************/ + +static +BOOL GetShell(WCHAR *CommandLine) +{ + HKEY hKey; + DWORD Type, Size; + WCHAR Shell[MAX_PATH]; + BOOL Ret = FALSE; + + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", + 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + Size = MAX_PATH * sizeof(WCHAR); + if(RegQueryValueEx(hKey, + L"Shell", + NULL, + &Type, + (LPBYTE)Shell, + &Size) == ERROR_SUCCESS) + { + if(Type == REG_SZ) + { + wcscpy(CommandLine, Shell); + Ret = TRUE; + } + } + RegCloseKey(hKey); + } + + if(!Ret) + { + if(GetWindowsDirectory(CommandLine, MAX_PATH - 13)) + wcscat(CommandLine, L"\\explorer.exe"); + else + wcscpy(CommandLine, L"explorer.exe"); + } + + return Ret; +} + +int WINAPI +WinMain(HINSTANCE hInst, + HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, + int nCmdShow) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + WCHAR Shell[MAX_PATH]; + + GetShell(Shell); + + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + + if(CreateProcess(NULL, + Shell, + NULL, + NULL, + FALSE, + NORMAL_PRIORITY_CLASS, + NULL, + NULL, + &si, + &pi)) + { + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + + return 0; +} + +/* EOF */ diff --git a/reactos/subsys/system/userinit/userinit.rc b/reactos/subsys/system/userinit/userinit.rc new file mode 100644 index 00000000000..d819d59d462 --- /dev/null +++ b/reactos/subsys/system/userinit/userinit.rc @@ -0,0 +1,37 @@ +#include +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "Userinit Logon Application\0" + VALUE "FileVersion", RES_STR_FILE_VERSION + VALUE "InternalName", "userinit\0" + VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT + VALUE "OriginalFilename", "userinit.exe\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END