⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storage32.h

📁 winNT技术操作系统,国外开放的原代码和LIUX一样
💻 H
📖 第 1 页 / 共 2 页
字号:
	    ULONG blockIndex,
	    ULONG nextBlock);

HRESULT StorageImpl_LoadFileHeader(
	    StorageImpl* This);

void StorageImpl_SaveFileHeader(
            StorageImpl* This);

BOOL StorageImpl_ReadProperty(
            StorageImpl* This,
	    ULONG          index,
	    StgProperty*    buffer);

BOOL StorageImpl_WriteProperty(
            StorageImpl* This,
	    ULONG          index,
	    StgProperty*   buffer);

BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
                      StorageImpl* This,
                      SmallBlockChainStream** ppsbChain);

ULONG Storage32Impl_GetNextExtendedBlock(StorageImpl* This,
                                         ULONG blockIndex);

void Storage32Impl_AddBlockDepot(StorageImpl* This,
                                 ULONG blockIndex);

ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This);

ULONG Storage32Impl_GetExtDepotBlock(StorageImpl* This,
                                     ULONG depotIndex);

void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
                                    ULONG depotIndex,
                                    ULONG blockIndex);
/****************************************************************************
 * Storage32InternalImpl definitions.
 *
 * Definition of the implementation structure for the IStorage32 interface.
 * This one implements the IStorage32 interface for storage that are
 * inside another storage.
 */
struct StorageInternalImpl
{
  struct StorageBaseImpl base;

  /*
   * There is no specific data for this class.
   */
};

/*
 * Method definitions for the Storage32InternalImpl class.
 */
StorageInternalImpl* StorageInternalImpl_Construct(
	    StorageImpl* ancestorStorage,
            DWORD          openFlags,
	    ULONG          rootTropertyIndex);

void StorageInternalImpl_Destroy(
       	    StorageBaseImpl* This);

HRESULT WINAPI StorageInternalImpl_Commit(
	    IStorage*            iface,
	    DWORD                  grfCommitFlags); /* [in] */

HRESULT WINAPI StorageInternalImpl_Revert(
     	    IStorage*            iface);


/****************************************************************************
 * IEnumSTATSTGImpl definitions.
 *
 * Definition of the implementation structure for the IEnumSTATSTGImpl interface.
 * This class allows iterating through the content of a storage and to find
 * specific items inside it.
 */
struct IEnumSTATSTGImpl
{
  const IEnumSTATSTGVtbl *lpVtbl;    /* Needs to be the first item in the struct
				* since we want to cast this in an IEnumSTATSTG pointer */

  LONG		 ref;		        /* Reference count */
  StorageImpl* parentStorage;         /* Reference to the parent storage */
  ULONG          firstPropertyNode;     /* Index of the root of the storage to enumerate */

  /*
   * The current implementation of the IEnumSTATSTGImpl class uses a stack
   * to walk the property sets to get the content of a storage. This stack
   * is implemented by the following 3 data members
   */
  ULONG          stackSize;
  ULONG          stackMaxSize;
  ULONG*         stackToVisit;

#define ENUMSTATSGT_SIZE_INCREMENT 10
};

IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
            StorageImpl* This,
	    ULONG          firstPropertyNode);

void IEnumSTATSTGImpl_Destroy(
            IEnumSTATSTGImpl* This);

void IEnumSTATSTGImpl_PushSearchNode(
	    IEnumSTATSTGImpl* This,
	    ULONG             nodeToPush);

ULONG IEnumSTATSTGImpl_PopSearchNode(
            IEnumSTATSTGImpl* This,
	    BOOL            remove);

ULONG IEnumSTATSTGImpl_FindProperty(
            IEnumSTATSTGImpl* This,
	    const OLECHAR*  lpszPropName,
	    StgProperty*      buffer);

INT IEnumSTATSTGImpl_FindParentProperty(
  IEnumSTATSTGImpl *This,
  ULONG             childProperty,
  StgProperty      *currentProperty,
  ULONG            *propertyId);


/****************************************************************************
 * StgStreamImpl definitions.
 *
 * This class imlements the IStream32 inteface and represents a stream
 * located inside a storage object.
 */
struct StgStreamImpl
{
  const IStreamVtbl *lpVtbl;  /* Needs to be the first item in the struct
			 * since we want to cast this to an IStream pointer */

  /*
   * Reference count
   */
  LONG		     ref;

  /*
   * Storage that is the parent(owner) of the stream
   */
  StorageBaseImpl* parentStorage;

  /*
   * Access mode of this stream.
   */
  DWORD grfMode;

  /*
   * Index of the property that owns (points to) this stream.
   */
  ULONG              ownerProperty;

  /*
   * Helper variable that contains the size of the stream
   */
  ULARGE_INTEGER     streamSize;

  /*
   * This is the current position of the cursor in the stream
   */
  ULARGE_INTEGER     currentPosition;

  /*
   * The information in the stream is represented by a chain of small blocks
   * or a chain of large blocks. Depending on the case, one of the two
   * following variabled points to that information.
   */
  BlockChainStream*      bigBlockChain;
  SmallBlockChainStream* smallBlockChain;
};

/*
 * Method definition for the StgStreamImpl class.
 */
StgStreamImpl* StgStreamImpl_Construct(
		StorageBaseImpl* parentStorage,
    DWORD            grfMode,
    ULONG            ownerProperty);


/******************************************************************************
 * Endian conversion macros
 */
#ifdef WORDS_BIGENDIAN

#define htole32(x) RtlUlongByteSwap(x)
#define htole16(x) RtlUshortByteSwap(x)
#define le32toh(x) RtlUlongByteSwap(x)
#define le16toh(x) RtlUshortByteSwap(x)

#else

#define htole32(x) (x)
#define htole16(x) (x)
#define le32toh(x) (x)
#define le16toh(x) (x)

#endif

/******************************************************************************
 * The StorageUtl_ functions are miscellaneous utility functions. Most of which
 * are abstractions used to read values from file buffers without having to
 * worry about bit order
 */
void StorageUtl_ReadWord(const BYTE* buffer, ULONG offset, WORD* value);
void StorageUtl_WriteWord(BYTE* buffer, ULONG offset, WORD value);
void StorageUtl_ReadDWord(const BYTE* buffer, ULONG offset, DWORD* value);
void StorageUtl_WriteDWord(BYTE* buffer, ULONG offset, DWORD value);
void StorageUtl_ReadULargeInteger(const BYTE* buffer, ULONG offset,
 ULARGE_INTEGER* value);
void StorageUtl_WriteULargeInteger(BYTE* buffer, ULONG offset,
 const ULARGE_INTEGER *value);
void StorageUtl_ReadGUID(const BYTE* buffer, ULONG offset, GUID* value);
void StorageUtl_WriteGUID(BYTE* buffer, ULONG offset, const GUID* value);
void StorageUtl_CopyPropertyToSTATSTG(STATSTG*     destination,
					     StgProperty* source,
					     int          statFlags);

/****************************************************************************
 * BlockChainStream definitions.
 *
 * The BlockChainStream class is a utility class that is used to create an
 * abstraction of the big block chains in the storage file.
 */
struct BlockChainStream
{
  StorageImpl* parentStorage;
  ULONG*       headOfStreamPlaceHolder;
  ULONG        ownerPropertyIndex;
  ULONG        lastBlockNoInSequence;
  ULONG        lastBlockNoInSequenceIndex;
  ULONG        tailIndex;
  ULONG        numBlocks;
};

/*
 * Methods for the BlockChainStream class.
 */
BlockChainStream* BlockChainStream_Construct(
		StorageImpl* parentStorage,
		ULONG*         headOfStreamPlaceHolder,
		ULONG          propertyIndex);

void BlockChainStream_Destroy(
		BlockChainStream* This);

ULONG BlockChainStream_GetHeadOfChain(
		BlockChainStream* This);

BOOL BlockChainStream_ReadAt(
		BlockChainStream* This,
		ULARGE_INTEGER offset,
		ULONG          size,
		void*          buffer,
		ULONG*         bytesRead);

BOOL BlockChainStream_WriteAt(
		BlockChainStream* This,
		ULARGE_INTEGER offset,
		ULONG          size,
		const void*    buffer,
		ULONG*         bytesWritten);

BOOL BlockChainStream_SetSize(
		BlockChainStream* This,
		ULARGE_INTEGER    newSize);

ULARGE_INTEGER BlockChainStream_GetSize(
    BlockChainStream* This);

ULONG BlockChainStream_GetCount(
    BlockChainStream* This);

/****************************************************************************
 * SmallBlockChainStream definitions.
 *
 * The SmallBlockChainStream class is a utility class that is used to create an
 * abstraction of the small block chains in the storage file.
 */
struct SmallBlockChainStream
{
  StorageImpl* parentStorage;
  ULONG          ownerPropertyIndex;
};

/*
 * Methods of the SmallBlockChainStream class.
 */
SmallBlockChainStream* SmallBlockChainStream_Construct(
	       StorageImpl* parentStorage,
	       ULONG          propertyIndex);

void SmallBlockChainStream_Destroy(
	       SmallBlockChainStream* This);

ULONG SmallBlockChainStream_GetHeadOfChain(
	       SmallBlockChainStream* This);

HRESULT SmallBlockChainStream_GetNextBlockInChain(
	       SmallBlockChainStream* This,
	       ULONG                  blockIndex,
	       ULONG*                 nextBlockIndex);

void SmallBlockChainStream_SetNextBlockInChain(
         SmallBlockChainStream* This,
         ULONG                  blockIndex,
         ULONG                  nextBlock);

void SmallBlockChainStream_FreeBlock(
         SmallBlockChainStream* This,
         ULONG                  blockIndex);

ULONG SmallBlockChainStream_GetNextFreeBlock(
         SmallBlockChainStream* This);

HRESULT SmallBlockChainStream_ReadAt(
	       SmallBlockChainStream* This,
	       ULARGE_INTEGER offset,
	       ULONG          size,
	       void*          buffer,
	       ULONG*         bytesRead);

BOOL SmallBlockChainStream_WriteAt(
	       SmallBlockChainStream* This,
	       ULARGE_INTEGER offset,
	       ULONG          size,
	       const void*    buffer,
	       ULONG*         bytesWritten);

BOOL SmallBlockChainStream_SetSize(
	       SmallBlockChainStream* This,
	       ULARGE_INTEGER          newSize);

ULARGE_INTEGER SmallBlockChainStream_GetSize(
         SmallBlockChainStream* This);

ULONG SmallBlockChainStream_GetCount(
         SmallBlockChainStream* This);


#endif /* __STORAGE32_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -