Paul Vriens : kernel32: Add a define for UNICODE_STRING_MAX_CHARS.

Alexandre Julliard julliard at winehq.org
Mon Dec 14 09:51:26 CST 2009


Module: wine
Branch: master
Commit: 4d6b74758f9ce967e87a9a1d0b67079898e8a5bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4d6b74758f9ce967e87a9a1d0b67079898e8a5bb

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Mon Dec 14 13:58:24 2009 +0100

kernel32: Add a define for UNICODE_STRING_MAX_CHARS.

---

 dlls/kernel32/environ.c |    4 ++--
 include/winnt.h         |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c
index aaa9d6e..b11f7bf 100644
--- a/dlls/kernel32/environ.c
+++ b/dlls/kernel32/environ.c
@@ -364,8 +364,8 @@ DWORD WINAPI ExpandEnvironmentStringsW( LPCWSTR src, LPWSTR dst, DWORD len )
     RtlInitUnicodeString(&us_src, src);
 
     /* make sure we don't overflow the maximum UNICODE_STRING size */
-    if (len > 0x7fff)
-        len = 0x7fff;
+    if (len > UNICODE_STRING_MAX_CHARS)
+        len = UNICODE_STRING_MAX_CHARS;
 
     us_dst.Length = 0;
     us_dst.MaximumLength = len * sizeof(WCHAR);
diff --git a/include/winnt.h b/include/winnt.h
index e2d1d1a..28409af 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -617,6 +617,8 @@ typedef struct _MEMORY_BASIC_INFORMATION
 #define MAXWORD       0xffff
 #define MAXDWORD      0xffffffff
 
+#define UNICODE_STRING_MAX_CHARS 32767
+
 #define FIELD_OFFSET(type, field) \
   ((LONG)(INT_PTR)&(((type *)0)->field))
 




More information about the wine-cvs mailing list