{"id":3973,"date":"2008-09-23T01:17:00","date_gmt":"2008-09-23T01:17:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2008\/09\/23\/to-compare-two-filenames-lucian-wischik\/"},"modified":"2024-07-05T14:07:51","modified_gmt":"2024-07-05T21:07:51","slug":"to-compare-two-filenames-lucian-wischik","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/to-compare-two-filenames-lucian-wischik\/","title":{"rendered":"To compare two filenames (Lucian Wischik)"},"content":{"rendered":"<p>I once visited an ancient tower in China. A sign said &#8220;tread carefully for you bear the weight of history on your shoulders&#8221;. Our guide explained that the tower was over 800 years old! Oh yes, he said, it was built 800 years ago,&nbsp;had burnt to the ground three times in its history, had been moved to completely different locations twice, but it still counted as 800 years old.<\/p>\n<p>Back in VB land I was making two different calls into&nbsp;some framework, and each call gave me back a filename, and I needed to judge whether the two results&nbsp;were talking about the same file. But how? The framework docs didn&#8217;t give any guarantee that they&#8217;d give back filenames in the same format. What if one call returned long filenames and the other returned it with different casing? or 8.3 format? Or UNC? Or long UNC?<\/p>\n<p>The following function is the best I could come up with. I think it only makes sense to compare filenames if they point to an <em>existing<\/em> file. And I called the function &#8220;DidFileNamesPointToSameFile&#8221;, in the <em>past tense<\/em>, because by the time the function returns then they might no longer point to the same file anymore!<\/p>\n<p>If anyone has suggestions for neater ways to accomplish the same task, I&#8217;d love to hear.<\/p>\n<p>&nbsp;<\/p>\n<p><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\"><\/p>\n<p>Module<\/p>\n<p><\/font><\/font><font size=\"2\"> Module1<br \/>&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Sub<\/font><\/font><font size=\"2\"> Main()<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> same1 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;C:SHARELONGFILENAME.TXT&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">)<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> same2 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">)<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\"><br \/>&nbsp;&nbsp;&nbsp; Dim<\/font><\/font><font size=\"2\"> same3 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;\\lwischiklsharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">)<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> same4 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;\\?c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">)<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> same5 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfi~1.txt&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:sharelongfilename.txt&#8221;<\/font><\/font><font size=\"2\">)<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> same6 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:share&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;C:SHARE&#8221;<\/font><\/font><font size=\"2\">)<br \/><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">&nbsp;&nbsp;&nbsp; Dim<\/font><\/font><font size=\"2\"> diff1 = DidFileNamesPointToSameFile(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:shareNonExistantFile.txt&#8221;<\/font><\/font><font size=\"2\">, <\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;c:shareNonExistantFile.txt&#8221;<\/font><\/font><font size=\"2\">)<br \/>&nbsp;&nbsp;<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Sub<\/p>\n<p><\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&nbsp; &#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;summary&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; Determines whether two filenames pointed to the same (existing) file\/directory on disk.<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; This function deals correctly with mismatched case, with relative vs absolute paths, with<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; UNC-style \\serverfilenames, with super-long \\?filenames, and with long vs 8.3 filenames.<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; Note: it&#8217;s conceivable that the result of this function has become out of date by the time<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; it function returns, e.g. if another process is deleting or creating or renaming files.<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;\/summary&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;param name=&#8221;FileName1&#8243;&gt;<\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">The first filename to compare<\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;\/param&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;param name=&#8221;FileName2&#8243;&gt;<\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">The second filename to compare<\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;\/param&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;returns&gt;<\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">True if both filenames referred to the same file and it existed; false otherwise<\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;\/returns&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; <\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;remarks&gt;<\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">This function uses BY_HANDLE_FILE_INFORMATION. This is the only way to determine authoritatively<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; whether two filenames are equivalent. MSDN explains:<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; The identifier (low and high parts) and the volume serial number uniquely identify a file on a single computer.<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; To determine whether two open handles represent the same file, combine the identifier and the volume serial number<br \/>&nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8221;&#8217; for each file and compare them.<\/font><\/font><font color=\"#808080\" size=\"2\"><font color=\"#808080\" size=\"2\">&lt;\/remarks&gt;<br \/>&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/font><\/font><font size=\"2\"> DidFileNamesPointToSameFile(<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> FileName1 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">String<\/font><\/font><font size=\"2\">, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> FileName2 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">String<\/font><\/font><font size=\"2\">) <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Boolean<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> desiredAccess <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32 = 0 <\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8216; We request neither read nor write access<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> fileShareMode <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32 = 7 <\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8216; FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> createDisposition <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32 = 3 <\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8216; OPEN_EXISTING<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> fileAttributes <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32 = &amp;H2000080 <\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8216; FILE_FLAG_BACKUP_SEMANTICS|FILE_ATTRIBUTES_NORMAL. BACKUP is needed to open a&nbsp;directory.<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#008000\" size=\"2\"><font color=\"#008000\" size=\"2\">&#8216;<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Using<\/font><\/font><font size=\"2\"> handle1 = CreateFile(FileName1, desiredAccess, fileShareMode, IntPtr.Zero, createDisposition, fileAttributes, IntPtr.Zero)<br \/>&nbsp; &nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Using<\/font><\/font><font size=\"2\"> handle2 = CreateFile(FileName2, desiredAccess, fileShareMode, IntPtr.Zero, createDisposition, fileAttributes, IntPtr.Zero)<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">If<\/font><\/font><font size=\"2\"> handle1.IsInvalid <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">OrElse<\/font><\/font><font size=\"2\"> handle2.IsInvalid <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Then<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Return<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">False<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> info1 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">New<\/font><\/font><font size=\"2\"> BY_HANDLE_FILE_INFORMATION, info2 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">New<\/font><\/font><font size=\"2\"> BY_HANDLE_FILE_INFORMATION<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> r1 = GetFileInformationByHandle(handle1, info1)<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> r2 = GetFileInformationByHandle(handle2, info2)<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">If<\/font><\/font><font size=\"2\"> r1 = 0 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">OrElse<\/font><\/font><font size=\"2\"> r2 = 0 <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Then<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Return<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">False<br \/>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Return<\/font><\/font><font size=\"2\"> info1.nFileIndexLow = info2.nFileIndexLow <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">AndAlso<\/font><\/font><font size=\"2\"> info1.nFileIndexHigh = info2.nFileIndexHigh <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">AndAlso<\/font><\/font><font size=\"2\"> info1.dwVolumeSerialNumber = info2.dwVolumeSerialNumber<br \/>&nbsp; &nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Using<br \/>&nbsp; &nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Using<br \/><\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">&nbsp; End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/p>\n<p><\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">&nbsp; Structure<\/font><\/font><font size=\"2\"> BY_HANDLE_FILE_INFORMATION<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> dwFileAttributes <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> ftCreationTime <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> System.Runtime.InteropServices.ComTypes.FILETIME<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> ftLastAccessTime <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> System.Runtime.InteropServices.ComTypes.FILETIME<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> ftLastWriteTime <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> System.Runtime.InteropServices.ComTypes.FILETIME<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> dwVolumeSerialNumber <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> nFileSizeHigh <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> nFileSizeLow <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> nNumberOfLinks <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> nFileIndexHigh <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp;&nbsp;&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Dim<\/font><\/font><font size=\"2\"> nFileIndexLow <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Structure<\/p>\n<p>&nbsp; <\/font><\/font><font size=\"2\">&lt;System.Runtime.InteropServices.DllImport(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;kernel32.dll&#8221;<\/font><\/font><font size=\"2\">, SetLastError:=<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">True<\/font><\/font><font size=\"2\">, CharSet:=System.Runtime.InteropServices.CharSet.Auto)&gt; _<br \/>&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/font><\/font><font size=\"2\"> GetFileInformationByHandle(<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> hFile <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> Microsoft.Win32.SafeHandles.SafeFileHandle, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByRef<\/font><\/font><font size=\"2\"> lpFileInformation <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> BY_HANDLE_FILE_INFORMATION) <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Integer<br \/>&nbsp; <\/font><\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/p>\n<p>&nbsp; <\/font><\/font><font size=\"2\">&lt;System.Runtime.InteropServices.DllImport(<\/font><font color=\"#a31515\" size=\"2\"><font color=\"#a31515\" size=\"2\">&#8220;kernel32.dll&#8221;<\/font><\/font><font size=\"2\">, SetLastError:=<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">True<\/font><\/font><font size=\"2\">, CharSet:=System.Runtime.InteropServices.CharSet.Auto)&gt; _<br \/>&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/font><\/font><font size=\"2\"> CreateFile(<\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> lpFileName <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">String<\/font><\/font><font size=\"2\">, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> dwDesiredAccess <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> dwShareMode <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32, _<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> lpSecurityAttributes <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> IntPtr, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> dwCreationDisposition <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32, _<br \/>&nbsp;&nbsp;&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> dwFlagsAndAttributes <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> UInt32, <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">ByVal<\/font><\/font><font size=\"2\"> hTemplateFile <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> IntPtr) <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">As<\/font><\/font><font size=\"2\"> Microsoft.Win32.SafeHandles.SafeFileHandle<br \/>&nbsp; <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">End<\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Function<\/p>\n<p>End<\/p>\n<p><\/font><\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\"><font color=\"#0000ff\" size=\"2\">Module<\/font><\/font><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I once visited an ancient tower in China. A sign said &#8220;tread carefully for you bear the weight of history on your shoulders&#8221;. Our guide explained that the tower was over 800 years old! Oh yes, he said, it was built 800 years ago,&nbsp;had burnt to the ground three times in its history, had been [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[192,195],"tags":[99],"class_list":["post-3973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-visual-basic","tag-lucian-wischik"],"acf":[],"blog_post_summary":"<p>I once visited an ancient tower in China. A sign said &#8220;tread carefully for you bear the weight of history on your shoulders&#8221;. Our guide explained that the tower was over 800 years old! Oh yes, he said, it was built 800 years ago,&nbsp;had burnt to the ground three times in its history, had been [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/3973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=3973"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/3973\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=3973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=3973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=3973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}