ReactOS  0.4.14-dev-833-g5f692ed
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 };

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 CTL_E_FILENOTFOUND
Definition: olectl.h:274
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
static DWORD get_parent_folder_name(const WCHAR *path, DWORD len)
Definition: filesystem.c:3110
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define FILE_ATTRIBUTE_DEVICE
Definition: disk.h:27
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

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);
3753  return CTL_E_FILEALREADYEXISTS;
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);
3769  if(FAILED(hr) && hr!=CTL_E_FILENOTFOUND)
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);
3815  return CTL_E_FILEALREADYEXISTS;
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 CTL_E_FILENOTFOUND
Definition: olectl.h:274
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static DWORD get_parent_folder_name(const WCHAR *path, DWORD len)
Definition: filesystem.c:3110
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static HRESULT copy_folder(const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
Definition: filesystem.c:3728
#define CTL_E_FILEALREADYEXISTS
Definition: olectl.h:278
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
GLenum GLenum dst
Definition: glext.h:6340
#define CTL_E_PATHNOTFOUND
Definition: olectl.h:288
static HRESULT copy_file(const WCHAR *source, DWORD source_len, const WCHAR *destination, DWORD destination_len, VARIANT_BOOL overwrite)
Definition: filesystem.c:3640
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by 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 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define S_OK
Definition: intsafe.h:59
static const IDriveVtbl drivevtbl
Definition: filesystem.c:1095
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLenum GLint GLuint mask
Definition: glext.h:6028
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
static const IDriveCollectionVtbl drivecollectionvtbl
Definition: filesystem.c:2152
unsigned long DWORD
Definition: ntddk_ex.h:95
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
DWORD WINAPI GetLogicalDrives(VOID)
Definition: disk.c:110
#define S_OK
Definition: intsafe.h:59

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 void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
static ICollection collection
Definition: typelib.c:184
static const IEnumVARIANTVtbl drivecollenumvariantvtbl
Definition: filesystem.c:1592

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 CTL_E_FILENOTFOUND
Definition: olectl.h:274
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CTL_E_PERMISSIONDENIED
Definition: olectl.h:285
#define CTL_E_FILEALREADYEXISTS
Definition: olectl.h:278
#define err(...)
#define CTL_E_PATHNOTFOUND
Definition: olectl.h:288
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80

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 
2890  len = GetFullPathNameW(path, 0, NULL, NULL);
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 }
IFile IFile_iface
Definition: filesystem.c:119
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define FILE_ATTRIBUTE_DEVICE
Definition: disk.h:27
GLfloat f
Definition: glext.h:7540
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const IFileVtbl file_vtbl
Definition: filesystem.c:2848
unsigned long DWORD
Definition: ntddk_ex.h:95
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: fci.c:126

Referenced by filecoll_enumvariant_Next(), and filesys_GetFile().

◆ 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
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define S_OK
Definition: intsafe.h:59
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IEnumVARIANTVtbl filecollenumvariantvtbl
Definition: filesystem.c:1469
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
static ICollection collection
Definition: typelib.c:184

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 }
Definition: fci.c:115
static const IFolderVtbl foldervtbl
Definition: filesystem.c:2476
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define TRACE(s)
Definition: solgame.cpp:4
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define S_OK
Definition: intsafe.h:59
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define S_OK
Definition: intsafe.h:59
static const IFolderCollectionVtbl foldercollvtbl
Definition: filesystem.c:1786
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
static ICollection collection
Definition: typelib.c:184

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  {
732  heap_free(stream);
733  return hr;
734  }
735 
736  if (mode == ForReading)
737  GetFileSizeEx(stream->file, &stream->size);
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 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define TRUE
Definition: types.h:120
static const ITextStreamVtbl textstreamvtbl
Definition: filesystem.c:676
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
const char * filename
Definition: ioapi.h:135
static const WCHAR utf16bom
Definition: filesystem.c:46
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI IsTextUnicode(IN CONST VOID *lpv, IN INT iSize, IN OUT LPINT lpiResult OPTIONAL)
Definition: unicode.c:27
#define FILE_END
Definition: winbase.h:114
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo)
Definition: scrrun.c:232
#define GetFileSizeEx
Definition: compat.h:422
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
unsigned int size
Definition: parse.h:27
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
GLenum mode
Definition: glext.h:6217
#define S_OK
Definition: intsafe.h:59
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_BEGIN
Definition: winbase.h:112
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define CreateFileW
Definition: compat.h:408
#define CREATE_NEW
Definition: disk.h:69
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 {
3493  WCHAR path[MAX_PATH];
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 SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
static DWORD get_parent_folder_name(const WCHAR *path, DWORD len)
Definition: filesystem.c:3110
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define FILE_ATTRIBUTE_DEVICE
Definition: disk.h:27
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
Definition: fci.c:126
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by delete_folder(), and filesys_DeleteFile().

◆ 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 {
3551  WCHAR path[MAX_PATH];
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 FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
Definition: fci.c:115
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
static DWORD get_parent_folder_name(const WCHAR *path, DWORD len)
Definition: filesystem.c:3110
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT delete_file(const WCHAR *file, DWORD file_len, VARIANT_BOOL force)
Definition: filesystem.c:3491
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define f
Definition: ke_i.h:83
static HRESULT delete_folder(const WCHAR *folder, DWORD folder_len, VARIANT_BOOL force)
Definition: filesystem.c:3549
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by 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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ 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 }
#define E_FAIL
Definition: ddrawi.h:102
static int avail
Definition: adh-main.c:39
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
const GLdouble * v
Definition: gl.h:2040
#define E_POINTER
Definition: winerror.h:2365
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

◆ 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 }
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ 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 }
#define DRIVE_RAMDISK
Definition: winbase.h:252
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define DRIVE_REMOVABLE
Definition: winbase.h:248
#define DRIVE_REMOTE
Definition: winbase.h:250
#define TRACE(s)
Definition: solgame.cpp:4
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define DRIVE_FIXED
Definition: winbase.h:249
#define S_OK
Definition: intsafe.h:59
#define DRIVE_CDROM
Definition: winbase.h:251
Definition: arc.h:81

◆ 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)
1061  *fs = SysAllocString(nameW);
1062  return ret ? S_OK : E_FAIL;
1063 }
Definition: fs.h:235
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
static const WCHAR nameW[]
Definition: main.c:46
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
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
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_POINTER
Definition: winerror.h:2365

◆ 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);
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 }
#define freespace(fs, percentreserved)
Definition: fs.h:640
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
const GLdouble * v
Definition: gl.h:2040
#define E_POINTER
Definition: winerror.h:2365
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

◆ 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);
1083  BOOL ret;
1084 
1085  TRACE("(%p)->(%p)\n", This, ready);
1086 
1087  if (!ready)
1088  return E_POINTER;
1089 
1091  *ready = ret ? VARIANT_TRUE : VARIANT_FALSE;
1092  return S_OK;
1093 }
#define freespace(fs, percentreserved)
Definition: fs.h:640
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342

◆ 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 FIXME(fmt,...)
Definition: debug.h:110
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#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 }
Definition: fci.c:115
#define FIXME(fmt,...)
Definition: debug.h:110
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
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
#define S_OK
Definition: intsafe.h:59
uint32_t serial
Definition: fsck.fat.h:64
#define E_POINTER
Definition: winerror.h:2365

◆ 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 }
#define FIXME(fmt,...)
Definition: debug.h:110
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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);
1009  ULARGE_INTEGER total;
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 }
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
const GLdouble * v
Definition: gl.h:2040
#define E_POINTER
Definition: winerror.h:2365
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

◆ 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 }
#define E_FAIL
Definition: ddrawi.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
static const WCHAR nameW[]
Definition: main.c:46
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
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
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38
#define E_POINTER
Definition: winerror.h:2365

◆ 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 hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ 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 }
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define S_OK
Definition: intsafe.h:59

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ 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 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: name.c:38

◆ 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  }
795  else if (IsEqualIID( riid, &IID_IProvideClassInfo ))
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IProvideClassInfo
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
const GUID IID_IDispatch
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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);
823  heap_free(This);
824  }
825 
826  return ref;
827 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static struct drive * impl_from_IDrive(IDrive *iface)
Definition: filesystem.c:147
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ 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 struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT create_drivecoll_enum(struct drivecollection *, IUnknown **)
Definition: filesystem.c:1602

◆ 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 
1549  V_VT(&var[count]) = VT_DISPATCH;
1550  V_DISPATCH(&var[count]) = (IDispatch*)drive;
1551 
1552  if (++count >= celt) break;
1553  }
1554 
1555  if (fetched)
1556  *fetched = count;
1557 
1558  return (count < celt) ? S_FALSE : S_OK;
1559 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define V_DISPATCH(A)
Definition: oleauto.h:239
static HRESULT create_drive(WCHAR letter, IDrive **drive)
Definition: filesystem.c:1118
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
static HRESULT find_next_drive(struct enumvariant *penum)
Definition: filesystem.c:1515
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
static char drive[2]
Definition: batch.c:28
unsigned int ULONG
Definition: retypes.h:1

◆ 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 }
Definition: send.c:47
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 }
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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 }
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
static HRESULT find_next_drive(struct enumvariant *penum)
Definition: filesystem.c:1515
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT create_drivecoll_enum(struct drivecollection *, IUnknown **)
Definition: filesystem.c:1602
#define E_POINTER
Definition: winerror.h:2365

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
REFIID riid
Definition: precomp.h:44
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
REFIID riid
Definition: precomp.h:44
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ 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 ) ||
2026  IsEqualIID( riid, &IID_IDispatch ) ||
2028  {
2029  *obj = &This->IDriveCollection_iface;
2030  }
2031  else if (IsEqualIID( riid, &IID_IProvideClassInfo ))
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
REFIID riid
Definition: precomp.h:44
const GUID IID_IProvideClassInfo
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
const GUID IID_IDispatch
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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 }
static struct drivecollection * impl_from_IDriveCollection(IDriveCollection *iface)
Definition: filesystem.c:177
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 }
Definition: send.c:47
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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);
2561  LONG ref = InterlockedIncrement(&This->ref);
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
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2922
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1425
Definition: fci.c:126

◆ 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_SYSTEM
Definition: nt_native.h:704
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define S_OK
Definition: intsafe.h:59
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define E_POINTER
Definition: winerror.h:2365
Definition: fci.c:126
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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 
2775  if (GetFileAttributesExW(This->path, GetFileExInfoStandard, &attrs))
2777 
2778  return E_FAIL;
2779 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT get_date_from_filetime(const FILETIME *ft, DATE *date)
Definition: filesystem.c:2746
__u16 date
Definition: mkdosfs.c:366
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:702
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define S_OK
Definition: intsafe.h:59
Definition: name.c:38
#define E_POINTER
Definition: winerror.h:2365
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static int fd
Definition: io.c:51
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define f
Definition: ke_i.h:83
#define E_POINTER
Definition: winerror.h:2365
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
Definition: fci.c:126
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
static HRESULT variant_from_largeint(const ULARGE_INTEGER *src, VARIANT *v)
Definition: filesystem.c:956

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define TRACE(s)
Definition: solgame.cpp:4
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
Definition: fci.c:126

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static ITypeInfo * typeinfo[last_tid]
Definition: apps.c:109
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2922
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMode mode, Tristate format, ITextStream **ret)
Definition: filesystem.c:699
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define OPEN_EXISTING
Definition: compat.h:434
#define TRACE(s)
Definition: solgame.cpp:4
Definition: parse.h:22
GLenum mode
Definition: glext.h:6217
Definition: fci.c:126

◆ 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 }
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:944
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static HRESULT create_error(DWORD err)
Definition: filesystem.c:187
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
Definition: fci.c:126

◆ 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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: fci.c:126

◆ 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  }
2547  else if (IsEqualIID( riid, &IID_IProvideClassInfo ))
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
const GUID IID_IProvideClassInfo
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
const GUID IID_IDispatch
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
Definition: fci.c:126

◆ 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);
2571  LONG ref = InterlockedDecrement(&This->ref);
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 }
static struct file * impl_from_IFile(IFile *iface)
Definition: filesystem.c:157
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: fci.c:126

◆ 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 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static struct filecollection * impl_from_IFileCollection(IFileCollection *iface)
Definition: filesystem.c:172
unsigned int ULONG
Definition: retypes.h:1

◆ 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 struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
static HRESULT create_filecoll_enum(struct filecollection *, IUnknown **)
Definition: filesystem.c:1479
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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);
1407  SysFreeString(str);
1408  if (FAILED(hr)) return hr;
1409 
1410  V_VT(&var[count]) = VT_DISPATCH;
1411  V_DISPATCH(&var[count]) = (IDispatch*)file;
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 }
static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file)
Definition: filesystem.c:1190
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static BSTR get_full_path(BSTR path, const WIN32_FIND_DATAW *data)
Definition: filesystem.c:222
GLuint GLuint GLsizei count
Definition: gl.h:1545
OLECHAR * BSTR
Definition: compat.h:1942
#define V_DISPATCH(A)
Definition: oleauto.h:239
static BOOL is_file_data(const WIN32_FIND_DATAW *data)
Definition: filesystem.c:217
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const char file[]
Definition: icontest.c:11
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
unsigned int ULONG
Definition: retypes.h:1
static HRESULT create_file(BSTR, IFile **)
Definition: filesystem.c:2876
Definition: fci.c:126

◆ 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 }
Definition: send.c:47
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

◆ 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 }
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

◆ 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 }
static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file)
Definition: filesystem.c:1190
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
static BOOL is_file_data(const WIN32_FIND_DATAW *data)
Definition: filesystem.c:217
static struct enumvariant * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: filesystem.c:182
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define S_OK
Definition: intsafe.h:59

◆ 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 }
static HRESULT create_filecoll_enum(struct filecollection *, IUnknown **)
Definition: filesystem.c:1479
#define TRACE(s)
Definition: solgame.cpp:4
static struct filecollection * impl_from_IFileCollection(IFileCollection *iface)
Definition: filesystem.c:172
#define E_POINTER
Definition: winerror.h:2365

◆ 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);
1969  return HRESULT_FROM_WIN32(GetLastError());
1970 
1971  do
1972  {
1973  if (is_file_data(&data))
1974  *count += 1;
1975  } while (FindNextFileW(handle, &data));
1976  FindClose(handle);
1977 
1978  return S_OK;
1979 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
GLuint GLuint GLsizei count
Definition: gl.h:1545