home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / OS2 / EDM2 / COMMON / SNIPPETS / NEWC2.ZIP / newcalls.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  1.9 KB  |  68 lines

  1. #define INCL_NOPMAPI
  2. #define INCL_DOS
  3. #include <os2.h>
  4. #include <string.h>
  5.  
  6.  
  7.  
  8. /* the real Dos32Open() has been renamed (by the *.def file) to
  9.  * _Dos32Open():
  10.  */
  11. APIRET APIENTRY  _DOS32OPEN(PSZ    pszFileName,
  12.                          PHFILE pHf,
  13.                          PULONG pulAction,
  14.                          ULONG  cbFile,
  15.                          ULONG  ulAttribute,
  16.                          ULONG  fsOpenFlags,
  17.                          ULONG  fsOpenMode,
  18.                          PEAOP2 peaop2);
  19.  
  20.  
  21.  
  22. /* write a string to stderr (file handle #2) */
  23. static void msg(char *s)
  24. {
  25.     ULONG bw;
  26.     DosWrite(2, s, strlen(s), &bw);
  27. }
  28.  
  29.  
  30.  
  31.  
  32. /* Our replacement Dos32Open() function.
  33.  * Look for,  and turn off, OPEN_FLAGS_WRITE_THROUGH
  34.  * and OPEN_FLAGS_NO_CACHE.  The latter was never seen being
  35.  * used by pmmerge, but what the heck...
  36.  */
  37. APIRET APIENTRY _Export DOS32OPEN(PSZ    pszFileName,
  38.                          PHFILE pHf,
  39.                          PULONG pulAction,
  40.                          ULONG  cbFile,
  41.                          ULONG  ulAttribute,
  42.                          ULONG  fsOpenFlags,
  43.                          ULONG  fsOpenMode,
  44.                          PEAOP2 peaop2)
  45. {
  46.     if( fsOpenMode & OPEN_FLAGS_WRITE_THROUGH ){
  47.         fsOpenMode &= ~OPEN_FLAGS_WRITE_THROUGH;
  48.         msg("OPEN_FLAGS_WRITE_THROUGH off for '");
  49.         msg(pszFileName);
  50.         msg("'\r\n");
  51.     }
  52.     if( fsOpenMode & OPEN_FLAGS_NO_CACHE){
  53.         fsOpenMode &= ~OPEN_FLAGS_NO_CACHE;
  54.         msg("OPEN_FLAGS_NO_CACHE off for'");
  55.         msg(pszFileName);
  56.         msg("'\r\n");
  57.     }
  58.     return _DOS32OPEN(pszFileName,
  59.                     pHf,
  60.                     pulAction,
  61.                     cbFile,
  62.                     ulAttribute,
  63.                     fsOpenFlags,
  64.                     fsOpenMode,
  65.                     peaop2);
  66. }
  67.  
  68.