procedure WriteREG_MULTI_SZ(const Name, Value: string; const Registry: TRegistry); var p, buffer: PChar; i: Integer; Size: DWORD; aStrings: TStringList; begin Size := 0; aStrings := TStringList.Create; aStrings.Text := Value; try for i := 0 to aStrings.Count - 1 do inc(Size, length(aStrings[i]) + 1); inc(Size); Size := Size * SizeOf(Char); GetMem(buffer, Size); try p := buffer; for i := 0 to aStrings.Count - 1 do begin StrCopy(p, PChar(aStrings[i])); inc(PChar(p), length(p) + 1); end; p^ := #0; SetLastError(RegSetValueEx(Registry.CurrentKey, PChar(Name), 0, REG_MULTI_SZ, buffer, Size)); if GetLastError <> ERROR_SUCCESS then raise Exception.Create('Unable to write MULTI_SZ value'); finally FreeMem(buffer) end finally aStrings.Free; end; end;