ole32: Added activation context support for OleRegGetMiscStatus().

This commit is contained in:
Nikolay Sivov 2013-11-11 22:02:58 +04:00 committed by Alexandre Julliard
parent 4242c437a2
commit d0bf7f4eaf
4 changed files with 79 additions and 4 deletions

View File

@ -99,6 +99,15 @@ enum comclass_threadingmodel
ThreadingModel_Neutral = 5
};
enum comclass_miscfields
{
MiscStatus = 1,
MiscStatusIcon = 2,
MiscStatusContent = 4,
MiscStatusThumbnail = 8,
MiscStatusDocPrint = 16
};
struct comclassredirect_data
{
ULONG size;
@ -218,6 +227,71 @@ static CRITICAL_SECTION_DEBUG class_cs_debug =
};
static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 };
static inline enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
{
switch (aspect)
{
case DVASPECT_CONTENT:
return MiscStatusContent;
case DVASPECT_THUMBNAIL:
return MiscStatusThumbnail;
case DVASPECT_ICON:
return MiscStatusIcon;
case DVASPECT_DOCPRINT:
return MiscStatusDocPrint;
default:
return MiscStatus;
};
}
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
{
ACTCTX_SECTION_KEYED_DATA data;
data.cbSize = sizeof(data);
if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
clsid, &data))
{
struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
if (!(comclass->miscmask & misc))
{
if (!(comclass->miscmask & MiscStatus))
{
*status = 0;
return TRUE;
}
misc = MiscStatus;
}
switch (misc)
{
case MiscStatus:
*status = comclass->miscstatus;
break;
case MiscStatusIcon:
*status = comclass->miscstatusicon;
break;
case MiscStatusContent:
*status = comclass->miscstatuscontent;
break;
case MiscStatusThumbnail:
*status = comclass->miscstatusthumbnail;
break;
case MiscStatusDocPrint:
*status = comclass->miscstatusdocprint;
break;
default:
;
};
return TRUE;
}
else
return FALSE;
}
/* wrapper for NtCreateKey that creates the key recursively if necessary */
static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr )
{

View File

@ -315,6 +315,8 @@ extern UINT ole_private_data_clipboard_format DECLSPEC_HIDDEN;
extern LSTATUS create_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
extern LSTATUS open_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
extern BOOL actctx_get_miscstatus(const CLSID*, DWORD, DWORD*) DECLSPEC_HIDDEN;
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);

View File

@ -895,6 +895,8 @@ HRESULT WINAPI OleRegGetMiscStatus(
*pdwStatus = 0;
if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
/*
* Open the class id Key
*/

View File

@ -1889,21 +1889,18 @@ static void test_OleRegGetMiscStatus(void)
{
status = 0;
hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
}
/* context data takes precedence over registration info */
status = 0;
hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
ok(hr == S_OK, "got 0x%08x\n", hr);
todo_wine
ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
/* there's no such attribute in context */
status = -1;
hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(status == 0, "got 0x%08x\n", status);