cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

environment.h (4643B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Process Environment Functions
      4 *
      5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 * Copyright 2013 Thincast Technologies GmbH
      7 * Copyright 2013 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
      8 *
      9 * Licensed under the Apache License, Version 2.0 (the "License");
     10 * you may not use this file except in compliance with the License.
     11 * You may obtain a copy of the License at
     12 *
     13 *     http://www.apache.org/licenses/LICENSE-2.0
     14 *
     15 * Unless required by applicable law or agreed to in writing, software
     16 * distributed under the License is distributed on an "AS IS" BASIS,
     17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18 * See the License for the specific language governing permissions and
     19 * limitations under the License.
     20 */
     21
     22#ifndef WINPR_ENVIRONMENT_H
     23#define WINPR_ENVIRONMENT_H
     24
     25#include <winpr/winpr.h>
     26#include <winpr/wtypes.h>
     27
     28#ifndef _WIN32
     29
     30#ifdef __cplusplus
     31extern "C"
     32{
     33#endif
     34
     35	WINPR_API DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
     36	WINPR_API DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
     37
     38	WINPR_API BOOL SetCurrentDirectoryA(LPCSTR lpPathName);
     39	WINPR_API BOOL SetCurrentDirectoryW(LPCWSTR lpPathName);
     40
     41	WINPR_API DWORD SearchPathA(LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension,
     42	                            DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart);
     43	WINPR_API DWORD SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension,
     44	                            DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart);
     45
     46	WINPR_API LPSTR GetCommandLineA(VOID);
     47	WINPR_API LPWSTR GetCommandLineW(VOID);
     48
     49	WINPR_API BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
     50	WINPR_API BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
     51
     52#ifdef __cplusplus
     53}
     54#endif
     55
     56#ifdef UNICODE
     57#define GetCurrentDirectory GetCurrentDirectoryW
     58#define SetCurrentDirectory SetCurrentDirectoryW
     59#define SearchPath SearchPathW
     60#define GetCommandLine GetCommandLineW
     61#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
     62#else
     63#define GetCurrentDirectory GetCurrentDirectoryA
     64#define SetCurrentDirectory SetCurrentDirectoryA
     65#define SearchPath SearchPathA
     66#define GetCommandLine GetCommandLineA
     67#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
     68#endif
     69
     70#endif
     71
     72#if !defined(_WIN32) || defined(_UWP)
     73
     74#ifdef __cplusplus
     75extern "C"
     76{
     77#endif
     78
     79	WINPR_API DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
     80	WINPR_API DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
     81
     82	WINPR_API BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue);
     83	WINPR_API BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue);
     84
     85	/**
     86	 * A brief history of the GetEnvironmentStrings functions:
     87	 * http://blogs.msdn.com/b/oldnewthing/archive/2013/01/17/10385718.aspx
     88	 */
     89
     90	WINPR_API LPCH GetEnvironmentStrings(VOID);
     91	WINPR_API LPWCH GetEnvironmentStringsW(VOID);
     92
     93	WINPR_API BOOL SetEnvironmentStringsA(LPCH NewEnvironment);
     94	WINPR_API BOOL SetEnvironmentStringsW(LPWCH NewEnvironment);
     95
     96	WINPR_API DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
     97	WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize);
     98
     99	WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
    100	WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
    101
    102#ifdef __cplusplus
    103}
    104#endif
    105
    106#ifdef UNICODE
    107#define GetEnvironmentVariable GetEnvironmentVariableW
    108#define SetEnvironmentVariable SetEnvironmentVariableW
    109#define GetEnvironmentStrings GetEnvironmentStringsW
    110#define SetEnvironmentStrings SetEnvironmentStringsW
    111#define ExpandEnvironmentStrings ExpandEnvironmentStringsW
    112#define FreeEnvironmentStrings FreeEnvironmentStringsW
    113#else
    114#define GetEnvironmentVariable GetEnvironmentVariableA
    115#define SetEnvironmentVariable SetEnvironmentVariableA
    116#define GetEnvironmentStringsA GetEnvironmentStrings
    117#define SetEnvironmentStrings SetEnvironmentStringsA
    118#define ExpandEnvironmentStrings ExpandEnvironmentStringsA
    119#define FreeEnvironmentStrings FreeEnvironmentStringsA
    120#endif
    121
    122#endif
    123
    124#ifdef __cplusplus
    125extern "C"
    126{
    127#endif
    128
    129	WINPR_API LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge);
    130
    131	WINPR_API DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
    132	                                          DWORD nSize);
    133	WINPR_API BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue);
    134
    135	WINPR_API char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock);
    136
    137#ifdef __cplusplus
    138}
    139#endif
    140
    141#endif /* WINPR_ENVIRONMENT_H */