From 3c9cf9b65f14baa8e439c82cbff3be937f1f8534 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 26 May 2020 14:42:49 +0200 Subject: [PATCH] kernel32: Remove environ.c. Signed-off-by: Alexandre Julliard --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/environ.c | 115 --------------------------------- dlls/kernel32/kernel_main.c | 45 ++++++++++++- dlls/kernel32/kernel_private.h | 6 -- dlls/kernel32/process.c | 20 ++++++ 5 files changed, 62 insertions(+), 125 deletions(-) delete mode 100644 dlls/kernel32/environ.c diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 38c5b55de78..801d8dd7fcf 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -12,7 +12,6 @@ C_SRCS = \ console.c \ debugger.c \ editline.c \ - environ.c \ file.c \ heap.c \ kernel_main.c \ diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c deleted file mode 100644 index 2d80600f78e..00000000000 --- a/dlls/kernel32/environ.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Process environment management - * - * Copyright 1996, 1998 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#include - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "wine/library.h" -#include "winternl.h" -#include "wine/unicode.h" -#include "wine/debug.h" - -#include "kernel_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(environ); - -/* Notes: - * - contrary to Microsoft docs, the environment strings do not appear - * to be sorted on Win95 (although they are on NT); so we don't bother - * to sort them either. - */ - -static STARTUPINFOA startup_infoA; - -/*********************************************************************** - * GetStartupInfoA (KERNEL32.@) - */ -VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) -{ - *info = startup_infoA; -} - -/****************************************************************** - * ENV_CopyStartupInformation (internal) - * - * Creates the STARTUPINFO information from the ntdll information - */ -void ENV_CopyStartupInformation(void) -{ - RTL_USER_PROCESS_PARAMETERS* rupp; - ANSI_STRING ansi; - - RtlAcquirePebLock(); - - rupp = NtCurrentTeb()->Peb->ProcessParameters; - - startup_infoA.cb = sizeof(startup_infoA); - startup_infoA.lpReserved = NULL; - startup_infoA.lpDesktop = RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) == STATUS_SUCCESS ? - ansi.Buffer : NULL; - startup_infoA.lpTitle = RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) == STATUS_SUCCESS ? - ansi.Buffer : NULL; - startup_infoA.dwX = rupp->dwX; - startup_infoA.dwY = rupp->dwY; - startup_infoA.dwXSize = rupp->dwXSize; - startup_infoA.dwYSize = rupp->dwYSize; - startup_infoA.dwXCountChars = rupp->dwXCountChars; - startup_infoA.dwYCountChars = rupp->dwYCountChars; - startup_infoA.dwFillAttribute = rupp->dwFillAttribute; - startup_infoA.dwFlags = rupp->dwFlags; - startup_infoA.wShowWindow = rupp->wShowWindow; - startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength; - startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; - startup_infoA.hStdInput = rupp->hStdInput ? rupp->hStdInput : INVALID_HANDLE_VALUE; - startup_infoA.hStdOutput = rupp->hStdOutput ? rupp->hStdOutput : INVALID_HANDLE_VALUE; - startup_infoA.hStdError = rupp->hStdError ? rupp->hStdError : INVALID_HANDLE_VALUE; - - RtlReleasePebLock(); -} - -/*********************************************************************** - * GetFirmwareEnvironmentVariableA (KERNEL32.@) - */ -DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size) -{ - FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size); - SetLastError(ERROR_INVALID_FUNCTION); - return 0; -} - -/*********************************************************************** - * GetFirmwareEnvironmentVariableW (KERNEL32.@) - */ -DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size) -{ - FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size); - SetLastError(ERROR_INVALID_FUNCTION); - return 0; -} diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index fbc2e8daeec..d312f110812 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -33,7 +33,6 @@ #include "wincon.h" #include "winternl.h" -#include "wine/library.h" #include "kernel_private.h" #include "console_private.h" #include "wine/debug.h" @@ -42,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(process); extern int CDECL __wine_set_signal_handler(unsigned, int (*)(unsigned)); +static STARTUPINFOA startup_infoA; + /*********************************************************************** * set_entry_point */ @@ -77,6 +78,45 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva ) } +/*********************************************************************** + * GetStartupInfoA (KERNEL32.@) + */ +VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) +{ + *info = startup_infoA; +} + +static void copy_startup_info(void) +{ + RTL_USER_PROCESS_PARAMETERS* rupp; + ANSI_STRING ansi; + + RtlAcquirePebLock(); + + rupp = NtCurrentTeb()->Peb->ProcessParameters; + + startup_infoA.cb = sizeof(startup_infoA); + startup_infoA.lpReserved = NULL; + startup_infoA.lpDesktop = !RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) ? ansi.Buffer : NULL; + startup_infoA.lpTitle = !RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) ? ansi.Buffer : NULL; + startup_infoA.dwX = rupp->dwX; + startup_infoA.dwY = rupp->dwY; + startup_infoA.dwXSize = rupp->dwXSize; + startup_infoA.dwYSize = rupp->dwYSize; + startup_infoA.dwXCountChars = rupp->dwXCountChars; + startup_infoA.dwYCountChars = rupp->dwYCountChars; + startup_infoA.dwFillAttribute = rupp->dwFillAttribute; + startup_infoA.dwFlags = rupp->dwFlags; + startup_infoA.wShowWindow = rupp->wShowWindow; + startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength; + startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; + startup_infoA.hStdInput = rupp->hStdInput ? rupp->hStdInput : INVALID_HANDLE_VALUE; + startup_infoA.hStdOutput = rupp->hStdOutput ? rupp->hStdOutput : INVALID_HANDLE_VALUE; + startup_infoA.hStdError = rupp->hStdError ? rupp->hStdError : INVALID_HANDLE_VALUE; + + RtlReleasePebLock(); +} + /*********************************************************************** * KERNEL process initialisation routine */ @@ -94,8 +134,7 @@ static BOOL process_attach( HMODULE module ) CONSOLE_Init(params); - /* copy process information from ntdll */ - ENV_CopyStartupInformation(); + copy_startup_info(); if (!(GetVersion() & 0x80000000)) { diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index d845623265f..7c1d548ff10 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -66,13 +66,7 @@ extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) extern BOOL NLS_IsUnicodeOnlyLcid(LCID) DECLSPEC_HIDDEN; -/* environ.c */ -extern void ENV_CopyStartupInformation(void) DECLSPEC_HIDDEN; - /* computername.c */ extern void COMPUTERNAME_Init(void) DECLSPEC_HIDDEN; -/* oldconfig.c */ -extern void convert_old_config(void) DECLSPEC_HIDDEN; - #endif diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 66fa4ad5067..8f506fcf132 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -741,6 +741,26 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void) return 0; } +/*********************************************************************** + * GetFirmwareEnvironmentVariableA (KERNEL32.@) + */ +DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size) +{ + FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size); + SetLastError(ERROR_INVALID_FUNCTION); + return 0; +} + +/*********************************************************************** + * GetFirmwareEnvironmentVariableW (KERNEL32.@) + */ +DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size) +{ + FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size); + SetLastError(ERROR_INVALID_FUNCTION); + return 0; +} + /********************************************************************** * GetNumaNodeProcessorMask (KERNEL32.@) */