fix for LoadStringA - return part of string if buffer is to small
Modified: trunk/reactos/lib/user32/misc/resources.c

Modified: trunk/reactos/lib/user32/misc/resources.c
--- trunk/reactos/lib/user32/misc/resources.c	2005-12-03 20:53:23 UTC (rev 19844)
+++ trunk/reactos/lib/user32/misc/resources.c	2005-12-03 21:00:55 UTC (rev 19845)
@@ -98,7 +98,7 @@
 {
  UNICODE_STRING wstrResStr;
  ANSI_STRING strBuf;
- NTSTATUS nErrCode;
+ INT retSize;
 
  /* parameter validation */
  if
@@ -125,14 +125,13 @@
  strBuf.MaximumLength = nBufferMax * sizeof(CHAR);
  strBuf.Buffer = lpBuffer;
 
- nErrCode = RtlUnicodeStringToAnsiString(&strBuf, &wstrResStr, FALSE);
+ retSize = WideCharToMultiByte(CP_ACP, 0, wstrResStr.Buffer, wstrResStr.Length / sizeof(WCHAR), strBuf.Buffer, strBuf.MaximumLength, NULL, NULL);
 
- if(!NT_SUCCESS(nErrCode))
- {
+ if(!retSize)
   /* failure */
-  RtlNtStatusToDosError(nErrCode);
   return 0;
- }
+ else 
+  strBuf.Length = retSize;
 
  /* the ANSI string may not be null-terminated */
  if(strBuf.Length >= strBuf.MaximumLength)