Ignore:
Timestamp:
Mar 28, 2000, 7:11:50 PM (25 years ago)
Author:
sandervl
Message:

openfile, virtualquery + import name fixes

File:
1 edited

Legend:

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

    r3228 r3259  
    1 /* $Id: hmopen32.cpp,v 1.19 2000-03-24 19:25:32 sandervl Exp $ */
     1/* $Id: hmopen32.cpp,v 1.20 2000-03-28 17:11:49 sandervl Exp $ */
    22
    33/*
     
    700700                                     PHMHANDLEDATA pHMHandleData,
    701701                                     OFSTRUCT      *pOFStruct,
    702                                      UINT          arg3)
     702                                     UINT          fuMode)
    703703{
    704704  HFILE hFile;
    705705  FILETIME filetime;
    706706  WORD filedatetime[2];
     707  char filepath[260];
    707708
    708709  dprintfl(("KERNEL32: HandleManager::Open32::OpenFile %s(%s,%08x,%08x,%08x) - stub?\n",
     
    711712           pHMHandleData,
    712713           pOFStruct,
    713            arg3));
    714 
    715   if (strcmp(lpFileName,       // "support" for local unc names
     714           fuMode));
     715
     716  if(strcmp(lpFileName,       // "support" for local unc names
    716717             "\\\\.\\") == 0)
     718  {
    717719    lpFileName+=4;
    718 
     720  }
     721  else
     722  if(!strchr(lpFileName, ':') && !strchr(lpFileName, '\\'))
     723  {
     724        //filename only; search for file in following order
     725        //1: dir from which the app loaded
     726        //2: current dir
     727        //3: windows system dir
     728        //4: windows dir
     729        //5: dirs in path path environment variable
     730        //SearchPath does exactly that
     731        LPSTR filenameinpath;
     732
     733        if(SearchPathA(NULL, lpFileName, NULL, sizeof(filepath), filepath, &filenameinpath) == 0
     734           && !(fuMode & OF_CREATE) ) {
     735                SetLastError(ERROR_FILE_NOT_FOUND);
     736                return HFILE_ERROR;
     737        }
     738        lpFileName = filepath;
     739  }
    719740  // filling OFSTRUCT
    720741  memset(pOFStruct, 0, sizeof(OFSTRUCT));
     
    725746  hFile = O32_OpenFile(lpFileName,
    726747                       pOFStruct,
    727                        arg3);
     748                       fuMode);
    728749  if (hFile != INVALID_HANDLE_ERROR)
    729750  {
Note: See TracChangeset for help on using the changeset viewer.