Changeset 1628 for trunk/src


Ignore:
Timestamp:
Nov 8, 1999, 2:43:13 PM (26 years ago)
Author:
sandervl
Message:

thread, SearchPath + handlemanager fixes

Location:
trunk/src/kernel32
Files:
9 edited

Legend:

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

    r1570 r1628  
    1 /* $Id: Fileio.cpp,v 1.13 1999-11-03 17:12:20 phaller Exp $ */
     1/* $Id: Fileio.cpp,v 1.14 1999-11-08 13:43:11 sandervl Exp $ */
    22
    33/*
     
    3030#include "oslibdos.h"
    3131
    32 
    3332ODINDEBUGCHANNEL(KERNEL32-FILEIO)
    3433
     
    360359                      nrbyteswritten,
    361360                      lpOverlapped));
    362 }
    363 //******************************************************************************
    364 //******************************************************************************
    365 ODINFUNCTION6(DWORD,  SearchPathA,
    366               LPCSTR, lpszPath,
    367               LPCSTR, lpszFile,
    368               LPCSTR, lpszExtension,
    369               DWORD,  cchReturnBuffer,
    370               LPSTR,  lpszReturnBuffer,
    371               LPSTR *, plpszFilePart)
    372 {
    373   LPSTR lpszFilePart;
    374 
    375   // @@@PH 1999/11/03 ANV.EXE seems to pass in NULL here, looks like
    376   // windows ignores that behaviour altough it's undocumented.
    377   if (plpszFilePart == NULL)
    378     plpszFilePart = &lpszFilePart; // just provide a valid pointer
    379 
    380   return O32_SearchPath(lpszPath,
    381                         lpszFile,
    382                         lpszExtension,
    383                         cchReturnBuffer,
    384                         lpszReturnBuffer,
    385                         plpszFilePart);
    386 }
    387 //******************************************************************************
    388 //******************************************************************************
    389 ODINFUNCTION6(DWORD,    SearchPathW,
    390               LPCWSTR,  lpszPath,
    391               LPCWSTR,  lpszFileName,
    392               LPCWSTR,  lpszExtension,
    393               DWORD,    cchReturnBufferLength,
    394               LPWSTR,   lpszReturnBuffer,
    395               LPWSTR *, plpszFilePart)
    396 {
    397   char *asciipath,
    398        *asciifile,
    399        *asciiext,
    400        *asciibuffer,
    401        *asciipart;
    402   DWORD rc;
    403 
    404   asciibuffer = (char *)malloc(cchReturnBufferLength+1);
    405   asciipath = UnicodeToAsciiString((LPWSTR)lpszPath);
    406   asciifile = UnicodeToAsciiString((LPWSTR)lpszFileName);
    407   asciiext  = UnicodeToAsciiString((LPWSTR)lpszExtension);
    408   rc = ODIN_SearchPathA(asciipath,
    409                         asciifile,
    410                         asciiext,
    411                         cchReturnBufferLength,
    412                         asciibuffer,
    413                         &asciipart);
    414 
    415   if(rc)
    416   {
    417       AsciiToUnicode(asciibuffer, lpszReturnBuffer);
    418       *plpszFilePart = lpszReturnBuffer + ((int)asciipart - (int)asciibuffer);
    419   }
    420 
    421   FreeAsciiString(asciiext);
    422   FreeAsciiString(asciifile);
    423   FreeAsciiString(asciipath);
    424   free(asciibuffer);
    425   return(rc);
    426361}
    427362//******************************************************************************
  • trunk/src/kernel32/HandleManager.cpp

    r1472 r1628  
    1 /* $Id: HandleManager.cpp,v 1.21 1999-10-27 10:08:32 phaller Exp $ */
     1/* $Id: HandleManager.cpp,v 1.22 1999-11-08 13:43:11 sandervl Exp $ */
    22
    33/*
     
    11371137  {
    11381138    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1139     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1139    return FILE_TYPE_UNKNOWN;                         /* signal failure */
    11401140  }
    11411141
     
    12161216  {
    12171217    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1218     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1218    return FALSE;                         /* signal failure */
    12191219  }
    12201220
     
    12501250  {
    12511251    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1252     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1252    return FALSE;                         /* signal failure */
    12531253  }
    12541254
     
    12861286  {
    12871287    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1288     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1288    return FALSE;                         /* signal failure */
    12891289  }
    12901290
     
    14001400  {
    14011401    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1402     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1402    return FALSE;                         /* signal failure */
    14031403  }
    14041404
     
    14421442  {
    14431443    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1444     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1444    return FALSE;                         /* signal failure */
    14451445  }
    14461446
     
    14851485  {
    14861486    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1487     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1487    return FALSE;                         /* signal failure */
    14881488  }
    14891489
     
    15271527  {
    15281528    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1529     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1529    return FALSE;                         /* signal failure */
    15301530  }
    15311531
     
    15661566  {
    15671567    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1568     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1568    return WAIT_FAILED;                         /* signal failure */
    15691569  }
    15701570
     
    16041604  {
    16051605    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1606     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1606    return WAIT_FAILED;                         /* signal failure */
    16071607  }
    16081608
     
    16391639  {
    16401640    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1641     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1641    return FALSE;                         /* signal failure */
    16421642  }
    16431643
     
    16751675  {
    16761676    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1677     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1677    return FALSE;                         /* signal failure */
    16781678  }
    16791679
     
    17111711  {
    17121712    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1713     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1713    return FALSE;                         /* signal failure */
    17141714  }
    17151715
     
    17441744  {
    17451745    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1746     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1746    return FALSE;                         /* signal failure */
    17471747  }
    17481748
     
    17771777  {
    17781778    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1779     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1779    return FALSE;                         /* signal failure */
    17801780  }
    17811781
     
    18101810  {
    18111811    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    1812     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     1812    return FALSE;                         /* signal failure */
    18131813  }
    18141814
     
    18501850  {
    18511851    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    1852     return (INVALID_HANDLE_VALUE);                           /* signal error */
     1852    return 0;                           /* signal error */
    18531853  }
    18541854
     
    18811881    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    18821882    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    1883     return (INVALID_HANDLE_VALUE);                           /* signal error */
     1883    return 0;                           /* signal error */
    18841884  }
    18851885  else
     
    19191919  {
    19201920    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    1921     return (INVALID_HANDLE_VALUE);                           /* signal error */
     1921    return 0;                           /* signal error */
    19221922  }
    19231923
     
    19491949    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    19501950    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    1951     return (INVALID_HANDLE_VALUE);                           /* signal error */
     1951    return 0;                           /* signal error */
    19521952  }
    19531953  else
     
    19871987  {
    19881988    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    1989     return (INVALID_HANDLE_VALUE);                           /* signal error */
     1989    return 0;                           /* signal error */
    19901990  }
    19911991
     
    20162016    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    20172017    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2018     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2018    return 0;                           /* signal error */
    20192019  }
    20202020  else
     
    20542054  {
    20552055    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    2056     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2056    return 0;                           /* signal error */
    20572057  }
    20582058
     
    20832083    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    20842084    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2085     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2085    return 0;                           /* signal error */
    20862086  }
    20872087  else
     
    21162116
    21172117
    2118   pDeviceHandler = HMGlobals.pHMEvent;               /* device is predefined */
     2118  pDeviceHandler = HMGlobals.pHMSemaphore;               /* device is predefined */
    21192119
    21202120  iIndexNew = _HMHandleGetFree();                         /* get free handle */
     
    21222122  {
    21232123    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    2124     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2124    return 0;                           /* signal error */
    21252125  }
    21262126
     
    21532153    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    21542154    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2155     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2155    return 0;                         /* signal failure */
    21562156  }
    21572157  else
     
    21852185
    21862186
    2187   pDeviceHandler = HMGlobals.pHMMutex;               /* device is predefined */
     2187  pDeviceHandler = HMGlobals.pHMSemaphore;               /* device is predefined */
    21882188
    21892189  iIndexNew = _HMHandleGetFree();                         /* get free handle */
     
    21912191  {
    21922192    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    2193     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2193    return 0;                           /* signal error */
    21942194  }
    21952195
     
    22202220    TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    22212221    SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2222     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2222    return 0;                         /* signal failure */
    22232223  }
    22242224  else
     
    22542254  {
    22552255    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    2256     return (INVALID_HANDLE_ERROR);                         /* signal failure */
     2256    return 0;                         /* signal failure */
    22572257  }
    22582258  else
     
    23002300  {
    23012301    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    2302     return (INVALID_HANDLE_VALUE);                           /* signal error */
     2302    return 0;                           /* signal error */
    23032303  }
    23042304
  • trunk/src/kernel32/KERNEL32.CPP

    r1490 r1628  
    1 /* $Id: KERNEL32.CPP,v 1.26 1999-10-28 12:01:11 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.27 1999-11-08 13:43:12 sandervl Exp $ */
    22
    33/*
     
    470470VOID WIN32API Sleep(DWORD arg1)
    471471{
    472     dprintf(("KERNEL32:  Sleep %d\n", arg1));
     472//    dprintf(("KERNEL32:  Sleep %d\n", arg1));
    473473    O32_Sleep(arg1);
    474474}
  • trunk/src/kernel32/directory.cpp

    r1490 r1628  
    1 /* $Id: directory.cpp,v 1.8 1999-10-28 12:01:12 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.9 1999-11-08 13:43:12 sandervl Exp $ */
    22
    33/*
     
    66 * Copyright 1998 Sander van Leeuwen
    77 *
     8 * Parts based on Wine code (991031) (files\directory.c)
     9 *
     10 * DOS directories functions
     11 *
     12 * Copyright 1995 Alexandre Julliard
    813 *
    914 * Project Odin Software License can be found in LICENSE.TXT
     
    2429#include <options.h>
    2530#include "initterm.h"
     31#include <win\file.h>
     32#include <string.h>
     33#include "oslibdos.h"
    2634
    2735ODINDEBUGCHANNEL(KERNEL32-DIRECTORY)
    2836
     37
     38static char DIR_Windows[MAX_PATHNAME_LEN];
     39static char DIR_System[MAX_PATHNAME_LEN];
     40
     41//******************************************************************************
     42//******************************************************************************
     43void InitDirectories()
     44{
     45        GetWindowsDirectoryA((LPSTR)&DIR_Windows, sizeof(DIR_Windows));
     46        GetSystemDirectoryA((LPSTR)&DIR_System, sizeof(DIR_System));
     47}
    2948
    3049/*****************************************************************************
     
    130149                                    PSECURITY_ATTRIBUTES,arg2)
    131150{
     151  dprintf(("CreateDirectory %s", arg1));
    132152  return O32_CreateDirectory(arg1, arg2);
    133153}
     
    342362}
    343363
     364/***********************************************************************
     365 *           DIR_TryModulePath
     366 *
     367 * Helper function for DIR_SearchPath.
     368 */
     369static BOOL DIR_TryModulePath( LPCSTR name, char *full_name )
     370{
     371    char buffer[OFS_MAXPATHNAME];
     372    LPSTR p;
     373
     374    if (!GetModuleFileNameA( 0, buffer, sizeof(buffer) ))
     375        buffer[0]='\0';
     376
     377    if (!(p = strrchr( buffer, '\\' ))) return FALSE;
     378    if (sizeof(buffer) - (++p - buffer) <= strlen(name)) return FALSE;
     379    strcpy( p, name );
     380
     381    return OSLibDosSearchPath(OSLIB_SEARCHFILE, NULL, buffer, full_name, MAX_PATHNAME_LEN);
     382}
     383
     384
     385/***********************************************************************
     386 *           DIR_SearchPath
     387 *
     388 * Implementation of SearchPath32A. 'win32' specifies whether the search
     389 * order is Win16 (module path last) or Win32 (module path first).
     390 *
     391 * FIXME: should return long path names.
     392 */
     393DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
     394                      char *full_name )
     395{
     396    DWORD len;
     397    LPCSTR p;
     398    LPSTR tmp = NULL;
     399    BOOL ret = TRUE;
     400
     401    /* First check the supplied parameters */
     402
     403    p = strrchr( name, '.' );
     404    if (p && !strchr( p, '/' ) && !strchr( p, '\\' ))
     405        ext = NULL;  /* Ignore the specified extension */
     406    if ((*name && (name[1] == ':')) ||
     407        strchr( name, '/' ) || strchr( name, '\\' ))
     408        path = NULL;  /* Ignore path if name already contains a path */
     409    if (path && !*path) path = NULL;  /* Ignore empty path */
     410
     411    len = strlen(name);
     412    if (ext) len += strlen(ext);
     413    if (path) len += strlen(path) + 1;
     414
     415    /* Allocate a buffer for the file name and extension */
     416
     417    if (path || ext)
     418    {
     419        if (!(tmp = (LPSTR)HeapAlloc( GetProcessHeap(), 0, len + 1 )))
     420        {
     421            SetLastError( ERROR_OUTOFMEMORY );
     422            return 0;
     423        }
     424        if (path)
     425        {
     426            strcpy( tmp, path );
     427            strcat( tmp, "\\" );
     428            strcat( tmp, name );
     429        }
     430        else strcpy( tmp, name );
     431        if (ext) strcat( tmp, ext );
     432        name = tmp;
     433    }
     434   
     435    /* If we have an explicit path, everything's easy */
     436
     437    if (path || (*name && (name[1] == ':')) ||
     438        strchr( name, '/' ) || strchr( name, '\\' ))
     439    {
     440        ret = OSLibDosSearchPath(OSLIB_SEARCHFILE, NULL, (LPSTR)name, full_name, MAX_PATHNAME_LEN);
     441        goto done;
     442    }
     443
     444    /* Try the path of the current executable (for Win32 search order) */
     445    if (DIR_TryModulePath( name, full_name )) goto done;
     446
     447    /* Try the current directory */
     448    if (OSLibDosSearchPath(OSLIB_SEARCHCURDIR, NULL, (LPSTR)name, full_name, MAX_PATHNAME_LEN))
     449        goto done;
     450
     451    /* Try the Windows system directory */
     452    if (OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)&DIR_System, (LPSTR)name, full_name, MAX_PATHNAME_LEN))
     453        goto done;
     454
     455    /* Try the Windows directory */
     456    if (OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)&DIR_Windows, (LPSTR)name, full_name, MAX_PATHNAME_LEN))
     457        goto done;
     458
     459    /* Try all directories in path */
     460    ret = OSLibDosSearchPath(OSLIB_SEARCHENV, "PATH", (LPSTR)name, full_name, MAX_PATHNAME_LEN);
     461
     462done:
     463    if (tmp) HeapFree( GetProcessHeap(), 0, tmp );
     464    return ret;
     465}
     466
     467
     468/***********************************************************************
     469 * SearchPath32A [KERNEL32.447]
     470 *
     471 * Searches for a specified file in the search path.
     472 *
     473 * PARAMS
     474 *    path      [I] Path to search
     475 *    name      [I] Filename to search for.
     476 *    ext       [I] File extension to append to file name. The first
     477 *                  character must be a period. This parameter is
     478 *                  specified only if the filename given does not
     479 *                  contain an extension.
     480 *    buflen    [I] size of buffer, in characters
     481 *    buffer    [O] buffer for found filename
     482 *    lastpart  [O] address of pointer to last used character in
     483 *                  buffer (the final '\')
     484 *
     485 * RETURNS
     486 *    Success: length of string copied into buffer, not including
     487 *             terminating null character. If the filename found is
     488 *             longer than the length of the buffer, the length of the
     489 *             filename is returned.
     490 *    Failure: Zero
     491 *
     492 * NOTES
     493 *    Should call SetLastError(but currently doesn't).
     494 */
     495DWORD WINAPI SearchPathA(LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
     496                         LPSTR buffer, LPSTR *lastpart )
     497{
     498    char full_name[MAX_PATHNAME_LEN];
     499
     500    if (!DIR_SearchPath( path, name, ext, (LPSTR)full_name )) return 0;
     501    lstrcpynA( buffer, (LPSTR)full_name, buflen-1);
     502    buffer[buflen-2] = 0;
     503    SetLastError(0);
     504    return strlen(buffer);
     505}
     506
     507
     508/***********************************************************************
     509 *           SearchPath32W   (KERNEL32.448)
     510 */
     511DWORD WINAPI SearchPathW(LPCWSTR path, LPCWSTR name, LPCWSTR ext,
     512                         DWORD buflen, LPWSTR buffer, LPWSTR *lastpart )
     513{
     514    char full_name[MAX_PATHNAME_LEN];
     515
     516    LPSTR pathA = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
     517    LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
     518    LPSTR extA  = HEAP_strdupWtoA( GetProcessHeap(), 0, ext );
     519    DWORD ret = DIR_SearchPath( pathA, nameA, extA, (LPSTR)full_name );
     520    HeapFree( GetProcessHeap(), 0, extA );
     521    HeapFree( GetProcessHeap(), 0, nameA );
     522    HeapFree( GetProcessHeap(), 0, pathA );
     523    if (!ret) return 0;
     524
     525    lstrcpynAtoW( buffer, full_name, buflen-1 );
     526    buffer[buflen-2] = 0;
     527    SetLastError(0);
     528    return strlen(full_name);
     529}
  • trunk/src/kernel32/initterm.cpp

    r1539 r1628  
    1 /* $Id: initterm.cpp,v 1.20 1999-11-01 19:03:03 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.21 1999-11-08 13:43:12 sandervl Exp $ */
    22
    33/*
     
    4343#include <heapshared.h>
    4444#include "mmap.h"
     45#include "fileio.h"
    4546
    4647/*-------------------------------------------------------------------*/
     
    131132            HMInitialize();             /* store standard handles within HandleManager */
    132133            PROFILE_LoadOdinIni();
     134            InitDirectories();
    133135            break;
    134136        }
  • trunk/src/kernel32/makefile

    r1492 r1628  
    1 # $Id: makefile,v 1.51 1999-10-28 15:22:09 sandervl Exp $
     1# $Id: makefile,v 1.52 1999-11-08 13:43:12 sandervl Exp $
    22
    33#
     
    9797directory.obj: directory.cpp \
    9898    $(PDWIN32_INCLUDE)\unicode.h \
    99     initterm.h
     99    initterm.h directory.h oslibdos.h
    100100
    101101disk.obj: disk.cpp \
     
    111111
    112112fileio.obj: fileio.cpp \
    113     $(PDWIN32_INCLUDE)\unicode.h
     113    $(PDWIN32_INCLUDE)\unicode.h 
    114114
    115115thread.OBJ: \
     
    135135    os2heap.h
    136136
    137 initterm.OBJ: .\initterm.cpp initterm.h  $(PDWIN32_INCLUDE)\heapshared.h  mmap.h
     137initterm.OBJ: .\initterm.cpp initterm.h  $(PDWIN32_INCLUDE)\heapshared.h  mmap.h directory.h
    138138
    139139thunk.OBJ: \
  • trunk/src/kernel32/oslibdos.cpp

    r1432 r1628  
    1 /* $Id: oslibdos.cpp,v 1.5 1999-10-24 22:51:22 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.6 1999-11-08 13:43:12 sandervl Exp $ */
    22
    33/*
     
    263263  return TRUE;
    264264}
     265//******************************************************************************
     266//******************************************************************************
     267
     268#define OSLIB_SEARCHDIR         1
     269#define OSLIB_SEARCHCURDIR      2
     270#define OSLIB_SEARCHFILE        3
     271#define OSLIB_SEARCHENV         4
     272
     273DWORD OSLibDosSearchPath(DWORD cmd, char *path, char *name, char *full_name,
     274                         DWORD length_fullname)
     275{
     276  switch(cmd) {
     277  case OSLIB_SEARCHDIR:
     278        if(DosSearchPath(SEARCH_IGNORENETERRS, path,
     279                         name, full_name, length_fullname) != 0) {
     280                return 0;
     281        }
     282        return strlen(full_name);
     283
     284
     285  case OSLIB_SEARCHCURDIR:
     286        if(DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_CUR_DIRECTORY, path,
     287                         name, full_name, length_fullname) != 0) {
     288                return 0;
     289        }
     290        return strlen(full_name);
     291
     292  case OSLIB_SEARCHFILE:
     293  {
     294    FILESTATUS3 fileinfo;
     295
     296        if(DosQueryPathInfo(name, FIL_STANDARD, &fileinfo, sizeof(fileinfo)) != 0) {
     297                return 0;
     298        }
     299        strncpy(full_name, name, length_fullname);
     300        return strlen(full_name);
     301  }
     302
     303  case OSLIB_SEARCHENV:
     304  {
     305        char *env = getenv(path);
     306        if(env == NULL)
     307                return 0;
     308
     309        while(*env != '=') env++;
     310        env++;
     311        while(*env == ' ') env++;
     312        if(DosSearchPath(SEARCH_IGNORENETERRS | SEARCH_ENVIRONMENT, env,
     313                         name, full_name, length_fullname) != 0) {
     314                return 0;
     315        }
     316        return strlen(full_name);
     317  }
     318  }
     319  return 0;
     320}
     321//******************************************************************************
     322//******************************************************************************
  • trunk/src/kernel32/oslibdos.h

    r1432 r1628  
    1 /* $Id: oslibdos.h,v 1.5 1999-10-24 22:51:22 sandervl Exp $ */
     1/* $Id: oslibdos.h,v 1.6 1999-11-08 13:43:12 sandervl Exp $ */
    22
    33/*
     
    2222DWORD OSLibDosGetNamedSharedMem(LPVOID *lplpMemAddr, LPSTR name);
    2323
    24 BOOL OSLibDosGetFileAttributesEx(PSZ pszName, ULONG ulDummy, PVOID pBuffer);
     24BOOL OSLibDosGetFileAttributesEx(LPSTR pszName, ULONG ulDummy, PVOID pBuffer);
    2525
    2626#define OSLIB_NOERROR                   0
     
    7373DWORD OSLibDosSetFilePtr(DWORD hFile, DWORD offset, DWORD method);
    7474
     75#define OSLIB_SEARCHDIR         1
     76#define OSLIB_SEARCHCURDIR      2
     77#define OSLIB_SEARCHFILE        3
     78#define OSLIB_SEARCHENV         4
     79
     80DWORD OSLibDosSearchPath(DWORD cmd, char *path, char *name, char *full_name, DWORD length_fullname);
     81
    7582#endif
  • trunk/src/kernel32/thread.cpp

    r1310 r1628  
    1 /* $Id: thread.cpp,v 1.16 1999-10-15 11:36:13 phaller Exp $ */
     1/* $Id: thread.cpp,v 1.17 1999-11-08 13:43:13 sandervl Exp $ */
    22
    33/*
     
    214214  thdb->entry_arg   = (void *)userdata;
    215215
     216  //Note: The Win32 exception structure referenced by FS:[0] is the same
     217  //      in OS/2
     218  OS2SetExceptionHandler((void *)&exceptFrame);
     219
    216220  SetWin32TIB();
    217221  WinExe->tlsAttachThread();              //setup TLS structure of main exe
     
    219223  Win32DllBase::attachThreadToAllDlls();          //send DLL_THREAD_ATTACH message to all dlls
    220224
    221   //Note: The Win32 exception structure references by FS:[0] is the same
    222   //      in OS/2
    223   OS2SetExceptionHandler((void *)&exceptFrame);
    224225  rc = winthread(userdata);
    225   OS2UnsetExceptionHandler((void *)&exceptFrame);
    226226
    227227  Win32DllBase::detachThreadFromAllDlls();  //send DLL_THREAD_DETACH message to all dlls
     
    229229  WinExe->tlsDetachThread();              //destroy TLS structure of main exe
    230230  DestroyTIB();
     231  OS2UnsetExceptionHandler((void *)&exceptFrame);
     232
    231233  return rc;
    232234}
Note: See TracChangeset for help on using the changeset viewer.