[ uuid(00E75FD0-19CE-4CD9-A87C-FAC5B74FADF8), version(1.0), helpstring("BStrAPI - Guido's VB-Speed API-Interface") ] library BStrAPI { // forward declared struct SAFEARRAY1D { short cDims; short fFeatures; LONG cbElements; LONG cLocks; LONG pvData; LONG cElements1D; LONG lLbound1D; }; [ dllname("oleaut32.dll") ] module OLEOUT32 { [helpstring("Allocates a new string, copies cch characters from the passed string into it, and then appends a null character")] BSTR SysAllocStringLen([in] LPSTR pch, [in] LONG cch); [helpstring("Allocates a new string and copies the passed string into it. Returns Null if there is insufficient memory, and if Null, Null is passed in.")] BSTR SysAllocString([in] LPSTR sz); [helpstring("Allocates a new BSTR and copies the passed string into it, then frees the BSTR referenced by pbstr, and finally resets pbstr to point to the new BSTR.")] LONG SysReAllocString([in] BSTR pbstr, [in] LPSTR sz); [helpstring("Creates a new BSTR containing a specified number of characters from an old BSTR, and frees the old BSTR.")] INT SysReAllocStringLen([in] BSTR pbstr, [in] LPSTR pch, [in] LONG cch); [helpstring("Frees a string allocated previously by SysAllocString, SysAllocStringByteLen, SysReAllocString, SysAllocStringLen, or SysReAllocStringLen.")] void SysFreeString([in] BSTR bstr); [helpstring("Returns the length in characters of a BSTR")] LONG SysStringLen([in] BSTR bstr); [helpstring("Returns the length in bytes of a BSTR")] LONG SysStringByteLen([in] BSTR bstr); [helpstring("Takes an ANSI string as input, and returns a BSTR that contains an ANSI string. Does not perform any ANSI-to-Unicode translation.")] BSTR SysAllocStringByteLen([in] LPSTR psz, [in] LONG len); }; };