' objbase.sbp

TypeDef RPC_AUTH_IDENTITY_HANDLE = VoidPtr 'Declared in Rpcdce.sbp; include Rpc.sbp.
TypeDef RPC_AUTHZ_HANDLE = VoidPtr 'Declared in Rpcdce.sbp; include Rpc.sbp.

Sub LISet32(ByRef li As LARGE_INTEGER, v As Long)
	With li
		If v < 0 Then
			.HighPart = -1
		Else
			.HighPart = 0
		End If
		.LowPart = v
	End With
End Sub
Sub ULISet32(ByRef li As ULARGE_INTEGER, v As DWord)
	With li
		.HighPart = 0
		.LowPart = v
	End With
End Sub

Const MARSHALINTERFACE_MIN = 500

Const CWCSTORAGENAME = 32

/* Storage instantiation modes */
Const STGM_DIRECT             = &h00000000
Const STGM_TRANSACTED         = &h00010000
Const STGM_SIMPLE             = &h08000000

Const STGM_READ               = &h00000000
Const STGM_WRITE              = &h00000001
Const STGM_READWRITE          = &h00000002

Const STGM_SHARE_DENY_NONE    = &h00000040
Const STGM_SHARE_DENY_READ    = &h00000030
Const STGM_SHARE_DENY_WRITE   = &h00000020
Const STGM_SHARE_EXCLUSIVE    = &h00000010

Const STGM_PRIORITY           = &h00040000
Const STGM_DELETEONRELEASE    = &h04000000
'#if (WINVER >= &h400)
Const STGM_NOSCRATCH          = &h00100000
'#endif /* WINVER */

Const STGM_CREATE             = &h00001000
Const STGM_CONVERT            = &h00020000
Const STGM_FAILIFTHERE        = &h00000000

Const STGM_NOSNAPSHOT         = &h00200000
'#if (_WIN32_WINNT >= &h0500)
Const STGM_DIRECT_SWMR        = &h00400000
'#endif

/*  flags for internet asyncronous and layout docfile */
Const ASYNC_MODE_COMPATIBILITY    = &h00000001
Const ASYNC_MODE_DEFAULT          = &h00000000

Const STGTY_REPEAT                = &h00000100
Const STG_TOEND                   = &hFFFFFFFF

Const STG_LAYOUT_SEQUENTIAL       = &h00000000
Const STG_LAYOUT_INTERLEAVED      = &h00000001

Const STGFMT_STORAGE          = 0
Const STGFMT_NATIVE           = 1
Const STGFMT_FILE             = 3
Const STGFMT_ANY              = 4
Const STGFMT_DOCFILE          = 5

Const STGFMT_DOCUMENT = 0

'/* here is where we pull in the MIDL generated headers for the interfaces */
'typedef interface    IRpcStubBuffer     IRpcStubBuffer;
'typedef interface    IRpcChannelBuffer  IRpcChannelBuffer;

#require <wtypes.ab>
#require <unknwn.sbp>
#require <objidl.sbp>

'-------------------
' IStream Interface
'-------------------

Const CLSCTX_INPROC = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER
'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM)
Const CLSCTX_ALL    = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER or CLSCTX_LOCAL_SERVER or CLSCTX_REMOTE_SERVER
Const CLSCTX_SERVER = CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER or CLSCTX_REMOTE_SERVER
'#else
'Const CLSCTX_ALL    = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER or CLSCTX_LOCAL_SERVER
'Const CLSCTX_SERVER = CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER
'#endif

Const Enum REGCLS
	REGCLS_SINGLEUSE = 0
	REGCLS_MULTIPLEUSE = 1
	REGCLS_MULTI_SEPARATE = 2
	REGCLS_SUSPENDED = 4
	REGCLS_SURROGATE = 8
End Enum

Declare Function CoInitialize Lib "ole32" (pvReserved As VoidPtr) As HRESULT
Declare Sub CoUninitialize Lib "ole32" ()
'Declare Sub CoGetMalloc Lib "ole32" (dwMemContext As DWord, ByRef Malloc As IMalloc) As HRESULT
Declare Function CoGetCurrentProcess Lib "ole32" () As DWord
'Declare Function CoRegisterMallocSpy Lib "ole32" (ByRef MallocSpy As IMallocSpy) As HRESULT
Declare Function CoRevokeMallocSpy Lib "ole32" () As HRESULT
'Declare Function CoCreateStandardMalloc Lib "ole32" (memctx As DWord, ByRef Malloc As IMalloc) As HRESULT


'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM)
Const Enum COINIT
	COINIT_MULTITHREADED     = &h0
	COINIT_APARTMENTTHREADED = &h2
	COINIT_DISABLE_OLE1DDE   = &h4
	COINIT_SPEED_OVER_MEMORY = &h8
End Enum
Declare Function CoInitializeEx Lib "ole32" (pvReserved As VoidPtr, dwCoInit As DWord) As HRESULT
Declare Function CoGetCallerTID Lib "ole32" (ByRef dwTID AS DWord) As HRESULT
'#endif

#ifdef __UNDECLARED__
'#if (_WIN32_WINNT >= &h0501)
' 注意：このcokkieは本来ULARGE_INTEGER型
'Declare Function CoRegisterInitializeSpy Lib "ole32" (Spy As IInitializeSpy, ByRef uliCokkie As QWord) As HRESULT
Declare Function CoRevokeInitializeSpy Lib "ole32" (uliCookie As QWord) As HRESULT

Declare Function CoGetContextToken Lib "ole32" (ByRef token As ULONG_PTR) As HRESULT

Const Enum COMSD
	SD_LAUNCHPERMISSIONS = 0
	SD_ACCESSPERMISSIONS = 1
	SD_LAUNCHRESTRICTIONS = 2
	SD_ACCESSRESTRICTIONS = 3
End Enum
'Declare Function CoGetSystemSecurityPermissions(comSDType As COMSD, ByRef ppSD As *SECURITY_DESCRIPTOR) As HRESULT
#endif

'#if DBG == 1
'Declare Function DebugCoGetRpcFault Lib "" () As DWord
'Declare Sub DebugCoSetRpcFault Lib "" (ul As DWord)
'#endif

'#if (_WIN32_WINNT >= &h0500)

Type SOleTlsDataPublic
	pvReserved0[ELM(2)] As VoidPtr
	dwReserved0[ELM(3)] As DWord
	pvReserved1[ELM(1)] As VoidPtr
	dwReserved1[ELM(3)] As DWord
	pvReserved2[ELM(4)] As VoidPtr
	dwReserved2[ELM(1)] As DWord
	pCurrentCtx As VoidPtr
End Type

'#endif

/* COM+ APIs */

Declare Function CoGetObjectContext Lib "ole32" (ByRef riid As IID, ByRef ppv As Any) As HRESULT

/* register/revoke/get class objects */

Declare Function CoGetClassObject Lib "ole32" (ByRef rclsid As CLSID, dwClsContext As DWord, pServerInfo As *COSERVERINFO, ByRef refiid As IID, ByRef ppv As Any) As HRESULT
Declare Function CoRegisterClassObject Lib "ole32" (ByRef rclsid As CLSID, pUnk As *IUnknown, dwClsContext As DWord, flags As DWord, ByRef dwRegister As DWord) As HRESULT
Declare Function CoRevokeClassObject Lib "ole32" (dwRegister As DWord) As HRESULT
Declare Function CoResumeClassObjects Lib "ole32" () As HRESULT
Declare Function CoSuspendClassObjects Lib "ole32" () As HRESULT
Declare Function CoAddRefServerProcess Lib "ole32" () As DWord
Declare Function CoReleaseServerProcess Lib "ole32" () As DWord
Declare Function CoGetPSClsid Lib "ole32" (ByRef riid As IID, ByRef rclsid As CLSID) As HRESULT
Declare Function CoRegisterPSClsid Lib "ole32" (ByRef riid As IID, ByRef rclsid As CLSID) As HRESULT

/* Registering surrogate processes */
'Declare Function CoRegisterSurrogate Lib "ole32" (Surrogate As ISurrogate) As HRESULT

/* marshaling interface pointers */

Declare Function CoGetMarshalSizeMax Lib "ole32" (ByRef ulSize As DWord, ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord) As HRESULT
Declare Function CoMarshalInterface Lib "ole32" (pStm As *IStream, ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord) As HRESULT
Declare Function CoUnmarshalInterface Lib "ole32" (pstm As *IStream, ByRef riid As IID, ByRef ppv As Any) As HRESULT
Declare Function CoMarshalHresult Lib "ole32" (pstm As *IStream, hresult As HRESULT) As HRESULT
Declare Function CoUnmarshalHresult Lib "ole32" (pstm As *IStream, ByRef phresult As HRESULT) As HRESULT
Declare Function CoReleaseMarshalData Lib "ole32" (pstm As *IStream) As HRESULT
Declare Function CoDisconnectObject Lib "ole32" (pUnk As *IUnknown, dwReserved As DWord) As HRESULT
Declare Function CoLockObjectExternal Lib "ole32" (pUnk As *IUnknown, fLock As BOOL, fLastUnlockReleases As BOOL) As HRESULT
'Declare Function CoGetStandardMarshal Lib "ole32" (ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord, ByRef pMarshal As *IMarshal) As HRESULT

Declare Function CoGetStdMarshalEx Lib "ole32" (pUnkOuter As *IUnknown, smexflags As DWord, ByRef pUnkInner As *IUnknown) As HRESULT

/* flags for CoGetStdMarshalEx */
Const Enum STDMSHLFLAGS
	SMEXF_SERVER  = &h01
	SMEXF_HANDLER = &h02
End Enum

Declare Function CoIsHandlerConnected Lib "ole32" (pUnk As *IUnknown) As BOOL

/* Apartment model inter-thread interface passing helpers */
Declare Function CoMarshalInterThreadInterfaceInStream Lib "ole32" (ByRef riid As IID, pUnk As *IUnknown, ByRef pStm As *IStream) As HRESULT

Declare Function CoGetInterfaceAndReleaseStream Lib "ole32" (pStm As *IStream, ByRef riid As IID, ByRef ppv As Any) As HRESULT
Declare Function CoCreateFreeThreadedMarshaler Lib "ole32" (punkOuter As *IUnknown, ByRef punkMarshal As *IUnknown) As HRESULT

/* dll loading helpers; keeps track of ref counts and unloads all on exit */

Declare Function CoLoadLibrary Lib "ole32" (lpszLibName As LPOLESTR, bAutoFree As BOOL) As HINSTANCE
Declare Sub CoFreeLibrary Lib "ole32" (hInst As HINSTANCE)
Declare Sub CoFreeAllLibraries Lib "ole32" ()
Declare Sub CoFreeUnusedLibraries Lib "ole32" ()
'#if  (_WIN32_WINNT >= &h0501)
Declare Sub CoFreeUnusedLibrariesEx Lib "ole32" (dwUnloadDelay As DWord, dwReserved As DWord)
'#endif

'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM

/* Call Security. */

/*SOLE_AUTHENTICATION_SERVICE未定義
Declare Function CoInitializeSecurity Lib "ole32" (
	ByVal pSecDesc As *SECURITY_DESCRIPTOR,
	ByVal cAuthSvc As *SOLE_AUTHENTICATION_SERVICE,
	ByVal pReserved1 As VoidPtr,
	ByVal dwAuthnLevel As DWord,
	ByVal dwImpLevel As DWord,
	ByVal pAuthList As VoidPtr,
	ByVal dwCapabilities As DWord,
	ByVal pReserved3 As VoidPtr) As HRESULT
*/
Declare Function CoGetCallContext Lib "ole32" (
	ByRef riid As IID,
	ByRef pInterface As Any) As HRESULT
Declare Function CoQueryProxyBlanket Lib "ole32" (
	ByVal pProxy As *IUnknown,
	ByRef AuthnSvc As DWord,
	ByVal pAuthzSvc As *DWord,
	ByVal pServerPrincName As **OLECHAR,
	ByVal pAuthnLevel As *DWord,
	ByVal pImpLevel As *DWord,
	ByVal pAuthInfo As *RPC_AUTH_IDENTITY_HANDLE,
	ByVal pCapabilites As *DWord) As HRESULT
Declare Function CoSetProxyBlanket Lib "ole32" (
	ByVal pProxy As *IUnknown,
	ByVal dwAuthnSvc As DWord,
	ByVal dwAuthzSvc As DWord,
	ByVal pServerPrincName As *OLECHAR,
	ByVal dwAuthnLevel As DWord,
	ByVal dwImpLevel As DWord,
	ByVal pAuthInfo As RPC_AUTH_IDENTITY_HANDLE,
	ByVal dwCapabilities As DWord) As HRESULT
Declare Function CoCopyProxy Lib "ole32" (
	ByVal pProxySrc As *IUnknown,
	ByRef pProxyDst As *IUnknown) As HRESULT
Declare Function CoQueryClientBlanket Lib "ole32" (
	ByVal pAuthnSvc As *DWord,
	ByVal pAuthzSvc As *DWord,
	ByVal pServerPrincName As **OLECHAR,
	ByVal pAuthnLevel As *DWord,
	ByVal pImpLevel As *DWord,
	ByVal pPrivs As *RPC_AUTHZ_HANDLE,
	ByVal pCapabilities As *DWord) As HRESULT
Declare Function CoImpersonateClient Lib "ole32" () As HRESULT
Declare Function CoRevertToSelf Lib "ole32" () As HRESULT
/*
Declare Function CoRevertToSelf Lib "ole32" (
	ByRef cAuthSvc As DWord,
	ByRef asAuthSvc As *SOLE_AUTHENTICATION_SERVICE) As HRESULT
*/
Declare Function CoSwitchCallContext Lib "ole32" (
	ByVal pNewObject As *IUnknown,
	ByRef ppOldObject As *IUnknown) As HRESULT

Const COM_RIGHTS_EXECUTE = 1
Const COM_RIGHTS_EXECUTE_LOCAL = 2
Const COM_RIGHTS_EXECUTE_REMOTE = 4
Const COM_RIGHTS_ACTIVATE_LOCAL = 8
Const COM_RIGHTS_ACTIVATE_REMOTE = 16
'#endif ' DCOM

Declare Function CoCreateInstance Lib "ole32" (ByRef clsid As CLSID, pUnknown As *IUnknown, dwClsContext As DWord, ByRef refiid As IID, ByRef pObj As Any) As HRESULT

'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
Declare Function CoGetInstanceFromFile Lib "ole32" (
	ByVal pServerInfo As *COSERVERINFO,
	ByRef clsid As CLSID,
	ByVal punkOuter As *IUnknown,
	ByVal dwClsCtx As DWord,
	ByVal grfMode As DWord,
	ByVal pwszName As *OLECHAR,
	ByVal dwCount As DWord,
	ByVal pResults As *MULTI_QI) As HRESULT

Declare Function CoGetInstanceFromIStorage Lib "ole32" (
	ByVal pServerInfo As *COSERVERINFO,
	ByRef clsid As CLSID,
	ByVal punkOuter As *IUnknown,
	ByVal dwClsCtx As DWord,
	ByVal grfMode As DWord,
	ByVal pstg As *IStorage,
	ByVal dwCount As DWord,
	ByVal pResults As *MULTI_QI) As HRESULT

Declare Function CoCreateInstanceEx Lib "ole32" (
	ByRef clsid As CLSID,
	ByVal punkOuter As *IUnknown,
	ByVal dwClsCtx As DWord,
	ByVal pServerInfo As *COSERVERINFO,
	ByVal dwCount As DWord,
	ByVal pResults As *MULTI_QI) As HRESULT
'#endif ' DCOM

/* Call related APIs */
'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
Declare Function CoGetCancelObject Lib "ole32" (dwThreadId As DWord, ByRef iid As IID, ByRef pUnk As Any) As HRESULT
Declare Function CoSetCancelObject Lib "ole32" (pUnk As *IUnknown) As HRESULT
Declare Function CoCancelCall Lib "ole32" (dwThreadId As DWord, ulTimeout As DWord) As HRESULT
Declare Function CoTestCancel Lib "ole32" () As HRESULT
Declare Function CoEnableCallCancellation Lib "ole32" (pReserved As VoidPtr) As HRESULT
Declare Function CoDisableCallCancellation Lib "ole32" (pReserved As VoidPtr) As HRESULT
Declare Function CoAllowSetForegroundWindow Lib "ole32" (pUnk As *IUnknown, pvReserved As VoidPtr) As HRESULT
Declare Function DcomChannelSetHResult Lib "ole32" (pvReserved As HRESULT, pulReserved As DWord, appsHR As HRESULT) As HRESULT
'#endif

/* other helpers */

Declare Function StringFromCLSID Lib "ole32" (ByRef rclsid As CLSID, ByRef lpsz As LPOLESTR) As HRESULT
Declare Function CLSIDFromString Lib "ole32" (lpsz As LPOLESTR, ByRef clsid As CLSID) As HRESULT
Declare Function StringFromIID Lib "ole32" (ByRef iid As IID, ByRef lpsz As LPOLESTR) As HRESULT
Declare Function IIDFromString Lib "ole32" (lpsz As LPOLESTR, ByRef iid As IID) As HRESULT
Declare Function CoIsOle1Class Lib "ole32" (ByRef rclsid As CLSID) As BOOL
Declare Function ProgIDFromCLSID  Lib "ole32" (ByRef clsid As CLSID, ByRef lpszProgID As LPOLESTR) As HRESULT
Declare Function CLSIDFromProgID  Lib "ole32" (lpszProgID As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
Declare Function CLSIDFromProgIDEx  Lib "ole32" (lpszProgID As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
Declare Function StringFromGUID2 Lib "ole32" (ByRef rguid As GUID, lpsz As LPOLESTR, cchMax As Long) As Long

Declare Function CoCreateGuid Lib "ole32" (ByRef guid As GUID) As HRESULT

Declare Function CoFileTimeToDosDateTime Lib "ole32" (ByRef FileTime As FILETIME, ByRef DosDate As Word, ByRef DosTime As Word) As BOOL
Declare Function CoDosDateTimeToFileTime Lib "ole32" (nDosDate As Word, nDosTime As Word, ByRef FileTime As FILETIME) As BOOL
Declare Function CoFileTimeNow Lib "ole32" (ByRef FileTime As FILETIME) As HRESULT

Declare Function CoRegisterMessageFilter Lib "ole32" (pMessageFilter As *IMessageFilter, ByRef pMessageFilter As *IMessageFilter) As HRESULT

'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
'IChannelHook未定義
'Declare Function CoRegisterChannelHook Lib "ole32" (ByRef ExtensionUuid As GUID, pChannelHook As *IChannelHook) As HRESULT
'#endif ' DCOM

'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM

Declare Function CoWaitForMultipleHandles Lib "ole32" (
	ByVal dwFlags As DWord,
	ByVal dwTimeout As DWord,
	ByVal cHandles As DWord,
	ByVal pHandles As *HANDLE,
	ByRef dwindex As DWord) As HRESULT

/* Flags for Synchronization API and Classes */

Const Enum COWAIT_FLAGS
	COWAIT_WAITALL = 1
	COWAIT_ALERTABLE = 2
	COWAIT_INPUTAVAILABLE = 4
End Enum

'#endif ' DCOM

/* for flushing OLESCM remote binding handles */

#ifdef __UNDECLARED__
'#if  (_WIN32_WINNT >= &h0501)
Declare Function CoInvalidateRemoteMachineBindings Lib "ole32" (pszMachineName As LPOLESTR) As HRESULT
#endif

/* TreatAs APIS */

Declare Function CoGetTreatAsClass Lib "ole32" (ByRef clsidOld As CLSID, ByRef ClsidNew As CLSID) As HRESULT
Declare Function CoTreatAsClass Lib "ole32" (ByRef clsidOld As CLSID, ByRef clsidNew As CLSID) As HRESULT

/* the server dlls must define their DllGetClassObject and DllCanUnloadNow
 * to match these; the typedefs are located here to ensure all are changed at
 * the same time.
 */

TypeDef LPFNGETCLASSOBJECT = *Function(ByRef rclsid As CLSID, ByRef riid As IID, ByRef ppv As Any) As HRESULT
TypeDef LPFNCANUNLOADNOW = *Function() As HRESULT

/*
Declare Function DllGetClassObject(ByRef rclsid As CLSID, ByRef riid As IID, ByVal ppv As *VoidPtr) As HRESULT
Declare Function DllCanUnloadNow() As HRESULT
*/

/****** Default Memory Allocation ******************************************/
Declare Function CoTaskMemAlloc Lib "ole32" (cb As SIZE_T) As VoidPtr
Declare Function CoTaskMemRealloc Lib "ole32" (pv As VoidPtr, cb As SIZE_T) As VoidPtr
Declare Sub CoTaskMemFree Lib "ole32" (pv As VoidPtr)

/****** DV APIs ***********************************************************/

/* This function is declared in objbase.h and ole2.h */
Declare Function CreateDataAdviseHolder Lib "ole32" (ByRef pDAHolder As *IDataAdviseHolder) As HRESULT
Declare Function CreateDataCache Lib "ole32" (pUnkOuter As *IUnknown, ByRef rclsid As CLSID, ByRef riid As IID, ByRef ppv As Any) As HRESULT

/****** Storage API Prototypes ********************************************/


Declare Function StgCreateDocfile Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByVal grfMode As DWord,
	ByVal reserved As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT

Declare Function StgCreateDocfileOnILockBytes Lib "ole32" (
	ByVal plkbyt As *ILockBytes,
	ByVal grfMode As DWord,
	ByVal reserved As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT

Declare Function StgOpenStorage Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByVal pstgPriority As *IStorage,
	ByVal grfMode As DWord,
	ByVal snbExclude As SNB,
	ByVal reserved As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT
Declare Function StgOpenStorageOnILockBytes Lib "ole32" (
	ByVal plkbyt As *ILockBytes,
	ByVal pstgPriority As *IStorage,
	ByVal grfMode As DWord,
	ByVal snbExclude As SNB,
	ByVal reserved As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT

Declare Function StgIsStorageFile Lib "ole32" (pwcsName As *OLECHAR) As HRESULT
Declare Function StgIsStorageILockBytes Lib "ole32" (plkbyt As *ILockBytes) As HRESULT

Declare Function StgSetTimes Lib "ole32" (
	ByVal pszName As *OLECHAR,
	ByRef pctime As FILETIME,
	ByRef patime As FILETIME,
	ByRef pmtime As FILETIME) As HRESULT

Declare Function StgOpenAsyncDocfileOnIFillLockBytes Lib "ole32" (
	ByVal pflb As *IFillLockBytes,
	ByVal grfMode As DWord,
	ByVal asyncFlags As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT

Declare Function StgGetIFillLockBytesOnILockBytes Lib "ole32" (
	ByVal pilb As *ILockBytes,
	ByRef pflb As *IFillLockBytes) As HRESULT

Declare Function StgGetIFillLockBytesOnFile Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByRef pflb As *IFillLockBytes) As HRESULT
/*
Declare Function StgOpenLayoutDocfile Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByVal grfMode As DWord,
	ByVal reserved As DWord,
	ByRef pstgOpen As *IStorage) As HRESULT
*/
/*
// STG initialization options for StgCreateStorageEx and StgOpenStorageEx
#if _WIN32_WINNT == &h500
#define STGOPTIONS_VERSION 1
#elif _WIN32_WINNT > &h500
#define STGOPTIONS_VERSION 2
#else
#define STGOPTIONS_VERSION 0
#endif
*/
Type STGOPTIONS
	usVersion As Word
	reserved As Word
	ulSectorSize As DWord
'#if STGOPTIONS_VERSION >= 2
'	pwcsTemplateFile As PCWSTR /' version 2 or above
'#endif
End Type

Declare Function StgCreateStorageEx Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByVal grfMode As DWord,
	ByVal stgfmt As DWord,
	ByVal grfAttrs As DWord,
	ByVal pStgOptions As *STGOPTIONS,
	ByVal reserved As VoidPtr,
	ByRef riid As IID,
	ByRef pObjectOpen As Any) As HRESULT

Declare Function StgOpenStorageEx Lib "ole32" (
	ByVal pwcsName As *OLECHAR,
	ByVal grfMode As DWord,
	ByVal stgfmt As DWord,
	ByVal grfAttrs As DWord,
	ByVal pStgOptions As *STGOPTIONS,
	ByVal reserved As VoidPtr,
	ByRef riid As IID,
	ByRef pObjectOpen As Any) As HRESULT


' Moniker APIs

Declare Function BindMoniker Lib "ole32" (pmk As *IMoniker, grfOpt As DWord, ByRef iidResult As IID, ByRef pvResult As Any) As HRESULT
/*
Declare Function CoInstall Lib "ole32" (
	ByVal pbc As *IBindCtx,
	ByVal dwFlags As DWord,
	ByRef pClassSpec As uCLSSPEC,
	ByRef pQuery As QUERYCONTEXT,
	ByVal pszCodeBase As PWSTR) As HRESULT
*/
Declare Function CoGetObject Lib "ole32" (pszName As PCWSTR, pBindOptions As *BIND_OPTS, ByRef riid As IID, ByRef ppv As Any) As HRESULT
Declare Function MkParseDisplayName Lib "ole32" (pbc As *IBindCtx, szUserName As LPCOLESTR, ByRef pchEaten As DWord, ByRef pmk As *IMoniker) As HRESULT
Declare Function MonikerRelativePathTo Lib "ole32" (pmkSrc As *IMoniker, pmkDest As *IMoniker, ByRef pmkRelPath As *IMoniker, dwReserved As BOOL) As HRESULT
Declare Function MonikerCommonPrefixWith Lib "ole32" (pmkThis As *IMoniker, pmkOther As *IMoniker, ByRef ppmkCommon As *IMoniker) As HRESULT
Declare Function CreateBindCtx Lib "ole32" (reserved As DWord, ByRef pbc As *IBindCtx) As HRESULT
Declare Function CreateGenericComposite Lib "ole32" ( pmkFirst As *IMoniker, pmkRest As *IMoniker, ByRef pmkComposite As *IMoniker) As HRESULT
Declare Function GetClassFile Lib "ole32" (szFilename As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
Declare Function CreateClassMoniker Lib "ole32" (ByRef rclsid As CLSID, ByRef pmk As *IMoniker) As HRESULT
Declare Function CreateFileMoniker Lib "ole32" (lpszPathName As LPCOLESTR, ByRef pmk As *IMoniker) As HRESULT
Declare Function CreateItemMoniker Lib "ole32" (lpszDelim As LPCOLESTR, lpszItem As LPCOLESTR, ByRef pmk As *IMoniker) As HRESULT
Declare Function CreateAntiMoniker Lib "ole32" (ByRef pmk As *IMoniker) As HRESULT
Declare Function CreatePointerMoniker Lib "ole32" (punk As *IUnknown, ByRef pmk As *IMoniker) As HRESULT
Declare Function CreateObjrefMoniker Lib "ole32" (punk As *IUnknown, ByRef pmk As *IMoniker) As HRESULT
Declare Function  GetRunningObjectTable Lib "ole32" (reserved As DWord, ByRef prot As *IRunningObjectTable) As HRESULT

Interface IBindStatusCallback ' urlmon.sbp
	Inherits IUnknown
End Interface
'#require <urlmon.sbp>
'#require <propidl.sbp>

' Standard Progress Indicator impolementation

Declare Function CreateStdProgressIndicator Lib "ole32" (
	ByVal hwndParent As HWND,
	ByVal pszTitle As LPCOLESTR,
	ByVal pIbscCaller As *IBindStatusCallback,
	ByRef pIbsc As *IBindStatusCallback) As HRESULT
