From 6c03551b3804b172b43f0b88fee9cb97caf4f6e5 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Mon, 28 Nov 2005 16:12:31 +0000 Subject: [PATCH] Some more OS/2 changes. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2394 --- src/dos/dos_programs.cpp | 19 +++++++++++++++++-- src/dos/drive_cache.cpp | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 53bcd27a..b7a94690 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.46 2005-11-24 18:09:47 qbix79 Exp $ */ +/* $Id: dos_programs.cpp,v 1.47 2005-11-28 16:12:30 qbix79 Exp $ */ #include #include @@ -168,6 +168,7 @@ public: APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L); + DosClose(cdrom_fd); if (rc != NO_ERROR && rc != ERROR_NOT_READY) { failed = true; @@ -193,9 +194,23 @@ public: } /* Not a switch so a normal directory/file */ if (!(test.st_mode & S_IFDIR)) { +#ifdef OS2 + HFILE cdrom_fd = 0; + ULONG ulAction = 0; + + APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, + OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L); + DosClose(cdrom_fd); + if (rc != NO_ERROR && rc != ERROR_NOT_READY) { WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str()); return; } +#else + WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str()); + return; +#endif + } + if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT; Bit8u bit8size=(Bit8u) sizes[1]; if (type=="cdrom") { @@ -914,7 +929,7 @@ void DOS_SetupPrograms(void) { "They can be changed in the \033[33mkeymapper\033[0m.\n" "\n" "\033[33;1mALT-ENTER\033[0m : Go full screen and back.\n" - "\033[33;1mPAUSE\033[0m : Pause DOSBox.\n" + "\033[33;1mCTRL-PAUSE\033[0m : Pause DOSBox.\n" "\033[33;1mCTRL-F1\033[0m : Start the \033[33mkeymapper\033[0m.\n" "\033[33;1mCTRL-F4\033[0m : Update directory cache for all drives! Swap mounted disk-image.\n" "\033[33;1mCTRL-F5\033[0m : Save a screenshot.\n" diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index 24fbdb00..f4c6c1c1 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.44 2005-07-19 19:45:31 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.45 2005-11-28 16:12:31 qbix79 Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -34,6 +34,12 @@ #include #endif +#if defined (OS2) +#define INCL_DOSERRORS +#define INCL_DOSFILEMGR +#include +#endif + int fileInfoCounter = 0; bool SortByName(DOS_Drive_Cache::CFileInfo* const &a, DOS_Drive_Cache::CFileInfo* const &b) @@ -155,11 +161,21 @@ void DOS_Drive_Cache::SetBaseDir(const char* baseDir) ReadDir(id,result); }; // Get Volume Label -#if defined (WIN32) +#if defined (WIN32) || defined (OS2) char labellocal[256]={ 0 }; char drive[4] = "C:\\"; drive[0] = basePath[0]; +#if defined (WIN32) if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) { +#else // OS2 + FSINFO fsinfo; + ULONG drivenumber = drive[0]; + if (drivenumber > 26) { // drive letter was lowercase + drivenumber = drive[0] - 'a' + 1; + } + APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO)); + if (rc == NO_ERROR) { +#endif /* Set label and allow being updated */ SetLabel(labellocal,true); }