Hola, gracias por tu codigo. Por cierto, desconocia ese error que con cuentas limitadas se producen errores. En todo caso, aqui te dejo una alternativa mia que no me ha dado ningun error hasta hora.
Código Delphi
[-]unit UNT_GetWriteINI;
interface
uses
Winapi.Windows, System.SysUtils;
function GetINI(sPath: String; sName: String; sKeyName: String; sDefault: String): String;
function WriteINI(sPath: String; sName: String; sKeyName: String; sValor: String): Bool;
implementation
function GetINI(sPath: String; sName: String; sKeyName: String; sDefault: String): String;
var
dwFile: DWORD;
sBuffer: String;
iSize: Integer;
begin
iSize := 0;
dwFile := CreateFile(PChar(sPath), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
iSize := GetFileSize(dwFile, 0);
if iSize = - 1 then exit;
SetLength(sBuffer, iSize);
iSize := GetPrivateProfileString(PChar(sName), PChar(sKeyName), PChar(sDefault), PChar(sBuffer), iSize, PChar(sPath));
Result := Copy(sBuffer, 1, iSize);
end;
function WriteINI(sPath: String; sName: String; sKeyName: String; sValor: String): Bool;
begin
if WritePrivateProfileString(PChar(sName), PChar(sKeyName), PChar(sValor), PChar(sPath)) = True then
Result := True
Else
Result := False;
end;
end.
Saludo.