Changeset 4473 for trunk/src/kernel32


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

GetDirectoryA replaced with correct implementation

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

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

    r4445 r4473  
    1 /* $Id: directory.cpp,v 1.31 2000-10-06 15:16:03 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.32 2000-10-09 22:51:17 sandervl Exp $ */
    22
    33/*
     
    103103 * Variables :
    104104 * Result    :
    105  * Remark    :
     105 * Remark    : returned length is number of characters required or used for current dir
     106 *             *excluding* terminator
    106107 * Status    :
    107108 *
     
    114115 UINT rc;
    115116
    116   rc = O32_GetCurrentDirectory(nBufferLength, lpBuffer);
    117   if(rc) {
    118     dprintf(("CurrentDirectory = %s", lpBuffer));
     117  rc = OSLibDosQueryDir(nBufferLength, lpBuffer);
     118  if(rc && rc < nBufferLength) {
     119       dprintf(("CurrentDirectory = %s (%d)", lpBuffer, rc));
    119120  }
     121  else dprintf(("CurrentDirectory returned %d", rc));
    120122  return rc;
    121123}
  • 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//******************************************************************************
  • trunk/src/kernel32/oslibdos.h

    r4319 r4473  
    1 /* $Id: oslibdos.h,v 1.24 2000-09-25 04:35:00 phaller Exp $ */
     1/* $Id: oslibdos.h,v 1.25 2000-10-09 22:51:19 sandervl Exp $ */
    22
    33/*
     
    284284
    285285ULONG OSLibDosQueryModuleName(ULONG hModule, int cchName, char *pszName);
     286ULONG OSLibDosQueryDir(DWORD length, LPSTR lpszCurDir);
Note: See TracChangeset for help on using the changeset viewer.