Support Forums > WinFBX - Windows Framework for FreeBASIC

Josť, if you're bored...

(1/36) > >>

Paul Squires:
...and looking for some new stuff to add to WinFBX...

How about maybe adding WinAPI unicode ready wrappers to replace all of the FB file handling routines?

See, it's easy for me to blindly suggest things without having to code it myself!  LOL   :D  :D  :D

Josť Roca:
I already provide:

CTextSTream

The CTextStream class allows to read and write sequential text files (sometimes referred to as a text stream).
Works with ASCII and Unicode.
Works with Windows CRLF files and with Linux LF files.

CFindFile

Performs local file searches. CFindFile includes member functions that begin a search, locate a file, and return the title, name, or path of the file. Contrarily to DIR, it works with unicode.

CFileSys

The CFileSys class wraps the Microsoft File System Object and provides methods to work with files and folders, giving your application the ability to create, copy, alter, move, and delete files and folders, or to determine if and where particular files or folders exist. It also enables you to get information about files and folders, such as their names and the date they were created or last modified.

------------

To work with files in binary mode, what I could do is to write classes to work with the IStream interface. CFileStream will work with files and CMemStream with memory files.

The available methods would be:

Open
Close
Read
Write
Seek
SetSize
CopyTo
Commit
Revert
LockRegion
UnlockRegion
Stat
Clone

Additional Read and Write methods that accept different data types can be added.

What do you think?

Paul Squires:
I love the idea :)  CFileStream should be enough because I doubt many people would have a overly great need for memory files (although for the sake of completeness it would be great to have them) :)

Having an easy to use replacement for FB's built-in file handling routines would certainly lesson those "gotcha" moments when a new/existing user realizes that the FB commands automatically convert your Unicode data to ansi. That has burned me since I started writing the editor and without you pointing it out, I probably would have struggled for a long time trying to fin the bug in my code.

Paul Squires:
I am more than happy to test the routines because I will replace every FB file handling routine in WinFBE to use the new ones.

Josť Roca:
Well, here you have something to read and test: first version of CFileStream.

List of possible error codes:

' Storage HRESULT's (error codes)
'#define STG_E_INVALIDFUNCTION _HRESULT_TYPEDEF_(&h80030001)
'#define STG_E_FILENOTFOUND _HRESULT_TYPEDEF_(&h80030002)
'#define STG_E_PATHNOTFOUND _HRESULT_TYPEDEF_(&h80030003)
'#define STG_E_TOOMANYOPENFILES _HRESULT_TYPEDEF_(&h80030004)
'#define STG_E_ACCESSDENIED _HRESULT_TYPEDEF_(&h80030005)
'#define STG_E_INVALIDHANDLE _HRESULT_TYPEDEF_(&h80030006)
'#define STG_E_INSUFFICIENTMEMORY _HRESULT_TYPEDEF_(&h80030008)
'#define STG_E_INVALIDPOINTER _HRESULT_TYPEDEF_(&h80030009)
'#define STG_E_NOMOREFILES _HRESULT_TYPEDEF_(&h80030012)
'#define STG_E_DISKISWRITEPROTECTED _HRESULT_TYPEDEF_(&h80030013)
'#define STG_E_SEEKERROR _HRESULT_TYPEDEF_(&h80030019)
'#define STG_E_WRITEFAULT _HRESULT_TYPEDEF_(&h8003001D)
'#define STG_E_READFAULT _HRESULT_TYPEDEF_(&h8003001E)
'#define STG_E_SHAREVIOLATION _HRESULT_TYPEDEF_(&h80030020)
'#define STG_E_LOCKVIOLATION _HRESULT_TYPEDEF_(&h80030021)
'#define STG_E_FILEALREADYEXISTS _HRESULT_TYPEDEF_(&h80030050)
'#define STG_E_INVALIDPARAMETER _HRESULT_TYPEDEF_(&h80030057)
'#define STG_E_MEDIUMFULL _HRESULT_TYPEDEF_(&h80030070)
'#define STG_E_PROPSETMISMATCHED _HRESULT_TYPEDEF_(&h800300F0)
'#define STG_E_ABNORMALAPIEXIT _HRESULT_TYPEDEF_(&h800300FA)
'#define STG_E_INVALIDHEADER _HRESULT_TYPEDEF_(&h800300FB)
'#define STG_E_INVALIDNAME _HRESULT_TYPEDEF_(&h800300FC)
'#define STG_E_UNKNOWN _HRESULT_TYPEDEF_(&h800300FD)
'#define STG_E_UNIMPLEMENTEDFUNCTION _HRESULT_TYPEDEF_(&h800300FE)
'#define STG_E_INVALIDFLAG _HRESULT_TYPEDEF_(&h800300FF)
'#define STG_E_INUSE _HRESULT_TYPEDEF_(&h80030100)
'#define STG_E_NOTCURRENT _HRESULT_TYPEDEF_(&h80030101)
'#define STG_E_REVERTED _HRESULT_TYPEDEF_(&h80030102)
'#define STG_E_CANTSAVE _HRESULT_TYPEDEF_(&h80030103)
'#define STG_E_OLDFORMAT _HRESULT_TYPEDEF_(&h80030104)
'#define STG_E_OLDDLL _HRESULT_TYPEDEF_(&h80030105)
'#define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(&h80030106)
'#define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(&h80030107)
'#define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(&h80030108)
'#define STG_E_DOCFILECORRUPT _HRESULT_TYPEDEF_(&h80030109)
'#define STG_E_BADBASEADDRESS _HRESULT_TYPEDEF_(&h80030110)
'#define STG_E_DOCFILETOOLARGE _HRESULT_TYPEDEF_(&h80030111)
'#define STG_E_NOTSIMPLEFORMAT _HRESULT_TYPEDEF_(&h80030112)
'#define STG_E_INCOMPLETE _HRESULT_TYPEDEF_(&h80030201)
'#define STG_E_TERMINATED _HRESULT_TYPEDEF_(&h80030202)
'#define STG_S_CONVERTED _HRESULT_TYPEDEF_(&h00030200)
'#define STG_S_BLOCK _HRESULT_TYPEDEF_(&h00030201)
'#define STG_S_RETRYNOW _HRESULT_TYPEDEF_(&h00030202)
'#define STG_S_MONITORING _HRESULT_TYPEDEF_(&h00030203)
'#define STG_S_MULTIPLEOPENS _HRESULT_TYPEDEF_(&h00030204)
'#define STG_S_CONSOLIDATIONFAILED _HRESULT_TYPEDEF_(&h00030205)
'#define STG_S_CANNOTCONSOLIDATE _HRESULT_TYPEDEF_(&h00030206)
'#define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(&h80030305)
'#define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(&h80030306)
'#define STG_E_CSS_KEY_NOT_PRESENT _HRESULT_TYPEDEF_(&h80030307)
'#define STG_E_CSS_KEY_NOT_ESTABLISHED _HRESULT_TYPEDEF_(&h80030308)
'#define STG_E_CSS_SCRAMBLED_SECTOR _HRESULT_TYPEDEF_(&h80030309)
'#define STG_E_CSS_REGION_MISMATCH _HRESULT_TYPEDEF_(&h8003030A)
'#define STG_E_RESETS_EXHAUSTED _HRESULT_TYPEDEF_(&h8003030B)

Navigation

[0] Message Index

[#] Next page

Go to full version