FreeRDP
environment.h
1 
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
31 extern "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
75 extern "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 
90  WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
91  WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
92 
93  WINPR_ATTR_MALLOC(FreeEnvironmentStringsA, 1)
94  WINPR_API LPCH GetEnvironmentStrings(VOID);
95 
96  WINPR_ATTR_MALLOC(FreeEnvironmentStringsW, 1)
97  WINPR_API LPWCH GetEnvironmentStringsW(VOID);
98 
99  WINPR_API BOOL SetEnvironmentStringsA(LPCH NewEnvironment);
100  WINPR_API BOOL SetEnvironmentStringsW(LPWCH NewEnvironment);
101 
102  WINPR_API DWORD ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR lpDst, DWORD nSize);
103  WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #ifdef UNICODE
110 #define GetEnvironmentVariable GetEnvironmentVariableW
111 #define SetEnvironmentVariable SetEnvironmentVariableW
112 #define GetEnvironmentStrings GetEnvironmentStringsW
113 #define SetEnvironmentStrings SetEnvironmentStringsW
114 #define ExpandEnvironmentStrings ExpandEnvironmentStringsW
115 #define FreeEnvironmentStrings FreeEnvironmentStringsW
116 #else
117 #define GetEnvironmentVariable GetEnvironmentVariableA
118 #define SetEnvironmentVariable SetEnvironmentVariableA
119 #define GetEnvironmentStringsA GetEnvironmentStrings
120 #define SetEnvironmentStrings SetEnvironmentStringsA
121 #define ExpandEnvironmentStrings ExpandEnvironmentStringsA
122 #define FreeEnvironmentStrings FreeEnvironmentStringsA
123 #endif
124 
125 #endif
126 
127 #ifdef __cplusplus
128 extern "C"
129 {
130 #endif
131 
132  WINPR_ATTR_MALLOC(free, 1)
133  WINPR_API LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge);
134 
135  WINPR_API DWORD GetEnvironmentVariableEBA(LPCSTR envBlock, LPCSTR lpName, LPSTR lpBuffer,
136  DWORD nSize);
137  WINPR_API BOOL SetEnvironmentVariableEBA(LPSTR* envBlock, LPCSTR lpName, LPCSTR lpValue);
138 
139  WINPR_ATTR_MALLOC(free, 1)
140  WINPR_API char** EnvironmentBlockToEnvpA(LPCH lpszEnvironmentBlock);
141 
142  WINPR_API DWORD GetEnvironmentVariableX(const char* lpName, char* lpBuffer, DWORD nSize);
143 
144  WINPR_ATTR_MALLOC(free, 1)
145  WINPR_API char* GetEnvAlloc(LPCSTR lpName);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* WINPR_ENVIRONMENT_H */