<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Lazarus - MacOS - DiskArbitration with callbacks on disk updates in Pascal - Delphi, Lazarus, Free Pascal				            </title>
            <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-diskarbitration-with-callbacks-on-disk-updates-in-pascal/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Wed, 20 May 2026 07:16:02 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Lazarus - MacOS - DiskArbitration with callbacks on disk updates in Pascal</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-diskarbitration-with-callbacks-on-disk-updates-in-pascal/#post-510</link>
                        <pubDate>Sat, 16 Feb 2019 06:51:27 +0000</pubDate>
                        <description><![CDATA[Since this took me a lot of time and work to figure out (thanks to the guys in the Lazarus forum as well, without their help I would have not gotten this to work), I figured; post it in the ...]]></description>
                        <content:encoded><![CDATA[<p>Since this took me a lot of time and work to figure out (thanks to the guys in the <a href="http://forum.lazarus.freepascal.org/index.php/topic,44285.0.html" target="_blank">Lazarus forum</a> as well, without their help I would have not gotten this to work), I figured; post it in the forum, maybe others are interested as well.</p><p>What this little demo project does is register functions of my application with MacOS, so that when a disk appears, disappears, or changes, my application gets notified by the OS.<br>For this I have used what Apple calls "DiskArbitration". I've included the required units for that (diskarbitration and dissenter).</p><p>The demo also shows how to read a CFArrayRef and how to convert a CFStringRef to a Pascal string;</p><pre>function CFStringToPascalString(theCFStringRef: CFTypeRef):string;<br>var FBuf : array of Char;<br>begin<br>&nbsp; if theCFStringRef&lt;&gt;nil then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; FillChar(FBuf, SizeOf(FBuf), 0);<br>&nbsp; &nbsp; &nbsp; CFStringGetPascalString(theCFStringRef,@FBuf,SizeOf(FBuf),CFStringGetSystemEncoding);<br>&nbsp; &nbsp; &nbsp; Result := trim(StrPas(PChar(@FBuf))); // skip 1st char, it's a strange 1st char causing crashes<br>&nbsp; &nbsp; end<br>&nbsp; else<br>&nbsp; &nbsp; Result:='';<br>end;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</pre><p><br></p><p>I hope it is to use for one or the other Lazarus Pascal user that works under MacOS.</p><div id="wpfa-11545" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="https://www.tweaking4all.com/wp-content/uploads/2019/02/DiskArbitrationTest.zip" target="_blank"><i class="fa fa-paperclip"></i>DiskArbitrationTest.zip</a></div><div id="wpfa-11546" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="https://www.tweaking4all.com/wp-content/uploads/2019/02/DiskArbitrationTest.png" target="_blank"><i class="fa fa-paperclip"></i>DiskArbitrationTest.png</a></div>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-diskarbitration-with-callbacks-on-disk-updates-in-pascal/#post-510</guid>
                    </item>
							        </channel>
        </rss>
		