Commit d36b8350 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comsvcs: Add a stub for "new" moniker.

parent a3bf974a
......@@ -8,4 +8,5 @@ C_SRCS = \
main.c
IDL_SRCS = \
comsvcs_classes.idl \
comsvcs_tlb.idl
/*
* Copyright 2019 Nikolay Sivov
*
* 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
*/
#pragma makedep register
[
uuid(ecabafc6-7f19-11d2-978e-0000f8757e2a),
progid("new"),
helpstring("New Moniker"),
threading(both)
]
coclass NewMoniker
{
[default] interface IMoniker;
}
......@@ -267,6 +267,105 @@ static void create_dispenser(void)
IDispenserManager_Release(dispenser);
}
static void test_new_moniker(void)
{
IMoniker *moniker, *inverse, *class_moniker;
DWORD moniker_type;
IBindCtx *bindctx;
FILETIME filetime;
DWORD hash, eaten;
IUnknown *obj, *obj2;
CLSID clsid;
HRESULT hr;
hr = CreateBindCtx(0, &bindctx);
ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
eaten = 0;
hr = MkParseDisplayName(bindctx, L"new:20d04fe0-3aea-1069-a2d8-08002b30309d", &eaten, &moniker);
ok(hr == S_OK, "Failed to parse display name, hr %#x.\n", hr);
ok(eaten == 40, "Unexpected eaten length %u.\n", eaten);
hr = IMoniker_QueryInterface(moniker, &IID_IParseDisplayName, (void **)&obj);
ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
/* Object creation. */
hr = CLSIDFromProgID(L"new", &clsid);
ok(hr == S_OK, "Failed to get clsid, hr %#x.\n", hr);
hr = CreateClassMoniker(&clsid, &class_moniker);
ok(hr == S_OK, "Failed to create class moniker, hr %#x.\n", hr);
hr = IMoniker_BindToObject(class_moniker, bindctx, NULL, &IID_IParseDisplayName, (void **)&obj);
ok(hr == S_OK, "Failed to get parsing interface, hr %#x.\n", hr);
IUnknown_Release(obj);
hr = IMoniker_BindToObject(class_moniker, bindctx, NULL, &IID_IClassFactory, (void **)&obj);
ok(hr == S_OK, "Failed to get parsing interface, hr %#x.\n", hr);
IUnknown_Release(obj);
hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IParseDisplayName, (void **)&obj);
ok(hr == S_OK, "Failed to get parsing interface, hr %#x.\n", hr);
IUnknown_Release(obj);
hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&obj);
ok(hr == S_OK, "Failed to get parsing interface, hr %#x.\n", hr);
hr = IUnknown_QueryInterface(obj, &IID_IParseDisplayName, (void **)&obj2);
ok(hr == S_OK, "Failed to get parsing interface, hr %#x.\n", hr);
IUnknown_Release(obj);
IMoniker_Release(class_moniker);
/* Hashing */
hash = 0;
hr = IMoniker_Hash(moniker, &hash);
todo_wine {
ok(hr == S_OK, "Failed to get a hash, hr %#x.\n", hr);
ok(hash == 0x20d04fe0, "Unexpected hash value %#x.\n", hash);
}
moniker_type = MKSYS_CLASSMONIKER;
hr = IMoniker_IsSystemMoniker(moniker, &moniker_type);
todo_wine {
ok(hr == S_FALSE || broken(hr == S_OK) /* XP */, "Unexpected hr %#x.\n", hr);
ok(moniker_type == MKSYS_NONE, "Unexpected moniker type %d.\n", moniker_type);
}
hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
todo_wine
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
todo_wine
ok(hr == MK_E_UNAVAILABLE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&obj);
todo_wine
ok(hr == S_OK, "Failed to bind to object, hr %#x.\n", hr);
if (SUCCEEDED(hr))
IUnknown_Release(obj);
hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&obj);
todo_wine
ok(hr == MK_E_NOSTORAGE, "Unexpected hr %#x.\n", hr);
hr = IMoniker_Inverse(moniker, &inverse);
todo_wine
ok(hr == S_OK, "Failed to create inverse moniker, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
moniker_type = MKSYS_NONE;
hr = IMoniker_IsSystemMoniker(inverse, &moniker_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(moniker_type == MKSYS_ANTIMONIKER, "Unexpected moniker type %d.\n", moniker_type);
IMoniker_Release(inverse);
}
IMoniker_Release(moniker);
IBindCtx_Release(bindctx);
}
START_TEST(comsvcs)
{
......@@ -278,6 +377,7 @@ START_TEST(comsvcs)
return;
create_dispenser();
test_new_moniker();
CoUninitialize();
}
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