Commit in reactos/lib/kernel32/misc on MAIN
atom.c+37-11.20 -> 1.21
deny usage of too long strings in add/find atom. makes wine reg. tests happy.

reactos/lib/kernel32/misc
atom.c 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- atom.c	13 Jun 2004 10:35:52 -0000	1.20
+++ atom.c	28 Nov 2004 21:16:15 -0000	1.21
@@ -1,4 +1,4 @@
-/* $Id: atom.c,v 1.20 2004/06/13 10:35:52 navaraf Exp $
+/* $Id: atom.c,v 1.21 2004/11/28 21:16:15 gdalsnes Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -45,6 +45,15 @@
 	return (ATOM)LOWORD((ULONG)lpString);
      }
 
+   if (lstrlenA(lpString) > 255)
+   {
+      /* This limit does not exist with NtAddAtom so the limit is probably 
+       * added for compability. -Gunnar 
+       */
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return (ATOM)0;
+   }
+
    RtlCreateUnicodeStringFromAsciiz(&AtomName,
 				    (LPSTR)lpString);
 
@@ -81,6 +90,15 @@
 	return (ATOM)LOWORD((ULONG)lpString);
      }
 
+   if (lstrlenW(lpString) > 255)
+   {
+      /* This limit does not exist with NtAddAtom so the limit is probably 
+       * added for compability. -Gunnar 
+       */
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return (ATOM)0;
+   }
+
    Status = NtAddAtom((LPWSTR)lpString,
                       wcslen(lpString),
 		      &Atom);
@@ -138,6 +156,15 @@
 	return (ATOM)LOWORD((ULONG)lpString);
      }
 
+   if (lstrlenA(lpString) > 255)
+   {
+      /* This limit does not exist with NtAddAtom so the limit is probably 
+       * added for compability. -Gunnar 
+       */
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return (ATOM)0;
+   }
+
    RtlCreateUnicodeStringFromAsciiz(&AtomName,
 				    (LPSTR)lpString);
    Status = NtFindAtom(AtomName.Buffer,
@@ -173,6 +200,15 @@
 	return (ATOM)LOWORD((ULONG)lpString);
      }
 
+   if (lstrlenW(lpString) > 255)
+   {
+      /* This limit does not exist with NtAddAtom so the limit is probably 
+       * added for compability. -Gunnar 
+       */
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return (ATOM)0;
+   }
+
    Status = NtFindAtom((LPWSTR)lpString,
                        wcslen(lpString),
 		       &Atom);
CVSspam 0.2.8