Ignore:
Timestamp:
Oct 10, 2000, 12:51:19 AM (25 years ago)
Author:
sandervl
Message:

GetDirectoryA replaced with correct implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibdos.cpp

    r4372 r4473  
    1 /* $Id: oslibdos.cpp,v 1.47 2000-10-02 13:38:56 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.48 2000-10-09 22:51:18 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    20412041  return rc;
    20422042}
     2043//******************************************************************************
     2044//returned length is number of characters required or used for current dir
     2045//*excluding* terminator
     2046//******************************************************************************
     2047ULONG OSLibDosQueryDir(DWORD length, LPSTR lpszCurDir)
     2048{
     2049  ULONG  drivemap, currentdisk, len;
     2050  char  *lpszCurDriveAndDir = lpszCurDir +3;
     2051  APIRET rc;
     2052
     2053   len = (length > 3) ? length - 3 : 0;
     2054
     2055   rc = DosQueryCurrentDir(0, lpszCurDriveAndDir, &len);
     2056   if(rc != ERROR_BUFFER_OVERFLOW)
     2057   {
     2058        if(rc)
     2059        {
     2060             SetLastError(error2WinError(rc,ERROR_INVALID_PARAMETER));
     2061             return 0;
     2062        }
     2063        len = strlen(lpszCurDriveAndDir) + 3;
     2064
     2065        // Dir returned by DosQueryCurDir doesn't include drive, so add it
     2066        DosQueryCurrentDisk(&currentdisk, &drivemap);
     2067
     2068        if(isupper(lpszCurDir[3])) {
     2069             lpszCurDir[0] = (char)('A' - 1 + currentdisk);
     2070        }
     2071        else lpszCurDir[0] = (char)('a' - 1 + currentdisk);
     2072
     2073        lpszCurDir[1] = ':';
     2074        lpszCurDir[2] = '\\';
     2075   }
     2076   else len += 3;   // + 3 since DosQueryCurDir doesn't include drive
     2077   return len;
     2078}
     2079//******************************************************************************
     2080//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.