Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

The Block end is corrupt | The Block is used

Help
Sereby
2009-01-24
2013-05-23
  • Sereby
    Sereby
    2009-01-24

    when calling this, with full-debugmode enabled, i get this error and cant fix it propperly :(
    but every documentation about these functions looks like this!
    I'm using Delphi 2009 and newest FastMM4

      function GetWindowsLanguage(ALCID:Integer; LCTYPE: LCTYPE): String;
      var
        Buffer : PChar;
        Size : Integer;
      begin
        Size := GetLocaleInfo(ALCID, LCType, nil, 0);
        GetMem(Buffer, Size);
        try
          GetLocaleInfo(ALCID, LCTYPE, Buffer, Size);
          Result := String(Buffer);
        finally
          FreeMem(Buffer);
        end;
      end;

    ...
    GetWindowsLanguage(LANG_USER_DEFAULT,LOCALE_IDEFAULTLANGUAGE);

     
    • The value returned by GetLocaleInfo is the size in TChar values. You are using D2009 so a Char is a WideChar (two bytes), but GetMem use a byte count. You are dimensioning the buffer half of the size needed. Try to change it to
      GetMem(Buffer, Size * SizeOf(Char))

      Bye, Maurizio.

       
      • Sereby
        Sereby
        2009-01-24

        cool it works :) thanks man!