Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1d4c698e
Commit
1d4c698e
authored
Nov 30, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Dec 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use the storage vtable to write to streams.
parent
71b4ac9c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
30 deletions
+71
-30
stg_stream.c
dlls/ole32/stg_stream.c
+6
-28
storage32.c
dlls/ole32/storage32.c
+57
-2
storage32.h
dlls/ole32/storage32.h
+8
-0
No files found.
dlls/ole32/stg_stream.c
View file @
1d4c698e
...
...
@@ -382,34 +382,12 @@ static HRESULT WINAPI StgStreamImpl_Write(
return
res
;
}
/*
* Depending on the type of chain that was opened when the stream was constructed,
* we delegate the work to the method that readwrites to the block chains.
*/
if
(
This
->
smallBlockChain
!=
0
)
{
res
=
SmallBlockChainStream_WriteAt
(
This
->
smallBlockChain
,
This
->
currentPosition
,
cb
,
pv
,
pcbWritten
);
}
else
if
(
This
->
bigBlockChain
!=
0
)
{
res
=
BlockChainStream_WriteAt
(
This
->
bigBlockChain
,
This
->
currentPosition
,
cb
,
pv
,
pcbWritten
);
}
else
{
/* this should never happen because the IStream_SetSize call above will
* make sure a big or small block chain is created */
assert
(
FALSE
);
res
=
0
;
}
res
=
StorageBaseImpl_StreamWriteAt
(
This
->
parentStorage
,
This
->
dirEntry
,
This
->
currentPosition
,
cb
,
pv
,
pcbWritten
);
/*
* Advance the position pointer for the number of positions written.
...
...
dlls/ole32/storage32.c
View file @
1d4c698e
...
...
@@ -2246,6 +2246,52 @@ static HRESULT StorageImpl_StreamReadAt(StorageBaseImpl *base, DirRef index,
}
}
static
HRESULT
StorageImpl_StreamWriteAt
(
StorageBaseImpl
*
base
,
DirRef
index
,
ULARGE_INTEGER
offset
,
ULONG
size
,
const
void
*
buffer
,
ULONG
*
bytesWritten
)
{
StorageImpl
*
This
=
(
StorageImpl
*
)
base
;
DirEntry
data
;
HRESULT
hr
;
hr
=
StorageImpl_ReadDirEntry
(
This
,
index
,
&
data
);
if
(
FAILED
(
hr
))
return
hr
;
/* FIXME: Enlarge the stream first if necessary. */
if
(
data
.
size
.
QuadPart
==
0
)
{
/* This shouldn't happen for now, because the stream object will set the size. */
assert
(
FALSE
);
}
if
(
data
.
size
.
QuadPart
<
LIMIT_TO_USE_SMALL_BLOCK
)
{
SmallBlockChainStream
*
stream
;
stream
=
SmallBlockChainStream_Construct
(
This
,
NULL
,
index
);
if
(
!
stream
)
return
E_OUTOFMEMORY
;
hr
=
SmallBlockChainStream_WriteAt
(
stream
,
offset
,
size
,
buffer
,
bytesWritten
);
SmallBlockChainStream_Destroy
(
stream
);
return
hr
;
}
else
{
BlockChainStream
*
stream
;
stream
=
BlockChainStream_Construct
(
This
,
NULL
,
index
);
if
(
!
stream
)
return
E_OUTOFMEMORY
;
hr
=
BlockChainStream_WriteAt
(
stream
,
offset
,
size
,
buffer
,
bytesWritten
);
BlockChainStream_Destroy
(
stream
);
return
hr
;
}
}
/*
* Virtual function table for the IStorage32Impl class.
*/
...
...
@@ -2278,7 +2324,8 @@ static const StorageBaseImplVtbl StorageImpl_BaseVtbl =
StorageImpl_BaseWriteDirEntry
,
StorageImpl_BaseReadDirEntry
,
StorageImpl_DestroyDirEntry
,
StorageImpl_StreamReadAt
StorageImpl_StreamReadAt
,
StorageImpl_StreamWriteAt
};
static
HRESULT
StorageImpl_Construct
(
...
...
@@ -3733,6 +3780,13 @@ static HRESULT StorageInternalImpl_StreamReadAt(StorageBaseImpl *base,
index
,
offset
,
size
,
buffer
,
bytesRead
);
}
static
HRESULT
StorageInternalImpl_StreamWriteAt
(
StorageBaseImpl
*
base
,
DirRef
index
,
ULARGE_INTEGER
offset
,
ULONG
size
,
const
void
*
buffer
,
ULONG
*
bytesWritten
)
{
return
StorageBaseImpl_StreamWriteAt
(
&
base
->
ancestorStorage
->
base
,
index
,
offset
,
size
,
buffer
,
bytesWritten
);
}
/******************************************************************************
**
** Storage32InternalImpl_Commit
...
...
@@ -4180,7 +4234,8 @@ static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl =
StorageInternalImpl_WriteDirEntry
,
StorageInternalImpl_ReadDirEntry
,
StorageInternalImpl_DestroyDirEntry
,
StorageInternalImpl_StreamReadAt
StorageInternalImpl_StreamReadAt
,
StorageInternalImpl_StreamWriteAt
};
/******************************************************************************
...
...
dlls/ole32/storage32.h
View file @
1d4c698e
...
...
@@ -253,6 +253,7 @@ struct StorageBaseImplVtbl {
HRESULT
(
*
ReadDirEntry
)(
StorageBaseImpl
*
,
DirRef
,
DirEntry
*
);
HRESULT
(
*
DestroyDirEntry
)(
StorageBaseImpl
*
,
DirRef
);
HRESULT
(
*
StreamReadAt
)(
StorageBaseImpl
*
,
DirRef
,
ULARGE_INTEGER
,
ULONG
,
void
*
,
ULONG
*
);
HRESULT
(
*
StreamWriteAt
)(
StorageBaseImpl
*
,
DirRef
,
ULARGE_INTEGER
,
ULONG
,
const
void
*
,
ULONG
*
);
};
static
inline
void
StorageBaseImpl_Destroy
(
StorageBaseImpl
*
This
)
...
...
@@ -291,6 +292,13 @@ static inline HRESULT StorageBaseImpl_StreamReadAt(StorageBaseImpl *This,
return
This
->
baseVtbl
->
StreamReadAt
(
This
,
index
,
offset
,
size
,
buffer
,
bytesRead
);
}
/* Write size bytes to this directory entry's stream at the given offset. */
static
inline
HRESULT
StorageBaseImpl_StreamWriteAt
(
StorageBaseImpl
*
This
,
DirRef
index
,
ULARGE_INTEGER
offset
,
ULONG
size
,
const
void
*
buffer
,
ULONG
*
bytesWritten
)
{
return
This
->
baseVtbl
->
StreamWriteAt
(
This
,
index
,
offset
,
size
,
buffer
,
bytesWritten
);
}
/****************************************************************************
* StorageBaseImpl stream list handlers
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment