title: Unicode problems with Delphi 2009 / 2010 and windows API calls
body: <p>Hi  I have been using this function in Delphi 2006, but now with D2010 it throws an error. 
  I think it is related to the switch to Unicode. </p>
  
  <pre><code>  Function TWinUtils.GetTempFile(Const Extension: STRING): STRING;
    Var
       Buffer: ARRAY [0 .. MAX_PATH] OF char;
    Begin
      Repeat
        GetTempPath(SizeOf(Buffer) - 1, Buffer);
        GetTempFileName(Buffer, '~~', 0, Buffer);
        Result := ChangeFileExt(Buffer, Extension);
      Until not FileExists(Result);
    End;
  </code></pre>
  
  <p>What should I do to make it work?</p>
  
  <p>EDIT</p>
  
  <p>I get an 'access violation' when the ChangeFileExt is called </p>