Commit 5b5cfda7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit 14.1.0 upon wine-1.7.25

parent 8108a14b
......@@ -364,6 +364,12 @@ static HRESULT WINAPI ddrawex4_CreateSurface(IDirectDraw4 *iface, DDSURFACEDESC2
}
hr = IDirectDraw4_CreateSurface(ddrawex->parent, desc, &inner_surface, outer_unknown);
if (FAILED(hr))
{
*surface = NULL;
return hr;
}
*surface = dds_get_outer(inner_surface);
/* The wrapper created by dds_get_outer holds a reference to its inner surface. */
IDirectDrawSurface4_Release(inner_surface);
......
......@@ -2029,6 +2029,14 @@ static void AddFaceToList(FT_Face ft_face, const char *file, void *font_data_ptr
face = create_face( ft_face, face_index, file, font_data_ptr, font_data_size, flags );
family = get_family( ft_face, flags & ADDFONT_VERTICAL_FONT );
if (strlenW(family->FamilyName) >= LF_FACESIZE)
{
WARN("Ignoring %s because name is too long\n", debugstr_w(family->FamilyName));
release_face( face );
release_family( family );
return;
}
if (insert_face_in_family_list( face, family ))
{
if (flags & ADDFONT_ADD_TO_CACHE)
......
......@@ -205,6 +205,11 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
scope_chain_t *scope;
HRESULT hres;
if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) {
WARN("Script engine state does not allow running code.\n");
return E_UNEXPECTED;
}
if(!function->func_code) {
FIXME("no source\n");
return E_FAIL;
......
......@@ -3607,13 +3607,21 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD
{
NTSTATUS status = STATUS_SUCCESS;
if (system_mask) *system_mask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
if (process_mask)
{
if ((status = NtQueryInformationProcess( hProcess, ProcessAffinityMask,
process_mask, sizeof(*process_mask), NULL )))
SetLastError( RtlNtStatusToDosError(status) );
}
if (system_mask && status == STATUS_SUCCESS)
{
SYSTEM_BASIC_INFORMATION info;
if ((status = NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )))
SetLastError( RtlNtStatusToDosError(status) );
else
*system_mask = info.ActiveProcessorsAffinityMask;
}
return !status;
}
......
......@@ -3047,10 +3047,17 @@ static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePage(
{
MLang_impl *This = impl_from_IMultiLanguage3( iface );
FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This, dwFlags, debugstr_w(lpWideCharStr),
cchWideChar, puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
return E_NOTIMPL;
FIXME("(%p)->(%08x %s %p %u %p %p(%u) %s)\n", This, dwFlags, debugstr_w(lpWideCharStr),
puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, pnDetectedCodePages ? *pnDetectedCodePages : 0,
debugstr_w(lpSpecialChar));
if (!puiDetectedCodePages || !pnDetectedCodePages || !*pnDetectedCodePages)
return E_INVALIDARG;
puiDetectedCodePages[0] = CP_UTF8;
*pnDetectedCodePages = 1;
return S_OK;
}
static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePageInIStream(
......@@ -3065,10 +3072,17 @@ static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePageInIStream(
{
MLang_impl *This = impl_from_IMultiLanguage3( iface );
FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This, dwFlags, pStrIn,
FIXME("(%p)->(%08x %p %p %u %p %p(%u) %s)\n", This, dwFlags, pStrIn,
puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
return E_NOTIMPL;
pnDetectedCodePages, pnDetectedCodePages ? *pnDetectedCodePages : 0,
debugstr_w(lpSpecialChar));
if (!puiDetectedCodePages || !pnDetectedCodePages || !*pnDetectedCodePages)
return E_INVALIDARG;
puiDetectedCodePages[0] = CP_UTF8;
*pnDetectedCodePages = 1;
return S_OK;
}
static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl =
......
......@@ -1973,10 +1973,214 @@ todo_wine
IMLangConvertCharset_Release(convert);
}
static const char stream_data[] = "VCARD2.1test;test";
static ULONG stream_pos;
static HRESULT WINAPI stream_QueryInterface(IStream *iface, REFIID riid, void **obj)
{
ok(FALSE, "unexpected call\n");
return E_NOINTERFACE;
}
static ULONG WINAPI stream_AddRef(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return 2;
}
static ULONG WINAPI stream_Release(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return 1;
}
static HRESULT WINAPI stream_Read(IStream *iface, void *buf, ULONG len, ULONG *read)
{
ULONG size;
if (stream_pos == sizeof(stream_data) - 1)
{
*read = 0;
return S_FALSE;
}
size = min(sizeof(stream_data) - 1 - stream_pos, len);
memcpy(buf, stream_data + stream_pos, size);
stream_pos += size;
*read = size;
return S_OK;
}
static HRESULT WINAPI stream_Write(IStream *iface, const void *buf, ULONG len, ULONG *written)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin,
ULARGE_INTEGER *newpos)
{
if (origin == STREAM_SEEK_SET)
stream_pos = move.QuadPart;
else if (origin == STREAM_SEEK_CUR)
stream_pos += move.QuadPart;
else if (origin == STREAM_SEEK_END)
stream_pos = sizeof(stream_data) - 1 - move.QuadPart;
if (newpos) newpos->QuadPart = stream_pos;
return S_OK;
}
static HRESULT WINAPI stream_SetSize(IStream *iface, ULARGE_INTEGER newsize)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_CopyTo(IStream *iface, IStream *stream, ULARGE_INTEGER len,
ULARGE_INTEGER *read, ULARGE_INTEGER *written)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Commit(IStream *iface, DWORD flags)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Revert(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_LockRegion(IStream *iface, ULARGE_INTEGER offset,
ULARGE_INTEGER len, DWORD locktype)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_UnlockRegion(IStream *iface, ULARGE_INTEGER offset,
ULARGE_INTEGER len, DWORD locktype)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Stat(IStream *iface, STATSTG *stg, DWORD flag)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Clone(IStream *iface, IStream **stream)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static const IStreamVtbl stream_vtbl =
{
stream_QueryInterface,
stream_AddRef,
stream_Release,
stream_Read,
stream_Write,
stream_Seek,
stream_SetSize,
stream_CopyTo,
stream_Commit,
stream_Revert,
stream_LockRegion,
stream_UnlockRegion,
stream_Stat,
stream_Clone
};
static IStream test_stream = { &stream_vtbl };
static void test_DetectOutboundCodePageInIStream(IMultiLanguage3 *ml)
{
HRESULT hr;
UINT nb_detected, detected[4];
UINT preferred[] = {1250,1251,1252,65001};
UINT preferred2[] = {1250,1251,1252};
nb_detected = 0;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
nb_detected = 1;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), NULL, &nb_detected, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
nb_detected = 1;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
ok(nb_detected == 1, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
nb_detected = 2;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 2, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
nb_detected = 3;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
nb_detected = 4;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
ok(detected[3] == 0, "got %u\n", detected[3]);
nb_detected = 3;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred2,
sizeof(preferred2)/sizeof(preferred2[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
}
START_TEST(mlang)
{
IMultiLanguage *iML = NULL;
IMultiLanguage2 *iML2 = NULL;
IMultiLanguage3 *iML3 = NULL;
IMLangFontLink *iMLFL = NULL;
IMLangFontLink2 *iMLFL2 = NULL;
HRESULT ret;
......@@ -2058,5 +2262,14 @@ START_TEST(mlang)
test_CodePageToScriptID(iMLFL2);
IMLangFontLink2_Release(iMLFL2);
trace("IMultiLanguage3\n");
ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
&IID_IMultiLanguage3, (void **)&iML3);
if (ret == S_OK)
{
test_DetectOutboundCodePageInIStream(iML3);
IMultiLanguage3_Release(iML3);
}
CoUninitialize();
}
......@@ -1020,7 +1020,7 @@ static void test_clock(int share)
ok(hr == S_OK, "GetPosition failed: %08x\n", hr);
ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last);
last = pos;
if(/*share &&*/ winetest_debug>1) todo_wine
if(/*share &&*/ winetest_debug>1)
ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept);
hr = IAudioClient_Start(ac); /* #2 */
......@@ -1054,7 +1054,7 @@ static void test_clock(int share)
ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum);
/* Prove that Stop must not drop frames (in shared mode). */
ok(pad ? pos > last : pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last);
if (share && pad > 0 && winetest_debug>1) todo_wine
if (share && pad > 0 && winetest_debug>1)
ok(pos*1000/freq <= slept*1.1, "Position %u too far after playing %ums\n", (UINT)pos, slept);
/* in exclusive mode, testbot's w7 machines yield pos > sum-pad */
if(/*share &&*/ winetest_debug>1)
......@@ -1133,7 +1133,7 @@ static void test_clock(int share)
ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last);
ok(pcpos > pcpos0, "pcpos should increase\n");
ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum);
if (pad > 0 && winetest_debug>1) todo_wine
if (pad > 0 && winetest_debug>1)
ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept);
if(winetest_debug>1)
ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq,
......@@ -1223,7 +1223,7 @@ static void test_clock(int share)
ok(pos*1000/freq <= slept*1.1, "Position %u too far after %ums\n", (UINT)pos, slept);
if (pad) /* not in case of underrun */
ok((pos-last)*1000/freq >= 90 && 110 >= (pos-last)*1000/freq,
"Position delta %ld not regular\n", (long)(pos-last));
"Position delta %ld not regular: %ld ms\n", (long)(pos-last), (long)((pos-last)*1000/freq));
}
last = pos;
......@@ -1237,7 +1237,7 @@ static void test_clock(int share)
/* ok(hr == AUDCLNT_E_BUFFER_TOO_LARGE || (hr == S_OK && i==0) without todo_wine */
ok(hr == S_OK || hr == AUDCLNT_E_BUFFER_TOO_LARGE,
"GetBuffer large (%u) failed: %08x\n", avail, hr);
if(hr == S_OK && i) todo_wine ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i);
if(hr == S_OK && i) ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i);
/* Only the first iteration should allow that large a buffer
* as prefill was drained during the first 350+100ms sleep.
* Afterwards, only 100ms of data should find room per iteration. */
......
......@@ -138,11 +138,25 @@ static HRESULT WINAPI HTMLDOMAttribute_get_nodeName(IHTMLDOMAttribute *iface, BS
return IDispatchEx_GetMemberName(&This->elem->node.dispex.IDispatchEx_iface, This->dispid, p);
}
static HRESULT WINAPI HTMLDOMAttribute_put_nodeName(IHTMLDOMAttribute *iface, VARIANT v)
static HRESULT WINAPI HTMLDOMAttribute_put_nodeValue(IHTMLDOMAttribute *iface, VARIANT v)
{
HTMLDOMAttribute *This = impl_from_IHTMLDOMAttribute(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
DISPID dispidNamed = DISPID_PROPERTYPUT;
DISPPARAMS dp = {&v, &dispidNamed, 1, 1};
EXCEPINFO ei;
VARIANT ret;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
if(!This->elem) {
FIXME("NULL This->elem\n");
return E_UNEXPECTED;
}
memset(&ei, 0, sizeof(ei));
return IDispatchEx_InvokeEx(&This->elem->node.dispex.IDispatchEx_iface, This->dispid, LOCALE_SYSTEM_DEFAULT,
DISPATCH_PROPERTYPUT, &dp, &ret, &ei, NULL);
}
static HRESULT WINAPI HTMLDOMAttribute_get_nodeValue(IHTMLDOMAttribute *iface, VARIANT *p)
......@@ -216,7 +230,7 @@ static const IHTMLDOMAttributeVtbl HTMLDOMAttributeVtbl = {
HTMLDOMAttribute_GetIDsOfNames,
HTMLDOMAttribute_Invoke,
HTMLDOMAttribute_get_nodeName,
HTMLDOMAttribute_put_nodeName,
HTMLDOMAttribute_put_nodeValue,
HTMLDOMAttribute_get_nodeValue,
HTMLDOMAttribute_get_specified
};
......
......@@ -4236,10 +4236,19 @@ static void _get_attr_node_value(unsigned line, IHTMLDOMAttribute *attr, VARIANT
HRESULT hres;
hres = IHTMLDOMAttribute_get_nodeValue(attr, v);
ok_(__FILE__,line) (hres == S_OK, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres);
ok_(__FILE__,line) (hres == S_OK, "get_nodeValue failed: %08x\n", hres);
ok_(__FILE__,line) (V_VT(v) == vt, "vt=%d, expected %d\n", V_VT(v), vt);
}
#define put_attr_node_value(a,b) _put_attr_node_value(__LINE__,a,b)
static void _put_attr_node_value(unsigned line, IHTMLDOMAttribute *attr, VARIANT v)
{
HRESULT hres;
hres = IHTMLDOMAttribute_put_nodeValue(attr, v);
ok_(__FILE__,line) (hres == S_OK, "put_nodeValue failed: %08x\n", hres);
}
#define get_window_doc(e) _get_window_doc(__LINE__,e)
static IHTMLDocument2 *_get_window_doc(unsigned line, IHTMLWindow2 *window)
{
......@@ -7511,12 +7520,31 @@ static void test_attr(IHTMLElement *elem)
ok(!strcmp_wa(V_BSTR(&v), "divid"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr("divid2");
put_attr_node_value(attr, v);
get_attr_node_value(attr, &v, VT_BSTR);
ok(!strcmp_wa(V_BSTR(&v), "divid2"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
IHTMLDOMAttribute_Release(attr);
attr = get_elem_attr_node((IUnknown*)elem, "emptyattr", TRUE);
get_attr_node_value(attr, &v, VT_BSTR);
ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr("newvalue");
put_attr_node_value(attr, v);
VariantClear(&v);
attr = get_elem_attr_node((IUnknown*)elem, "emptyattr", TRUE);
get_attr_node_value(attr, &v, VT_BSTR);
ok(!strcmp_wa(V_BSTR(&v), "newvalue"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
test_attr_specified(attr, VARIANT_TRUE);
IHTMLDOMAttribute_Release(attr);
......@@ -7527,6 +7555,14 @@ static void test_attr(IHTMLElement *elem)
get_attr_node_value(attr, &v, VT_I4);
ok(V_I4(&v) == 100, "V_I4(v) = %d\n", V_I4(&v));
test_attr_specified(attr, VARIANT_TRUE);
V_VT(&v) = VT_I4;
V_I4(&v) = 150;
put_attr_node_value(attr, v);
get_attr_node_value(attr, &v, VT_I4);
ok(V_I4(&v) == 150, "V_I4(v) = %d\n", V_I4(&v));
IHTMLDOMAttribute_Release(attr);
attr = get_elem_attr_node((IUnknown*)elem, "tabIndex", TRUE);
......
......@@ -439,7 +439,7 @@ int xmlnode_get_inst_cnt(xmlnode *node)
/* Duplicates logic used by xmlAddChild() to determine if node will be merged with
existing text node. */
static int xmlnode_will_merge(const xmlnode *parent_node, const xmlnode *child_node)
static int xmlAddChild_will_merge(const xmlnode *parent_node, const xmlnode *child_node)
{
xmlNodePtr cur = child_node->node;
xmlNodePtr parent = parent_node->node;
......@@ -461,6 +461,25 @@ static int xmlnode_will_merge(const xmlnode *parent_node, const xmlnode *child_n
return 0;
}
/* Duplicates logic used by xmlAddPrevSibling() to determine if node will be merged with
existing text node. */
static int xmlAddPrevSibling_will_merge(const xmlnode *before_node, const xmlnode *child_node)
{
xmlNodePtr elem = child_node->node;
xmlNodePtr cur = before_node->node;
if (elem->type == XML_TEXT_NODE) {
if (cur->type == XML_TEXT_NODE)
return 1;
if (cur->prev && cur->prev->type == XML_TEXT_NODE &&
cur->name == cur->prev->name)
return 1;
}
return 0;
}
/* Crossover HACK for bug 10953 */
static int is_dotnet35sp1(void)
{
......@@ -546,7 +565,35 @@ HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT
refcount = xmlnode_get_inst_cnt(node_obj);
if (refcount) xmldoc_add_refs(before_node_obj->node->doc, refcount);
xmlAddPrevSibling(before_node_obj->node, node_obj->node);
if (!is_dotnet35sp1())
xmlAddPrevSibling(before_node_obj->node, node_obj->node);
else
{
xmlNodePtr clone = NULL;
/* currently only makes sense for a one instance per xmlNode case */
if (xmlAddPrevSibling_will_merge(before_node_obj, node_obj) && refcount == 1)
{
clone = xmlCopyNode(node_obj->node, 2);
*(LONG*)&clone->_private = refcount;
}
if (xmlAddPrevSibling(before_node_obj->node, node_obj->node) == node_obj->node)
{
xmlFreeNode(clone);
}
else
{
/* so libxml2 freed our node at this point, add a clone of it as an orphan */
if (clone)
{
xmlSetTreeDoc(clone, This->node->doc);
node_obj->node = clone;
xmldoc_add_orphan(node_obj->node->doc, node_obj->node);
}
}
}
if (refcount) xmldoc_release_refs(doc, refcount);
node_obj->parent = This->parent;
}
......@@ -574,7 +621,7 @@ HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT
xmlNodePtr clone = NULL;
/* currently only makes sense for a one instance per xmlNode case */
if (xmlnode_will_merge(This, node_obj) && refcount == 1)
if (xmlAddChild_will_merge(This, node_obj) && refcount == 1)
{
clone = xmlCopyNode(node_obj->node, 2);
*(LONG*)&clone->_private = refcount;
......
......@@ -46,6 +46,7 @@ struct drive_info
};
extern NTSTATUS close_handle( HANDLE ) DECLSPEC_HIDDEN;
extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
/* exceptions */
extern void wait_suspend( CONTEXT *context ) DECLSPEC_HIDDEN;
......
......@@ -111,6 +111,13 @@ static UINT process_error_mode;
ret = STATUS_INVALID_INFO_CLASS; \
break
ULONG_PTR get_system_affinity_mask(void)
{
ULONG num_cpus = NtCurrentTeb()->Peb->NumberOfProcessors;
if (num_cpus >= sizeof(ULONG_PTR) * 8) return ~(ULONG_PTR)0;
return ((ULONG_PTR)1 << num_cpus) - 1;
}
/******************************************************************************
* NtQueryInformationProcess [NTDLL.@]
* ZwQueryInformationProcess [NTDLL.@]
......@@ -158,7 +165,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
case ProcessBasicInformation:
{
PROCESS_BASIC_INFORMATION pbi;
const ULONG_PTR affinity_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
const ULONG_PTR affinity_mask = get_system_affinity_mask();
if (ProcessInformationLength >= sizeof(PROCESS_BASIC_INFORMATION))
{
......@@ -408,7 +415,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
len = sizeof(ULONG_PTR);
if (ProcessInformationLength == len)
{
const ULONG_PTR system_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
const ULONG_PTR system_mask = get_system_affinity_mask();
SERVER_START_REQ(get_process_info)
{
......@@ -504,8 +511,11 @@ NTSTATUS WINAPI NtSetInformationProcess(
process_error_mode = *(UINT *)ProcessInformation;
break;
case ProcessAffinityMask:
{
const ULONG_PTR system_mask = get_system_affinity_mask();
if (ProcessInformationLength != sizeof(DWORD_PTR)) return STATUS_INVALID_PARAMETER;
if (*(PDWORD_PTR)ProcessInformation & ~(((DWORD_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1))
if (*(PDWORD_PTR)ProcessInformation & ~system_mask)
return STATUS_INVALID_PARAMETER;
if (!*(PDWORD_PTR)ProcessInformation)
return STATUS_INVALID_PARAMETER;
......@@ -518,6 +528,7 @@ NTSTATUS WINAPI NtSetInformationProcess(
}
SERVER_END_REQ;
break;
}
case ProcessPriorityClass:
if (ProcessInformationLength != sizeof(PROCESS_PRIORITY_CLASS))
return STATUS_INVALID_PARAMETER;
......
......@@ -902,7 +902,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadBasicInformation:
{
THREAD_BASIC_INFORMATION info;
const ULONG_PTR affinity_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
const ULONG_PTR affinity_mask = get_system_affinity_mask();
SERVER_START_REQ( get_thread_info )
{
......@@ -929,7 +929,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
return status;
case ThreadAffinityMask:
{
const ULONG_PTR affinity_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
const ULONG_PTR affinity_mask = get_system_affinity_mask();
ULONG_PTR affinity = 0;
SERVER_START_REQ( get_thread_info )
......@@ -1172,7 +1172,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
return status;
case ThreadAffinityMask:
{
const ULONG_PTR affinity_mask = ((ULONG_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
const ULONG_PTR affinity_mask = get_system_affinity_mask();
ULONG_PTR req_aff;
if (length != sizeof(ULONG_PTR)) return STATUS_INVALID_PARAMETER;
......
......@@ -1402,7 +1402,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
info->AllocationGranularity = get_mask(0) + 1;
info->LowestUserAddress = (void *)0x10000;
info->HighestUserAddress = (char *)user_space_limit - 1;
info->ActiveProcessorsAffinityMask = (1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1;
info->ActiveProcessorsAffinityMask = get_system_affinity_mask();
info->NumberOfProcessors = NtCurrentTeb()->Peb->NumberOfProcessors;
}
......
......@@ -2524,7 +2524,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
args[0] = 0;
if ( This->sArgs )
lstrcatW( args, This->sArgs );
if ( iciex->lpParametersW )
if ( iciex->lpParametersW && iciex->lpParametersW[0] )
{
static const WCHAR space[] = { ' ', 0 };
lstrcatW( args, space );
......
......@@ -169,7 +169,7 @@ typedef struct {
OUTLINETEXTMETRICW *otm;
SCRIPT_FONTPROPERTIES sfp;
BOOL sfnt;
CacheGlyphPage *page[0x10];
CacheGlyphPage *page[0x11];
ABC *widths[GLYPH_MAX / GLYPH_BLOCK_SIZE];
LPVOID GSUB_Table;
LPVOID GDEF_Table;
......
......@@ -1964,7 +1964,7 @@ static enum wined3d_d3d_level d3d_level_from_gl_info(const struct wined3d_gl_inf
{
/* Wine can not use SM 4 on mesa drivers as the necessary functionality is not exposed
* on compatibility contexts */
if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30))
if (gl_info->glsl_version >= MAKEDWORD_VERSION(1, 30) || gl_info->supported[EXT_GPU_SHADER4])
return WINED3D_D3D_LEVEL_10;
return WINED3D_D3D_LEVEL_9_SM3;
}
......
......@@ -1660,16 +1660,16 @@ int macdrv_err_on;
{
WineWindow* window = (WineWindow*)[theEvent window];
NSEventType type = [theEvent type];
BOOL broughtWindowForward = FALSE;
WineWindow* windowBroughtForward = nil;
BOOL process = FALSE;
if ([window isKindOfClass:[WineWindow class]] &&
!window.disabled && !window.noActivate &&
type == NSLeftMouseDown &&
(([theEvent modifierFlags] & (NSShiftKeyMask | NSControlKeyMask| NSAlternateKeyMask | NSCommandKeyMask)) != NSCommandKeyMask))
{
NSWindowButton windowButton;
broughtWindowForward = TRUE;
windowBroughtForward = window;
/* Any left-click on our window anyplace other than the close or
minimize buttons will bring it forward. */
......@@ -1683,7 +1683,7 @@ int macdrv_err_on;
NSPoint point = [button convertPoint:[theEvent locationInWindow] fromView:nil];
if ([button mouse:point inRect:[button bounds]])
{
broughtWindowForward = FALSE;
windowBroughtForward = nil;
break;
}
}
......@@ -1699,7 +1699,6 @@ int macdrv_err_on;
{
BOOL pressed = (type == NSLeftMouseDown || type == NSRightMouseDown || type == NSOtherMouseDown);
CGPoint pt = CGEventGetLocation([theEvent CGEvent]);
BOOL process;
if (clippingCursor)
[self clipCursorLocation:&pt];
......@@ -1766,12 +1765,13 @@ int macdrv_err_on;
macdrv_release_event(event);
}
else if (broughtWindowForward)
{
[[window ancestorWineWindow] postBroughtForwardEvent];
if (![window isKeyWindow])
[self windowGotFocus:window];
}
}
if (!process && windowBroughtForward)
{
[[windowBroughtForward ancestorWineWindow] postBroughtForwardEvent];
if (![windowBroughtForward isKeyWindow] && !windowBroughtForward.disabled && !windowBroughtForward.noActivate)
[self windowGotFocus:windowBroughtForward];
}
// Since mouse button events deliver absolute cursor position, the
......
......@@ -195,6 +195,8 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
@property (retain, nonatomic) NSTimer* liveResizeDisplayTimer;
@property (readonly, copy, nonatomic) NSArray* childWineWindows;
- (void) updateColorSpace;
- (BOOL) becameEligibleParentOrChild;
......@@ -263,6 +265,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextSetInterpolationQuality(context, kCGInterpolationNone);
for (i = 0; i < count; i++)
{
......@@ -691,7 +694,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
NSUInteger style = [self styleMask];
if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
style & NSResizableWindowMask && !(style & NSUtilityWindowMask))
style & NSResizableWindowMask && !(style & NSUtilityWindowMask) && !maximized)
{
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
......@@ -701,7 +704,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
behavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
if (style & NSFullScreenWindowMask)
[self toggleFullScreen:nil];
[super toggleFullScreen:nil];
}
}
......@@ -783,7 +786,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
if (captured)
level = CGShieldingWindowLevel() + 1; /* Need +1 or we don't get mouse moves */
else
level = NSMainMenuWindowLevel + 1;
level = NSStatusWindowLevel + 1;
if (self.floating)
level++;
......@@ -829,7 +832,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
// Became non-floating. If parent of floating children, make that
// relationship latent.
WineWindow* child;
for (child in [[[self childWindows] copy] autorelease])
for (child in [self childWineWindows])
{
if (child.floating)
[child becameIneligibleChild];
......@@ -844,25 +847,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[[WineApplicationController sharedController] adjustWindowLevels];
}
behavior = NSWindowCollectionBehaviorDefault;
if (state->excluded_by_expose)
behavior |= NSWindowCollectionBehaviorTransient;
else
behavior |= NSWindowCollectionBehaviorManaged;
if (state->excluded_by_cycle)
{
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
if ([self isOrderedIn])
[NSApp removeWindowsItem:self];
}
else
{
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
if ([self isOrderedIn])
[NSApp addWindowsItem:self title:[self title] filename:NO];
}
[self adjustFullScreenBehavior:behavior];
if (state->minimized_valid)
{
macdrv_event_mask discard = event_mask_for_type(WINDOW_DID_UNMINIMIZE);
......@@ -904,6 +888,25 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
maximized = state->maximized;
[self adjustFeaturesForState];
}
behavior = NSWindowCollectionBehaviorDefault;
if (state->excluded_by_expose)
behavior |= NSWindowCollectionBehaviorTransient;
else
behavior |= NSWindowCollectionBehaviorManaged;
if (state->excluded_by_cycle)
{
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
if ([self isOrderedIn])
[NSApp removeWindowsItem:self];
}
else
{
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
if ([self isOrderedIn])
[NSApp addWindowsItem:self title:[self title] filename:NO];
}
[self adjustFullScreenBehavior:behavior];
}
- (BOOL) addChildWineWindow:(WineWindow*)child assumeVisible:(BOOL)assumeVisible
......@@ -1007,7 +1010,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
- (void) becameIneligibleParentOrChild
{
NSArray* childWindows = [self childWindows];
NSArray* childWindows = [self childWineWindows];
[self becameIneligibleChild];
......@@ -1015,7 +1018,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
{
WineWindow* child;
childWindows = [[childWindows copy] autorelease];
for (child in childWindows)
{
child.latentParentWindow = self;
......@@ -1096,7 +1098,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
// Get our child windows and sort them in the reverse of the desired
// z-order (back-to-front).
origChildren = [self childWindows];
origChildren = [self childWineWindows];
children = [[origChildren mutableCopy] autorelease];
[children sortWithOptions:NSSortStable
usingComparator:^NSComparisonResult(id obj1, id obj2){
......@@ -1310,7 +1312,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[self setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
}
if (equalSizes && [[self childWindows] count])
if (equalSizes && [[self childWineWindows] count])
{
// If we change the window frame such that the origin moves
// but the size doesn't change, then Cocoa moves child
......@@ -1565,7 +1567,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
ret = [self isKeyWindow] || (!self.disabled && !self.noActivate);
else if ([menuItem action] == @selector(undo:)) // CrossOver Hack 10912: Mac Edit menu
ret = TRUE;
if ([menuItem action] == @selector(toggleFullScreen:) && self.disabled)
if ([menuItem action] == @selector(toggleFullScreen:) && (self.disabled || maximized))
ret = NO;
return ret;
......@@ -1667,10 +1669,19 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
- (void) toggleFullScreen:(id)sender
{
if (!self.disabled)
if (!self.disabled && !maximized)
[super toggleFullScreen:sender];
}
- (NSArray*) childWineWindows
{
NSArray* childWindows = self.childWindows;
NSIndexSet* indexes = [childWindows indexesOfObjectsPassingTest:^BOOL(id child, NSUInteger idx, BOOL *stop){
return [child isKindOfClass:[WineWindow class]];
}];
return [childWindows objectsAtIndexes:indexes];
}
// We normally use the generic/calibrated RGB color space for the window,
// rather than the device color space, to avoid expensive color conversion
// which slows down drawing. However, for windows displaying OpenGL, having
......
......@@ -50,7 +50,9 @@ extern const char* debugstr_cf(CFTypeRef t) DECLSPEC_HIDDEN;
static inline CGRect cgrect_from_rect(RECT rect)
{
return CGRectMake(rect.left, rect.top, max(0, rect.right - rect.left), max(0, rect.bottom - rect.top));
if (rect.left >= rect.right || rect.top >= rect.bottom)
return CGRectMake(rect.left, rect.top, 0, 0);
return CGRectMake(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
}
static inline RECT rect_from_cgrect(CGRect cgrect)
......
......@@ -117,7 +117,7 @@ struct ACImpl {
BOOL initted, playing;
UINT64 written_frames, last_pos_frames;
UINT32 period_us, period_frames, bufsize_frames, held_frames, tmp_buffer_frames;
UINT32 period_us, period_frames, bufsize_frames, held_frames, tmp_buffer_frames, in_oss_frames;
UINT32 oss_bufsize_bytes, lcl_offs_frames; /* offs into local_buffer where valid data starts */
BYTE *local_buffer, *tmp_buffer;
......@@ -1396,19 +1396,10 @@ static void silence_buffer(ACImpl *This, BYTE *buffer, UINT32 frames)
static void oss_write_data(ACImpl *This)
{
ssize_t written_bytes;
UINT32 written_frames, in_oss_frames, write_limit, max_period;
size_t to_write_frames, to_write_bytes;
UINT32 written_frames, in_oss_frames, write_limit, max_period, write_offs_frames, new_frames;
size_t to_write_frames, to_write_bytes, advanced;
audio_buf_info bi;
BYTE *buf =
This->local_buffer + (This->lcl_offs_frames * This->fmt->nBlockAlign);
if(This->held_frames == 0)
return;
if(This->lcl_offs_frames + This->held_frames > This->bufsize_frames)
to_write_frames = This->bufsize_frames - This->lcl_offs_frames;
else
to_write_frames = This->held_frames;
BYTE *buf;
if(ioctl(This->fd, SNDCTL_DSP_GETOSPACE, &bi) < 0){
WARN("GETOSPACE failed: %d (%s)\n", errno, strerror(errno));
......@@ -1433,9 +1424,38 @@ static void oss_write_data(ACImpl *This)
if(write_limit == 0)
return;
/* vvvvvv - in_oss_frames
* [--xxxxxxxxxx]
* [xxxxxxxxxx--]
* ^^^^^^^^^^ - held_frames
* ^ - lcl_offs_frames
*/
advanced = This->in_oss_frames - in_oss_frames;
if(advanced > This->held_frames)
advanced = This->held_frames;
This->lcl_offs_frames += advanced;
This->lcl_offs_frames %= This->bufsize_frames;
This->held_frames -= advanced;
This->in_oss_frames = in_oss_frames;
if(This->held_frames == This->in_oss_frames)
return;
write_offs_frames = (This->lcl_offs_frames + This->in_oss_frames) % This->bufsize_frames;
new_frames = This->held_frames - This->in_oss_frames;
if(write_offs_frames + new_frames > This->bufsize_frames)
to_write_frames = This->bufsize_frames - write_offs_frames;
else
to_write_frames = new_frames;
to_write_frames = min(to_write_frames, write_limit);
to_write_bytes = to_write_frames * This->fmt->nBlockAlign;
buf = This->local_buffer + write_offs_frames * This->fmt->nBlockAlign;
if(This->session->mute)
silence_buffer(This, buf, to_write_frames);
......@@ -1447,19 +1467,17 @@ static void oss_write_data(ACImpl *This)
}
written_frames = written_bytes / This->fmt->nBlockAlign;
This->lcl_offs_frames += written_frames;
This->lcl_offs_frames %= This->bufsize_frames;
This->held_frames -= written_frames;
This->in_oss_frames += written_frames;
if(written_frames < to_write_frames){
/* OSS buffer probably full */
return;
}
if(This->held_frames && written_frames < write_limit){
if(new_frames > written_frames && written_frames < write_limit){
/* wrapped and have some data back at the start to write */
to_write_frames = min(write_limit - written_frames, This->held_frames);
to_write_frames = min(write_limit - written_frames, new_frames - written_frames);
to_write_bytes = to_write_frames * This->fmt->nBlockAlign;
if(This->session->mute)
......@@ -1471,30 +1489,18 @@ static void oss_write_data(ACImpl *This)
return;
}
written_frames = written_bytes / This->fmt->nBlockAlign;
This->lcl_offs_frames += written_frames;
This->lcl_offs_frames %= This->bufsize_frames;
This->held_frames -= written_frames;
This->in_oss_frames += written_frames;
}
}
static void oss_read_data(ACImpl *This)
{
UINT64 pos, readable;
audio_buf_info bi;
ssize_t nread;
if(ioctl(This->fd, SNDCTL_DSP_GETISPACE, &bi) < 0){
WARN("GETISPACE failed: %d (%s)\n", errno, strerror(errno));
return;
}
pos = (This->held_frames + This->lcl_offs_frames) % This->bufsize_frames;
readable = (This->bufsize_frames - pos) * This->fmt->nBlockAlign;
if(bi.bytes < readable)
readable = bi.bytes;
nread = read(This->fd, This->local_buffer + pos * This->fmt->nBlockAlign,
readable);
if(nread < 0){
......@@ -1587,6 +1593,7 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface)
}
This->playing = FALSE;
This->in_oss_frames = 0;
LeaveCriticalSection(&This->lock);
......@@ -1624,6 +1631,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
}
This->held_frames = 0;
This->lcl_offs_frames = 0;
This->in_oss_frames = 0;
LeaveCriticalSection(&This->lock);
......@@ -2159,7 +2167,6 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
UINT64 *qpctime)
{
ACImpl *This = impl_from_IAudioClock(iface);
int delay;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
......@@ -2169,18 +2176,9 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
EnterCriticalSection(&This->lock);
if(This->dataflow == eRender){
if(!This->playing || !This->held_frames ||
ioctl(This->fd, SNDCTL_DSP_GETODELAY, &delay) < 0)
delay = 0;
else
delay /= This->fmt->nBlockAlign;
if(This->held_frames + delay >= This->written_frames)
*pos = This->written_frames - This->held_frames;
if(*pos < This->last_pos_frames)
*pos = This->last_pos_frames;
else{
*pos = This->written_frames - This->held_frames - delay;
if(*pos < This->last_pos_frames)
*pos = This->last_pos_frames;
}
}else if(This->dataflow == eCapture){
audio_buf_info bi;
UINT32 held;
......@@ -2200,6 +2198,7 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
This->last_pos_frames = *pos;
TRACE("returning: %s\n", wine_dbgstr_longlong(*pos));
if(This->share == AUDCLNT_SHAREMODE_SHARED)
*pos *= This->fmt->nBlockAlign;
......
......@@ -386,6 +386,18 @@ interface IMLangConvertCharset : IUnknown
MLCONVCHARF_DETECTJPN = 32
} MLCONVCHAR;
typedef enum tagMLCPF
{
MLDETECTF_MAILNEWS = 0x0001,
MLDETECTF_BROWSER = 0x0002,
MLDETECTF_VALID = 0x0004,
MLDETECTF_VALID_NLS = 0x0008,
MLDETECTF_PRESERVE_ORDER = 0x0010,
MLDETECTF_PREFERRED_ONLY = 0x0020,
MLDETECTF_FILTER_SPECIALCHAR = 0x0040,
MLDETECTF_EURO_UTF8 = 0x0080
} MLCP;
HRESULT Initialize(
[in] UINT uiSrcCodePage,
[in] UINT uiDstCodePage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment