4 #include <winpr/tchar.h>
5 #include <winpr/environment.h>
7 int TestEnvironmentGetEnvironmentStrings(
int argc,
char* argv[])
14 LPTCH lpszEnvironmentBlock = GetEnvironmentStrings();
15 if (!lpszEnvironmentBlock)
18 TCHAR* p = lpszEnvironmentBlock;
21 const size_t max = _tcslen(p);
22 const int rc = _sntprintf(NULL, 0, _T(
"%s\n"), p);
25 _tprintf(_T(
"test failed: return %d\n"), rc);
28 if (max != (
size_t)(rc - 1))
30 _tprintf(_T(
"test failed: length %") _T(PRIuz) _T(
" != %d [%s]\n"), max, rc - 1, p);
38 FreeEnvironmentStrings(lpszEnvironmentBlock);