Changeset 826 for trunk/dll/wrappers.c


Ignore:
Timestamp:
Sep 1, 2007, 11:50:33 PM (18 years ago)
Author:
Gregg Young
Message:

Add xDosSetPathInfo to work around FILESTATUSx buffer crossing 64k boundry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/wrappers.c

    r794 r826  
    1212  18 Aug 06 SHL Correct Runtime_Error line number report
    1313  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     14  01 Sep 07 GKY Add xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry
    1415
    1516***********************************************************************/
    1617
    1718#define INCL_WIN
     19#define INCL_DOS
     20#define INCL_DOSERRORS
    1821#include <os2.h>
    1922
     
    2528#include "fm3str.h"
    2629
     30APIRET APIENTRY  xDosSetPathInfo(PSZ   pszPathName,
     31                                 ULONG ulInfoLevel,
     32                                 PVOID pInfoBuf,
     33                                 ULONG cbInfoBuf,
     34                                 ULONG flOptions)
     35{
     36    APIRET rc;
     37
     38    rc = DosSetPathInfo(pszPathName, ulInfoLevel, pInfoBuf, cbInfoBuf, flOptions);
     39    if (rc)
     40      /* Some kernels to do not handle fs3 buffers that cross 64K boundaries
     41        and return ERROR_INVALID_NAME
     42        If code works around the problem because if fs3 crosses the boundary
     43        fsa2 will not because we don't have enough data on the stack for this
     44        to occur 25 Aug 07 SHL
     45      */
     46        if (rc == ERROR_INVALID_NAME){
     47          if (ulInfoLevel == FIL_STANDARD){
     48            FILESTATUS3 fs3x;
     49            fs3x = *(PFILESTATUS3) pInfoBuf;
     50            rc = DosSetPathInfo(pszPathName, ulInfoLevel, &fs3x, sizeof(fs3x), flOptions);
     51          }
     52          else {
     53            EAOP2 eaop2x;
     54            eaop2x = *(PEAOP2) pInfoBuf;
     55            rc = DosSetPathInfo(pszPathName, ulInfoLevel, &eaop2x, sizeof(eaop2x), flOptions);
     56          }
     57        }
     58    return rc;
     59}
    2760
    2861PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
Note: See TracChangeset for help on using the changeset viewer.