ReactOS 0.4.16-dev-136-g52192f1
filesystem.c File Reference
#include <stdarg.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "olectl.h"
#include "dispex.h"
#include "ntsecapi.h"
#include "scrrun.h"
#include "scrrun_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for filesystem.c:

Go to the source code of this file.

Classes

struct  filesystem
 
struct  foldercollection
 
struct  filecollection
 
struct  drivecollection
 
struct  enumdata
 
struct  enumvariant
 
struct  drive
 
struct  folder
 
struct  file
 
struct  textstream
 

Macros

#define COBJMACROS
 

Enumerations

enum  iotype { IORead , IOWrite }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (scrrun)
 
static struct filesystemimpl_from_IFileSystem3 (IFileSystem3 *iface)
 
static struct driveimpl_from_IDrive (IDrive *iface)
 
static struct folderimpl_from_IFolder (IFolder *iface)
 
static struct fileimpl_from_IFile (IFile *iface)
 
static struct textstreamimpl_from_ITextStream (ITextStream *iface)
 
static struct foldercollectionimpl_from_IFolderCollection (IFolderCollection *iface)
 
static struct filecollectionimpl_from_IFileCollection (IFileCollection *iface)
 
static struct drivecollectionimpl_from_IDriveCollection (IDriveCollection *iface)
 
static struct enumvariantimpl_from_IEnumVARIANT (IEnumVARIANT *iface)
 
static HRESULT create_error (DWORD err)
 
static HRESULT create_folder (const WCHAR *, IFolder **)
 
static HRESULT create_file (BSTR, IFile **)
 
static HRESULT create_foldercoll_enum (struct foldercollection *, IUnknown **)
 
static HRESULT create_filecoll_enum (struct filecollection *, IUnknown **)
 
static HRESULT create_drivecoll_enum (struct drivecollection *, IUnknown **)
 
static BOOL is_dir_data (const WIN32_FIND_DATAW *data)
 
static BOOL is_file_data (const WIN32_FIND_DATAW *data)
 
static BSTR get_full_path (BSTR path, const WIN32_FIND_DATAW *data)
 
static BOOL textstream_check_iomode (struct textstream *This, enum iotype type)
 
static HRESULT WINAPI textstream_QueryInterface (ITextStream *iface, REFIID riid, void **obj)
 
static ULONG WINAPI textstream_AddRef (ITextStream *iface)
 
static ULONG WINAPI textstream_Release (ITextStream *iface)
 
static HRESULT WINAPI textstream_GetTypeInfoCount (ITextStream *iface, UINT *pctinfo)
 
static HRESULT WINAPI textstream_GetTypeInfo (ITextStream *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI textstream_GetIDsOfNames (ITextStream *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI textstream_Invoke (ITextStream *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI textstream_get_Line (ITextStream *iface, LONG *line)
 
static HRESULT WINAPI textstream_get_Column (ITextStream *iface, LONG *column)
 
static HRESULT WINAPI textstream_get_AtEndOfStream (ITextStream *iface, VARIANT_BOOL *eos)
 
static HRESULT WINAPI textstream_get_AtEndOfLine (ITextStream *iface, VARIANT_BOOL *eol)
 
static HRESULT textstream_read (struct textstream *stream, LONG toread, BOOL bof, BSTR *text)
 
static HRESULT WINAPI textstream_Read (ITextStream *iface, LONG len, BSTR *text)
 
static HRESULT WINAPI textstream_ReadLine (ITextStream *iface, BSTR *text)
 
static HRESULT WINAPI textstream_ReadAll (ITextStream *iface, BSTR *text)
 
static HRESULT textstream_writestr (struct textstream *stream, BSTR text)
 
static HRESULT WINAPI textstream_Write (ITextStream *iface, BSTR text)
 
static HRESULT textstream_writecrlf (struct textstream *stream)
 
static HRESULT WINAPI textstream_WriteLine (ITextStream *iface, BSTR text)
 
static HRESULT WINAPI textstream_WriteBlankLines (ITextStream *iface, LONG lines)
 
static HRESULT WINAPI textstream_Skip (ITextStream *iface, LONG count)
 
static HRESULT WINAPI textstream_SkipLine (ITextStream *iface)
 
static HRESULT WINAPI textstream_Close (ITextStream *iface)
 
static HRESULT create_textstream (const WCHAR *filename, DWORD disposition, IOMode mode, Tristate format, ITextStream **ret)
 
static HRESULT WINAPI drive_QueryInterface (IDrive *iface, REFIID riid, void **obj)
 
static ULONG WINAPI drive_AddRef (IDrive *iface)
 
static ULONG WINAPI drive_Release (IDrive *iface)
 
static HRESULT WINAPI drive_GetTypeInfoCount (IDrive *iface, UINT *pctinfo)
 
static HRESULT WINAPI drive_GetTypeInfo (IDrive *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI drive_GetIDsOfNames (IDrive *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI drive_Invoke (IDrive *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI drive_get_Path (IDrive *iface, BSTR *path)
 
static HRESULT WINAPI drive_get_DriveLetter (IDrive *iface, BSTR *letter)
 
static HRESULT WINAPI drive_get_ShareName (IDrive *iface, BSTR *share_name)
 
static HRESULT WINAPI drive_get_DriveType (IDrive *iface, DriveTypeConst *type)
 
static HRESULT WINAPI drive_get_RootFolder (IDrive *iface, IFolder **folder)
 
static HRESULT variant_from_largeint (const ULARGE_INTEGER *src, VARIANT *v)
 
static HRESULT WINAPI drive_get_AvailableSpace (IDrive *iface, VARIANT *v)
 
static HRESULT WINAPI drive_get_FreeSpace (IDrive *iface, VARIANT *v)
 
static HRESULT WINAPI drive_get_TotalSize (IDrive *iface, VARIANT *v)
 
static HRESULT WINAPI drive_get_VolumeName (IDrive *iface, BSTR *name)
 
static HRESULT WINAPI drive_put_VolumeName (IDrive *iface, BSTR name)
 
static HRESULT WINAPI drive_get_FileSystem (IDrive *iface, BSTR *fs)
 
static HRESULT WINAPI drive_get_SerialNumber (IDrive *iface, LONG *serial)
 
static HRESULT WINAPI drive_get_IsReady (IDrive *iface, VARIANT_BOOL *ready)
 
static HRESULT create_drive (WCHAR letter, IDrive **drive)
 
static HRESULT WINAPI enumvariant_QueryInterface (IEnumVARIANT *iface, REFIID riid, void **obj)
 
static ULONG WINAPI enumvariant_AddRef (IEnumVARIANT *iface)
 
static ULONG WINAPI foldercoll_enumvariant_Release (IEnumVARIANT *iface)
 
static HANDLE start_enumeration (const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file)
 
static HRESULT WINAPI foldercoll_enumvariant_Next (IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched)
 
static HRESULT WINAPI foldercoll_enumvariant_Skip (IEnumVARIANT *iface, ULONG celt)
 
static HRESULT WINAPI foldercoll_enumvariant_Reset (IEnumVARIANT *iface)
 
static HRESULT WINAPI foldercoll_enumvariant_Clone (IEnumVARIANT *iface, IEnumVARIANT **pclone)
 
static ULONG WINAPI filecoll_enumvariant_Release (IEnumVARIANT *iface)
 
static HRESULT WINAPI filecoll_enumvariant_Next (IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched)
 
static HRESULT WINAPI filecoll_enumvariant_Skip (IEnumVARIANT *iface, ULONG celt)
 
static HRESULT WINAPI filecoll_enumvariant_Reset (IEnumVARIANT *iface)
 
static HRESULT WINAPI filecoll_enumvariant_Clone (IEnumVARIANT *iface, IEnumVARIANT **pclone)
 
static ULONG WINAPI drivecoll_enumvariant_Release (IEnumVARIANT *iface)
 
static HRESULT find_next_drive (struct enumvariant *penum)
 
static HRESULT WINAPI drivecoll_enumvariant_Next (IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched)
 
static HRESULT WINAPI drivecoll_enumvariant_Skip (IEnumVARIANT *iface, ULONG celt)
 
static HRESULT WINAPI drivecoll_enumvariant_Reset (IEnumVARIANT *iface)
 
static HRESULT WINAPI drivecoll_enumvariant_Clone (IEnumVARIANT *iface, IEnumVARIANT **pclone)
 
static HRESULT WINAPI foldercoll_QueryInterface (IFolderCollection *iface, REFIID riid, void **obj)
 
static ULONG WINAPI foldercoll_AddRef (IFolderCollection *iface)
 
static ULONG WINAPI foldercoll_Release (IFolderCollection *iface)
 
static HRESULT WINAPI foldercoll_GetTypeInfoCount (IFolderCollection *iface, UINT *pctinfo)
 
static HRESULT WINAPI foldercoll_GetTypeInfo (IFolderCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI foldercoll_GetIDsOfNames (IFolderCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI foldercoll_Invoke (IFolderCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI foldercoll_Add (IFolderCollection *iface, BSTR name, IFolder **folder)
 
static HRESULT WINAPI foldercoll_get_Item (IFolderCollection *iface, VARIANT key, IFolder **folder)
 
static HRESULT WINAPI foldercoll_get__NewEnum (IFolderCollection *iface, IUnknown **newenum)
 
static HRESULT WINAPI foldercoll_get_Count (IFolderCollection *iface, LONG *count)
 
static HRESULT create_foldercoll (BSTR path, IFolderCollection **folders)
 
static HRESULT WINAPI filecoll_QueryInterface (IFileCollection *iface, REFIID riid, void **obj)
 
static ULONG WINAPI filecoll_AddRef (IFileCollection *iface)
 
static ULONG WINAPI filecoll_Release (IFileCollection *iface)
 
static HRESULT WINAPI filecoll_GetTypeInfoCount (IFileCollection *iface, UINT *pctinfo)
 
static HRESULT WINAPI filecoll_GetTypeInfo (IFileCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI filecoll_GetIDsOfNames (IFileCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI filecoll_Invoke (IFileCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI filecoll_get_Item (IFileCollection *iface, VARIANT Key, IFile **file)
 
static HRESULT WINAPI filecoll_get__NewEnum (IFileCollection *iface, IUnknown **ppenum)
 
static HRESULT WINAPI filecoll_get_Count (IFileCollection *iface, LONG *count)
 
static HRESULT create_filecoll (BSTR path, IFileCollection **files)
 
static HRESULT WINAPI drivecoll_QueryInterface (IDriveCollection *iface, REFIID riid, void **obj)
 
static ULONG WINAPI drivecoll_AddRef (IDriveCollection *iface)
 
static ULONG WINAPI drivecoll_Release (IDriveCollection *iface)
 
static HRESULT WINAPI drivecoll_GetTypeInfoCount (IDriveCollection *iface, UINT *pctinfo)
 
static HRESULT WINAPI drivecoll_GetTypeInfo (IDriveCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI drivecoll_GetIDsOfNames (IDriveCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI drivecoll_Invoke (IDriveCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI drivecoll_get_Item (IDriveCollection *iface, VARIANT key, IDrive **drive)
 
static HRESULT WINAPI drivecoll_get__NewEnum (IDriveCollection *iface, IUnknown **ppenum)
 
static HRESULT WINAPI drivecoll_get_Count (IDriveCollection *iface, LONG *count)
 
static HRESULT create_drivecoll (IDriveCollection **drives)
 
static HRESULT WINAPI folder_QueryInterface (IFolder *iface, REFIID riid, void **obj)
 
static ULONG WINAPI folder_AddRef (IFolder *iface)
 
static ULONG WINAPI folder_Release (IFolder *iface)
 
static HRESULT WINAPI folder_GetTypeInfoCount (IFolder *iface, UINT *pctinfo)
 
static HRESULT WINAPI folder_GetTypeInfo (IFolder *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI folder_GetIDsOfNames (IFolder *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI folder_Invoke (IFolder *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI folder_get_Path (IFolder *iface, BSTR *path)
 
static HRESULT WINAPI folder_get_Name (IFolder *iface, BSTR *name)
 
static HRESULT WINAPI folder_put_Name (IFolder *iface, BSTR name)
 
static HRESULT WINAPI folder_get_ShortPath (IFolder *iface, BSTR *path)
 
static HRESULT WINAPI folder_get_ShortName (IFolder *iface, BSTR *name)
 
static HRESULT WINAPI folder_get_Drive (IFolder *iface, IDrive **drive)
 
static HRESULT WINAPI folder_get_ParentFolder (IFolder *iface, IFolder **parent)
 
static HRESULT WINAPI folder_get_Attributes (IFolder *iface, FileAttribute *attr)
 
static HRESULT WINAPI folder_put_Attributes (IFolder *iface, FileAttribute attr)
 
static HRESULT WINAPI folder_get_DateCreated (IFolder *iface, DATE *date)
 
static HRESULT WINAPI folder_get_DateLastModified (IFolder *iface, DATE *date)
 
static HRESULT WINAPI folder_get_DateLastAccessed (IFolder *iface, DATE *date)
 
static HRESULT WINAPI folder_get_Type (IFolder *iface, BSTR *type)
 
static HRESULT WINAPI folder_Delete (IFolder *iface, VARIANT_BOOL force)
 
static HRESULT WINAPI folder_Copy (IFolder *iface, BSTR dest, VARIANT_BOOL overwrite)
 
static HRESULT WINAPI folder_Move (IFolder *iface, BSTR dest)
 
static HRESULT WINAPI folder_get_IsRootFolder (IFolder *iface, VARIANT_BOOL *isroot)
 
static HRESULT WINAPI folder_get_Size (IFolder *iface, VARIANT *size)
 
static HRESULT WINAPI folder_get_SubFolders (IFolder *iface, IFolderCollection **folders)
 
static HRESULT WINAPI folder_get_Files (IFolder *iface, IFileCollection **files)
 
static HRESULT WINAPI folder_CreateTextFile (IFolder *iface, BSTR filename, VARIANT_BOOL overwrite, VARIANT_BOOL unicode, ITextStream **stream)
 
static HRESULT WINAPI file_QueryInterface (IFile *iface, REFIID riid, void **obj)
 
static ULONG WINAPI file_AddRef (IFile *iface)
 
static ULONG WINAPI file_Release (IFile *iface)
 
static HRESULT WINAPI file_GetTypeInfoCount (IFile *iface, UINT *pctinfo)
 
static HRESULT WINAPI file_GetTypeInfo (IFile *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI file_GetIDsOfNames (IFile *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI file_Invoke (IFile *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI file_get_Path (IFile *iface, BSTR *path)
 
static HRESULT WINAPI file_get_Name (IFile *iface, BSTR *name)
 
static HRESULT WINAPI file_put_Name (IFile *iface, BSTR pbstrName)
 
static HRESULT WINAPI file_get_ShortPath (IFile *iface, BSTR *pbstrPath)
 
static HRESULT WINAPI file_get_ShortName (IFile *iface, BSTR *pbstrName)
 
static HRESULT WINAPI file_get_Drive (IFile *iface, IDrive **ppdrive)
 
static HRESULT WINAPI file_get_ParentFolder (IFile *iface, IFolder **ppfolder)
 
static HRESULT WINAPI file_get_Attributes (IFile *iface, FileAttribute *pfa)
 
static HRESULT WINAPI file_put_Attributes (IFile *iface, FileAttribute pfa)
 
static HRESULT get_date_from_filetime (const FILETIME *ft, DATE *date)
 
static HRESULT WINAPI file_get_DateCreated (IFile *iface, DATE *pdate)
 
static HRESULT WINAPI file_get_DateLastModified (IFile *iface, DATE *date)
 
static HRESULT WINAPI file_get_DateLastAccessed (IFile *iface, DATE *pdate)
 
static HRESULT WINAPI file_get_Size (IFile *iface, VARIANT *pvarSize)
 
static HRESULT WINAPI file_get_Type (IFile *iface, BSTR *pbstrType)
 
static HRESULT WINAPI file_Delete (IFile *iface, VARIANT_BOOL Force)
 
static HRESULT WINAPI file_Copy (IFile *iface, BSTR Destination, VARIANT_BOOL OverWriteFiles)
 
static HRESULT WINAPI file_Move (IFile *iface, BSTR Destination)
 
static HRESULT WINAPI file_OpenAsTextStream (IFile *iface, IOMode mode, Tristate format, ITextStream **stream)
 
static HRESULT WINAPI filesys_QueryInterface (IFileSystem3 *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI filesys_AddRef (IFileSystem3 *iface)
 
static ULONG WINAPI filesys_Release (IFileSystem3 *iface)
 
static HRESULT WINAPI filesys_GetTypeInfoCount (IFileSystem3 *iface, UINT *pctinfo)
 
static HRESULT WINAPI filesys_GetTypeInfo (IFileSystem3 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI filesys_GetIDsOfNames (IFileSystem3 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI filesys_Invoke (IFileSystem3 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI filesys_get_Drives (IFileSystem3 *iface, IDriveCollection **ppdrives)
 
static HRESULT WINAPI filesys_BuildPath (IFileSystem3 *iface, BSTR Path, BSTR Name, BSTR *Result)
 
static HRESULT WINAPI filesys_GetDriveName (IFileSystem3 *iface, BSTR path, BSTR *drive)
 
static DWORD get_parent_folder_name (const WCHAR *path, DWORD len)
 
static HRESULT WINAPI filesys_GetParentFolderName (IFileSystem3 *iface, BSTR Path, BSTR *pbstrResult)
 
static HRESULT WINAPI filesys_GetFileName (IFileSystem3 *iface, BSTR Path, BSTR *pbstrResult)
 
static HRESULT WINAPI filesys_GetBaseName (IFileSystem3 *iface, BSTR Path, BSTR *pbstrResult)
 
static HRESULT WINAPI filesys_GetExtensionName (IFileSystem3 *iface, BSTR path, BSTR *ext)
 
static HRESULT WINAPI filesys_GetAbsolutePathName (IFileSystem3 *iface, BSTR Path, BSTR *pbstrResult)
 
static HRESULT WINAPI filesys_GetTempName (IFileSystem3 *iface, BSTR *pbstrResult)
 
static HRESULT WINAPI filesys_DriveExists (IFileSystem3 *iface, BSTR DriveSpec, VARIANT_BOOL *pfExists)
 
static HRESULT WINAPI filesys_FileExists (IFileSystem3 *iface, BSTR path, VARIANT_BOOL *ret)
 
static HRESULT WINAPI filesys_FolderExists (IFileSystem3 *iface, BSTR path, VARIANT_BOOL *ret)
 
static HRESULT WINAPI filesys_GetDrive (IFileSystem3 *iface, BSTR DriveSpec, IDrive **ppdrive)
 
static HRESULT WINAPI filesys_GetFile (IFileSystem3 *iface, BSTR FilePath, IFile **ppfile)
 
static HRESULT WINAPI filesys_GetFolder (IFileSystem3 *iface, BSTR FolderPath, IFolder **folder)
 
static HRESULT WINAPI filesys_GetSpecialFolder (IFileSystem3 *iface, SpecialFolderConst SpecialFolder, IFolder **folder)
 
static HRESULT delete_file (const WCHAR *file, DWORD file_len, VARIANT_BOOL force)
 
static HRESULT WINAPI filesys_DeleteFile (IFileSystem3 *iface, BSTR FileSpec, VARIANT_BOOL Force)
 
static HRESULT delete_folder (const WCHAR *folder, DWORD folder_len, VARIANT_BOOL force)
 
static HRESULT WINAPI filesys_DeleteFolder (IFileSystem3 *iface, BSTR FolderSpec, VARIANT_BOOL Force)
 
static HRESULT WINAPI filesys_MoveFile (IFileSystem3 *iface, BSTR Source, BSTR Destination)
 
static HRESULT WINAPI filesys_MoveFolder (IFileSystem3 *iface, BSTR Source, BSTR Destination)
 
static HRESULT copy_file (const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
 
static HRESULT WINAPI filesys_CopyFile (IFileSystem3 *iface, BSTR Source, BSTR Destination, VARIANT_BOOL OverWriteFiles)
 
static HRESULT copy_folder (const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
 
static HRESULT WINAPI filesys_CopyFolder (IFileSystem3 *iface, BSTR Source, BSTR Destination, VARIANT_BOOL OverWriteFiles)
 
static HRESULT WINAPI filesys_CreateFolder (IFileSystem3 *iface, BSTR path, IFolder **folder)
 
static HRESULT WINAPI filesys_CreateTextFile (IFileSystem3 *iface, BSTR filename, VARIANT_BOOL overwrite, VARIANT_BOOL unicode, ITextStream **stream)
 
static HRESULT WINAPI filesys_OpenTextFile (IFileSystem3 *iface, BSTR filename, IOMode mode, VARIANT_BOOL create, Tristate format, ITextStream **stream)
 
static HRESULT WINAPI filesys_GetStandardStream (IFileSystem3 *iface, StandardStreamTypes StandardStreamType, VARIANT_BOOL Unicode, ITextStream **ppts)
 
static void get_versionstring (VS_FIXEDFILEINFO *info, WCHAR *ver)
 
static HRESULT WINAPI filesys_GetFileVersion (IFileSystem3 *iface, BSTR name, BSTR *version)
 
HRESULT WINAPI FileSystem_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 

Variables

static const WCHAR bsW [] = {'\\',0}
 
static const WCHAR utf16bom = 0xfeff
 
static const ITextStreamVtbl textstreamvtbl
 
static const IDriveVtbl drivevtbl
 
static const IEnumVARIANTVtbl foldercollenumvariantvtbl
 
static const IEnumVARIANTVtbl filecollenumvariantvtbl
 
static const IEnumVARIANTVtbl drivecollenumvariantvtbl
 
static const IFolderCollectionVtbl foldercollvtbl
 
static const IFileCollectionVtbl filecollectionvtbl
 
static const IDriveCollectionVtbl drivecollectionvtbl
 
static const IFolderVtbl foldervtbl
 
static const IFileVtbl file_vtbl
 
static const struct IFileSystem3Vtbl filesys_vtbl
 
static struct filesystem filesystem
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file filesystem.c.

Enumeration Type Documentation

◆ iotype

Enumerator
IORead 
IOWrite 

Definition at line 137 of file filesystem.c.

137 {
138 IORead,
139 IOWrite
140};
@ IOWrite
Definition: filesystem.c:139
@ IORead
Definition: filesystem.c:138

Function Documentation

◆ copy_file()

static HRESULT copy_file ( const WCHAR source,
DWORD  source_len,
const WCHAR destination,
DWORD  destination_len,
VARIANT_BOOL  overwrite 
)
inlinestatic

Definition at line 3640 of file filesystem.c.

3642{
3643 DWORD attrs;
3644 WCHAR src_path[MAX_PATH], dst_path[MAX_PATH];
3645 DWORD src_len, dst_len, name_len;
3646 WIN32_FIND_DATAW ffd;
3647 HANDLE f;
3648 HRESULT hr;
3649
3650 if(!source[0] || !destination[0])
3651 return E_INVALIDARG;
3652
3653 attrs = GetFileAttributesW(destination);
3654 if(attrs==INVALID_FILE_ATTRIBUTES || !(attrs & FILE_ATTRIBUTE_DIRECTORY)) {
3655 attrs = GetFileAttributesW(source);
3656 if(attrs == INVALID_FILE_ATTRIBUTES)
3657 return create_error(GetLastError());
3658 else if(attrs & FILE_ATTRIBUTE_DIRECTORY)
3659 return CTL_E_FILENOTFOUND;
3660
3661 if(!CopyFileW(source, destination, !overwrite))
3662 return create_error(GetLastError());
3663 return S_OK;
3664 }
3665
3666 f = FindFirstFileW(source, &ffd);
3667 if(f == INVALID_HANDLE_VALUE)
3668 return CTL_E_FILENOTFOUND;
3669
3670 src_len = get_parent_folder_name(source, source_len);
3671 if(src_len+1 >= MAX_PATH) {
3672 FindClose(f);
3673 return E_FAIL;
3674 }
3675 if(src_len) {
3676 memcpy(src_path, source, src_len*sizeof(WCHAR));
3677 src_path[src_len++] = '\\';
3678 }
3679
3680 dst_len = destination_len;
3681 if(dst_len+1 >= MAX_PATH) {
3682 FindClose(f);
3683 return E_FAIL;
3684 }
3685 memcpy(dst_path, destination, dst_len*sizeof(WCHAR));
3686 if(dst_path[dst_len-1]!= '\\' && dst_path[dst_len-1]!='/')
3687 dst_path[dst_len++] = '\\';
3688
3690 do {
3691 if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE))
3692 continue;
3693
3694 name_len = lstrlenW(ffd.cFileName);
3695 if(src_len+name_len+1>=MAX_PATH || dst_len+name_len+1>=MAX_PATH) {
3696 FindClose(f);
3697 return E_FAIL;
3698 }
3699 memcpy(src_path+src_len, ffd.cFileName, (name_len+1)*sizeof(WCHAR));
3700 memcpy(dst_path+dst_len, ffd.cFileName, (name_len+1)*sizeof(WCHAR));
3701
3702 TRACE("copying %s to %s\n", debugstr_w(src_path), debugstr_w(dst_path));
3703
3704 if(!CopyFileW(src_path, dst_path, !overwrite)) {
3705 FindClose(f);
3706 return create_error(GetLastError());
3707 }else {
3708 hr = S_OK;
3709 }
3710 } while(FindNextFileW(f, &ffd));
3711 FindClose(f);
3712
3713 return hr;
3714}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
static DWORD get_parent_folder_name(const WCHAR *path, DWORD len)
Definition: filesystem.c:3110
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat f
Definition: glext.h:7540
#define S_OK
Definition: intsafe.h:52
#define f
Definition: ke_i.h:83
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FILE_ATTRIBUTE_DEVICE
Definition: disk.h:27
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define CTL_E_FILENOTFOUND
Definition: olectl.h:274
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by copy_folder(), and filesys_CopyFile().

◆ copy_folder()

static HRESULT copy_folder ( const WCHAR source,
DWORD  source_len,
const WCHAR destination,
DWORD  destination_len,
VARIANT_BOOL  overwrite 
)
static

Definition at line 3728 of file filesystem.c.

3730{
3731 DWORD tmp, src_len, dst_len, name_len;
3733 WIN32_FIND_DATAW ffd;
3734 HANDLE f;
3735 HRESULT hr;
3736 BOOL copied = FALSE;
3737
3738 if(!source[0] || !destination[0])
3739 return E_INVALIDARG;
3740
3741 dst_len = destination_len;
3742 if(dst_len+1 >= MAX_PATH)
3743 return E_FAIL;
3744 memcpy(dst, destination, (dst_len+1)*sizeof(WCHAR));
3745
3746 if(dst[dst_len-1]!='\\' && dst[dst_len-1]!='/' &&
3749 if(!CreateDirectoryW(dst, NULL)) {
3750 if(overwrite && GetLastError()==ERROR_ALREADY_EXISTS) {
3751 tmp = GetFileAttributesW(dst);
3754 }else {
3755 return create_error(GetLastError());
3756 }
3757 }
3758 copied = TRUE;
3759
3760 src_len = source_len;
3761 if(src_len+2 >= MAX_PATH)
3762 return E_FAIL;
3763 memcpy(src, source, src_len*sizeof(WCHAR));
3764 src[src_len++] = '\\';
3765 src[src_len] = '*';
3766 src[src_len+1] = 0;
3767
3768 hr = copy_file(src, src_len+1, dst, dst_len, overwrite);
3770 return create_error(GetLastError());
3771
3772 f = FindFirstFileW(src, &ffd);
3773 }else {
3774 src_len = get_parent_folder_name(source, source_len);
3775 if(src_len+2 >= MAX_PATH)
3776 return E_FAIL;
3777 memcpy(src, source, src_len*sizeof(WCHAR));
3778 if(src_len)
3779 src[src_len++] = '\\';
3780
3781 f = FindFirstFileW(source, &ffd);
3782 }
3783 if(f == INVALID_HANDLE_VALUE)
3784 return CTL_E_PATHNOTFOUND;
3785
3786 dst[dst_len++] = '\\';
3787 dst[dst_len] = 0;
3788
3789 do {
3790 if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
3791 continue;
3792 if(ffd.cFileName[0]=='.' && (ffd.cFileName[1]==0 ||
3793 (ffd.cFileName[1]=='.' && ffd.cFileName[2]==0)))
3794 continue;
3795
3796 name_len = lstrlenW(ffd.cFileName);
3797 if(dst_len+name_len>=MAX_PATH || src_len+name_len+2>=MAX_PATH) {
3798 FindClose(f);
3799 return E_FAIL;
3800 }
3801 memcpy(dst+dst_len, ffd.cFileName, name_len*sizeof(WCHAR));
3802 dst[dst_len+name_len] = 0;
3803 memcpy(src+src_len, ffd.cFileName, name_len*sizeof(WCHAR));
3804 src[src_len+name_len] = '\\';
3805 src[src_len+name_len+1] = '*';
3806 src[src_len+name_len+2] = 0;
3807
3808 TRACE("copying %s to %s\n", debugstr_w(src), debugstr_w(dst));
3809
3810 if(!CreateDirectoryW(dst, NULL)) {
3811 if(overwrite && GetLastError()==ERROR_ALREADY_EXISTS) {
3812 tmp = GetFileAttributesW(dst);
3814 FindClose(f);
3816 }
3817 }
3818
3819 FindClose(f);
3820 return create_error(GetLastError());
3821 }
3822 copied = TRUE;
3823
3824 hr = copy_file(src, src_len+name_len+2, dst, dst_len+name_len, overwrite);
3825 if(FAILED(hr) && hr!=CTL_E_FILENOTFOUND) {
3826 FindClose(f);
3827 return hr;
3828 }
3829
3830 hr = copy_folder(src, src_len+name_len+2, dst, dst_len+name_len, overwrite);
3831 if(FAILED(hr) && hr!=CTL_E_PATHNOTFOUND) {
3832 FindClose(f);
3833 return hr;
3834 }
3835 } while(FindNextFileW(f, &ffd));
3836 FindClose(f);
3837
3838 return copied ? S_OK : CTL_E_PATHNOTFOUND;
3839}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static HRESULT copy_file(const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
Definition: filesystem.c:3640
static HRESULT copy_folder(const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
Definition: filesystem.c:3728
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define FAILED(hr)
Definition: intsafe.h:51
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define CTL_E_PATHNOTFOUND
Definition: olectl.h:288
#define CTL_E_FILEALREADYEXISTS
Definition: olectl.h:278

Referenced by copy_folder(), and filesys_CopyFolder().

◆ create_drive()

static HRESULT create_drive ( WCHAR  letter,
IDrive **  drive 
)
static

Definition at line 1118 of file filesystem.c.

1119{
1120 struct drive *This;
1121
1122 *drive = NULL;
1123
1124 This = heap_alloc(sizeof(*This));
1125 if (!This) return E_OUTOFMEMORY;
1126
1127 This->IDrive_iface.lpVtbl = &drivevtbl;
1128 This->ref = 1;
1129 This->root = SysAllocStringLen(NULL, 3);
1130 if (!This->root)
1131 {
1132 heap_free(This);
1133 return E_OUTOFMEMORY;
1134 }
1135 This->root[0] = letter;
1136 This->root[1] = ':';
1137 This->root[2] = '\\';
1138 This->root[3] = 0;
1139
1140 init_classinfo(&CLSID_Drive, (IUnknown *)&This->IDrive_iface, &This->classinfo);
1141 *drive = &This->IDrive_iface;
1142 return S_OK;
1143}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IDriveVtbl drivevtbl
Definition: filesystem.c:1095
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232

Referenced by drivecoll_enumvariant_Next(), and filesys_GetDrive().

◆ create_drivecoll()

static HRESULT create_drivecoll ( IDriveCollection **  drives)
static

Definition at line 2165 of file filesystem.c.

2166{
2167 struct drivecollection *This;
2168 DWORD mask;
2169
2170 *drives = NULL;
2171
2172 This = heap_alloc(sizeof(*This));
2173 if (!This) return E_OUTOFMEMORY;
2174
2175 This->IDriveCollection_iface.lpVtbl = &drivecollectionvtbl;
2176 This->ref = 1;
2177 This->drives = mask = GetLogicalDrives();
2178 /* count set bits */
2179 for (This->count = 0; mask; This->count++)
2180 mask &= mask - 1;
2181
2182 init_classinfo(&CLSID_Drives, (IUnknown *)&This->IDriveCollection_iface, &This->classinfo);
2183 *drives = &This->IDriveCollection_iface;
2184 return S_OK;
2185}
static const IDriveCollectionVtbl drivecollectionvtbl
Definition: filesystem.c:2152
GLenum GLint GLuint mask
Definition: glext.h:6028
DWORD WINAPI GetLogicalDrives(void)
Definition: disk.c:110

Referenced by filesys_get_Drives().

◆ create_drivecoll_enum()

static HRESULT create_drivecoll_enum ( struct drivecollection collection,
IUnknown **  newenum 
)
static

Definition at line 1602 of file filesystem.c.

1603{
1604 struct enumvariant *This;
1605
1606 *newenum = NULL;
1607
1608 This = heap_alloc(sizeof(*This));
1609 if (!This) return E_OUTOFMEMORY;
1610
1611 This->IEnumVARIANT_iface.lpVtbl = &drivecollenumvariantvtbl;
1612 This->ref = 1;
1613 This->data.u.drivecoll.coll = collection;
1614 This->data.u.drivecoll.cur = -1;
1615 IDriveCollection_AddRef(&collection->IDriveCollection_iface);
1616
1617 *newenum = (IUnknown*)&This->IEnumVARIANT_iface;
1618
1619 return S_OK;
1620}
static const IEnumVARIANTVtbl drivecollenumvariantvtbl
Definition: filesystem.c:1592
static ICollection collection
Definition: typelib.c:184

Referenced by drivecoll_enumvariant_Clone(), and drivecoll_get__NewEnum().

◆ create_error()

static HRESULT create_error ( DWORD  err)
inlinestatic

Definition at line 187 of file filesystem.c.

188{
189 switch(err) {
195 default:
196 FIXME("Unsupported error code: %d\n", err);
197 return E_FAIL;
198 }
199}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CTL_E_PERMISSIONDENIED
Definition: olectl.h:285
#define err(...)
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_FILE_EXISTS
Definition: winerror.h:165

Referenced by copy_file(), copy_folder(), create_file(), create_textstream(), delete_file(), delete_folder(), file_get_Attributes(), file_get_Size(), file_put_Attributes(), textstream_writecrlf(), and textstream_writestr().

◆ create_file()

static HRESULT create_file ( BSTR  path,
IFile **  file 
)
static

Definition at line 2876 of file filesystem.c.

2877{
2878 struct file *f;
2879 DWORD len, attrs;
2880
2881 *file = NULL;
2882
2883 f = heap_alloc(sizeof(struct file));
2884 if(!f)
2885 return E_OUTOFMEMORY;
2886
2887 f->IFile_iface.lpVtbl = &file_vtbl;
2888 f->ref = 1;
2889
2891 if(!len) {
2892 heap_free(f);
2893 return E_FAIL;
2894 }
2895
2896 f->path = heap_alloc(len*sizeof(WCHAR));
2897 if(!f->path) {
2898 heap_free(f);
2899 return E_OUTOFMEMORY;
2900 }
2901
2902 if(!GetFullPathNameW(path, len, f->path, NULL)) {
2903 heap_free(f->path);
2904 heap_free(f);
2905 return E_FAIL;
2906 }
2907
2908 attrs = GetFileAttributesW(f->path);
2909 if(attrs==INVALID_FILE_ATTRIBUTES ||
2911 heap_free(f->path);
2912 heap_free(f);
2913 return create_error(GetLastError());
2914 }
2915
2916 init_classinfo(&CLSID_File, (IUnknown *)&f->IFile_iface, &f->classinfo);
2917 *file = &f->IFile_iface;
2918 return S_OK;
2919}
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
static const IFileVtbl file_vtbl
Definition: filesystem.c:2848
GLenum GLsizei len
Definition: glext.h:6722
Definition: fci.c:127
IFile IFile_iface
Definition: filesystem.c:119

◆ create_filecoll()

static HRESULT create_filecoll ( BSTR  path,
IFileCollection **  files 
)
static

Definition at line 1994 of file filesystem.c.

1995{
1996 struct filecollection *This;
1997
1998 *files = NULL;
1999
2000 This = heap_alloc(sizeof(*This));
2001 if (!This) return E_OUTOFMEMORY;
2002
2003 This->IFileCollection_iface.lpVtbl = &filecollectionvtbl;
2004 This->ref = 1;
2005 This->path = SysAllocString(path);
2006 if (!This->path)
2007 {
2008 heap_free(This);
2009 return E_OUTOFMEMORY;
2010 }
2011
2012 init_classinfo(&CLSID_Files, (IUnknown *)&This->IFileCollection_iface, &This->classinfo);
2013 *files = &This->IFileCollection_iface;
2014 return S_OK;
2015}
static const IFileCollectionVtbl filecollectionvtbl
Definition: filesystem.c:1981
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

Referenced by folder_get_Files().

◆ create_filecoll_enum()

static HRESULT create_filecoll_enum ( struct filecollection collection,
IUnknown **  newenum 
)
static

Definition at line 1479 of file filesystem.c.

1480{
1481 struct enumvariant *This;
1482
1483 *newenum = NULL;
1484
1485 This = heap_alloc(sizeof(*This));
1486 if (!This) return E_OUTOFMEMORY;
1487
1488 This->IEnumVARIANT_iface.lpVtbl = &filecollenumvariantvtbl;
1489 This->ref = 1;
1490 This->data.u.filecoll.find = NULL;
1491 This->data.u.filecoll.coll = collection;
1492 IFileCollection_AddRef(&collection->IFileCollection_iface);
1493
1494 *newenum = (IUnknown*)&This->IEnumVARIANT_iface;
1495
1496 return S_OK;
1497}
static const IEnumVARIANTVtbl filecollenumvariantvtbl
Definition: filesystem.c:1469

Referenced by filecoll_enumvariant_Clone(), and filecoll_get__NewEnum().

◆ create_folder()

HRESULT create_folder ( const WCHAR path,
IFolder **  folder 
)
static

Definition at line 2507 of file filesystem.c.

2508{
2509 struct folder *This;
2510
2511 *folder = NULL;
2512
2513 TRACE("%s\n", debugstr_w(path));
2514
2515 This = heap_alloc(sizeof(struct folder));
2516 if (!This) return E_OUTOFMEMORY;
2517
2518 This->IFolder_iface.lpVtbl = &foldervtbl;
2519 This->ref = 1;
2520 This->path = SysAllocString(path);
2521 if (!This->path)
2522 {
2523 heap_free(This);
2524 return E_OUTOFMEMORY;
2525 }
2526
2527 init_classinfo(&CLSID_Folder, (IUnknown *)&This->IFolder_iface, &This->classinfo);
2528 *folder = &This->IFolder_iface;
2529
2530 return S_OK;
2531}
static const IFolderVtbl foldervtbl
Definition: filesystem.c:2476
Definition: fci.c:116

Referenced by filesys_CreateFolder(), filesys_GetFolder(), filesys_GetSpecialFolder(), and foldercoll_enumvariant_Next().

◆ create_foldercoll()

static HRESULT create_foldercoll ( BSTR  path,
IFolderCollection **  folders 
)
static

Definition at line 1800 of file filesystem.c.

1801{
1802 struct foldercollection *This;
1803
1804 *folders = NULL;
1805
1806 This = heap_alloc(sizeof(struct foldercollection));
1807 if (!This) return E_OUTOFMEMORY;
1808
1809 This->IFolderCollection_iface.lpVtbl = &foldercollvtbl;
1810 This->ref = 1;
1811 This->path = SysAllocString(path);
1812 if (!This->path)
1813 {
1814 heap_free(This);
1815 return E_OUTOFMEMORY;
1816 }
1817
1818 init_classinfo(&CLSID_Folders, (IUnknown *)&This->IFolderCollection_iface, &This->classinfo);
1819 *folders = &This->IFolderCollection_iface;
1820
1821 return S_OK;
1822}
static const IFolderCollectionVtbl foldercollvtbl
Definition: filesystem.c:1786

Referenced by folder_get_SubFolders().

◆ create_foldercoll_enum()

static HRESULT create_foldercoll_enum ( struct foldercollection collection,
IUnknown **  newenum 
)
static

Definition at line 1337 of file filesystem.c.

1338{
1339 struct enumvariant *This;
1340
1341 *newenum = NULL;
1342
1343 This = heap_alloc(sizeof(*This));
1344 if (!This) return E_OUTOFMEMORY;
1345
1346 This->IEnumVARIANT_iface.lpVtbl = &foldercollenumvariantvtbl;
1347 This->ref = 1;
1348 This->data.u.foldercoll.find = NULL;
1349 This->data.u.foldercoll.coll = collection;
1350 IFolderCollection_AddRef(&collection->IFolderCollection_iface);
1351
1352 *newenum = (IUnknown*)&This->IEnumVARIANT_iface;
1353
1354 return S_OK;
1355}
static const IEnumVARIANTVtbl foldercollenumvariantvtbl
Definition: filesystem.c:1327

Referenced by foldercoll_enumvariant_Clone(), and foldercoll_get__NewEnum().

◆ create_textstream()

static HRESULT create_textstream ( const WCHAR filename,
DWORD  disposition,
IOMode  mode,
Tristate  format,
ITextStream **  ret 
)
static

Definition at line 699 of file filesystem.c.

700{
701 struct textstream *stream;
702 DWORD access = 0;
703
704 /* map access mode */
705 switch (mode)
706 {
707 case ForReading:
709 break;
710 case ForWriting:
712 break;
713 case ForAppending:
715 break;
716 default:
717 return E_INVALIDARG;
718 }
719
720 stream = heap_alloc(sizeof(struct textstream));
721 if (!stream) return E_OUTOFMEMORY;
722
723 stream->ITextStream_iface.lpVtbl = &textstreamvtbl;
724 stream->ref = 1;
725 stream->mode = mode;
726 stream->first_read = TRUE;
727
728 stream->file = CreateFileW(filename, access, 0, NULL, disposition, FILE_ATTRIBUTE_NORMAL, NULL);
729 if (stream->file == INVALID_HANDLE_VALUE)
730 {
733 return hr;
734 }
735
736 if (mode == ForReading)
738 else
739 stream->size.QuadPart = 0;
740
741 if (mode == ForWriting)
742 {
743 stream->unicode = format == TristateTrue;
744 /* Write Unicode BOM */
745 if (stream->unicode && (disposition == CREATE_ALWAYS || disposition == CREATE_NEW)) {
746 DWORD written = 0;
747 BOOL ret = WriteFile(stream->file, &utf16bom, sizeof(utf16bom), &written, NULL);
748 if (!ret || written != sizeof(utf16bom)) {
749 ITextStream_Release(&stream->ITextStream_iface);
750 return create_error(GetLastError());
751 }
752 }
753 }
754 else
755 {
756 if (format == TristateUseDefault)
757 {
758 BYTE buf[64];
759 DWORD read;
760 BOOL ret;
761
762 ret = ReadFile(stream->file, buf, sizeof(buf), &read, NULL);
763 if (!ret) {
764 ITextStream_Release(&stream->ITextStream_iface);
765 return create_error(GetLastError());
766 }
767
768 stream->unicode = IsTextUnicode(buf, read, NULL);
769 if (mode == ForReading) SetFilePointer(stream->file, 0, 0, FILE_BEGIN);
770 }
771 else stream->unicode = format != TristateFalse;
772
773 if (mode == ForAppending) SetFilePointer(stream->file, 0, 0, FILE_END);
774 }
775
776 init_classinfo(&CLSID_TextStream, (IUnknown *)&stream->ITextStream_iface, &stream->classinfo);
777 *ret = &stream->ITextStream_iface;
778 return S_OK;
779}
#define read
Definition: acwin.h:96
BOOL WINAPI IsTextUnicode(IN CONST VOID *lpv, IN INT iSize, IN OUT LPINT lpiResult OPTIONAL)
Definition: unicode.c:27
#define FILE_BEGIN
Definition: compat.h:761
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define GetFileSizeEx
Definition: compat.h:757
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static const WCHAR utf16bom
Definition: filesystem.c:46
static const ITextStreamVtbl textstreamvtbl
Definition: filesystem.c:676
GLenum mode
Definition: glext.h:6217
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
const char * filename
Definition: ioapi.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
@ TristateFalse
Definition: scrrun.idl:62
@ TristateTrue
Definition: scrrun.idl:61
@ ForWriting
Definition: scrrun.idl:55
@ ForAppending
Definition: scrrun.idl:56
@ ForReading
Definition: scrrun.idl:54
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: format.c:58
Definition: parse.h:23
unsigned int size
Definition: parse.h:27
int ret
#define FILE_END
Definition: winbase.h:114
unsigned char BYTE
Definition: xxhash.c:193

Referenced by file_OpenAsTextStream(), filesys_CreateTextFile(), and filesys_OpenTextFile().

◆ delete_file()

static HRESULT delete_file ( const WCHAR file,
DWORD  file_len,
VARIANT_BOOL  force 
)
inlinestatic

Definition at line 3491 of file filesystem.c.

3492{
3494 DWORD len, name_len;
3495 WIN32_FIND_DATAW ffd;
3496 HANDLE f;
3497
3498 f = FindFirstFileW(file, &ffd);
3499 if(f == INVALID_HANDLE_VALUE)
3500 return create_error(GetLastError());
3501
3502 len = get_parent_folder_name(file, file_len);
3503 if(len+1 >= MAX_PATH) {
3504 FindClose(f);
3505 return E_FAIL;
3506 }
3507 if(len) {
3508 memcpy(path, file, len*sizeof(WCHAR));
3509 path[len++] = '\\';
3510 }
3511
3512 do {
3513 if(ffd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE))
3514 continue;
3515
3516 name_len = lstrlenW(ffd.cFileName);
3517 if(len+name_len+1 >= MAX_PATH) {
3518 FindClose(f);
3519 return E_FAIL;
3520 }
3521 memcpy(path+len, ffd.cFileName, (name_len+1)*sizeof(WCHAR));
3522
3523 TRACE("deleting %s\n", debugstr_w(path));
3524
3525 if(!DeleteFileW(path)) {
3527 || !DeleteFileW(path)) {
3528 FindClose(f);
3529 return create_error(GetLastError());
3530 }
3531 }
3532 } while(FindNextFileW(f, &ffd));
3533 FindClose(f);
3534
3535 return S_OK;
3536}
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794

◆ delete_folder()

static HRESULT delete_folder ( const WCHAR folder,
DWORD  folder_len,
VARIANT_BOOL  force 
)
static

Definition at line 3549 of file filesystem.c.

3550{
3552 DWORD len, name_len;
3553 WIN32_FIND_DATAW ffd;
3554 HANDLE f;
3555 HRESULT hr;
3556
3557 f = FindFirstFileW(folder, &ffd);
3558 if(f == INVALID_HANDLE_VALUE)
3559 return create_error(GetLastError());
3560
3561 len = get_parent_folder_name(folder, folder_len);
3562 if(len+1 >= MAX_PATH) {
3563 FindClose(f);
3564 return E_FAIL;
3565 }
3566 if(len) {
3567 memcpy(path, folder, len*sizeof(WCHAR));
3568 path[len++] = '\\';
3569 }
3570
3571 do {
3572 if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
3573 continue;
3574 if(ffd.cFileName[0]=='.' && (ffd.cFileName[1]==0 ||
3575 (ffd.cFileName[1]=='.' && ffd.cFileName[2]==0)))
3576 continue;
3577
3578 name_len = lstrlenW(ffd.cFileName);
3579 if(len+name_len+3 >= MAX_PATH) {
3580 FindClose(f);
3581 return E_FAIL;
3582 }
3583 memcpy(path+len, ffd.cFileName, name_len*sizeof(WCHAR));
3584 path[len+name_len] = '\\';
3585 path[len+name_len+1] = '*';
3586 path[len+name_len+2] = 0;
3587
3588 hr = delete_file(path, len+name_len+2, force);
3589 if(FAILED(hr)) {
3590 FindClose(f);
3591 return hr;
3592 }
3593
3594 hr = delete_folder(path, len+name_len+2, force);
3595 if(FAILED(hr)) {
3596 FindClose(f);
3597 return hr;
3598 }
3599
3600 path[len+name_len] = 0;
3601 TRACE("deleting %s\n", debugstr_w(path));
3602
3603 if(!RemoveDirectoryW(path)) {
3604 FindClose(f);
3605 return create_error(GetLastError());
3606 }
3607 } while(FindNextFileW(f, &ffd));
3608 FindClose(f);
3609
3610 return S_OK;
3611}
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
static HRESULT delete_folder(const WCHAR *folder, DWORD folder_len, VARIANT_BOOL force)
Definition: filesystem.c:3549
#define delete_file(f)
Definition: reg_test.h:97

Referenced by delete_folder(), and filesys_DeleteFolder().

◆ drive_AddRef()

static ULONG WINAPI drive_AddRef ( IDrive *  iface)
static

Definition at line 806 of file filesystem.c.

807{
808 struct drive *This = impl_from_IDrive(iface);
810 TRACE("(%p)->(%d)\n", This, ref);
811 return ref;
812}
#define InterlockedIncrement
Definition: armddk.h:53
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
LONG ref
Definition: filesystem.c:106
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ drive_get_AvailableSpace()

static HRESULT WINAPI drive_get_AvailableSpace ( IDrive *  iface,
VARIANT v 
)
static

Definition at line 974 of file filesystem.c.

975{
976 struct drive *This = impl_from_IDrive(iface);
978
979 TRACE("(%p)->(%p)\n", This, v);
980
981 if (!v)
982 return E_POINTER;
983
984 if (!GetDiskFreeSpaceExW(This->root, &avail, NULL, NULL))
985 return E_FAIL;
986
987 return variant_from_largeint(&avail, v);
988}
static int avail
Definition: adh-main.c:39
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342
static HRESULT variant_from_largeint(const ULARGE_INTEGER *src, VARIANT *v)
Definition: filesystem.c:956
const GLdouble * v
Definition: gl.h:2040
#define E_POINTER
Definition: winerror.h:2365

◆ drive_get_DriveLetter()

static HRESULT WINAPI drive_get_DriveLetter ( IDrive *  iface,
BSTR letter 
)
static

Definition at line 895 of file filesystem.c.

896{
897 struct drive *This = impl_from_IDrive(iface);
898
899 TRACE("(%p)->(%p)\n", This, letter);
900
901 if (!letter)
902 return E_POINTER;
903
904 *letter = SysAllocStringLen(This->root, 1);
905 if (!*letter)
906 return E_OUTOFMEMORY;
907
908 return S_OK;
909}

◆ drive_get_DriveType()

static HRESULT WINAPI drive_get_DriveType ( IDrive *  iface,
DriveTypeConst *  type 
)
static

Definition at line 918 of file filesystem.c.

919{
920 struct drive *This = impl_from_IDrive(iface);
921
922 TRACE("(%p)->(%p)\n", This, type);
923
924 switch (GetDriveTypeW(This->root))
925 {
926 case DRIVE_REMOVABLE:
927 *type = Removable;
928 break;
929 case DRIVE_FIXED:
930 *type = Fixed;
931 break;
932 case DRIVE_REMOTE:
933 *type = Remote;
934 break;
935 case DRIVE_CDROM:
936 *type = CDRom;
937 break;
938 case DRIVE_RAMDISK:
939 *type = RamDisk;
940 break;
941 default:
942 *type = UnknownType;
943 break;
944 }
945
946 return S_OK;
947}
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define DRIVE_CDROM
Definition: machpc98.h:119
@ UnknownType
Definition: scrrun.idl:89
@ RamDisk
Definition: scrrun.idl:94
@ Remote
Definition: scrrun.idl:92
@ Removable
Definition: arc.h:81
#define DRIVE_REMOTE
Definition: winbase.h:253
#define DRIVE_RAMDISK
Definition: winbase.h:255
#define DRIVE_FIXED
Definition: winbase.h:252
#define DRIVE_REMOVABLE
Definition: winbase.h:251

◆ drive_get_FileSystem()

static HRESULT WINAPI drive_get_FileSystem ( IDrive *  iface,
BSTR fs 
)
static

Definition at line 1047 of file filesystem.c.

1048{
1049 struct drive *This = impl_from_IDrive(iface);
1050 WCHAR nameW[MAX_PATH+1];
1051 BOOL ret;
1052
1053 TRACE("(%p)->(%p)\n", This, fs);
1054
1055 if (!fs)
1056 return E_POINTER;
1057
1058 *fs = NULL;
1060 if (ret)
1062 return ret ? S_OK : E_FAIL;
1063}
static const WCHAR nameW[]
Definition: main.c:49
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
Definition: ffs.h:70

◆ drive_get_FreeSpace()

static HRESULT WINAPI drive_get_FreeSpace ( IDrive *  iface,
VARIANT v 
)
static

Definition at line 990 of file filesystem.c.

991{
992 struct drive *This = impl_from_IDrive(iface);
993 ULARGE_INTEGER freespace;
994
995 TRACE("(%p)->(%p)\n", This, v);
996
997 if (!v)
998 return E_POINTER;
999
1000 if (!GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL))
1001 return E_FAIL;
1002
1003 return variant_from_largeint(&freespace, v);
1004}

◆ drive_get_IsReady()

static HRESULT WINAPI drive_get_IsReady ( IDrive *  iface,
VARIANT_BOOL ready 
)
static

Definition at line 1079 of file filesystem.c.

1080{
1081 struct drive *This = impl_from_IDrive(iface);
1082 ULARGE_INTEGER freespace;
1083 BOOL ret;
1084
1085 TRACE("(%p)->(%p)\n", This, ready);
1086
1087 if (!ready)
1088 return E_POINTER;
1089
1090 ret = GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL);
1091 *ready = ret ? VARIANT_TRUE : VARIANT_FALSE;
1092 return S_OK;
1093}

◆ drive_get_Path()

static HRESULT WINAPI drive_get_Path ( IDrive *  iface,
BSTR path 
)
static

Definition at line 888 of file filesystem.c.

889{
890 struct drive *This = impl_from_IDrive(iface);
891 FIXME("(%p)->(%p): stub\n", This, path);
892 return E_NOTIMPL;
893}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ drive_get_RootFolder()

static HRESULT WINAPI drive_get_RootFolder ( IDrive *  iface,
IFolder **  folder 
)
static

Definition at line 949 of file filesystem.c.

950{
951 struct drive *This = impl_from_IDrive(iface);
952 FIXME("(%p)->(%p): stub\n", This, folder);
953 return E_NOTIMPL;
954}

◆ drive_get_SerialNumber()

static HRESULT WINAPI drive_get_SerialNumber ( IDrive *  iface,
LONG serial 
)
static

Definition at line 1065 of file filesystem.c.

1066{
1067 struct drive *This = impl_from_IDrive(iface);
1068 BOOL ret;
1069
1070 TRACE("(%p)->(%p)\n", This, serial);
1071
1072 if (!serial)
1073 return E_POINTER;
1074
1075 ret = GetVolumeInformationW(This->root, NULL, 0, (DWORD*)serial, NULL, NULL, NULL, 0);
1076 return ret ? S_OK : E_FAIL;
1077}
uint32_t serial
Definition: fsck.fat.h:29

◆ drive_get_ShareName()

static HRESULT WINAPI drive_get_ShareName ( IDrive *  iface,
BSTR share_name 
)
static

Definition at line 911 of file filesystem.c.

912{
913 struct drive *This = impl_from_IDrive(iface);
914 FIXME("(%p)->(%p): stub\n", This, share_name);
915 return E_NOTIMPL;
916}

◆ drive_get_TotalSize()

static HRESULT WINAPI drive_get_TotalSize ( IDrive *  iface,
VARIANT v 
)
static

Definition at line 1006 of file filesystem.c.

1007{
1008 struct drive *This = impl_from_IDrive(iface);
1010
1011 TRACE("(%p)->(%p)\n", This, v);
1012
1013 if (!v)
1014 return E_POINTER;
1015
1016 if (!GetDiskFreeSpaceExW(This->root, NULL, &total, NULL))
1017 return E_FAIL;
1018
1019 return variant_from_largeint(&total, v);
1020}
size_t total

◆ drive_get_VolumeName()

static HRESULT WINAPI drive_get_VolumeName ( IDrive *  iface,
BSTR name 
)
static

Definition at line 1022 of file filesystem.c.

1023{
1024 struct drive *This = impl_from_IDrive(iface);
1025 WCHAR nameW[MAX_PATH+1];
1026 BOOL ret;
1027
1028 TRACE("(%p)->(%p)\n", This, name);
1029
1030 if (!name)
1031 return E_POINTER;
1032
1033 *name = NULL;
1035 if (ret)
1037 return ret ? S_OK : E_FAIL;
1038}
Definition: name.c:39

◆ drive_GetIDsOfNames()

static HRESULT WINAPI drive_GetIDsOfNames ( IDrive *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 845 of file filesystem.c.

848{
849 struct drive *This = impl_from_IDrive(iface);
851 HRESULT hr;
852
853 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
854
856 if(SUCCEEDED(hr))
857 {
858 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
859 ITypeInfo_Release(typeinfo);
860 }
861
862 return hr;
863}
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
REFIID riid
Definition: atlbase.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
@ IDrive_tid

◆ drive_GetTypeInfo()

static HRESULT WINAPI drive_GetTypeInfo ( IDrive *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 837 of file filesystem.c.

839{
840 struct drive *This = impl_from_IDrive(iface);
841 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
842 return get_typeinfo(IDrive_tid, ppTInfo);
843}

◆ drive_GetTypeInfoCount()

static HRESULT WINAPI drive_GetTypeInfoCount ( IDrive *  iface,
UINT pctinfo 
)
static

Definition at line 829 of file filesystem.c.

830{
831 struct drive *This = impl_from_IDrive(iface);
832 TRACE("(%p)->(%p)\n", This, pctinfo);
833 *pctinfo = 1;
834 return S_OK;
835}

◆ drive_Invoke()

static HRESULT WINAPI drive_Invoke ( IDrive *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 865 of file filesystem.c.

869{
870 struct drive *This = impl_from_IDrive(iface);
872 HRESULT hr;
873
874 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
875 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
876
878 if(SUCCEEDED(hr))
879 {
880 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
881 pDispParams, pVarResult, pExcepInfo, puArgErr);
882 ITypeInfo_Release(typeinfo);
883 }
884
885 return hr;
886}
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531

◆ drive_put_VolumeName()

static HRESULT WINAPI drive_put_VolumeName ( IDrive *  iface,
BSTR  name 
)
static

Definition at line 1040 of file filesystem.c.

1041{
1042 struct drive *This = impl_from_IDrive(iface);
1043 FIXME("(%p)->(%s): stub\n", This, debugstr_w(name));
1044 return E_NOTIMPL;
1045}

◆ drive_QueryInterface()

static HRESULT WINAPI drive_QueryInterface ( IDrive *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 781 of file filesystem.c.

782{
783 struct drive *This = impl_from_IDrive(iface);
784
785 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
786
787 *obj = NULL;
788
789 if (IsEqualIID( riid, &IID_IDrive ) ||
792 {
793 *obj = &This->IDrive_iface;
794 }
796 {
797 *obj = &This->classinfo.IProvideClassInfo_iface;
798 }
799 else
800 return E_NOINTERFACE;
801
802 IUnknown_AddRef((IUnknown*)*obj);
803 return S_OK;
804}
const GUID IID_IUnknown
const GUID IID_IProvideClassInfo
const GUID IID_IDispatch
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ drive_Release()

static ULONG WINAPI drive_Release ( IDrive *  iface)
static

Definition at line 814 of file filesystem.c.

815{
816 struct drive *This = impl_from_IDrive(iface);
818 TRACE("(%p)->(%d)\n", This, ref);
819
820 if (!ref)
821 {
822 SysFreeString(This->root);
824 }
825
826 return ref;
827}
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

◆ drivecoll_AddRef()

static ULONG WINAPI drivecoll_AddRef ( IDriveCollection *  iface)
static

Definition at line 2042 of file filesystem.c.

2043{
2046 TRACE("(%p)->(%d)\n", This, ref);
2047 return ref;
2048}
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177

◆ drivecoll_enumvariant_Clone()

static HRESULT WINAPI drivecoll_enumvariant_Clone ( IEnumVARIANT iface,
IEnumVARIANT **  pclone 
)
static

Definition at line 1585 of file filesystem.c.

1586{
1587 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1588 TRACE("(%p)->(%p)\n", This, pclone);
1589 return create_drivecoll_enum(This->data.u.drivecoll.coll, (IUnknown**)pclone);
1590}
static HRESULT create_drivecoll_enum(struct drivecollection *, IUnknown **)
Definition: filesystem.c:1602
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182

◆ drivecoll_enumvariant_Next()

static HRESULT WINAPI drivecoll_enumvariant_Next ( IEnumVARIANT iface,
ULONG  celt,
VARIANT var,
ULONG fetched 
)
static

Definition at line 1529 of file filesystem.c.

1530{
1531 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1532 ULONG count = 0;
1533
1534 TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched);
1535
1536 if (fetched)
1537 *fetched = 0;
1538
1539 if (!celt) return S_OK;
1540
1541 while (find_next_drive(This) == S_OK)
1542 {
1543 IDrive *drive;
1544 HRESULT hr;
1545
1546 hr = create_drive('A' + This->data.u.drivecoll.cur, &drive);
1547 if (FAILED(hr)) return hr;
1548
1551
1552 if (++count >= celt) break;
1553 }
1554
1555 if (fetched)
1556 *fetched = count;
1557
1558 return (count < celt) ? S_FALSE : S_OK;
1559}
@ VT_DISPATCH
Definition: compat.h:2304
static HRESULT find_next_drive(struct enumvariant *penum)
Definition: filesystem.c:1515
static HRESULT create_drive(WCHAR letter, IDrive **drive)
Definition: filesystem.c:1118
GLuint GLuint GLsizei count
Definition: gl.h:1545
const char * var
Definition: shader.c:5666
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define S_FALSE
Definition: winerror.h:2357

◆ drivecoll_enumvariant_Release()

static ULONG WINAPI drivecoll_enumvariant_Release ( IEnumVARIANT iface)
static

Definition at line 1499 of file filesystem.c.

1500{
1501 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1503
1504 TRACE("(%p)->(%d)\n", This, ref);
1505
1506 if (!ref)
1507 {
1508 IDriveCollection_Release(&This->data.u.drivecoll.coll->IDriveCollection_iface);
1509 heap_free(This);
1510 }
1511
1512 return ref;
1513}

◆ drivecoll_enumvariant_Reset()

static HRESULT WINAPI drivecoll_enumvariant_Reset ( IEnumVARIANT iface)
static

Definition at line 1575 of file filesystem.c.

1576{
1577 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1578
1579 TRACE("(%p)\n", This);
1580
1581 This->data.u.drivecoll.cur = -1;
1582 return S_OK;
1583}

◆ drivecoll_enumvariant_Skip()

static HRESULT WINAPI drivecoll_enumvariant_Skip ( IEnumVARIANT iface,
ULONG  celt 
)
static

Definition at line 1561 of file filesystem.c.

1562{
1563 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1564
1565 TRACE("(%p)->(%d)\n", This, celt);
1566
1567 if (!celt) return S_OK;
1568
1569 while (celt && find_next_drive(This) == S_OK)
1570 celt--;
1571
1572 return celt ? S_FALSE : S_OK;
1573}

◆ drivecoll_get__NewEnum()

static HRESULT WINAPI drivecoll_get__NewEnum ( IDriveCollection *  iface,
IUnknown **  ppenum 
)
static

Definition at line 2128 of file filesystem.c.

2129{
2131
2132 TRACE("(%p)->(%p)\n", This, ppenum);
2133
2134 if(!ppenum)
2135 return E_POINTER;
2136
2137 return create_drivecoll_enum(This, ppenum);
2138}

◆ drivecoll_get_Count()

static HRESULT WINAPI drivecoll_get_Count ( IDriveCollection *  iface,
LONG count 
)
static

Definition at line 2140 of file filesystem.c.

2141{
2143
2144 TRACE("(%p)->(%p)\n", This, count);
2145
2146 if (!count) return E_POINTER;
2147
2148 *count = This->count;
2149 return S_OK;
2150}

◆ drivecoll_get_Item()

static HRESULT WINAPI drivecoll_get_Item ( IDriveCollection *  iface,
VARIANT  key,
IDrive **  drive 
)
static

Definition at line 2121 of file filesystem.c.

2122{
2124 FIXME("(%p)->(%p): stub\n", This, drive);
2125 return E_NOTIMPL;
2126}

◆ drivecoll_GetIDsOfNames()

static HRESULT WINAPI drivecoll_GetIDsOfNames ( IDriveCollection *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 2078 of file filesystem.c.

2081{
2084 HRESULT hr;
2085
2086 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
2087
2089 if(SUCCEEDED(hr))
2090 {
2091 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
2092 ITypeInfo_Release(typeinfo);
2093 }
2094
2095 return hr;
2096}
@ IDriveCollection_tid

◆ drivecoll_GetTypeInfo()

static HRESULT WINAPI drivecoll_GetTypeInfo ( IDriveCollection *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 2070 of file filesystem.c.

2072{
2074 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
2075 return get_typeinfo(IDriveCollection_tid, ppTInfo);
2076}

◆ drivecoll_GetTypeInfoCount()

static HRESULT WINAPI drivecoll_GetTypeInfoCount ( IDriveCollection *  iface,
UINT pctinfo 
)
static

Definition at line 2062 of file filesystem.c.

2063{
2065 TRACE("(%p)->(%p)\n", This, pctinfo);
2066 *pctinfo = 1;
2067 return S_OK;
2068}

◆ drivecoll_Invoke()

static HRESULT WINAPI drivecoll_Invoke ( IDriveCollection *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 2098 of file filesystem.c.

2102{
2105 HRESULT hr;
2106
2107 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
2108 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2109
2111 if(SUCCEEDED(hr))
2112 {
2113 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
2114 pDispParams, pVarResult, pExcepInfo, puArgErr);
2115 ITypeInfo_Release(typeinfo);
2116 }
2117
2118 return hr;
2119}

◆ drivecoll_QueryInterface()

static HRESULT WINAPI drivecoll_QueryInterface ( IDriveCollection *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 2017 of file filesystem.c.

2018{
2020
2021 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
2022
2023 *obj = NULL;
2024
2025 if (IsEqualIID( riid, &IID_IDriveCollection ) ||
2028 {
2029 *obj = &This->IDriveCollection_iface;
2030 }
2032 {
2033 *obj = &This->classinfo.IProvideClassInfo_iface;
2034 }
2035 else
2036 return E_NOINTERFACE;
2037
2038 IUnknown_AddRef((IUnknown*)*obj);
2039 return S_OK;
2040}

◆ drivecoll_Release()

static ULONG WINAPI drivecoll_Release ( IDriveCollection *  iface)
static

Definition at line 2050 of file filesystem.c.

2051{
2054 TRACE("(%p)->(%d)\n", This, ref);
2055
2056 if (!ref)
2057 heap_free(This);
2058
2059 return ref;
2060}

◆ enumvariant_AddRef()

static ULONG WINAPI enumvariant_AddRef ( IEnumVARIANT iface)
static

Definition at line 1165 of file filesystem.c.

1166{
1167 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1169 TRACE("(%p)->(%d)\n", This, ref);
1170 return ref;
1171}

◆ enumvariant_QueryInterface()

static HRESULT WINAPI enumvariant_QueryInterface ( IEnumVARIANT iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 1145 of file filesystem.c.

1146{
1147 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1148
1149 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
1150
1151 *obj = NULL;
1152
1153 if (IsEqualIID( riid, &IID_IEnumVARIANT ) ||
1155 {
1156 *obj = iface;
1157 IEnumVARIANT_AddRef(iface);
1158 }
1159 else
1160 return E_NOINTERFACE;
1161
1162 return S_OK;
1163}

◆ file_AddRef()

static ULONG WINAPI file_AddRef ( IFile *  iface)
static

Definition at line 2558 of file filesystem.c.

2559{
2560 struct file *This = impl_from_IFile(iface);
2562
2563 TRACE("(%p) ref=%d\n", This, ref);
2564
2565 return ref;
2566}
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
long LONG
Definition: pedump.c:60
LONG ref
Definition: filesystem.c:120

◆ file_Copy()

static HRESULT WINAPI file_Copy ( IFile *  iface,
BSTR  Destination,
VARIANT_BOOL  OverWriteFiles 
)
static

Definition at line 2825 of file filesystem.c.

2826{
2827 struct file *This = impl_from_IFile(iface);
2828 FIXME("(%p)->(%s %x)\n", This, debugstr_w(Destination), OverWriteFiles);
2829 return E_NOTIMPL;
2830}
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3016

◆ file_Delete()

static HRESULT WINAPI file_Delete ( IFile *  iface,
VARIANT_BOOL  Force 
)
static

Definition at line 2818 of file filesystem.c.

2819{
2820 struct file *This = impl_from_IFile(iface);
2821 FIXME("(%p)->(%x)\n", This, Force);
2822 return E_NOTIMPL;
2823}
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1417

◆ file_get_Attributes()

static HRESULT WINAPI file_get_Attributes ( IFile *  iface,
FileAttribute *  pfa 
)
static

Definition at line 2717 of file filesystem.c.

2718{
2719 struct file *This = impl_from_IFile(iface);
2720 DWORD fa;
2721
2722 TRACE("(%p)->(%p)\n", This, pfa);
2723
2724 if(!pfa)
2725 return E_POINTER;
2726
2727 fa = GetFileAttributesW(This->path);
2729 return create_error(GetLastError());
2730
2734 return S_OK;
2735}
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
f_args fa
Definition: format.c:280

◆ file_get_DateCreated()

static HRESULT WINAPI file_get_DateCreated ( IFile *  iface,
DATE pdate 
)
static

Definition at line 2761 of file filesystem.c.

2762{
2763 struct file *This = impl_from_IFile(iface);
2764 FIXME("(%p)->(%p)\n", This, pdate);
2765 return E_NOTIMPL;
2766}

◆ file_get_DateLastAccessed()

static HRESULT WINAPI file_get_DateLastAccessed ( IFile *  iface,
DATE pdate 
)
static

Definition at line 2781 of file filesystem.c.

2782{
2783 struct file *This = impl_from_IFile(iface);
2784 FIXME("(%p)->(%p)\n", This, pdate);
2785 return E_NOTIMPL;
2786}

◆ file_get_DateLastModified()

static HRESULT WINAPI file_get_DateLastModified ( IFile *  iface,
DATE date 
)
static

Definition at line 2768 of file filesystem.c.

2769{
2770 struct file *This = impl_from_IFile(iface);
2772
2773 TRACE("(%p)->(%p)\n", This, date);
2774
2777
2778 return E_FAIL;
2779}
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:552
static HRESULT get_date_from_filetime(const FILETIME *ft, DATE *date)
Definition: filesystem.c:2746
__u16 date
Definition: mkdosfs.c:8
@ GetFileExInfoStandard
Definition: winbase.h:1161

◆ file_get_Drive()

static HRESULT WINAPI file_get_Drive ( IFile *  iface,
IDrive **  ppdrive 
)
static

Definition at line 2703 of file filesystem.c.

2704{
2705 struct file *This = impl_from_IFile(iface);
2706 FIXME("(%p)->(%p)\n", This, ppdrive);
2707 return E_NOTIMPL;
2708}

◆ file_get_Name()

static HRESULT WINAPI file_get_Name ( IFile *  iface,
BSTR name 
)
static

Definition at line 2657 of file filesystem.c.

2658{
2659 struct file *This = impl_from_IFile(iface);
2660 WCHAR *ptr;
2661
2662 TRACE("(%p)->(%p)\n", This, name);
2663
2664 if(!name)
2665 return E_POINTER;
2666
2667 *name = NULL;
2668
2669 ptr = wcsrchr(This->path, '\\');
2670 if (ptr)
2671 {
2672 *name = SysAllocString(ptr+1);
2673 TRACE("%s\n", debugstr_w(*name));
2674 if (!*name) return E_OUTOFMEMORY;
2675 }
2676 else
2677 return E_FAIL;
2678
2679 return S_OK;
2680}
#define wcsrchr
Definition: compat.h:16
static PVOID ptr
Definition: dispmode.c:27

◆ file_get_ParentFolder()

static HRESULT WINAPI file_get_ParentFolder ( IFile *  iface,
IFolder **  ppfolder 
)
static

Definition at line 2710 of file filesystem.c.

2711{
2712 struct file *This = impl_from_IFile(iface);
2713 FIXME("(%p)->(%p)\n", This, ppfolder);
2714 return E_NOTIMPL;
2715}

◆ file_get_Path()

static HRESULT WINAPI file_get_Path ( IFile *  iface,
BSTR path 
)
static

Definition at line 2641 of file filesystem.c.

2642{
2643 struct file *This = impl_from_IFile(iface);
2644
2645 TRACE("(%p)->(%p)\n", This, path);
2646
2647 if (!path)
2648 return E_POINTER;
2649
2650 *path = SysAllocString(This->path);
2651 if (!*path)
2652 return E_OUTOFMEMORY;
2653
2654 return S_OK;
2655}

◆ file_get_ShortName()

static HRESULT WINAPI file_get_ShortName ( IFile *  iface,
BSTR pbstrName 
)
static

Definition at line 2696 of file filesystem.c.

2697{
2698 struct file *This = impl_from_IFile(iface);
2699 FIXME("(%p)->(%p)\n", This, pbstrName);
2700 return E_NOTIMPL;
2701}

◆ file_get_ShortPath()

static HRESULT WINAPI file_get_ShortPath ( IFile *  iface,
BSTR pbstrPath 
)
static

Definition at line 2689 of file filesystem.c.

2690{
2691 struct file *This = impl_from_IFile(iface);
2692 FIXME("(%p)->(%p)\n", This, pbstrPath);
2693 return E_NOTIMPL;
2694}

◆ file_get_Size()

static HRESULT WINAPI file_get_Size ( IFile *  iface,
VARIANT pvarSize 
)
static

Definition at line 2788 of file filesystem.c.

2789{
2790 struct file *This = impl_from_IFile(iface);
2793 HANDLE f;
2794
2795 TRACE("(%p)->(%p)\n", This, pvarSize);
2796
2797 if(!pvarSize)
2798 return E_POINTER;
2799
2800 f = FindFirstFileW(This->path, &fd);
2801 if(f == INVALID_HANDLE_VALUE)
2802 return create_error(GetLastError());
2803 FindClose(f);
2804
2805 size.u.LowPart = fd.nFileSizeLow;
2806 size.u.HighPart = fd.nFileSizeHigh;
2807
2808 return variant_from_largeint(&size, pvarSize);
2809}
GLsizeiptr size
Definition: glext.h:5919
static int fd
Definition: io.c:51

◆ file_get_Type()

static HRESULT WINAPI file_get_Type ( IFile *  iface,
BSTR pbstrType 
)
static

Definition at line 2811 of file filesystem.c.

2812{
2813 struct file *This = impl_from_IFile(iface);
2814 FIXME("(%p)->(%p)\n", This, pbstrType);
2815 return E_NOTIMPL;
2816}

◆ file_GetIDsOfNames()

static HRESULT WINAPI file_GetIDsOfNames ( IFile *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 2604 of file filesystem.c.

2606{
2607 struct file *This = impl_from_IFile(iface);
2609 HRESULT hr;
2610
2611 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid),
2612 rgszNames, cNames, lcid, rgDispId);
2613
2615 if(SUCCEEDED(hr)) {
2616 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
2617 ITypeInfo_Release(typeinfo);
2618 }
2619 return hr;
2620}
@ IFile_tid

◆ file_GetTypeInfo()

static HRESULT WINAPI file_GetTypeInfo ( IFile *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 2594 of file filesystem.c.

2596{
2597 struct file *This = impl_from_IFile(iface);
2598
2599 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
2600
2601 return get_typeinfo(IFile_tid, ppTInfo);
2602}

◆ file_GetTypeInfoCount()

static HRESULT WINAPI file_GetTypeInfoCount ( IFile *  iface,
UINT pctinfo 
)
static

Definition at line 2584 of file filesystem.c.

2585{
2586 struct file *This = impl_from_IFile(iface);
2587
2588 TRACE("(%p)->(%p)\n", This, pctinfo);
2589
2590 *pctinfo = 1;
2591 return S_OK;
2592}

◆ file_Invoke()

static HRESULT WINAPI file_Invoke ( IFile *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 2622 of file filesystem.c.

2623{
2624 struct file *This = impl_from_IFile(iface);
2626 HRESULT hr;
2627
2628 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
2629 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
2630
2632 if(SUCCEEDED(hr))
2633 {
2634 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
2635 pDispParams, pVarResult, pExcepInfo, puArgErr);
2636 ITypeInfo_Release(typeinfo);
2637 }
2638 return hr;
2639}

◆ file_Move()

static HRESULT WINAPI file_Move ( IFile *  iface,
BSTR  Destination 
)
static

Definition at line 2832 of file filesystem.c.

2833{
2834 struct file *This = impl_from_IFile(iface);
2835 FIXME("(%p)->(%s)\n", This, debugstr_w(Destination));
2836 return E_NOTIMPL;
2837}

◆ file_OpenAsTextStream()

static HRESULT WINAPI file_OpenAsTextStream ( IFile *  iface,
IOMode  mode,
Tristate  format,
ITextStream **  stream 
)
static

Definition at line 2839 of file filesystem.c.

2840{
2841 struct file *This = impl_from_IFile(iface);
2842
2843 TRACE("(%p)->(%d %d %p)\n", This, mode, format, stream);
2844
2846}
#define OPEN_EXISTING
Definition: compat.h:775
static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMode mode, Tristate format, ITextStream **ret)
Definition: filesystem.c:699

◆ file_put_Attributes()

static HRESULT WINAPI file_put_Attributes ( IFile *  iface,
FileAttribute  pfa 
)
static

Definition at line 2737 of file filesystem.c.

2738{
2739 struct file *This = impl_from_IFile(iface);
2740
2741 TRACE("(%p)->(%x)\n", This, pfa);
2742
2743 return SetFileAttributesW(This->path, pfa) ? S_OK : create_error(GetLastError());
2744}

◆ file_put_Name()

static HRESULT WINAPI file_put_Name ( IFile *  iface,
BSTR  pbstrName 
)
static

Definition at line 2682 of file filesystem.c.

2683{
2684 struct file *This = impl_from_IFile(iface);
2685 FIXME("(%p)->(%s)\n", This, debugstr_w(pbstrName));
2686 return E_NOTIMPL;
2687}

◆ file_QueryInterface()

static HRESULT WINAPI file_QueryInterface ( IFile *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 2533 of file filesystem.c.

2534{
2535 struct file *This = impl_from_IFile(iface);
2536
2537 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
2538
2539 *obj = NULL;
2540
2541 if (IsEqualIID(riid, &IID_IFile) ||
2544 {
2545 *obj = &This->IFile_iface;
2546 }
2548 {
2549 *obj = &This->classinfo.IProvideClassInfo_iface;
2550 }
2551 else
2552 return E_NOINTERFACE;
2553
2554 IUnknown_AddRef((IUnknown*)*obj);
2555 return S_OK;
2556}

◆ file_Release()

static ULONG WINAPI file_Release ( IFile *  iface)
static

Definition at line 2568 of file filesystem.c.

2569{
2570 struct file *This = impl_from_IFile(iface);
2572
2573 TRACE("(%p) ref=%d\n", This, ref);
2574
2575 if(!ref)
2576 {
2577 heap_free(This->path);
2578 heap_free(This);
2579 }
2580
2581 return ref;
2582}

◆ filecoll_AddRef()

static ULONG WINAPI filecoll_AddRef ( IFileCollection *  iface)
static

Definition at line 1849 of file filesystem.c.

1850{
1853 TRACE("(%p)->(%d)\n", This, ref);
1854 return ref;
1855}
static struct filecollection * impl_from_IFileCollection(IFileCollection *iface)
Definition: filesystem.c:172

◆ filecoll_enumvariant_Clone()

static HRESULT WINAPI filecoll_enumvariant_Clone ( IEnumVARIANT iface,
IEnumVARIANT **  pclone 
)
static

Definition at line 1462 of file filesystem.c.

1463{
1464 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1465 TRACE("(%p)->(%p)\n", This, pclone);
1466 return create_filecoll_enum(This->data.u.filecoll.coll, (IUnknown**)pclone);
1467}
static HRESULT create_filecoll_enum(struct filecollection *, IUnknown **)
Definition: filesystem.c:1479

◆ filecoll_enumvariant_Next()

static HRESULT WINAPI filecoll_enumvariant_Next ( IEnumVARIANT iface,
ULONG  celt,
VARIANT var,
ULONG fetched 
)
static

Definition at line 1374 of file filesystem.c.

1375{
1376 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1377 HANDLE handle = This->data.u.filecoll.find;
1379 ULONG count = 0;
1380
1381 TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched);
1382
1383 if (fetched)
1384 *fetched = 0;
1385
1386 if (!celt) return S_OK;
1387
1388 if (!handle)
1389 {
1390 handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE);
1391 if (!handle) return S_FALSE;
1392 This->data.u.filecoll.find = handle;
1393 }
1394 else if (!FindNextFileW(handle, &data))
1395 return S_FALSE;
1396
1397 do
1398 {
1399 if (is_file_data(&data))
1400 {
1401 IFile *file;
1402 HRESULT hr;
1403 BSTR str;
1404
1405 str = get_full_path(This->data.u.filecoll.coll->path, &data);
1406 hr = create_file(str, &file);
1408 if (FAILED(hr)) return hr;
1409
1412 if (++count >= celt) break;
1413 }
1414 } while (FindNextFileW(handle, &data));
1415
1416 if (fetched)
1417 *fetched = count;
1418
1419 return (count < celt) ? S_FALSE : S_OK;
1420}
OLECHAR * BSTR
Definition: compat.h:2293
static BOOL is_file_data(const WIN32_FIND_DATAW *data)
Definition: filesystem.c:217
static BSTR get_full_path(BSTR path, const WIN32_FIND_DATAW *data)
Definition: filesystem.c:222
static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file)
Definition: filesystem.c:1190
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define create_file(name, size)
Definition: asmcache.c:813
const WCHAR * str

◆ filecoll_enumvariant_Release()

static ULONG WINAPI filecoll_enumvariant_Release ( IEnumVARIANT iface)
static

Definition at line 1357 of file filesystem.c.

1358{
1359 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1361
1362 TRACE("(%p)->(%d)\n", This, ref);
1363
1364 if (!ref)
1365 {
1366 IFileCollection_Release(&This->data.u.filecoll.coll->IFileCollection_iface);
1367 FindClose(This->data.u.filecoll.find);
1368 heap_free(This);
1369 }
1370
1371 return ref;
1372}

◆ filecoll_enumvariant_Reset()

static HRESULT WINAPI filecoll_enumvariant_Reset ( IEnumVARIANT iface)
static

Definition at line 1450 of file filesystem.c.

1451{
1452 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1453
1454 TRACE("(%p)\n", This);
1455
1456 FindClose(This->data.u.filecoll.find);
1457 This->data.u.filecoll.find = NULL;
1458
1459 return S_OK;
1460}

◆ filecoll_enumvariant_Skip()

static HRESULT WINAPI filecoll_enumvariant_Skip ( IEnumVARIANT iface,
ULONG  celt 
)
static

Definition at line 1422 of file filesystem.c.

1423{
1424 struct enumvariant *This = impl_from_IEnumVARIANT(iface);
1425 HANDLE handle = This->data.u.filecoll.find;
1427
1428 TRACE("(%p)->(%d)\n", This, celt);
1429
1430 if (!celt) return S_OK;
1431
1432 if (!handle)
1433 {
1434 handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE);
1435 if (!handle) return S_FALSE;
1436 This->data.u.filecoll.find = handle;
1437 }
1438 else if (!FindNextFileW(handle, &data))
1439 return S_FALSE;
1440
1441 do
1442 {
1443 if (is_file_data(&data))
1444 --celt;
1445 } while (celt && FindNextFileW(handle, &data));
1446
1447 return celt ? S_FALSE : S_OK;
1448}

◆ filecoll_get__NewEnum()

static HRESULT WINAPI filecoll_get__NewEnum ( IFileCollection *  iface,
IUnknown **  ppenum 
)
static

Definition at line 1938 of file filesystem.c.

1939{
1941
1942 TRACE("(%p)->(%p)\n", This, ppenum);
1943
1944 if(!ppenum)
1945 return E_POINTER;
1946
1947 return create_filecoll_enum(This, ppenum);
1948}

◆ filecoll_get_Count()

static HRESULT WINAPI filecoll_get_Count ( IFileCollection *  iface,
LONG count 
)
static

Definition at line 1950 of file filesystem.c.

1951{
1953 static const WCHAR allW[] = {'\\','*',0};
1955 WCHAR pathW[MAX_PATH];
1956 HANDLE handle;
1957
1958 TRACE("(%p)->(%p)\n", This, count);
1959
1960 if(!count)
1961 return E_POINTER;
1962
1963 *count = 0;
1964
1965 lstrcpyW(pathW, This->path);
1966 lstrcatW(pathW, allW);
1967 handle = FindFirstFileW(pathW, &data);
1970
1971 do
1972 {
1973 if (is_file_data(&data))
1974 *count += 1;
1975 } while (FindNextFileW(handle, &data));
1977
1978 return S_OK;
1979}
#define lstrcpyW
Definition: compat.h:749
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

◆ filecoll_get_Item()

static HRESULT WINAPI filecoll_get_Item ( IFileCollection *  iface,
VARIANT  Key,
IFile **  file 
)
static

Definition at line 1931 of file filesystem.c.

1932{
1934 FIXME("(%p)->(%p)\n", This, file);
1935 return E_NOTIMPL;
1936}

◆ filecoll_GetIDsOfNames()

static HRESULT WINAPI filecoll_GetIDsOfNames ( IFileCollection *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 1888 of file filesystem.c.

1891{
1894 HRESULT hr;
1895
1896 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1897
1899 if(SUCCEEDED(hr))
1900 {
1901 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
1902 ITypeInfo_Release(typeinfo);
1903 }
1904
1905 return hr;
1906}
@ IFileCollection_tid

◆ filecoll_GetTypeInfo()

static HRESULT WINAPI filecoll_GetTypeInfo ( IFileCollection *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 1880 of file filesystem.c.

1882{
1884 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1885 return get_typeinfo(IFileCollection_tid, ppTInfo);
1886}

◆ filecoll_GetTypeInfoCount()

static HRESULT WINAPI filecoll_GetTypeInfoCount ( IFileCollection *  iface,
UINT pctinfo 
)
static

Definition at line 1872 of file filesystem.c.

1873{
1875 TRACE("(%p)->(%p)\n", This, pctinfo);
1876 *pctinfo = 1;
1877 return S_OK;
1878}

◆ filecoll_Invoke()

static HRESULT WINAPI filecoll_Invoke ( IFileCollection *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 1908 of file filesystem.c.

1912{
1915 HRESULT hr;
1916
1917 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1918 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1919
1921 if(SUCCEEDED(hr))
1922 {
1923 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
1924 pDispParams, pVarResult, pExcepInfo, puArgErr);
1925 ITypeInfo_Release(typeinfo);
1926 }
1927
1928 return hr;
1929}

◆ filecoll_QueryInterface()

static HRESULT WINAPI filecoll_QueryInterface ( IFileCollection *  iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 1824 of file filesystem.c.

1825{
1827
1828 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
1829
1830 *obj = NULL;
1831
1832 if (IsEqualIID( riid, &IID_IFileCollection ) ||
1835 {
1836 *obj = &This->IFileCollection_iface;
1837 }
1839 {
1840 *obj = &This->classinfo.IProvideClassInfo_iface;
1841 }
1842 else
1843 return E_NOINTERFACE;
1844
1845 IUnknown_AddRef((IUnknown*)*obj);
1846 return S_OK;
1847}

◆ filecoll_Release()

static ULONG WINAPI filecoll_Release ( IFileCollection *  iface)
static

Definition at line 1857 of file filesystem.c.

1858{
1861 TRACE("(%p)->(%d)\n", This, ref);
1862
1863 if (!ref)
1864 {
1865 SysFreeString(This->path);
1866 heap_free(This);
1867 }
1868
1869 return ref;
1870}

◆ filesys_AddRef()

static ULONG WINAPI filesys_AddRef ( IFileSystem3 *  iface)
static

Definition at line 2961 of file filesystem.c.

2962{
2963 TRACE("%p\n", iface);
2964
2965 return 2;
2966}

◆ filesys_BuildPath()

static HRESULT WINAPI filesys_BuildPath ( IFileSystem3 *  iface,
BSTR  Path,
BSTR  Name,
BSTR Result 
)
static

Definition at line 3037 of file filesystem.c.

3039{
3040 BSTR ret;
3041
3042 TRACE("%p %s %s %p\n", iface, debugstr_w(Path), debugstr_w(Name), Result);
3043
3044 if (!Result) return E_POINTER;
3045
3046 if (Path && Name)
3047 {
3048 int path_len = SysStringLen(Path), name_len = SysStringLen(Name);
3049
3050 /* if both parts have backslashes strip one from Path */
3051 if (Path[path_len-1] == '\\' && Name[0] == '\\')
3052 {
3053 path_len -= 1;
3054
3055 ret = SysAllocStringLen(NULL, path_len + name_len);
3056 if (ret)
3057 {
3058 lstrcpyW(ret, Path);
3059 ret[path_len] = 0;
3060 lstrcatW(ret, Name);
3061 }
3062 }
3063 else if (Path[path_len-1] != '\\' && Name[0] != '\\')
3064 {
3065 ret = SysAllocStringLen(NULL, path_len + name_len + 1);
3066 if (ret)
3067 {
3068 lstrcpyW(ret, Path);
3069 if (Path[path_len-1] != ':')
3070 lstrcatW(ret, bsW);
3071 lstrcatW(ret, Name);
3072 }
3073 }
3074 else
3075 {
3076 ret = SysAllocStringLen(NULL, path_len + name_len);
3077 if (ret)
3078 {
3079 lstrcpyW(ret, Path);
3080 lstrcatW(ret, Name);
3081 }
3082 }
3083 }
3084 else if (Path || Name)
3086 else
3088
3089 if (!ret) return E_OUTOFMEMORY;
3090 *Result = ret;
3091
3092 return S_OK;
3093}
PRTL_UNICODE_STRING_BUFFER Path
static const WCHAR bsW[]
Definition: filesystem.c:45
static DWORD path_len
Definition: batch.c:31
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ filesys_CopyFile()

static HRESULT WINAPI filesys_CopyFile ( IFileSystem3 *  iface,
BSTR  Source,
BSTR  Destination,
VARIANT_BOOL  OverWriteFiles 
)
static

Definition at line 3716 of file filesystem.c.

3718{
3719 TRACE("%p %s %s %d\n", iface, debugstr_w(Source), debugstr_w(Destination), OverWriteFiles);
3720
3721 if(!Source || !Destination)
3722 return E_POINTER;
3723
3725 SysStringLen(Destination), OverWriteFiles);
3726}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169

◆ filesys_CopyFolder()

static HRESULT WINAPI filesys_CopyFolder ( IFileSystem3 *  iface,
BSTR  Source,
BSTR  Destination,
VARIANT_BOOL  OverWriteFiles 
)
static

Definition at line 3841 of file filesystem.c.

3843{
3844 TRACE("%p %s %s %d\n", iface, debugstr_w(Source), debugstr_w(Destination), OverWriteFiles);
3845
3846 if(!Source || !Destination)
3847 return E_POINTER;
3848
3850 SysStringLen(Destination), OverWriteFiles);
3851}

◆ filesys_CreateFolder()

static HRESULT WINAPI filesys_CreateFolder ( IFileSystem3 *  iface,
BSTR  path,
IFolder **  folder 
)
static

Definition at line 3853 of file filesystem.c.

3855{
3856 BOOL ret;
3857
3858 TRACE("(%p)->(%s %p)\n", iface, debugstr_w(path), folder);
3859
3861 if (!ret)
3862 {
3863 *folder = NULL;
3866 }
3867
3868 return create_folder(path, folder);
3869}
static HRESULT create_folder(const WCHAR *, IFolder **)
Definition: filesystem.c:2507

◆ filesys_CreateTextFile()

static HRESULT WINAPI filesys_CreateTextFile ( IFileSystem3 *  iface,
BSTR  filename,
VARIANT_BOOL  overwrite,
VARIANT_BOOL  unicode,
ITextStream **  stream 
)
static

Definition at line 3871 of file filesystem.c.

3874{
3875 DWORD disposition;
3876
3877 TRACE("%p %s %d %d %p\n", iface, debugstr_w(filename), overwrite, unicode, stream);
3878
3879 disposition = overwrite == VARIANT_TRUE ? CREATE_ALWAYS : CREATE_NEW;
3880 return create_textstream(filename, disposition, ForWriting, unicode ? TristateTrue : TristateFalse, stream);
3881}

◆ filesys_DeleteFile()

static HRESULT WINAPI filesys_DeleteFile ( IFileSystem3 *  iface,
BSTR  FileSpec,
VARIANT_BOOL  Force 
)
static

Definition at line 3538 of file filesystem.c.

3540{
3541 TRACE("%p %s %d\n", iface, debugstr_w(FileSpec), Force);
3542
3543 if(!FileSpec)
3544 return E_POINTER;
3545
3546 return delete_file(FileSpec, SysStringLen(FileSpec), Force);
3547}

◆ filesys_DeleteFolder()

static HRESULT WINAPI filesys_DeleteFolder ( IFileSystem3 *  iface,
BSTR  FolderSpec,
VARIANT_BOOL  Force 
)
static

Definition at line 3613 of file filesystem.c.

3615{
3616 TRACE("%p %s %d\n", iface, debugstr_w(FolderSpec), Force);
3617
3618 if(!FolderSpec)
3619 return E_POINTER;
3620
3621 return delete_folder(FolderSpec, SysStringLen(FolderSpec), Force);
3622}

◆ filesys_DriveExists()

static HRESULT WINAPI filesys_DriveExists ( IFileSystem3 *  iface,
BSTR  DriveSpec,
VARIANT_BOOL pfExists 
)
static

Definition at line 3328 of file filesystem.c.

3330{
3331 UINT len;
3332 WCHAR driveletter;
3333 TRACE("%p %s %p\n", iface, debugstr_w(DriveSpec), pfExists);
3334
3335 if (!pfExists) return E_POINTER;
3336
3337 *pfExists = VARIANT_FALSE;
3338 len = SysStringLen(DriveSpec);
3339
3340 if (len >= 1) {
3341 driveletter = towupper(DriveSpec[0]);
3342 if (driveletter >= 'A' && driveletter <= 'Z'
3343 && (len < 2 || DriveSpec[1] == ':')
3344 && (len < 3 || DriveSpec[2] == '\\')) {
3345 const WCHAR root[] = {driveletter, ':', '\\', 0};
3346 UINT drivetype = GetDriveTypeW(root);
3347 *pfExists = drivetype != DRIVE_NO_ROOT_DIR && drivetype != DRIVE_UNKNOWN ? VARIANT_TRUE : VARIANT_FALSE;
3348 }
3349 }
3350
3351 return S_OK;
3352}
unsigned int UINT
Definition: ndis.h:50
#define towupper(c)
Definition: wctype.h:99
#define DRIVE_UNKNOWN
Definition: winbase.h:256
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:257

◆ filesys_FileExists()

static HRESULT WINAPI filesys_FileExists ( IFileSystem3 *  iface,
BSTR  path,
VARIANT_BOOL ret 
)
static

Definition at line 3354 of file filesystem.c.

3355{
3356 DWORD attrs;
3357 TRACE("%p %s %p\n", iface, debugstr_w(path), ret);
3358
3359 if (!ret) return E_POINTER;
3360
3361 attrs = GetFileAttributesW(path);
3362 *ret = attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY) ? VARIANT_TRUE : VARIANT_FALSE;
3363 return S_OK;
3364}

◆ filesys_FolderExists()

static HRESULT WINAPI filesys_FolderExists ( IFileSystem3 *  iface,
BSTR  path,
VARIANT_BOOL ret 
)
static

Definition at line 3366 of file filesystem.c.

3367{
3368 DWORD attrs;
3369 TRACE("%p %s %p\n", iface, debugstr_w(path), ret);
3370
3371 if (!ret) return E_POINTER;
3372
3373 attrs = GetFileAttributesW(path);
3374 *ret = attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY) ? VARIANT_TRUE : VARIANT_FALSE;
3375
3376 return S_OK;
3377}

◆ filesys_get_Drives()

static HRESULT WINAPI filesys_get_Drives ( IFileSystem3 *  iface,
IDriveCollection **  ppdrives 
)
static

Definition at line 3031 of file filesystem.c.

3032{
3033 TRACE("%p %p\n", iface, ppdrives);
3034 return create_drivecoll(ppdrives);
3035}
static HRESULT create_drivecoll(IDriveCollection **drives)
Definition: filesystem.c:2165

◆ filesys_GetAbsolutePathName()

static HRESULT WINAPI filesys_GetAbsolutePathName ( IFileSystem3 *  iface,
BSTR  Path,
BSTR pbstrResult 
)
static

Definition at line 3254 of file filesystem.c.

3256{
3257 static const WCHAR cur_path[] = {'.',0};
3258
3259 WCHAR buf[MAX_PATH], ch;
3260 const WCHAR *path;
3261 DWORD i, beg, len, exp_len;
3262 WIN32_FIND_DATAW fdata;
3263 HANDLE fh;
3264
3265 TRACE("%p %s %p\n", iface, debugstr_w(Path), pbstrResult);
3266
3267 if(!pbstrResult)
3268 return E_POINTER;
3269
3270 if(!Path)
3271 path = cur_path;
3272 else
3273 path = Path;
3274
3276 if(!len)
3277 return E_FAIL;
3278
3279 buf[0] = towupper(buf[0]);
3280 if(len>3 && buf[len-1] == '\\')
3281 buf[--len] = 0;
3282
3283 for(beg=3, i=3; i<=len; i++) {
3284 if(buf[i]!='\\' && buf[i])
3285 continue;
3286
3287 ch = buf[i];
3288 buf[i] = 0;
3289 fh = FindFirstFileW(buf, &fdata);
3290 if(fh == INVALID_HANDLE_VALUE)
3291 break;
3292
3293 exp_len = lstrlenW(fdata.cFileName);
3294 if(exp_len == i-beg)
3295 memcpy(buf+beg, fdata.cFileName, exp_len*sizeof(WCHAR));
3296 FindClose(fh);
3297 buf[i] = ch;
3298 beg = i+1;
3299 }
3300
3301 *pbstrResult = SysAllocString(buf);
3302 if(!*pbstrResult)
3303 return E_OUTOFMEMORY;
3304 return S_OK;
3305}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ filesys_GetBaseName()

static HRESULT WINAPI filesys_GetBaseName ( IFileSystem3 *  iface,
BSTR  Path,
BSTR pbstrResult 
)
static

Definition at line 3194 of file filesystem.c.

3196{
3197 int i, end;
3198
3199 TRACE("%p %s %p\n", iface, debugstr_w(Path), pbstrResult);
3200
3201 if(!pbstrResult)
3202 return E_POINTER;
3203
3204 if(!Path) {
3205 *pbstrResult = NULL;
3206 return S_OK;
3207 }
3208
3209 for(end=lstrlenW(Path)-1; end>=0; end--)
3210 if(Path[end]!='/' && Path[end]!='\\')
3211 break;
3212
3213 for(i=end; i>=0; i--) {
3214 if(Path[i]=='.' && Path[end+1]!='.')
3215 end = i-1;
3216 if(Path[i]=='/' || Path[i]=='\\')
3217 break;
3218 }
3219 i++;
3220
3221 if((i>end && Path[end+1]!='.') || (i==0 && end==1 && Path[1]==':')) {
3222 *pbstrResult = NULL;
3223 return S_OK;
3224 }
3225
3226 *pbstrResult = SysAllocStringLen(Path+i, end-i+1);
3227 if(!*pbstrResult)
3228 return E_OUTOFMEMORY;
3229 return S_OK;
3230}
GLuint GLuint end
Definition: gl.h:1545

◆ filesys_GetDrive()

static HRESULT WINAPI filesys_GetDrive ( IFileSystem3 *  iface,
BSTR  DriveSpec,
IDrive **  ppdrive 
)
static

Definition at line 3379 of file filesystem.c.

3381{
3382 UINT len;
3383 HRESULT hr;
3384 WCHAR driveletter;
3385 VARIANT_BOOL drive_exists;
3386
3387 TRACE("%p %s %p\n", iface, debugstr_w(DriveSpec), ppdrive);
3388
3389 if (!ppdrive)
3390 return E_POINTER;
3391
3392 *ppdrive = NULL;
3393
3394 /* DriveSpec may be one of: 'x', 'x:', 'x:\', '\\computer\share' */
3395 len = SysStringLen(DriveSpec);
3396 if (!len)
3397 return E_INVALIDARG;
3398 else if (len <= 3) {
3399 driveletter = towupper(DriveSpec[0]);
3400 if (driveletter < 'A' || driveletter > 'Z'
3401 || (len >= 2 && DriveSpec[1] != ':')
3402 || (len == 3 && DriveSpec[2] != '\\'))
3403 return E_INVALIDARG;
3404 hr = IFileSystem3_DriveExists(iface, DriveSpec, &drive_exists);
3405 if (FAILED(hr))
3406 return hr;
3407 if (drive_exists == VARIANT_FALSE)
3409 return create_drive(driveletter, ppdrive);
3410 } else {
3411 if (DriveSpec[0] != '\\' || DriveSpec[1] != '\\')
3412 return E_INVALIDARG;
3413 FIXME("%s not implemented yet\n", debugstr_w(DriveSpec));
3414 return E_NOTIMPL;
3415 }
3416}
short VARIANT_BOOL
Definition: compat.h:2290
#define CTL_E_DEVICEUNAVAILABLE
Definition: olectl.h:284

◆ filesys_GetDriveName()

static HRESULT WINAPI filesys_GetDriveName ( IFileSystem3 *  iface,
BSTR  path,
BSTR drive 
)
static

Definition at line 3095 of file filesystem.c.

3096{
3097 TRACE("(%p)->(%s %p)\n", iface, debugstr_w(path), drive);
3098
3099 if (!drive)
3100 return E_POINTER;
3101
3102 *drive = NULL;
3103
3104 if (path && lstrlenW(path) > 1 && path[1] == ':')
3106
3107 return S_OK;
3108}

◆ filesys_GetExtensionName()

static HRESULT WINAPI filesys_GetExtensionName ( IFileSystem3 *  iface,
BSTR  path,
BSTR ext 
)
static

Definition at line 3232 of file filesystem.c.

3234{
3235 INT len;
3236
3237 TRACE("%p %s %p\n", iface, debugstr_w(path), ext);
3238
3239 *ext = NULL;
3241 while (len) {
3242 if (path[len-1] == '.') {
3243 *ext = SysAllocString(&path[len]);
3244 if (!*ext)
3245 return E_OUTOFMEMORY;
3246 break;
3247 }
3248 len--;
3249 }
3250
3251 return S_OK;
3252}
static const WCHAR *const ext[]
Definition: module.c:53
int32_t INT
Definition: typedefs.h:58

◆ filesys_GetFile()

static HRESULT WINAPI filesys_GetFile ( IFileSystem3 *  iface,
BSTR  FilePath,
IFile **  ppfile 
)
static

Definition at line 3418 of file filesystem.c.

3420{
3421 TRACE("%p %s %p\n", iface, debugstr_w(FilePath), ppfile);
3422
3423 if(!ppfile)
3424 return E_POINTER;
3425 if(!FilePath)
3426 return E_INVALIDARG;
3427
3428 return create_file(FilePath, ppfile);
3429}
PCWSTR FilePath

◆ filesys_GetFileName()

static HRESULT WINAPI filesys_GetFileName ( IFileSystem3 *  iface,
BSTR  Path,
BSTR pbstrResult 
)
static

Definition at line 3159 of file filesystem.c.

3161{
3162 int i, end;
3163
3164 TRACE("%p %s %p\n", iface, debugstr_w(Path), pbstrResult);
3165
3166 if(!pbstrResult)
3167 return E_POINTER;
3168
3169 if(!Path) {
3170 *pbstrResult = NULL;
3171 return S_OK;
3172 }
3173
3174 for(end=lstrlenW(Path)-1; end>=0; end--)
3175 if(Path[end]!='/' && Path[end]!='\\')
3176 break;
3177
3178 for(i=end; i>=0; i--)
3179 if(Path[i]=='/' || Path[i]=='\\')
3180 break;
3181 i++;
3182
3183 if(i>end || (i==0 && end==1 && Path[1]==':')) {
3184 *pbstrResult = NULL;
3185 return S_OK;
3186 }
3187
3188 *pbstrResult = SysAllocStringLen(Path+i, end-i+1);
3189 if(!*pbstrResult)
3190 return E_OUTOFMEMORY;
3191 return S_OK;
3192}

◆ filesys_GetFileVersion()

static HRESULT WINAPI filesys_GetFileVersion ( IFileSystem3 *  iface,
BSTR  name,
BSTR version 
)
static

Definition at line 3920 of file filesystem.c.

3921{
3922 static const WCHAR rootW[] = {'\\',0};
3924 WCHAR ver[30];
3925 void *ptr;
3926 DWORD len;
3927 BOOL ret;
3928
3929 TRACE("%p %s %p\n", iface, debugstr_w(name), version);
3930
3932 if (!len)
3934
3935 ptr = heap_alloc(len);
3936 if (!GetFileVersionInfoW(name, 0, len, ptr))
3937 {
3938 heap_free(ptr);
3940 }
3941
3942 ret = VerQueryValueW(ptr, rootW, (void**)&info, &len);
3943 if (!ret)
3944 {
3945 heap_free(ptr);
3947 }
3948
3949 get_versionstring(info, ver);
3950 heap_free(ptr);
3951
3952 *version = SysAllocString(ver);
3953 TRACE("version=%s\n", debugstr_w(ver));
3954
3955 return S_OK;
3956}
static const WCHAR rootW[]
Definition: chain.c:69
static const WCHAR version[]
Definition: asmname.c:66
static void get_versionstring(VS_FIXEDFILEINFO *info, WCHAR *ver)
Definition: filesystem.c:3905
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
Definition: version.c:611

◆ filesys_GetFolder()

static HRESULT WINAPI filesys_GetFolder ( IFileSystem3 *  iface,
BSTR  FolderPath,
IFolder **  folder 
)
static

Definition at line 3431 of file filesystem.c.

3433{
3434 DWORD attrs;
3435
3436 TRACE("%p %s %p\n", iface, debugstr_w(FolderPath), folder);
3437
3438 if(!folder)
3439 return E_POINTER;
3440
3441 *folder = NULL;
3442 if(!FolderPath)
3443 return E_INVALIDARG;
3444
3445 attrs = GetFileAttributesW(FolderPath);
3446 if((attrs == INVALID_FILE_ATTRIBUTES) || !(attrs & FILE_ATTRIBUTE_DIRECTORY))
3447 return CTL_E_PATHNOTFOUND;
3448
3449 return create_folder(FolderPath, folder);
3450}

◆ filesys_GetIDsOfNames()

static HRESULT WINAPI filesys_GetIDsOfNames ( IFileSystem3 *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 2990 of file filesystem.c.

2993{
2995 HRESULT hr;
2996
2997 TRACE("(%p)->(%s %p %u %u %p)\n", iface, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
2998
3000 if(SUCCEEDED(hr))
3001 {
3002 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
3003 ITypeInfo_Release(typeinfo);
3004 }
3005
3006 return hr;
3007}
@ IFileSystem3_tid

◆ filesys_GetParentFolderName()

static HRESULT WINAPI filesys_GetParentFolderName ( IFileSystem3 *  iface,
BSTR  Path,
BSTR pbstrResult 
)
static

Definition at line 3137 of file filesystem.c.

3139{
3140 DWORD len;
3141
3142 TRACE("%p %s %p\n", iface, debugstr_w(Path), pbstrResult);
3143
3144 if(!pbstrResult)
3145 return E_POINTER;
3146
3148 if(!len) {
3149 *pbstrResult = NULL;
3150 return S_OK;
3151 }
3152
3153 *pbstrResult = SysAllocStringLen(Path, len);
3154 if(!*pbstrResult)
3155 return E_OUTOFMEMORY;
3156 return S_OK;
3157}

◆ filesys_GetSpecialFolder()

static HRESULT WINAPI filesys_GetSpecialFolder ( IFileSystem3 *  iface,
SpecialFolderConst  SpecialFolder,
IFolder **  folder 
)
static

Definition at line 3452 of file filesystem.c.

3455{
3456 WCHAR pathW[MAX_PATH];
3457 DWORD ret;
3458
3459 TRACE("%p %d %p\n", iface, SpecialFolder, folder);
3460
3461 if (!folder)
3462 return E_POINTER;
3463
3464 *folder = NULL;
3465
3466 switch (SpecialFolder)
3467 {
3468 case WindowsFolder:
3469 ret = GetWindowsDirectoryW(pathW, ARRAY_SIZE(pathW));
3470 break;
3471 case SystemFolder:
3472 ret = GetSystemDirectoryW(pathW, ARRAY_SIZE(pathW));
3473 break;
3474 case TemporaryFolder:
3475 ret = GetTempPathW(ARRAY_SIZE(pathW), pathW);
3476 /* we don't want trailing backslash */
3477 if (ret && pathW[ret-1] == '\\')
3478 pathW[ret-1] = 0;
3479 break;
3480 default:
3481 FIXME("unknown special folder type, %d\n", SpecialFolder);
3482 return E_INVALIDARG;
3483 }
3484
3485 if (!ret)
3487
3488 return create_folder(pathW, folder);
3489}
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
@ SystemFolder
Definition: scrrun.idl:83
@ TemporaryFolder
Definition: scrrun.idl:84
@ WindowsFolder
Definition: scrrun.idl:82
Retrieval of special shell folder.

◆ filesys_GetStandardStream()

static HRESULT WINAPI filesys_GetStandardStream ( IFileSystem3 *  iface,
StandardStreamTypes  StandardStreamType,
VARIANT_BOOL  Unicode,
ITextStream **  ppts 
)
static

Definition at line 3895 of file filesystem.c.

3899{
3900 FIXME("%p %d %d %p\n", iface, StandardStreamType, Unicode, ppts);
3901
3902 return E_NOTIMPL;
3903}

◆ filesys_GetTempName()

static HRESULT WINAPI filesys_GetTempName ( IFileSystem3 *  iface,
BSTR pbstrResult 
)
static

Definition at line 3307 of file filesystem.c.

3308{
3309 static const WCHAR fmt[] = {'r','a','d','%','0','5','X','.','t','x','t',0};
3310
3311 DWORD random;
3312
3313 TRACE("%p %p\n", iface, pbstrResult);
3314
3315 if(!pbstrResult)
3316 return E_POINTER;
3317
3318 *pbstrResult = SysAllocStringLen(NULL, 12);
3319 if(!*pbstrResult)
3320 return E_OUTOFMEMORY;
3321
3322 if(!RtlGenRandom(&random, sizeof(random)))
3323 return E_FAIL;
3324 swprintf(*pbstrResult, fmt, random & 0xfffff);
3325 return S_OK;
3326}
#define swprintf
Definition: precomp.h:40
#define RtlGenRandom
Definition: ntsecapi.h:691
#define random
Definition: rosdhcp.h:81
Definition: dsound.c:943

◆ filesys_GetTypeInfo()

static HRESULT WINAPI filesys_GetTypeInfo ( IFileSystem3 *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 2983 of file filesystem.c.

2985{
2986 TRACE("(%p)->(%u %u %p)\n", iface, iTInfo, lcid, ppTInfo);
2987 return get_typeinfo(IFileSystem3_tid, ppTInfo);
2988}

◆ filesys_GetTypeInfoCount()

static HRESULT WINAPI filesys_GetTypeInfoCount ( IFileSystem3 *  iface,
UINT pctinfo 
)
static

Definition at line 2975 of file filesystem.c.

2976{
2977 TRACE("(%p)->(%p)\n", iface, pctinfo);
2978
2979 *pctinfo = 1;
2980 return S_OK;
2981}

◆ filesys_Invoke()

static HRESULT WINAPI filesys_Invoke ( IFileSystem3 *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 3009 of file filesystem.c.

3013{
3015 HRESULT hr;
3016
3017 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", iface, dispIdMember, debugstr_guid(riid),
3018 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3019
3021 if(SUCCEEDED(hr))
3022 {
3023 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags,
3024 pDispParams, pVarResult, pExcepInfo, puArgErr);
3025 ITypeInfo_Release(typeinfo);
3026 }
3027
3028 return hr;
3029}

◆ filesys_MoveFile()

static HRESULT WINAPI filesys_MoveFile ( IFileSystem3 *  iface,
BSTR  Source,
BSTR  Destination 
)
static

Definition at line 3624 of file filesystem.c.

3626{
3627 FIXME("%p %s %s\n", iface, debugstr_w(Source), debugstr_w(Destination));
3628
3629 return E_NOTIMPL;
3630}

◆ filesys_MoveFolder()

static HRESULT WINAPI filesys_MoveFolder ( IFileSystem3 *  iface,
BSTR  Source,
BSTR  Destination 
)
static

Definition at line 3632 of file filesystem.c.

3634{
3635 FIXME("%p %s %s\n", iface, debugstr_w(Source), debugstr_w(Destination));
3636
3637 return E_NOTIMPL;
3638}

◆ filesys_OpenTextFile()

static HRESULT WINAPI filesys_OpenTextFile ( IFileSystem3 *  iface,
BSTR  filename,
IOMode  mode,
VARIANT_BOOL  create,
Tristate  format,
ITextStream **  stream 
)
static

Definition at line 3883 of file filesystem.c.

3886{
3887 DWORD disposition;
3888
3889 TRACE("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream);
3890
3891 disposition = create == VARIANT_TRUE ? OPEN_ALWAYS : OPEN_EXISTING;
3892 return create_textstream(filename, disposition, mode, format, stream);
3893}
#define OPEN_ALWAYS
Definition: disk.h:70
static const struct access_res create[16]
Definition: package.c:7505

◆ filesys_QueryInterface()

static HRESULT WINAPI filesys_QueryInterface ( IFileSystem3 *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 2921 of file filesystem.c.

2922{
2923 struct filesystem *This = impl_from_IFileSystem3(iface);
2924
2925 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
2926
2927 if ( IsEqualGUID( riid, &IID_IFileSystem3 ) ||
2928 IsEqualGUID( riid, &IID_IFileSystem ) ||
2931 {
2932 *ppvObject = &This->IFileSystem3_iface;
2933 }
2935 {
2936 *ppvObject = &This->classinfo.IProvideClassInfo_iface;
2937 }
2938 else if ( IsEqualGUID( riid, &IID_IDispatchEx ))
2939 {
2940 TRACE("Interface IDispatchEx not supported - returning NULL\n");
2941 *ppvObject = NULL;
2942 return E_NOINTERFACE;
2943 }
2944 else if ( IsEqualGUID( riid, &IID_IObjectWithSite ))
2945 {
2946 TRACE("Interface IObjectWithSite not supported - returning NULL\n");
2947 *ppvObject = NULL;
2948 return E_NOINTERFACE;
2949 }
2950 else
2951 {
2952 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
2953 return E_NOINTERFACE;
2954 }
2955
2956 IUnknown_AddRef((IUnknown*)*ppvObject);
2957
2958 return S_OK;
2959}
static struct filesystem * impl_from_IFileSystem3(IFileSystem3 *iface)
Definition: filesystem.c:142
const IID IID_IObjectWithSite
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ filesys_Release()

static ULONG WINAPI filesys_Release ( IFileSystem3 *  iface)
static

Definition at line 2968 of file filesystem.c.

2969{
2970 TRACE("%p\n", iface);
2971
2972 return 1;
2973}

◆ FileSystem_CreateInstance()

HRESULT WINAPI FileSystem_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  ppv 
)

Definition at line 3998 of file filesystem.c.

3999{
4000 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
4001
4004 return IFileSystem3_QueryInterface(&filesystem.IFileSystem3_iface, riid, ppv);
4005}
static const struct IFileSystem3Vtbl filesys_vtbl
Definition: filesystem.c:3958
REFIID LPVOID * ppv
Definition: atlbase.h:39
IFileSystem3 IFileSystem3_iface
Definition: filesystem.c:50
struct provideclassinfo classinfo
Definition: filesystem.c:49

◆ find_next_drive()

static HRESULT find_next_drive ( struct enumvariant penum)
static

Definition at line 1515 of file filesystem.c.

1516{
1517 int i = penum->data.u.drivecoll.cur == -1 ? 0 : penum->data.u.drivecoll.cur + 1;
1518
1519 for (; i < 32; i++)
1520 if (penum->data.u.drivecoll.coll->drives & (1 << i))
1521 {
1522 penum->data.u.drivecoll.cur = i;
1523 return S_OK;
1524 }
1525
1526 return S_FALSE;
1527}
struct enumdata data
Definition: filesystem.c:100

Referenced by drivecoll_enumvariant_Next(), and drivecoll_enumvariant_Skip().

◆ folder_AddRef()

static ULONG WINAPI folder_AddRef ( IFolder *  iface)
static

Definition at line 2212 of file filesystem.c.

2213{
2214 struct folder *This = impl_from_IFolder(iface);
2216 TRACE("(%p)->(%d)\n", This, ref);
2217 return ref;
2218}
static struct folder * impl_from_IFolder(IFolder *iface)
Definition: filesystem.c:152
LONG ref
Definition: filesystem.c:113

◆ folder_Copy()

static HRESULT WINAPI folder_Copy ( IFolder *  iface,
BSTR  dest,
VARIANT_BOOL  overwrite 
)
static

Definition at line 2416 of file filesystem.c.

2417{
2418 struct folder *This = impl_from_IFolder(iface);
2419 FIXME("(%p)->(%s %x): stub\n", This, debugstr_w(dest), overwrite);
2420 return E_NOTIMPL;
2421}
static char * dest
Definition: rtl.c:135

◆ folder_CreateTextFile()

static HRESULT WINAPI folder_CreateTextFile ( IFolder *  iface,
BSTR  filename,
VARIANT_BOOL  overwrite,
VARIANT_BOOL  unicode,
ITextStream **  stream 
)
static

Definition at line 2468 of file filesystem.c.

2470{
2471 struct folder *This = impl_from_IFolder(iface);
2472 FIXME("(%p)->(%s %x %x %p): stub\n", This, debugstr_w(filename), overwrite, unicode, stream);
2473 return E_NOTIMPL;
2474}

◆ folder_Delete()

static HRESULT WINAPI folder_Delete ( IFolder *  iface,
VARIANT_BOOL  force 
)
static

Definition at line 2409 of file filesystem.c.

2410{
2411 struct folder *This = impl_from_IFolder(iface);
2412 FIXME("(%p)->(%x): stub\n", This, force);
2413 return E_NOTIMPL;
2414}

◆ folder_get_Attributes()