2013-10-23 11:58:33 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/tchar.h>
|
|
|
|
#include <winpr/environment.h>
|
|
|
|
|
|
|
|
int TestEnvironmentMergeEnvironmentStrings(int argc, char* argv[])
|
|
|
|
{
|
2013-10-31 01:56:44 +04:00
|
|
|
#ifndef _WIN32
|
2013-10-23 11:58:33 +04:00
|
|
|
TCHAR* p;
|
|
|
|
int length;
|
|
|
|
LPTCH lpszEnvironmentBlock;
|
|
|
|
LPTCH lpsz2Merge = "SHELL=123\0test=1\0test1=2\0DISPLAY=:77\0\0";
|
|
|
|
LPTCH lpszMergedEnvironmentBlock;
|
|
|
|
|
|
|
|
lpszEnvironmentBlock = GetEnvironmentStrings();
|
|
|
|
lpszMergedEnvironmentBlock = MergeEnvironmentStrings(lpszEnvironmentBlock,lpsz2Merge);
|
|
|
|
|
|
|
|
p = (TCHAR*) lpszMergedEnvironmentBlock;
|
|
|
|
|
|
|
|
while (p[0] && p[1])
|
|
|
|
{
|
|
|
|
printf("%s\n", p);
|
|
|
|
length = strlen(p);
|
|
|
|
p += (length + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeEnvironmentStrings(lpszEnvironmentBlock);
|
2013-10-31 01:56:44 +04:00
|
|
|
#endif
|
2013-10-23 11:58:33 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|