}
+BOOL IsMountPoint(const char * name)
+{
+ register LONG code = 0;
+ struct ViceIoctl blob;
+ char tbuffer[1024];
+ char lsbuffer[1024];
+ register char *tp;
+ char szCurItem[1024];
+ strcpy(szCurItem, name);
+
+ tp = (char *)strrchr(szCurItem, '\\');
+ if (tp) {
+ strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1); /* the dir name */
+ tbuffer[code] = 0;
+ tp++; /* skip the slash */
+ } else {
+ fs_ExtractDriveLetter(szCurItem, tbuffer);
+ strcat(tbuffer, ".");
+ tp = szCurItem;
+ fs_StripDriveLetter(tp, tp, 0);
+ }
+
+ blob.in = tp;
+ blob.in_size = strlen(tp)+1;
+ blob.out = lsbuffer;
+ blob.out_size = sizeof(lsbuffer);
+
+ code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0);
+
+ return (code==0);
+}
+
+
/*
* Delete AFS mount points. Variables are used as follows:
* tbuffer: Set to point to the null-terminated directory name of the mount point
HOURGLASS hourglass;
for (int i = 0; i < files.GetSize(); i++) {
- char szCurItem[1024];
- strcpy(szCurItem, files[i]);
-
- tp = (char *)strrchr(szCurItem, '\\');
- if (tp) {
- strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1); /* the dir name */
- tbuffer[code] = 0;
- tp++; /* skip the slash */
- } else {
- fs_ExtractDriveLetter(szCurItem, tbuffer);
- strcat(tbuffer, ".");
- tp = szCurItem;
- fs_StripDriveLetter(tp, tp, 0);
- }
-
- blob.in = tp;
- blob.in_size = strlen(tp)+1;
- blob.out = lsbuffer;
- blob.out_size = sizeof(lsbuffer);
-
- code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0);
- if (code) {
+ if (!IsMountPoint(files[i])) {
error = TRUE;
if (errno == EINVAL)
results.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i])));
long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize);
long fs_ExtractDriveLetter(const char *inPathp, char *outPathp);
BOOL IsSymlink(const char * true_name);
+BOOL IsMountPoint(const char * name);
UINT MakeSymbolicLink(const char *,const char *);
void ListSymbolicLinkPath(const char *strName,char *strPath,UINT nlenPath);
#endif //__GUI2FS_H__
// Mount Point submenu of the AFS submenu
HMENU hMountPointMenu = CreatePopupMenu();
int indexMountPointMenu = 0;
- ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
- ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
- ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
+ int nMountPointSelected = MF_GRAYED;
+ for (int n = pThis->m_astrFileNames.GetSize() - 1 ; n >= 0; n--) {
+ if ( IsMountPoint(pThis->m_astrFileNames[n]) ) {
+ nMountPointSelected = MF_ENABLED;
+ break;
+ }
+ }
+ ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
+ ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION | nMountPointSelected, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
+ ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hMountPointMenu, GetMessageString(IDS_MOUNT_POINT_ITEM));
::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH, GetMessageString(IDS_FLUSH_FILE_DIR_ITEM));