Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
567919d7
Commit
567919d7
authored
Nov 29, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Nov 29, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement some user marshal functions and add tests.
parent
8a8ce9c4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
236 additions
and
42 deletions
+236
-42
Makefile.in
dlls/ole32/Makefile.in
+2
-1
ole32.spec
dlls/ole32/ole32.spec
+44
-40
Makefile.in
dlls/ole32/tests/Makefile.in
+1
-1
marshal.c
dlls/ole32/tests/marshal.c
+189
-0
usrmarshal.c
dlls/ole32/usrmarshal.c
+0
-0
No files found.
dlls/ole32/Makefile.in
View file @
567919d7
...
...
@@ -39,7 +39,8 @@ C_SRCS = \
stg_prop.c
\
stg_stream.c
\
storage32.c
\
stubmanager.c
stubmanager.c
\
usrmarshal.c
C_SRCS16
=
\
memlockbytes16.c
\
...
...
dlls/ole32/ole32.spec
View file @
567919d7
@ stdcall BindMoniker(ptr long ptr ptr)
@ st
ub CLIPFORMAT_UserFree
@ st
ub CLIPFORMAT_UserMarshal
@ st
ub CLIPFORMAT_UserSize
@ st
ub CLIPFORMAT_UserUnmarshal
@ st
dcall CLIPFORMAT_UserFree(ptr ptr)
@ st
dcall CLIPFORMAT_UserMarshal(ptr ptr ptr)
@ st
dcall CLIPFORMAT_UserSize(ptr long ptr)
@ st
dcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr)
@ stdcall CLSIDFromProgID(wstr ptr)
@ stdcall CLSIDFromString(wstr ptr)
@ stdcall CoAddRefServerProcess()
...
...
@@ -107,30 +107,34 @@
@ stdcall GetHGlobalFromStream(ptr ptr)
@ stub GetHookInterface
@ stdcall GetRunningObjectTable(long ptr)
@ st
ub HACCEL_UserFree
@ st
ub HACCEL_UserMarshal
@ st
ub HACCEL_UserSize
@ st
ub HACCEL_UserUnmarshal
@ st
ub HBITMAP_UserFree
@ st
ub HBITMAP_UserMarshal
@ st
ub HBITMAP_UserSize
@ st
ub HBITMAP_UserUnmarshal
@ st
dcall HACCEL_UserFree(ptr ptr)
@ st
dcall HACCEL_UserMarshal(ptr ptr ptr)
@ st
dcall HACCEL_UserSize(ptr long ptr)
@ st
dcall HACCEL_UserUnmarshal(ptr ptr ptr)
@ st
dcall HBITMAP_UserFree(ptr ptr)
@ st
dcall HBITMAP_UserMarshal(ptr ptr ptr)
@ st
dcall HBITMAP_UserSize(ptr long ptr)
@ st
dcall HBITMAP_UserUnmarshal(ptr ptr ptr)
@ stub HBRUSH_UserFree
@ stub HBRUSH_UserMarshal
@ stub HBRUSH_UserSize
@ stub HBRUSH_UserUnmarshal
@ stub HENHMETAFILE_UserFree
@ stub HENHMETAFILE_UserMarshal
@ stub HENHMETAFILE_UserSize
@ stub HENHMETAFILE_UserUnmarshal
@ stub HGLOBAL_UserFree
@ stub HGLOBAL_UserMarshal
@ stub HGLOBAL_UserSize
@ stub HGLOBAL_UserUnmarshal
@ stub HMENU_UserFree
@ stub HMENU_UserMarshal
@ stub HMENU_UserSize
@ stub HMENU_UserUnmarshal
@ stdcall HDC_UserFree(ptr ptr)
@ stdcall HDC_UserMarshal(ptr ptr ptr)
@ stdcall HDC_UserSize(ptr long ptr)
@ stdcall HDC_UserUnmarshal(ptr ptr ptr)
@ stdcall HENHMETAFILE_UserFree(ptr ptr)
@ stdcall HENHMETAFILE_UserMarshal(ptr ptr ptr)
@ stdcall HENHMETAFILE_UserSize(ptr long ptr)
@ stdcall HENHMETAFILE_UserUnmarshal(ptr ptr ptr)
@ stdcall HGLOBAL_UserFree(ptr ptr)
@ stdcall HGLOBAL_UserMarshal(ptr ptr ptr)
@ stdcall HGLOBAL_UserSize(ptr long ptr)
@ stdcall HGLOBAL_UserUnmarshal(ptr ptr ptr)
@ stdcall HMENU_UserFree(ptr ptr)
@ stdcall HMENU_UserMarshal(ptr ptr ptr)
@ stdcall HMENU_UserSize(ptr long ptr)
@ stdcall HMENU_UserUnmarshal(ptr ptr ptr)
@ stub HMETAFILEPICT_UserFree
@ stub HMETAFILEPICT_UserMarshal
@ stub HMETAFILEPICT_UserSize
...
...
@@ -139,14 +143,14 @@
@ stub HMETAFILE_UserMarshal
@ stub HMETAFILE_UserSize
@ stub HMETAFILE_UserUnmarshal
@ st
ub HPALETTE_UserFree
@ st
ub HPALETTE_UserMarshal
@ st
ub HPALETTE_UserSize
@ st
ub HPALETTE_UserUnmarshal
@ st
ub HWND_UserFree
@ st
ub HWND_UserMarshal
@ st
ub HWND_UserSize
@ st
ub HWND_UserUnmarshal
@ st
dcall HPALETTE_UserFree(ptr ptr)
@ st
dcall HPALETTE_UserMarshal(ptr ptr ptr)
@ st
dcall HPALETTE_UserSize(ptr long ptr)
@ st
dcall HPALETTE_UserUnmarshal(ptr ptr ptr)
@ st
dcall HWND_UserFree(ptr ptr)
@ st
dcall HWND_UserMarshal(ptr ptr ptr)
@ st
dcall HWND_UserSize(ptr long ptr)
@ st
dcall HWND_UserUnmarshal(ptr ptr ptr)
@ stdcall IIDFromString(wstr ptr) CLSIDFromString
@ stub I_RemoteMain
@ stdcall IsAccelerator(long long ptr long)
...
...
@@ -227,14 +231,14 @@
@ stdcall RegisterDragDrop(long ptr)
@ stdcall ReleaseStgMedium(ptr)
@ stdcall RevokeDragDrop(long)
@ st
ub SNB_UserFree
@ st
ub SNB_UserMarshal
@ st
ub SNB_UserSize
@ st
ub SNB_UserUnmarshal
@ st
ub STGMEDIUM_UserFree
@ st
ub STGMEDIUM_UserMarshal
@ st
ub STGMEDIUM_UserSize
@ st
ub STGMEDIUM_UserUnmarshal
@ st
dcall SNB_UserFree(ptr ptr)
@ st
dcall SNB_UserMarshal(ptr ptr ptr)
@ st
dcall SNB_UserSize(ptr long ptr)
@ st
dcall SNB_UserUnmarshal(ptr ptr ptr)
@ st
dcall STGMEDIUM_UserFree(ptr ptr)
@ st
dcall STGMEDIUM_UserMarshal(ptr ptr ptr)
@ st
dcall STGMEDIUM_UserSize(ptr long ptr)
@ st
dcall STGMEDIUM_UserUnmarshal(ptr ptr ptr)
@ stdcall SetConvertStg(ptr long)
@ stub SetDocumentBitStg
@ stdcall SetErrorInfo(long ptr)
...
...
dlls/ole32/tests/Makefile.in
View file @
567919d7
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
ole32.dll
IMPORTS
=
oleaut32 ole32 user32 kernel32
IMPORTS
=
oleaut32 ole32 user32
gdi32
kernel32
EXTRALIBS
=
-luuid
CTESTS
=
\
...
...
dlls/ole32/tests/marshal.c
View file @
567919d7
...
...
@@ -1666,6 +1666,190 @@ static void test_ROT(void)
ok_no_locks
();
}
static
const
char
cf_marshaled
[]
=
{
0x9
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x9
,
0x0
,
0x0
,
0x0
,
'M'
,
0x0
,
'y'
,
0x0
,
'F'
,
0x0
,
'o'
,
0x0
,
'r'
,
0x0
,
'm'
,
0x0
,
'a'
,
0x0
,
't'
,
0x0
,
0x0
,
0x0
};
static
void
test_marshal_CLIPFORMAT
(
void
)
{
unsigned
char
*
buffer
;
unsigned
long
size
;
unsigned
long
flags
=
MAKELONG
(
MSHCTX_DIFFERENTMACHINE
,
NDR_LOCAL_DATA_REPRESENTATION
);
wireCLIPFORMAT
wirecf
;
CLIPFORMAT
cf
=
RegisterClipboardFormatA
(
"MyFormat"
);
CLIPFORMAT
cf2
;
size
=
CLIPFORMAT_UserSize
(
&
flags
,
0
,
&
cf
);
ok
(
size
==
sizeof
(
*
wirecf
)
+
sizeof
(
cf_marshaled
),
"Size should be %d, instead of %ld
\n
"
,
sizeof
(
*
wirecf
)
+
sizeof
(
cf_marshaled
),
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
CLIPFORMAT_UserMarshal
(
&
flags
,
buffer
,
&
cf
);
wirecf
=
(
wireCLIPFORMAT
)
buffer
;
ok
(
wirecf
->
fContext
==
WDT_REMOTE_CALL
,
"Context should be WDT_REMOTE_CALL instead of 0x%08lx
\n
"
,
wirecf
->
fContext
);
ok
(
wirecf
->
u
.
dwValue
==
cf
,
"Marshaled value should be 0x%04x instead of 0x%04lx
\n
"
,
cf
,
wirecf
->
u
.
dwValue
);
ok
(
!
memcmp
(
wirecf
+
1
,
cf_marshaled
,
sizeof
(
cf_marshaled
)),
"Marshaled data differs
\n
"
);
CLIPFORMAT_UserUnmarshal
(
&
flags
,
buffer
,
&
cf2
);
ok
(
cf
==
cf2
,
"Didn't unmarshal properly
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
CLIPFORMAT_UserFree
(
&
flags
,
&
cf2
);
}
static
void
test_marshal_HWND
(
void
)
{
unsigned
char
*
buffer
;
unsigned
long
size
;
unsigned
long
flags
=
MAKELONG
(
MSHCTX_LOCAL
,
NDR_LOCAL_DATA_REPRESENTATION
);
HWND
hwnd
=
GetDesktopWindow
();
HWND
hwnd2
;
wireHWND
wirehwnd
;
size
=
HWND_UserSize
(
&
flags
,
0
,
&
hwnd
);
ok
(
size
==
sizeof
(
*
wirehwnd
),
"Size should be %d, instead of %ld
\n
"
,
sizeof
(
*
wirehwnd
),
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
HWND_UserMarshal
(
&
flags
,
buffer
,
&
hwnd
);
wirehwnd
=
(
wireHWND
)
buffer
;
ok
(
wirehwnd
->
fContext
==
WDT_INPROC_CALL
,
"Context should be WDT_INPROC_CALL instead of 0x%08lx
\n
"
,
wirehwnd
->
fContext
);
ok
(
wirehwnd
->
u
.
hInproc
==
(
LONG_PTR
)
hwnd
,
"Marshaled value should be %p instead of %p
\n
"
,
hwnd
,
(
HANDLE
)
wirehwnd
->
u
.
hRemote
);
HWND_UserUnmarshal
(
&
flags
,
buffer
,
&
hwnd2
);
ok
(
hwnd
==
hwnd2
,
"Didn't unmarshal properly
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HWND_UserFree
(
&
flags
,
&
hwnd2
);
}
static
void
test_marshal_HGLOBAL
(
void
)
{
unsigned
char
*
buffer
;
unsigned
long
size
;
unsigned
long
flags
=
MAKELONG
(
MSHCTX_LOCAL
,
NDR_LOCAL_DATA_REPRESENTATION
);
HGLOBAL
hglobal
;
HGLOBAL
hglobal2
;
unsigned
char
*
wirehglobal
;
int
i
;
hglobal
=
NULL
;
flags
=
MAKELONG
(
MSHCTX_LOCAL
,
NDR_LOCAL_DATA_REPRESENTATION
);
size
=
HGLOBAL_UserSize
(
&
flags
,
0
,
&
hglobal
);
/* native is poorly programmed and allocates 4 bytes more than it needs to
* here - Wine doesn't have to emulate that */
ok
((
size
==
8
)
||
(
size
==
12
),
"Size should be 12, instead of %ld
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
HGLOBAL_UserMarshal
(
&
flags
,
buffer
,
&
hglobal
);
wirehglobal
=
buffer
;
ok
(
*
(
ULONG
*
)
wirehglobal
==
WDT_REMOTE_CALL
,
"Context should be WDT_REMOTE_CALL instead of 0x%08lx
\n
"
,
*
(
ULONG
*
)
wirehglobal
);
wirehglobal
+=
sizeof
(
ULONG
);
ok
(
*
(
ULONG
*
)
wirehglobal
==
(
ULONG
)
hglobal
,
"buffer+4 should be HGLOBAL
\n
"
);
HGLOBAL_UserUnmarshal
(
&
flags
,
buffer
,
&
hglobal2
);
ok
(
hglobal2
==
hglobal
,
"Didn't unmarshal properly
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HGLOBAL_UserFree
(
&
flags
,
&
hglobal2
);
hglobal
=
GlobalAlloc
(
0
,
4
);
buffer
=
GlobalLock
(
hglobal
);
for
(
i
=
0
;
i
<
4
;
i
++
)
buffer
[
i
]
=
i
;
GlobalUnlock
(
hglobal
);
flags
=
MAKELONG
(
MSHCTX_LOCAL
,
NDR_LOCAL_DATA_REPRESENTATION
);
size
=
HGLOBAL_UserSize
(
&
flags
,
0
,
&
hglobal
);
/* native is poorly programmed and allocates 4 bytes more than it needs to
* here - Wine doesn't have to emulate that */
ok
((
size
==
24
)
||
(
size
==
28
),
"Size should be 24 or 28, instead of %ld
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
HGLOBAL_UserMarshal
(
&
flags
,
buffer
,
&
hglobal
);
wirehglobal
=
buffer
;
ok
(
*
(
ULONG
*
)
wirehglobal
==
WDT_REMOTE_CALL
,
"Context should be WDT_REMOTE_CALL instead of 0x%08lx
\n
"
,
*
(
ULONG
*
)
wirehglobal
);
wirehglobal
+=
sizeof
(
ULONG
);
ok
(
*
(
ULONG
*
)
wirehglobal
==
(
ULONG
)
hglobal
,
"buffer+0x4 should be HGLOBAL
\n
"
);
wirehglobal
+=
sizeof
(
ULONG
);
ok
(
*
(
ULONG
*
)
wirehglobal
==
4
,
"buffer+0x8 should be size of HGLOBAL
\n
"
);
wirehglobal
+=
sizeof
(
ULONG
);
ok
(
*
(
ULONG
*
)
wirehglobal
==
(
ULONG
)
hglobal
,
"buffer+0xc should be HGLOBAL
\n
"
);
wirehglobal
+=
sizeof
(
ULONG
);
ok
(
*
(
ULONG
*
)
wirehglobal
==
4
,
"buffer+0x10 should be size of HGLOBAL
\n
"
);
wirehglobal
+=
sizeof
(
ULONG
);
for
(
i
=
0
;
i
<
4
;
i
++
)
ok
(
wirehglobal
[
i
]
==
i
,
"buffer+0x%x should be %d
\n
"
,
0x10
+
i
,
i
);
HGLOBAL_UserUnmarshal
(
&
flags
,
buffer
,
&
hglobal2
);
ok
(
hglobal2
!=
NULL
,
"Didn't unmarshal properly
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HGLOBAL_UserFree
(
&
flags
,
&
hglobal2
);
GlobalFree
(
hglobal
);
}
static
HENHMETAFILE
create_emf
(
void
)
{
RECT
rect
=
{
0
,
0
,
100
,
100
};
HDC
hdc
=
CreateEnhMetaFile
(
NULL
,
NULL
,
&
rect
,
"HENHMETAFILE Marshaling Test
\0
Test
\0\0
"
);
ExtTextOut
(
hdc
,
0
,
0
,
ETO_OPAQUE
,
NULL
,
"Test String"
,
strlen
(
"Test String"
),
NULL
);
return
CloseEnhMetaFile
(
hdc
);
}
static
void
test_marshal_HENHMETAFILE
(
void
)
{
unsigned
char
*
buffer
;
unsigned
long
size
;
unsigned
long
flags
=
MAKELONG
(
MSHCTX_DIFFERENTMACHINE
,
NDR_LOCAL_DATA_REPRESENTATION
);
HENHMETAFILE
hemf
;
HENHMETAFILE
hemf2
=
NULL
;
unsigned
char
*
wirehemf
;
hemf
=
create_emf
();
size
=
HENHMETAFILE_UserSize
(
&
flags
,
0
,
&
hemf
);
ok
(
size
>
20
,
"size should be at least 20 bytes, not %ld
\n
"
,
size
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
HENHMETAFILE_UserMarshal
(
&
flags
,
buffer
,
&
hemf
);
wirehemf
=
buffer
;
ok
(
*
(
DWORD
*
)
wirehemf
==
WDT_REMOTE_CALL
,
"wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehemf
==
(
DWORD
)(
DWORD_PTR
)
hemf
,
"wirestgm + 0x4 should be hemf instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehemf
==
(
size
-
0x10
),
"wirestgm + 0x8 should be size - 0x10 instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehemf
==
(
size
-
0x10
),
"wirestgm + 0xc should be size - 0x10 instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehemf
==
EMR_HEADER
,
"wirestgm + 0x10 should be EMR_HEADER instead of %ld
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
/* ... rest of data not tested - refer to tests for GetEnhMetaFileBits
* at this point */
HENHMETAFILE_UserUnmarshal
(
&
flags
,
buffer
,
&
hemf2
);
ok
(
hemf2
!=
NULL
,
"HENHMETAFILE didn't unmarshal
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HENHMETAFILE_UserFree
(
&
flags
,
&
hemf2
);
DeleteEnhMetaFile
(
hemf
);
/* test NULL emf */
hemf
=
NULL
;
size
=
HENHMETAFILE_UserSize
(
&
flags
,
0
,
&
hemf
);
ok
(
size
==
8
,
"size should be 8 bytes, not %ld
\n
"
,
size
);
buffer
=
(
unsigned
char
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
HENHMETAFILE_UserMarshal
(
&
flags
,
buffer
,
&
hemf
);
wirehemf
=
buffer
;
ok
(
*
(
DWORD
*
)
wirehemf
==
WDT_REMOTE_CALL
,
"wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
ok
(
*
(
DWORD
*
)
wirehemf
==
(
DWORD
)(
DWORD_PTR
)
hemf
,
"wirestgm + 0x4 should be hemf instead of 0x%08lx
\n
"
,
*
(
DWORD
*
)
wirehemf
);
wirehemf
+=
sizeof
(
DWORD
);
HENHMETAFILE_UserUnmarshal
(
&
flags
,
buffer
,
&
hemf2
);
ok
(
hemf2
==
NULL
,
"NULL HENHMETAFILE didn't unmarshal
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HENHMETAFILE_UserFree
(
&
flags
,
&
hemf2
);
}
START_TEST
(
marshal
)
{
HMODULE
hOle32
=
GetModuleHandle
(
"ole32"
);
...
...
@@ -1711,6 +1895,11 @@ START_TEST(marshal)
test_ROT
();
/* FIXME: test GIT */
test_marshal_CLIPFORMAT
();
test_marshal_HWND
();
test_marshal_HGLOBAL
();
test_marshal_HENHMETAFILE
();
CoUninitialize
();
return
;
...
...
dlls/ole32/usrmarshal.c
0 → 100644
View file @
567919d7
This diff is collapsed.
Click to expand it.
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