From 72d055854b59db9059a3465f1e65247c0cc5e94e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 11 Jun 2020 19:40:25 +0300 Subject: [PATCH] ntdll: Use single field for misc flags in ComClass redirection section. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/actctx.c | 23 ++++++++++------------- dlls/mscoree/corruntimehost.c | 4 +--- dlls/ntdll/actctx.c | 22 +++++++++------------- dlls/ole32/compobj.c | 9 ++++----- dlls/sxs/sxs.c | 4 +--- 5 files changed, 25 insertions(+), 37 deletions(-) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 2d942cdc981..2093959d98d 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -1422,9 +1422,7 @@ enum comclass_miscfields { struct comclassredirect_data { ULONG size; - BYTE res; - BYTE miscmask; - BYTE res1[2]; + ULONG flags; DWORD model; GUID clsid; GUID alias; @@ -1481,12 +1479,9 @@ static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GU ok_(__FILE__, line)(comclass->size == sizeof(*comclass), "got %d for header size\n", comclass->size); if (data.lpData && comclass->size == sizeof(*comclass)) { + ULONG len, miscmask; WCHAR *ptr; - ULONG len; - ok_(__FILE__, line)(comclass->res == 0, "got res as %d\n", comclass->res); - ok_(__FILE__, line)(comclass->res1[0] == 0, "got res1[0] as %02x\n", comclass->res1[0]); - ok_(__FILE__, line)(comclass->res1[1] == 0, "got res1[1] as %02x\n", comclass->res1[1]); ok_(__FILE__, line)(comclass->model == ThreadingModel_Neutral, "got model %d\n", comclass->model); ok_(__FILE__, line)(IsEqualGUID(&comclass->clsid, clsid), "got wrong clsid %s\n", wine_dbgstr_guid(&comclass->clsid)); ok_(__FILE__, line)(IsEqualGUID(&comclass->clsid2, clsid), "got wrong clsid2 %s\n", wine_dbgstr_guid(&comclass->clsid2)); @@ -1519,19 +1514,21 @@ static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GU ok_(__FILE__, line)(data.ulSectionTotalLength > comclass->name_offset, "got wrong offset %d\n", comclass->name_offset); /* check misc fields are set */ - if (comclass->miscmask) + miscmask = (comclass->flags >> 8) & 0xff; + if (miscmask) { - if (comclass->miscmask & MiscStatus) + if (miscmask & MiscStatus) ok_(__FILE__, line)(comclass->miscstatus != 0, "got miscstatus 0x%08x\n", comclass->miscstatus); - if (comclass->miscmask & MiscStatusIcon) + if (miscmask & MiscStatusIcon) ok_(__FILE__, line)(comclass->miscstatusicon != 0, "got miscstatusicon 0x%08x\n", comclass->miscstatusicon); - if (comclass->miscmask & MiscStatusContent) + if (miscmask & MiscStatusContent) ok_(__FILE__, line)(comclass->miscstatuscontent != 0, "got miscstatuscontent 0x%08x\n", comclass->miscstatuscontent); - if (comclass->miscmask & MiscStatusThumbnail) + if (miscmask & MiscStatusThumbnail) ok_(__FILE__, line)(comclass->miscstatusthumbnail != 0, "got miscstatusthumbnail 0x%08x\n", comclass->miscstatusthumbnail); - if (comclass->miscmask & MiscStatusDocPrint) + if (miscmask & MiscStatusDocPrint) ok_(__FILE__, line)(comclass->miscstatusdocprint != 0, "got miscstatusdocprint 0x%08x\n", comclass->miscstatusdocprint); } + ok_(__FILE__, line)(!(comclass->flags & 0xffff00ff), "Unexpected flags %#x.\n", comclass->flags); /* part used for clrClass only */ if (comclass->clrdata_len) diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 9f53555ee94..a5b378b9251 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -74,9 +74,7 @@ struct dll_fixup struct comclassredirect_data { ULONG size; - BYTE res; - BYTE miscmask; - BYTE res1[2]; + ULONG flags; DWORD model; GUID clsid; GUID alias; diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index af9499c4044..1fb337ea333 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -242,9 +242,7 @@ enum comclass_miscfields struct comclassredirect_data { ULONG size; - BYTE res; - BYTE miscmask; - BYTE res1[2]; + ULONG flags; DWORD model; GUID clsid; GUID alias; @@ -4030,7 +4028,7 @@ static void add_comserver_record(const struct guidsection_header *section, const struct entity *entity = &entities->base[i]; if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION) { - ULONG module_len, progid_len, str_len = 0; + ULONG module_len, progid_len, str_len = 0, miscmask; struct comclassredirect_data *data; struct guid_index *alias_index; struct clrclass_data *clrdata; @@ -4064,9 +4062,6 @@ static void add_comserver_record(const struct guidsection_header *section, const /* setup data */ data = (struct comclassredirect_data*)((BYTE*)section + (*index)->data_offset); data->size = sizeof(*data); - data->res = 0; - data->res1[0] = 0; - data->res1[1] = 0; data->model = entity->u.comclass.model; data->clsid = (*index)->guid; data->alias = alias_index->guid; @@ -4091,17 +4086,18 @@ static void add_comserver_record(const struct guidsection_header *section, const data->miscstatusdocprint = entity->u.comclass.miscstatusdocprint; /* mask describes which misc* data is available */ - data->miscmask = 0; + miscmask = 0; if (data->miscstatus) - data->miscmask |= MiscStatus; + miscmask |= MiscStatus; if (data->miscstatuscontent) - data->miscmask |= MiscStatusContent; + miscmask |= MiscStatusContent; if (data->miscstatusthumbnail) - data->miscmask |= MiscStatusThumbnail; + miscmask |= MiscStatusThumbnail; if (data->miscstatusicon) - data->miscmask |= MiscStatusIcon; + miscmask |= MiscStatusIcon; if (data->miscstatusdocprint) - data->miscmask |= MiscStatusDocPrint; + miscmask |= MiscStatusDocPrint; + data->flags = miscmask << 8; if (data->clrdata_offset) { diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index bd28f42b33b..df234498e65 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -105,9 +105,7 @@ enum comclass_miscfields struct comclassredirect_data { ULONG size; - BYTE res; - BYTE miscmask; - BYTE res1[2]; + ULONG flags; DWORD model; GUID clsid; GUID alias; @@ -265,10 +263,11 @@ BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status) { struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData; enum comclass_miscfields misc = dvaspect_to_miscfields(aspect); + ULONG miscmask = (comclass->flags >> 8) & 0xff; - if (!(comclass->miscmask & misc)) + if (!(miscmask & misc)) { - if (!(comclass->miscmask & MiscStatus)) + if (!(miscmask & MiscStatus)) { *status = 0; return TRUE; diff --git a/dlls/sxs/sxs.c b/dlls/sxs/sxs.c index 5b2db1d997c..0b59eb5d2e9 100644 --- a/dlls/sxs/sxs.c +++ b/dlls/sxs/sxs.c @@ -64,9 +64,7 @@ typedef struct _SXS_GUID_INFORMATION_CLR struct comclassredirect_data { ULONG size; - BYTE res; - BYTE miscmask; - BYTE res1[2]; + ULONG flags; DWORD model; GUID clsid; GUID alias;