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
0b149df9
Commit
0b149df9
authored
Apr 12, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Apr 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Create storage files with 4096-byte blocks when asked.
parent
7c8b7559
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
36 deletions
+65
-36
storage32.c
dlls/ole32/storage32.c
+63
-36
storage32.h
dlls/ole32/storage32.h
+2
-0
No files found.
dlls/ole32/storage32.c
View file @
0b149df9
...
...
@@ -2583,6 +2583,7 @@ static HRESULT StorageImpl_Construct(
DWORD
openFlags
,
BOOL
fileBased
,
BOOL
create
,
ULONG
sector_size
,
StorageImpl
**
result
)
{
StorageImpl
*
This
;
...
...
@@ -2634,7 +2635,7 @@ static HRESULT StorageImpl_Construct(
/*
* Initialize the big block cache.
*/
This
->
bigBlockSize
=
DEF_BIG_BLOCK_SIZE
;
This
->
bigBlockSize
=
sector_size
;
This
->
smallBlockSize
=
DEF_SMALL_BLOCK_SIZE
;
This
->
bigBlockFile
=
BIGBLOCKFILE_Construct
(
hFile
,
pLkbyt
,
...
...
@@ -2667,7 +2668,10 @@ static HRESULT StorageImpl_Construct(
This
->
rootStartBlock
=
1
;
This
->
smallBlockLimit
=
LIMIT_TO_USE_SMALL_BLOCK
;
This
->
smallBlockDepotStart
=
BLOCK_END_OF_CHAIN
;
This
->
bigBlockSizeBits
=
DEF_BIG_BLOCK_SIZE_BITS
;
if
(
sector_size
==
4096
)
This
->
bigBlockSizeBits
=
MAX_BIG_BLOCK_SIZE_BITS
;
else
This
->
bigBlockSizeBits
=
MIN_BIG_BLOCK_SIZE_BITS
;
This
->
smallBlockSizeBits
=
DEF_SMALL_BLOCK_SIZE_BITS
;
This
->
extBigBlockDepotStart
=
BLOCK_END_OF_CHAIN
;
This
->
extBigBlockDepotCount
=
0
;
...
...
@@ -4355,13 +4359,14 @@ static HRESULT Storage_Construct(
DWORD
openFlags
,
BOOL
fileBased
,
BOOL
create
,
ULONG
sector_size
,
StorageBaseImpl
**
result
)
{
StorageImpl
*
newStorage
;
StorageBaseImpl
*
newTransactedStorage
;
HRESULT
hr
;
hr
=
StorageImpl_Construct
(
hFile
,
pwcsName
,
pLkbyt
,
openFlags
,
fileBased
,
create
,
&
newStorage
);
hr
=
StorageImpl_Construct
(
hFile
,
pwcsName
,
pLkbyt
,
openFlags
,
fileBased
,
create
,
sector_size
,
&
newStorage
);
if
(
FAILED
(
hr
))
goto
end
;
if
(
openFlags
&
STGM_TRANSACTED
)
...
...
@@ -6311,30 +6316,13 @@ static ULARGE_INTEGER SmallBlockChainStream_GetSize(SmallBlockChainStream* This)
return
chainEntry
.
size
;
}
/******************************************************************************
* StgCreateDocfile [OLE32.@]
* Creates a new compound file storage object
*
* PARAMS
* pwcsName [ I] Unicode string with filename (can be relative or NULL)
* grfMode [ I] Access mode for opening the new storage object (see STGM_ constants)
* reserved [ ?] unused?, usually 0
* ppstgOpen [IO] A pointer to IStorage pointer to the new onject
*
* RETURNS
* S_OK if the file was successfully created
* some STG_E_ value if error
* NOTES
* if pwcsName is NULL, create file with new unique name
* the function can returns
* STG_S_CONVERTED if the specified file was successfully converted to storage format
* (unrealized now)
*/
HRESULT
WINAPI
StgCreateDocfile
(
static
HRESULT
create_storagefile
(
LPCOLESTR
pwcsName
,
DWORD
grfMode
,
DWORD
reserved
,
IStorage
**
ppstgOpen
)
DWORD
grfAttrs
,
STGOPTIONS
*
pStgOptions
,
REFIID
riid
,
void
**
ppstgOpen
)
{
StorageBaseImpl
*
newStorage
=
0
;
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
...
...
@@ -6345,13 +6333,10 @@ HRESULT WINAPI StgCreateDocfile(
DWORD
fileAttributes
;
WCHAR
tempFileName
[
MAX_PATH
];
TRACE
(
"(%s, %x, %d, %p)
\n
"
,
debugstr_w
(
pwcsName
),
grfMode
,
reserved
,
ppstgOpen
);
if
(
ppstgOpen
==
0
)
return
STG_E_INVALIDPOINTER
;
if
(
reserved
!=
0
)
if
(
pStgOptions
->
ulSectorSize
!=
MIN_BIG_BLOCK_SIZE
&&
pStgOptions
->
ulSectorSize
!=
MAX_BIG_BLOCK_SIZE
)
return
STG_E_INVALIDPARAMETER
;
/* if no share mode given then DENY_NONE is the default */
...
...
@@ -6453,6 +6438,7 @@ HRESULT WINAPI StgCreateDocfile(
grfMode
,
TRUE
,
TRUE
,
pStgOptions
->
ulSectorSize
,
&
newStorage
);
if
(
FAILED
(
hr
))
...
...
@@ -6460,10 +6446,9 @@ HRESULT WINAPI StgCreateDocfile(
goto
end
;
}
/*
* Get an "out" pointer for the caller.
*/
*
ppstgOpen
=
(
IStorage
*
)
newStorage
;
hr
=
IStorage_QueryInterface
((
IStorage
*
)
newStorage
,
riid
,
ppstgOpen
);
IStorage_Release
((
IStorage
*
)
newStorage
);
end:
TRACE
(
"<-- %p r = %08x
\n
"
,
*
ppstgOpen
,
hr
);
...
...
@@ -6472,6 +6457,45 @@ end:
}
/******************************************************************************
* StgCreateDocfile [OLE32.@]
* Creates a new compound file storage object
*
* PARAMS
* pwcsName [ I] Unicode string with filename (can be relative or NULL)
* grfMode [ I] Access mode for opening the new storage object (see STGM_ constants)
* reserved [ ?] unused?, usually 0
* ppstgOpen [IO] A pointer to IStorage pointer to the new onject
*
* RETURNS
* S_OK if the file was successfully created
* some STG_E_ value if error
* NOTES
* if pwcsName is NULL, create file with new unique name
* the function can returns
* STG_S_CONVERTED if the specified file was successfully converted to storage format
* (unrealized now)
*/
HRESULT
WINAPI
StgCreateDocfile
(
LPCOLESTR
pwcsName
,
DWORD
grfMode
,
DWORD
reserved
,
IStorage
**
ppstgOpen
)
{
STGOPTIONS
stgoptions
=
{
1
,
0
,
512
};
TRACE
(
"(%s, %x, %d, %p)
\n
"
,
debugstr_w
(
pwcsName
),
grfMode
,
reserved
,
ppstgOpen
);
if
(
ppstgOpen
==
0
)
return
STG_E_INVALIDPOINTER
;
if
(
reserved
!=
0
)
return
STG_E_INVALIDPARAMETER
;
return
create_storagefile
(
pwcsName
,
grfMode
,
0
,
&
stgoptions
,
&
IID_IStorage
,
(
void
**
)
ppstgOpen
);
}
/******************************************************************************
* StgCreateStorageEx [OLE32.@]
*/
HRESULT
WINAPI
StgCreateStorageEx
(
const
WCHAR
*
pwcsName
,
DWORD
grfMode
,
DWORD
stgfmt
,
DWORD
grfAttrs
,
STGOPTIONS
*
pStgOptions
,
void
*
reserved
,
REFIID
riid
,
void
**
ppObjectOpen
)
...
...
@@ -6499,10 +6523,10 @@ HRESULT WINAPI StgCreateStorageEx(const WCHAR* pwcsName, DWORD grfMode, DWORD st
if
(
stgfmt
==
STGFMT_STORAGE
||
stgfmt
==
STGFMT_DOCFILE
)
{
FIXME
(
"Stub: calling StgCreateDocfile, but ignoring pStgOptions and grfAttrs
\n
"
);
return
StgCreateDocfile
(
pwcsName
,
grfMode
,
0
,
(
IStorage
**
)
ppObjectOpen
);
return
create_storagefile
(
pwcsName
,
grfMode
,
grfAttrs
,
pStgOptions
,
riid
,
ppObjectOpen
);
}
ERR
(
"Invalid stgfmt argument
\n
"
);
return
STG_E_INVALIDPARAMETER
;
}
...
...
@@ -6725,6 +6749,7 @@ HRESULT WINAPI StgOpenStorage(
grfMode
,
TRUE
,
FALSE
,
512
,
&
newStorage
);
if
(
FAILED
(
hr
))
...
...
@@ -6772,6 +6797,7 @@ HRESULT WINAPI StgCreateDocfileOnILockBytes(
grfMode
,
FALSE
,
TRUE
,
512
,
&
newStorage
);
if
(
FAILED
(
hr
))
...
...
@@ -6819,6 +6845,7 @@ HRESULT WINAPI StgOpenStorageOnILockBytes(
grfMode
,
FALSE
,
FALSE
,
512
,
&
newStorage
);
if
(
FAILED
(
hr
))
...
...
dlls/ole32/storage32.h
View file @
0b149df9
...
...
@@ -66,6 +66,8 @@ static const ULONG OFFSET_PS_MTIMEHIGH = 0x00000070;
static
const
ULONG
OFFSET_PS_STARTBLOCK
=
0x00000074
;
static
const
ULONG
OFFSET_PS_SIZE
=
0x00000078
;
static
const
WORD
DEF_BIG_BLOCK_SIZE_BITS
=
0x0009
;
static
const
WORD
MIN_BIG_BLOCK_SIZE_BITS
=
0x0009
;
static
const
WORD
MAX_BIG_BLOCK_SIZE_BITS
=
0x000c
;
static
const
WORD
DEF_SMALL_BLOCK_SIZE_BITS
=
0x0006
;
static
const
WORD
DEF_BIG_BLOCK_SIZE
=
0x0200
;
static
const
WORD
DEF_SMALL_BLOCK_SIZE
=
0x0040
;
...
...
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