summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c')
-rw-r--r--winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c b/winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c
new file mode 100644
index 0000000..428418d
--- /dev/null
+++ b/winpr/libwinpr/environment/test/TestEnvironmentMergeEnvironmentStrings.c
@@ -0,0 +1,34 @@
+
+#include <stdio.h>
+#include <winpr/crt.h>
+#include <winpr/tchar.h>
+#include <winpr/environment.h>
+
+int TestEnvironmentMergeEnvironmentStrings(int argc, char* argv[])
+{
+#ifndef _WIN32
+ TCHAR* p = NULL;
+ size_t length = 0;
+ LPTCH lpszEnvironmentBlock = NULL;
+ LPTCH lpsz2Merge = "SHELL=123\0test=1\0test1=2\0DISPLAY=:77\0\0";
+ LPTCH lpszMergedEnvironmentBlock = NULL;
+
+ WINPR_UNUSED(argc);
+ WINPR_UNUSED(argv);
+
+ 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(lpszMergedEnvironmentBlock);
+ FreeEnvironmentStrings(lpszEnvironmentBlock);
+#endif
+ return 0;
+}