1998-04-13 14:21:30 +02:00
|
|
|
/*
|
|
|
|
* Process environment management
|
|
|
|
*
|
|
|
|
* Copyright 1996, 1998 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-04-13 14:21:30 +02:00
|
|
|
*/
|
|
|
|
|
2001-07-18 23:04:23 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1998-04-13 14:21:30 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-06-18 05:23:22 +02:00
|
|
|
#include <assert.h>
|
2001-07-18 23:04:23 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "ntstatus.h"
|
2005-11-28 17:32:54 +01:00
|
|
|
#define WIN32_NO_STATUS
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2000-11-28 23:40:56 +01:00
|
|
|
#include "winerror.h"
|
2002-05-17 01:16:01 +02:00
|
|
|
#include "wine/library.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
2003-06-18 05:23:22 +02:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
1998-04-13 14:21:30 +02:00
|
|
|
|
2005-06-14 13:42:34 +02:00
|
|
|
#include "kernel_private.h"
|
|
|
|
|
2003-06-18 05:23:22 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(environ);
|
2000-12-11 04:48:15 +01:00
|
|
|
|
2003-09-18 06:28:22 +02:00
|
|
|
/* Notes:
|
1998-04-13 14:21:30 +02:00
|
|
|
* - 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-18 05:23:22 +02:00
|
|
|
static STARTUPINFOA startup_infoA;
|
|
|
|
|
2000-08-10 00:33:42 +02:00
|
|
|
/***********************************************************************
|
2001-06-13 22:13:18 +02:00
|
|
|
* GetStartupInfoA (KERNEL32.@)
|
2000-08-10 00:33:42 +02:00
|
|
|
*/
|
|
|
|
VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info )
|
|
|
|
{
|
2008-03-03 23:27:46 +01:00
|
|
|
*info = startup_infoA;
|
2000-08-10 00:33:42 +02:00
|
|
|
}
|
|
|
|
|
2003-06-18 05:23:22 +02:00
|
|
|
/******************************************************************
|
|
|
|
* 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;
|
|
|
|
|
2004-10-25 23:47:23 +02:00
|
|
|
startup_infoA.cb = sizeof(startup_infoA);
|
2003-06-18 05:23:22 +02:00
|
|
|
startup_infoA.lpReserved = NULL;
|
2010-06-08 11:53:58 +02:00
|
|
|
startup_infoA.lpDesktop = RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) == STATUS_SUCCESS ?
|
2003-06-18 05:23:22 +02:00
|
|
|
ansi.Buffer : NULL;
|
2010-06-08 11:53:58 +02:00
|
|
|
startup_infoA.lpTitle = RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) == STATUS_SUCCESS ?
|
2003-06-18 05:23:22 +02:00
|
|
|
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;
|
2004-10-25 23:47:23 +02:00
|
|
|
startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength;
|
|
|
|
startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL;
|
2015-01-04 07:37:42 +01:00
|
|
|
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;
|
2003-06-18 05:23:22 +02:00
|
|
|
|
|
|
|
RtlReleasePebLock();
|
2000-08-10 00:33:42 +02:00
|
|
|
}
|
2014-06-27 20:16:45 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2014-10-02 10:30:06 +02:00
|
|
|
* GetFirmwareEnvironmentVariableW (KERNEL32.@)
|
2014-06-27 20:16:45 +02:00
|
|
|
*/
|
|
|
|
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;
|
|
|
|
}
|