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
181332b7
Commit
181332b7
authored
Jun 23, 2006
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 26, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added HTMLLoadOptions implementation (with tests).
parent
6f03b0c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
196 additions
and
5 deletions
+196
-5
loadopts.c
dlls/mshtml/loadopts.c
+77
-5
.gitignore
dlls/mshtml/tests/.gitignore
+1
-0
Makefile.in
dlls/mshtml/tests/Makefile.in
+1
-0
misc.c
dlls/mshtml/tests/misc.c
+117
-0
No files found.
dlls/mshtml/loadopts.c
View file @
181332b7
...
...
@@ -35,10 +35,20 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
typedef
struct
load_opt
{
DWORD
option
;
PVOID
buffer
;
DWORD
size
;
struct
load_opt
*
next
;
}
load_opt
;
typedef
struct
{
const
IHtmlLoadOptionsVtbl
*
lpHtmlLoadOptionsVtbl
;
LONG
ref
;
load_opt
*
opts
;
}
HTMLLoadOptions
;
#define LOADOPTS(x) ((IHtmlLoadOptions*) &(x)->lpHtmlLoadOptionsVtbl)
...
...
@@ -89,8 +99,19 @@ static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
TRACE
(
"(%p) ref=%ld
\n
"
,
This
,
ref
);
if
(
!
ref
)
if
(
!
ref
)
{
load_opt
*
iter
=
This
->
opts
,
*
last
;
while
(
iter
)
{
last
=
iter
;
iter
=
iter
->
next
;
HeapFree
(
GetProcessHeap
(),
0
,
last
->
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
last
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
...
...
@@ -99,16 +120,66 @@ static HRESULT WINAPI HtmlLoadOptions_QueryOption(IHtmlLoadOptions *iface, DWORD
LPVOID
pBuffer
,
ULONG
*
pcbBuf
)
{
HTMLLoadOptions
*
This
=
LOADOPTS_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %p %p)
\n
"
,
This
,
dwOption
,
pBuffer
,
pcbBuf
);
return
E_NOTIMPL
;
load_opt
*
iter
;
TRACE
(
"(%p)->(%ld %p %p)
\n
"
,
This
,
dwOption
,
pBuffer
,
pcbBuf
);
for
(
iter
=
This
->
opts
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
->
option
==
dwOption
)
break
;
}
if
(
!
iter
)
{
*
pcbBuf
=
0
;
return
S_OK
;
}
if
(
*
pcbBuf
<
iter
->
size
)
{
*
pcbBuf
=
iter
->
size
;
return
E_FAIL
;
}
memcpy
(
pBuffer
,
iter
->
buffer
,
iter
->
size
);
*
pcbBuf
=
iter
->
size
;
return
S_OK
;
}
static
HRESULT
WINAPI
HtmlLoadOptions_SetOption
(
IHtmlLoadOptions
*
iface
,
DWORD
dwOption
,
LPVOID
pBuffer
,
ULONG
cbBuf
)
{
HTMLLoadOptions
*
This
=
LOADOPTS_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %p %ld)
\n
"
,
This
,
dwOption
,
pBuffer
,
cbBuf
);
return
E_NOTIMPL
;
load_opt
*
iter
=
NULL
;
TRACE
(
"(%p)->(%ld %p %ld)
\n
"
,
This
,
dwOption
,
pBuffer
,
cbBuf
);
for
(
iter
=
This
->
opts
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
->
option
==
dwOption
)
break
;
}
if
(
!
iter
)
{
iter
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
load_opt
));
iter
->
next
=
This
->
opts
;
This
->
opts
=
iter
;
iter
->
option
=
dwOption
;
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
iter
->
buffer
);
}
if
(
!
cbBuf
)
{
iter
->
buffer
=
NULL
;
iter
->
size
=
0
;
return
S_OK
;
}
iter
->
size
=
cbBuf
;
iter
->
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbBuf
);
memcpy
(
iter
->
buffer
,
pBuffer
,
iter
->
size
);
return
S_OK
;
}
#undef LOADOPTS_THIS
...
...
@@ -132,6 +203,7 @@ HRESULT HTMLLoadOptions_Create(IUnknown *pUnkOuter, REFIID riid, void** ppv)
ret
->
lpHtmlLoadOptionsVtbl
=
&
HtmlLoadOptionsVtbl
;
ret
->
ref
=
1
;
ret
->
opts
=
NULL
;
hres
=
IHtmlLoadOptions_QueryInterface
(
LOADOPTS
(
ret
),
riid
,
ppv
);
IHtmlLoadOptions_Release
(
LOADOPTS
(
ret
));
...
...
dlls/mshtml/tests/.gitignore
View file @
181332b7
Makefile
htmldoc.ok
misc.ok
protocol.ok
testlist.c
dlls/mshtml/tests/Makefile.in
View file @
181332b7
...
...
@@ -8,6 +8,7 @@ EXTRALIBS = -luuid
CTESTS
=
\
htmldoc.c
\
misc.c
\
protocol.c
@MAKE_TEST_RULES@
...
...
dlls/mshtml/tests/misc.c
0 → 100644
View file @
181332b7
/*
* Copyright 2006 Jacek Caban for CodeWeavers
*
* 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
#include <wine/test.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "optary.h"
#include "initguid.h"
static
void
test_HTMLLoadOptions
(
void
)
{
IHtmlLoadOptions
*
loadopts
;
BYTE
buf
[
100
];
DWORD
size
,
i
,
data
=
0xdeadbeef
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_HTMLLoadOptions
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IHtmlLoadOptions
,
(
void
**
)
&
loadopts
);
ok
(
hres
==
S_OK
,
"creating HTMLLoadOptions failed: %08lx
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
;
for
(
i
=
0
;
i
<=
HTMLLOADOPTION_FRAMELOAD
+
3
;
i
++
)
{
size
=
0xdeadbeef
;
memset
(
buf
,
0xdd
,
sizeof
(
buf
));
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
i
,
NULL
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
0
,
"size = %ld
\n
"
,
size
);
ok
(
buf
[
0
]
==
0xdd
,
"buf changed
\n
"
);
}
size
=
0xdeadbeef
;
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
NULL
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
0
,
"size = %ld
\n
"
,
size
);
hres
=
IHtmlLoadOptions_SetOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
&
data
,
sizeof
(
data
));
ok
(
hres
==
S_OK
,
"SetOption failed: %08lx
\n
"
,
hres
);
size
=
sizeof
(
data
);
memset
(
buf
,
0xdd
,
sizeof
(
buf
));
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
buf
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
sizeof
(
data
),
"size = %ld
\n
"
,
size
);
ok
(
*
(
DWORD
*
)
buf
==
data
,
"unexpected buf
\n
"
);
size
=
sizeof
(
data
)
-
1
;
memset
(
buf
,
0xdd
,
sizeof
(
buf
));
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
buf
,
&
size
);
ok
(
hres
==
E_FAIL
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
sizeof
(
data
),
"size = %ld
\n
"
,
size
);
ok
(
buf
[
0
]
==
0xdd
,
"buf changed
\n
"
);
data
=
100
;
hres
=
IHtmlLoadOptions_SetOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
&
data
,
0
);
ok
(
hres
==
S_OK
,
"SetOption failed: %08lx
\n
"
,
hres
);
size
=
0xdeadbeef
;
memset
(
buf
,
0xdd
,
sizeof
(
buf
));
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
buf
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
0
,
"size = %ld
\n
"
,
size
);
ok
(
buf
[
0
]
==
0xdd
,
"buf changed
\n
"
);
hres
=
IHtmlLoadOptions_SetOption
(
loadopts
,
HTMLLOADOPTION_CODEPAGE
,
NULL
,
0
);
ok
(
hres
==
S_OK
,
"SetOption failed: %08lx
\n
"
,
hres
);
hres
=
IHtmlLoadOptions_SetOption
(
loadopts
,
1000
,
&
data
,
sizeof
(
data
));
ok
(
hres
==
S_OK
,
"SetOption failed: %08lx
\n
"
,
hres
);
size
=
sizeof
(
data
);
memset
(
buf
,
0xdd
,
sizeof
(
buf
));
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
1000
,
buf
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
sizeof
(
data
),
"size = %ld
\n
"
,
size
);
ok
(
*
(
DWORD
*
)
buf
==
data
,
"unexpected buf
\n
"
);
hres
=
IHtmlLoadOptions_SetOption
(
loadopts
,
1000
,
buf
,
sizeof
(
buf
));
ok
(
hres
==
S_OK
,
"SetOption failed: %08lx
\n
"
,
hres
);
size
=
0xdeadbeef
;
hres
=
IHtmlLoadOptions_QueryOption
(
loadopts
,
1000
,
buf
,
&
size
);
ok
(
hres
==
S_OK
,
"QueryOption failed: %08lx
\n
"
,
hres
);
ok
(
size
==
sizeof
(
buf
),
"size = %ld
\n
"
,
size
);
IHtmlLoadOptions_Release
(
loadopts
);
}
START_TEST
(
misc
)
{
CoInitialize
(
NULL
);
test_HTMLLoadOptions
();
CoUninitialize
();
}
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