HB_VLINKREAD() Question

130 views
Skip to first unread message

Mario H. Sabado

unread,
Mar 3, 2026, 11:43:33 AM (12 days ago) Mar 3
to 'elch' via Harbour Users
Hi Team,

While trying to determine if a file or directory is a link or not, I encountered that when the file/directory is a valid link, it returns the actual location of the file.  When the file/directory is not a link, it returns the current file/directory location.

I checked on the Changelog and as I understand it, it should return the dest file/directory if the parameter is a link or empty  if it is not a link. 

HB_VFLINKREAD( <cFileName> ) -> <cDestFileName> | ""

If this is the expected behavior, what's the alternative function to determine if file/directory is a link/symlink?

Thanks,
Mario

Mario H. Sabado

unread,
Mar 3, 2026, 8:16:49 PM (12 days ago) Mar 3
to 'elch' via Harbour Users
Hi,

As per further testing, this only occurs on my Windows (10).  Under Linux (Ubuntu), non-linked files return empty string.

Thanks,
Mario

Maurizio la Cecilia

unread,
Mar 4, 2026, 12:55:09 PM (11 days ago) Mar 4
to harbou...@googlegroups.com
Hi Mario,
I've tested on Windows 11 what you said and found inconsistent values returned by HB_VFLINKREAD().

As alternative, according to the Shell Link Binary File Format (download at https://winprotocoldocs-bhdugrdyduf5h2e4.b02.azurefd.net/MS-SHLLINK/%5bMS-SHLLINK%5d.pdf ), you could use this simple function

function hbs_IsFileLink( cFilePath )
    local lResult := .f.
    if hb_vfExists( cFilePath )
       lResult := hb_LeftEq( hb_vfLoad( cFilePath ), e"\x4C\x00\x00\x00\x01\x14\x02\x00\x00\x00\x00\x00\xC0\x00\x00\x00\x00\x00\x00\x46" )
    endif
    return lResult

or modify it for your needs.

Best regards.
--
Maurizio
--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/CAGuBOFo_pcGJNkBqwODVv_riTZtgm6ZA25p77BOm%3DmXw_oKUmg%40mail.gmail.com.


Mario H. Sabado

unread,
Mar 4, 2026, 1:17:11 PM (11 days ago) Mar 4
to harbou...@googlegroups.com
Many thanks for this info Maurizio.  Greatly appreciated.

Best regards,
Mario


Reply all
Reply to author
Forward
0 new messages