Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.3 KiB

//+----------------------------------------------------------------------------
//
// File: fileexists.cpp
//
// Module: CMSETUP.LIB
//
// Synopsis: Implementation of the FileExists function.
//
// Copyright (c) 1998 Microsoft Corporation
//
// Author: quintinb Created Header 08/19/99
//
//+----------------------------------------------------------------------------
#include "cmsetup.h"
//+----------------------------------------------------------------------------
//
// Function: FileExists
//
// Synopsis: Helper function to encapsulate determining if a file exists.
//
// Arguments: LPCTSTR pszFullNameAndPath - The FULL Name and Path of the file.
//
// Returns: BOOL - TRUE if the file is located
//
// History: nickball Created 3/9/98
//
//+----------------------------------------------------------------------------
BOOL FileExists(LPCTSTR pszFullNameAndPath)
{
MYDBGASSERT(pszFullNameAndPath);
if (pszFullNameAndPath && pszFullNameAndPath[0])
{
HANDLE hFile = CreateFile(pszFullNameAndPath, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(hFile);
return TRUE;
}
}
return FALSE;
}