//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::FileExists(BSTR PathString,BOOL *pVal) { USES_CONVERSION; LPTSTR szPathString = OLE2T(PathString); *pVal = PathFileExists( szPathString ); return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::StripPath(BSTR BaseString, BSTR *pVal) { USES_CONVERSION; LPTSTR szBaseString = OLE2T(BaseString); char *lpBuffer = new char[lstrlen(szBaseString)*BUFFER_N]; PathStripPath( szBaseString ); lstrcpy( lpBuffer, szBaseString ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::RemoveFileSpec(BSTR BaseString, BSTR *pVal) { USES_CONVERSION; LPTSTR szBaseString = OLE2T(BaseString); char *lpBuffer = new char[lstrlen(szBaseString)*BUFFER_N]; PathRemoveFileSpec( szBaseString ); lstrcpy( lpBuffer, szBaseString ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::GetCurDir(BSTR *pVal) { char Dummy[2]; DWORD nRequiredBufferSize; nRequiredBufferSize = GetCurrentDirectory( (DWORD)1, Dummy ); char *lpBuffer = new char[(nRequiredBufferSize + 2)*BUFFER_N]; nRequiredBufferSize++; GetCurrentDirectory( nRequiredBufferSize, lpBuffer ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::SetCurDir(BSTR DirPath, BOOL *pVal) { USES_CONVERSION; LPTSTR szDirPath = OLE2T(DirPath); *pVal = SetCurrentDirectory( szDirPath ); return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::ShortPathName(BSTR LongPathName, BSTR *pVal) { char Dummy[2]; DWORD nRequiredBufferSize; USES_CONVERSION; LPTSTR szLongPathName = OLE2T(LongPathName); nRequiredBufferSize = GetShortPathName( szLongPathName, Dummy, (DWORD)1 ); char *lpBuffer = new char[(nRequiredBufferSize + 2)*BUFFER_N]; nRequiredBufferSize++; GetShortPathName( szLongPathName, lpBuffer, nRequiredBufferSize ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::LongPathName(BSTR ShortPathName, BSTR *pVal) { if ( GetPlatform() < 1 ) { *pVal = A2BSTR("error Windows95 Unsupported"); return S_OK; } char Dummy[2]; DWORD nRequiredBufferSize; USES_CONVERSION; LPTSTR szShortPathName = OLE2T(ShortPathName); nRequiredBufferSize = GetLongPathName( szShortPathName, Dummy, (DWORD)1 ); char *lpBuffer = new char[(nRequiredBufferSize + 2)*BUFFER_N]; nRequiredBufferSize++; GetLongPathName( szShortPathName, lpBuffer, nRequiredBufferSize ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::RemoveExtension(BSTR BaseString, BSTR *pVal) { USES_CONVERSION; LPTSTR szBaseString = OLE2T(BaseString); char *lpBuffer = new char[lstrlen(szBaseString)*BUFFER_N]; PathRemoveExtension( szBaseString ); lstrcpy( lpBuffer, szBaseString ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::RemoveBackslash(BSTR BaseString, BSTR *pVal) { USES_CONVERSION; LPTSTR szBaseString = OLE2T(BaseString); char *lpBuffer = new char[lstrlen(szBaseString)*BUFFER_N]; PathRemoveBackslash( szBaseString ); lstrcpy( lpBuffer, szBaseString ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::Win32CopyFile(BSTR Sfile, BSTR Dfile, BOOL Exist, BOOL *pVal) { USES_CONVERSION; LPTSTR szSfile = OLE2T(Sfile); LPTSTR szDfile = OLE2T(Dfile); BOOL ret; ret = CopyFile( szSfile, szDfile, Exist ); *pVal = ret; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::Win32CreateDirectory(BSTR DirString, BOOL *pVal) { USES_CONVERSION; LPTSTR szDirString = OLE2T(DirString); BOOL ret; ret = CreateDirectory( szDirString, NULL ); *pVal = ret; return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::AddBackslash(BSTR BaseString, BSTR *pVal) { USES_CONVERSION; LPTSTR szBaseString = OLE2T(BaseString); char *lpBuffer = new char[lstrlen(szBaseString)*BUFFER_N+10]; lstrcpy( lpBuffer, szBaseString ); PathAddBackslash( lpBuffer ); *pVal = A2BSTR(lpBuffer); delete [] lpBuffer; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::Win32RemoveDirectory(BSTR TargetPath, BOOL *pVal) { USES_CONVERSION; LPTSTR szDirString = OLE2T(TargetPath); BOOL ret; ret = RemoveDirectory( szDirString ); *pVal = ret; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::Win32DeleteFile(BSTR TargetPath, BOOL *pVal) { USES_CONVERSION; LPTSTR szDirString = OLE2T(TargetPath); BOOL ret; ret = DeleteFile( szDirString ); *pVal = ret; return S_OK; }
//******************************************************************* // ( winbase.h : kernel32.lib ) //******************************************************************* STDMETHODIMP CFile::FileSize(BSTR TargetPath, LONG *pVal) { USES_CONVERSION; LPTSTR szTargetPath = OLE2T(TargetPath); HANDLE handle; WIN32_FIND_DATA FindFileData; handle = FindFirstFile( szTargetPath, &FindFileData ); if ( handle != INVALID_HANDLE_VALUE ) { *pVal = (LONG)FindFileData.nFileSizeLow; FindClose( handle ); } else { *pVal = 0; } return S_OK; }
//******************************************************************* // ( shlwapi.lib ) //******************************************************************* STDMETHODIMP CFile::IsDirectory(BSTR TargetPath, BOOL *pVal) { USES_CONVERSION; LPTSTR szTargetPath = OLE2T(TargetPath); *pVal = PathIsDirectory( szTargetPath ); return S_OK; }