Commit 251c9dfd authored by Thuy Nguyen's avatar Thuy Nguyen Committed by Alexandre Julliard

- Fixed a small block depot bug.

- Implemented converting from small blocks to big blocks. - Validated file attributes and flags. - Fixed a bug for larger files.
parent 591a50ed
......@@ -655,7 +655,7 @@ static void * BIGBLOCKFILE_GetMappedView(
/* actually map the page
*/
if (This->filesize.LowPart < PAGE_SIZE)
if (This->filesize.LowPart <= PAGE_SIZE)
{
newMappedPage->lpBytes = MapViewOfFile(This->hfilemap,
desired_access,
......@@ -664,11 +664,12 @@ static void * BIGBLOCKFILE_GetMappedView(
}
else
{
DWORD numBytesToMap = This->filesize.LowPart - (pagenum*PAGE_SIZE);
newMappedPage->lpBytes = MapViewOfFile(This->hfilemap,
desired_access,
hioffset,
lowoffset,
PAGE_SIZE);
numBytesToMap);
}
return newMappedPage->lpBytes;
......@@ -698,7 +699,7 @@ static void * BIGBLOCKFILE_GetMappedView(
/* actually map the page
*/
if (This->filesize.LowPart < PAGE_SIZE)
if (This->filesize.LowPart <= PAGE_SIZE)
{
newMappedPage->lpBytes = MapViewOfFile(This->hfilemap,
desired_access,
......@@ -708,11 +709,12 @@ static void * BIGBLOCKFILE_GetMappedView(
}
else
{
DWORD numBytesToMap = This->filesize.LowPart - (pagenum*PAGE_SIZE);
newMappedPage->lpBytes = MapViewOfFile(This->hfilemap,
desired_access,
hioffset,
lowoffset,
PAGE_SIZE);
numBytesToMap);
}
return newMappedPage->lpBytes;
......
......@@ -281,7 +281,6 @@ void StgStreamImpl_OpenBlockChain(
This->smallBlockChain = SmallBlockChainStream_Construct(
This->parentStorage->ancestorStorage,
This->ownerProperty);
}
else
{
......@@ -574,19 +573,29 @@ HRESULT WINAPI StgStreamImpl_SetSize(
This->ownerProperty,
&curProperty);
/*
* TODO
* determine if we have to switch from small to big blocks or vice versa
* Determine if we have to switch from small to big blocks or vice versa
*/
if (curProperty.size.LowPart < LIMIT_TO_USE_SMALL_BLOCK)
{
if (libNewSize.LowPart >= LIMIT_TO_USE_SMALL_BLOCK)
{
/*
* Transform the small block chain into a big block chain
*/
This->bigBlockChain = Storage32Impl_SmallBlocksToBigBlocks(
This->parentStorage->ancestorStorage,
&This->smallBlockChain);
}
}
if (This->smallBlockChain!=0)
{
Success = SmallBlockChainStream_SetSize(This->smallBlockChain, libNewSize);
curProperty.blockType = SMALL_BLOCK_TYPE;
}
else
{
Success = BlockChainStream_SetSize(This->bigBlockChain, libNewSize);
curProperty.blockType = BIG_BLOCK_TYPE;
}
/*
......
......@@ -69,12 +69,6 @@ static const ULONG PROPERTY_NULL = 0xFFFFFFFF;
#define PROPTYPE_ROOT 0x05
/*
* Block type constants
*/
#define SMALL_BLOCK_TYPE 0x00
#define BIG_BLOCK_TYPE 0x01
/*
* This define allows me to assign a function to a vtable without having the
* nasty warning about incompatible types.
*
......@@ -121,7 +115,6 @@ struct StgProperty
WCHAR name[PROPERTY_NAME_MAX_LEN];
WORD sizeOfNameString;
BYTE propertyType;
BYTE blockType;
ULONG previousProperty;
ULONG nextProperty;
ULONG dirProperty;
......@@ -433,6 +426,9 @@ BOOL32 Storage32Impl_WriteProperty(
ULONG index,
StgProperty* buffer);
BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
Storage32Impl* This,
SmallBlockChainStream** ppsbChain);
/****************************************************************************
* Storage32InternalImpl definitions.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment