22 #ifndef WINPR_ENVIRONMENT_H
23 #define WINPR_ENVIRONMENT_H
25 #include <winpr/winpr.h>
26 #include <winpr/wtypes.h>
35 WINPR_API DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
36 WINPR_API DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
38 WINPR_API BOOL SetCurrentDirectoryA(LPCSTR lpPathName);
39 WINPR_API BOOL SetCurrentDirectoryW(LPCWSTR lpPathName);
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);
46 WINPR_API LPSTR GetCommandLineA(VOID);
47 WINPR_API LPWSTR GetCommandLineW(VOID);
49 WINPR_API BOOL NeedCurrentDirectoryForExePathA(LPCSTR ExeName);
50 WINPR_API BOOL NeedCurrentDirectoryForExePathW(LPCWSTR ExeName);
57 #define GetCurrentDirectory GetCurrentDirectoryW
58 #define SetCurrentDirectory SetCurrentDirectoryW
59 #define SearchPath SearchPathW
60 #define GetCommandLine GetCommandLineW
61 #define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW
63 #define GetCurrentDirectory GetCurrentDirectoryA
64 #define SetCurrentDirectory SetCurrentDirectoryA
65 #define SearchPath SearchPathA
66 #define GetCommandLine GetCommandLineA
67 #define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA
72 #if !defined(_WIN32) || defined(_UWP)
79 WINPR_API DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
80 WINPR_API DWORD GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);
82 WINPR_API BOOL SetEnvironmentVariableA(LPCSTR lpName, LPCSTR lpValue);
83 WINPR_API BOOL SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue);
90 WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
91 WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
93 WINPR_ATTR_MALLOC(FreeEnvironmentStringsA, 1)
94 WINPR_API LPCH GetEnvironmentStrings(VOID);
96 WINPR_ATTR_MALLOC(FreeEnvironmentStringsW, 1)
97 WINPR_API LPWCH GetEnvironmentStringsW(VOID);
99 WINPR_API BOOL SetEnvironmentStringsA(LPCH NewEnvironment);
100 WINPR_API BOOL SetEnvironmentStringsW(LPWCH NewEnvironment);
102 WINPR_API DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
103 WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize);
110 #define GetEnvironmentVariable GetEnvironmentVariableW
111 #define SetEnvironmentVariable SetEnvironmentVariableW
112 #define GetEnvironmentStrings GetEnvironmentStringsW
113 #define SetEnvironmentStrings SetEnvironmentStringsW
114 #define ExpandEnvironmentStrings ExpandEnvironmentStringsW
115 #define FreeEnvironmentStrings FreeEnvironmentStringsW
117 #define GetEnvironmentVariable GetEnvironmentVariableA
118 #define SetEnvironmentVariable SetEnvironmentVariableA
119 #define GetEnvironmentStringsA GetEnvironmentStrings
120 #define SetEnvironmentStrings SetEnvironmentStringsA
121 #define ExpandEnvironmentStrings ExpandEnvironmentStringsA
122 #define FreeEnvironmentStrings FreeEnvironmentStringsA
132 WINPR_ATTR_MALLOC(free, 1)
133 WINPR_API LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge);
135 WINPR_API DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
137 WINPR_API BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue);
139 WINPR_ATTR_MALLOC(free, 1)
140 WINPR_API
char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock);
142 WINPR_API DWORD GetEnvironmentVariableX(const
char* lpName,
char* lpBuffer, DWORD nSize);
144 WINPR_ATTR_MALLOC(free, 1)
145 WINPR_API
char* GetEnvAlloc(LPCSTR lpName);