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
0cc2c531
Commit
0cc2c531
authored
Oct 27, 2008
by
Huw Davies
Committed by
Alexandre Julliard
Oct 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Create the '\1Ole' stream.
parent
61900098
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
0 deletions
+164
-0
defaulthandler.c
dlls/ole32/defaulthandler.c
+53
-0
Makefile.in
dlls/ole32/tests/Makefile.in
+1
-0
defaulthandler.c
dlls/ole32/tests/defaulthandler.c
+110
-0
No files found.
dlls/ole32/defaulthandler.c
View file @
0cc2c531
...
...
@@ -1546,6 +1546,58 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty(
return
hr
;
}
/***********************************************************************
* init_ole_stream
*
* Creates the '\1Ole' stream.
* The format of this stream is as follows:
*
* DWORD Version == 0x02000001
* DWORD Flags - low bit set indicates the object is a link otherwise it's embedded.
* DWORD LinkupdateOption - [MS-OLEDS describes this as an implementation specific hint
* supplied by the app that creates the data structure. May be
* ignored on processing].
*
* DWORD Reserved == 0
* DWORD MonikerStreamSize - size of the rest of the data (ie CLSID + moniker stream data).
* CLSID clsid - class id of object capable of processing the moniker
* BYTE data[] - moniker data for a link
*/
static
const
WCHAR
OleStream
[]
=
{
1
,
'O'
,
'l'
,
'e'
,
0
};
typedef
struct
{
DWORD
version
;
DWORD
flags
;
DWORD
link_update_opt
;
DWORD
res
;
DWORD
moniker_size
;
}
ole_stream_header_t
;
static
const
DWORD
ole_stream_version
=
0x02000001
;
static
void
init_ole_stream
(
IStorage
*
storage
)
{
HRESULT
hr
;
IStream
*
stream
;
hr
=
IStorage_CreateStream
(
storage
,
OleStream
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stream
);
if
(
SUCCEEDED
(
hr
))
{
DWORD
written
;
ole_stream_header_t
header
;
header
.
version
=
ole_stream_version
;
header
.
flags
=
0
;
header
.
link_update_opt
=
0
;
header
.
res
=
0
;
header
.
moniker_size
=
0
;
IStream_Write
(
stream
,
&
header
,
sizeof
(
header
),
&
written
);
IStream_Release
(
stream
);
}
return
;
}
/************************************************************************
* DefaultHandler_IPersistStorage_InitNew
*
...
...
@@ -1558,6 +1610,7 @@ static HRESULT WINAPI DefaultHandler_IPersistStorage_InitNew(
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
iface
,
pStg
);
init_ole_stream
(
pStg
);
hr
=
IPersistStorage_InitNew
(
This
->
dataCache_PersistStg
,
pStg
);
...
...
dlls/ole32/tests/Makefile.in
View file @
0cc2c531
...
...
@@ -8,6 +8,7 @@ IMPORTS = oleaut32 ole32 user32 gdi32 advapi32 kernel32
CTESTS
=
\
clipboard.c
\
compobj.c
\
defaulthandler.c
\
dragdrop.c
\
errorinfo.c
\
hglobalstream.c
\
...
...
dlls/ole32/tests/defaulthandler.c
0 → 100644
View file @
0cc2c531
/*
* Default Handler Tests
*
* Copyright 2008 Huw Davies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#define CONST_VTABLE
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wine/test.h"
static
HRESULT
create_storage
(
IStorage
**
stg
)
{
HRESULT
hr
;
ILockBytes
*
lock_bytes
;
hr
=
CreateILockBytesOnHGlobal
(
NULL
,
TRUE
,
&
lock_bytes
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
StgCreateDocfileOnILockBytes
(
lock_bytes
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
stg
);
ILockBytes_Release
(
lock_bytes
);
}
return
hr
;
}
typedef
struct
{
DWORD
version
;
DWORD
flags
;
DWORD
link_update_opt
;
DWORD
res
;
DWORD
moniker_size
;
}
ole_stream_header_t
;
static
void
test_olestream
(
void
)
{
HRESULT
hr
;
const
CLSID
non_existent_class
=
{
0xa5f1772f
,
0x3772
,
0x490f
,
{
0x9e
,
0xc6
,
0x77
,
0x13
,
0xe8
,
0xb3
,
0x4b
,
0x5d
}};
IOleObject
*
ole_obj
;
IPersistStorage
*
persist
;
IStorage
*
stg
;
IStream
*
stm
;
static
const
WCHAR
olestream
[]
=
{
1
,
'O'
,
'l'
,
'e'
,
0
};
ULONG
read
;
ole_stream_header_t
header
;
hr
=
create_storage
(
&
stg
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IStorage_OpenStream
(
stg
,
olestream
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READ
,
0
,
&
stm
);
ok
(
hr
==
STG_E_FILENOTFOUND
,
"got %08x
\n
"
,
hr
);
hr
=
OleCreateDefaultHandler
(
&
non_existent_class
,
0
,
&
IID_IOleObject
,
(
void
**
)
&
ole_obj
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IOleObject_QueryInterface
(
ole_obj
,
&
IID_IPersistStorage
,
(
void
**
)
&
persist
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IPersistStorage_InitNew
(
persist
,
stg
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IStorage_OpenStream
(
stg
,
olestream
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READ
,
0
,
&
stm
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IStream_Read
(
stm
,
&
header
,
sizeof
(
header
),
&
read
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
read
==
sizeof
(
header
),
"read %d
\n
"
,
read
);
ok
(
header
.
version
==
0x02000001
,
"got version %08x
\n
"
,
header
.
version
);
ok
(
header
.
flags
==
0x0
,
"got flags %08x
\n
"
,
header
.
flags
);
ok
(
header
.
link_update_opt
==
0x0
,
"got link update option %08x
\n
"
,
header
.
link_update_opt
);
ok
(
header
.
res
==
0x0
,
"got reserved %08x
\n
"
,
header
.
res
);
ok
(
header
.
moniker_size
==
0x0
,
"got moniker size %08x
\n
"
,
header
.
moniker_size
);
IStream_Release
(
stm
);
IPersistStorage_Release
(
persist
);
IOleObject_Release
(
ole_obj
);
IStorage_Release
(
stg
);
}
START_TEST
(
defaulthandler
)
{
OleInitialize
(
NULL
);
test_olestream
();
OleUninitialize
();
}
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