Skip to content

Commit 284feb0

Browse files
tyan0dscho
authored andcommitted
Cygwin: path: Implement path_conv::is_app_execution_alias()
An app execution alias cannot be opened for read (CreateFile() with GENERIC_READ fails with ERROR_CANT_ACCESS_FILE) because it does not resolve the reparse point for app execution alias. Therefore, we need to know if the path is an app execution alias when opening it. This patch adds new api path_conv::is_app_execution_alias() for that purpose. Reviewed-by: Signed-off-by: Takashi Yano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 1f87881 commit 284feb0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

winsup/cygwin/local_includes/path.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ enum path_types
7979
PATH_SOCKET = _BIT ( 5), /* AF_UNIX socket file */
8080
PATH_RESOLVE_PROCFD = _BIT ( 6), /* fd symlink via /proc */
8181
PATH_REP_NOAPI = _BIT ( 7), /* rep. point unknown to WinAPI */
82+
PATH_APPEXECLINK = _BIT ( 8), /* rep. point app execution alias */
8283
PATH_DONT_USE = _BIT (31) /* conversion to signed happens. */
8384
};
8485

@@ -214,6 +215,10 @@ class path_conv
214215
{
215216
return (path_flags & (PATH_REP | PATH_REP_NOAPI)) == PATH_REP;
216217
}
218+
int is_app_execution_alias () const
219+
{
220+
return path_flags & PATH_APPEXECLINK;
221+
}
217222

218223
int isfifo () const {return dev.is_device (FH_FIFO);}
219224
int iscygdrive () const {return dev.is_device (FH_CYGDRIVE);}

winsup/cygwin/path.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp,
26612661
if (i == 2 && n > 0 && n < size)
26622662
{
26632663
RtlInitCountedUnicodeString (psymbuf, buf, n * sizeof (WCHAR));
2664-
return PATH_SYMLINK | PATH_REP;
2664+
return PATH_SYMLINK | PATH_REP | PATH_APPEXECLINK;
26652665
}
26662666
if (i == 2)
26672667
break;

0 commit comments

Comments
 (0)