2 * WinPR: Windows Portable Runtime
3 * Process Environment Functions
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef WINPR_ENVIRONMENT_H
23 #define WINPR_ENVIRONMENT_H
25 #include <winpr/winpr.h>
26 #include <winpr/wtypes.h>
34 WINPR_API DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
35 WINPR_API DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
37 WINPR_API BOOL SetCurrentDirectoryA(LPCSTR lpPathName);
38 WINPR_API BOOL SetCurrentDirectoryW(LPCWSTR lpPathName);
40 WINPR_API DWORD SearchPathA(LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart);
41 WINPR_API DWORD SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart);
43 WINPR_API LPSTR GetCommandLineA(VOID);
44 WINPR_API LPWSTR GetCommandLineW(VOID);
46 WINPR_API BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
47 WINPR_API BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
49 WINPR_API DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
50 WINPR_API DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
52 WINPR_API BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue);
53 WINPR_API BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue);
56 * A brief history of the GetEnvironmentStrings functions:
57 * http://blogs.msdn.com/b/oldnewthing/archive/2013/01/17/10385718.aspx
60 WINPR_API LPCH GetEnvironmentStrings(VOID);
61 WINPR_API LPWCH GetEnvironmentStringsW(VOID);
63 WINPR_API BOOL SetEnvironmentStringsA(LPCH NewEnvironment);
64 WINPR_API BOOL SetEnvironmentStringsW(LPWCH NewEnvironment);
66 WINPR_API DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
67 WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize);
69 WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
70 WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
77 #define GetCurrentDirectory GetCurrentDirectoryW
78 #define SetCurrentDirectory SetCurrentDirectoryW
79 #define SearchPath SearchPathW
80 #define GetCommandLine GetCommandLineW
81 #define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
82 #define GetEnvironmentVariable GetEnvironmentVariableW
83 #define SetEnvironmentVariable SetEnvironmentVariableW
84 #define GetEnvironmentStrings GetEnvironmentStringsW
85 #define SetEnvironmentStrings SetEnvironmentStringsW
86 #define ExpandEnvironmentStrings ExpandEnvironmentStringsW
87 #define FreeEnvironmentStrings FreeEnvironmentStringsW
89 #define GetCurrentDirectory GetCurrentDirectoryA
90 #define SetCurrentDirectory SetCurrentDirectoryA
91 #define SearchPath SearchPathA
92 #define GetCommandLine GetCommandLineA
93 #define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
94 #define GetEnvironmentVariable GetEnvironmentVariableA
95 #define SetEnvironmentVariable SetEnvironmentVariableA
96 #define GetEnvironmentStringsA GetEnvironmentStrings
97 #define SetEnvironmentStrings SetEnvironmentStringsA
98 #define ExpandEnvironmentStrings ExpandEnvironmentStringsA
99 #define FreeEnvironmentStrings FreeEnvironmentStringsA
108 WINPR_API LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge);
110 WINPR_API DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
111 WINPR_API BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue);
117 #endif /* WINPR_ENVIRONMENT_H */