Changeset 4664 for trunk/src/kernel32/heapstring.cpp
- Timestamp:
- Nov 21, 2000, 3:10:09 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/heapstring.cpp
r4525 r4664 1 /* $Id: heapstring.cpp,v 1.3 4 2000-10-23 19:35:11sandervl Exp $ */1 /* $Id: heapstring.cpp,v 1.35 2000-11-21 14:10:08 sandervl Exp $ */ 2 2 3 3 /* … … 547 547 for (i = 0; i < unilen-1; i++) 548 548 { 549 astring[i] = (ustring[i] > 255) ? (char) 20 : (char)ustring[i]; //CB: handle invalid characters as space549 astring[i] = (ustring[i] > 255) ? (char)0x20 : (char)ustring[i]; //CB: handle invalid characters as space 550 550 if (ustring[i] == 0) return i; //asta la vista, baby 551 551 } 552 552 553 astring[unilen-1] = 0; // @@@PH: 1999/06/09 fix - always terminate string554 555 return (unilen-1);553 // astring[unilen-1] = 0; // @@@PH: 1999/06/09 fix - always terminate string 554 // return(unilen-1); 555 return unilen; 556 556 } 557 557 } … … 566 566 567 567 ret = lstrcpynCtoA(astring, ustring, unilen, GetWindowsUconvObject()); 568 astring[unilen-1] = 0; 568 //Must not always set the last character to 0; some apps send the wrong 569 //string size to apis that use this function (i.e. GetMenuStringW (Notes)) 570 //-> overwrites stack 571 if(ret == unilen) { 572 astring[unilen-1] = 0; 573 } 574 else astring[ret] = 0; 575 569 576 return ret; 570 577 } … … 680 687 681 688 ret = lstrcpynAtoC(unicode, ascii, asciilen, GetWindowsUconvObject()); 682 unicode[asciilen-1] = 0; 689 //Must not always set the last character to 0; some apps send the wrong 690 //string size to apis that use this function (i.e. GetMenuStringW (Notes)) 691 //-> overwrites stack 692 if(ret == asciilen) { 693 unicode[asciilen-1] = 0; 694 } 695 else unicode[ret] = 0; 683 696 return ret; 684 697 }
Note:
See TracChangeset
for help on using the changeset viewer.