ReactOS 0.4.15-dev-6662-g1b3eed5
actctx.c File Reference
#include <rtl.h>
#include <ntstrsafe.h>
#include <compat_undoc.h>
#include <debug.h>
#include <wine/unicode.h>
Include dependency graph for actctx.c:

Go to the source code of this file.

Classes

struct  xmlstr_t
 
struct  xml_elem
 
struct  xml_attr
 
struct  xmlbuf_t
 
struct  file_info
 
struct  assembly_version
 
struct  assembly_identity
 
struct  strsection_header
 
struct  string_index
 
struct  guidsection_header
 
struct  guid_index
 
struct  wndclass_redirect_data
 
struct  dllredirect_data
 
struct  tlibredirect_data
 
struct  comclassredirect_data
 
struct  ifacepsredirect_data
 
struct  clrsurrogate_data
 
struct  clrclass_data
 
struct  progidredirect_data
 
struct  progids
 
struct  entity
 
struct  entity_array
 
struct  dll_redirect
 
struct  assembly
 
struct  _ASSEMBLY_STORAGE_MAP_ENTRY
 
struct  _ASSEMBLY_STORAGE_MAP
 
struct  _ACTIVATION_CONTEXT
 
struct  actctx_loader
 
struct  _ACTIVATION_CONTEXT_WRAPPED
 
struct  olemisc_entry
 

Macros

#define NDEBUG
 
#define ACTCTX_FLAGS_ALL
 
#define STRSECTION_MAGIC   0x64487353 /* dHsS */
 
#define GUIDSECTION_MAGIC   0x64487347 /* dHsG */
 
#define ACTCTX_MAGIC_MARKER   (PVOID)'gMcA'
 
#define ACTCTX_FAKE_HANDLE   ((HANDLE) 0xf00baa)
 
#define ACTCTX_FAKE_COOKIE   ((ULONG_PTR) 0xf00bad)
 
#define MAX_NAMESPACES   64
 
#define FIND_ACTCTX_RETURN_FLAGS   0x00000002
 
#define FIND_ACTCTX_RETURN_ASSEMBLY_METADATA   0x00000004
 
#define FIND_ACTCTX_VALID_MASK   (FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX | FIND_ACTCTX_RETURN_FLAGS | FIND_ACTCTX_RETURN_ASSEMBLY_METADATA)
 

Typedefs

typedef struct _ASSEMBLY_STORAGE_MAP_ENTRY ASSEMBLY_STORAGE_MAP_ENTRY
 
typedef struct _ASSEMBLY_STORAGE_MAP_ENTRYPASSEMBLY_STORAGE_MAP_ENTRY
 
typedef struct _ASSEMBLY_STORAGE_MAP ASSEMBLY_STORAGE_MAP
 
typedef struct _ASSEMBLY_STORAGE_MAPPASSEMBLY_STORAGE_MAP
 
typedef struct _ACTIVATION_CONTEXT ACTIVATION_CONTEXT
 
typedef struct _ACTIVATION_CONTEXTPIACTIVATION_CONTEXT
 
typedef struct _ACTIVATION_CONTEXT_WRAPPED ACTIVATION_CONTEXT_WRAPPED
 
typedef struct _ACTIVATION_CONTEXT_WRAPPEDPACTIVATION_CONTEXT_WRAPPED
 

Enumerations

enum  comclass_threadingmodel {
  ThreadingModel_Apartment = 1 , ThreadingModel_Free = 2 , ThreadingModel_No = 3 , ThreadingModel_Both = 4 ,
  ThreadingModel_Neutral = 5 , ThreadingModel_Apartment = 1 , ThreadingModel_Free = 2 , ThreadingModel_No = 3 ,
  ThreadingModel_Both = 4 , ThreadingModel_Neutral = 5 , ThreadingModel_Apartment = 1 , ThreadingModel_Free = 2 ,
  ThreadingModel_No = 3 , ThreadingModel_Both = 4 , ThreadingModel_Neutral = 5
}
 
enum  comclass_miscfields {
  MiscStatus = 1 , MiscStatusIcon = 2 , MiscStatusContent = 4 , MiscStatusThumbnail = 8 ,
  MiscStatusDocPrint = 16 , MiscStatus = 1 , MiscStatusIcon = 2 , MiscStatusContent = 4 ,
  MiscStatusThumbnail = 8 , MiscStatusDocPrint = 16 , MiscStatus = 1 , MiscStatusIcon = 2 ,
  MiscStatusContent = 4 , MiscStatusThumbnail = 8 , MiscStatusDocPrint = 16
}
 
enum  ifaceps_mask { NumMethods = 1 , BaseIface = 2 , NumMethods = 1 , BaseIface = 2 }
 
enum  assembly_type { APPLICATION_MANIFEST , ASSEMBLY_MANIFEST , ASSEMBLY_SHARED_MANIFEST }
 
enum  context_sections {
  WINDOWCLASS_SECTION = 1 , DLLREDIRECT_SECTION = 2 , TLIBREDIRECT_SECTION = 4 , SERVERREDIRECT_SECTION = 8 ,
  IFACEREDIRECT_SECTION = 16 , CLRSURROGATES_SECTION = 32 , PROGIDREDIRECT_SECTION = 64
}
 

Functions

VOID NTAPI RtlpSxsBreakOnInvalidMarker (IN PACTIVATION_CONTEXT ActCtx, IN ULONG FailureCode)
 
FORCEINLINE VOID RtlpValidateActCtx (IN PACTIVATION_CONTEXT ActCtx)
 
static WCHARstrdupW (const WCHAR *str)
 
static WCHARxmlstrdupW (const xmlstr_t *str)
 
static BOOL xmlstr_cmp (const xmlstr_t *xmlstr, const WCHAR *str)
 
static BOOL xmlstr_cmpi (const xmlstr_t *xmlstr, const WCHAR *str)
 
static BOOL xmlstr_cmp_end (const xmlstr_t *xmlstr, const WCHAR *str)
 
static BOOL xml_attr_cmp (const struct xml_attr *attr, const WCHAR *str)
 
static BOOL xml_name_cmp (const struct xml_elem *elem1, const struct xml_elem *elem2)
 
static BOOL xml_elem_cmp (const struct xml_elem *elem, const WCHAR *str, const WCHAR *namespace)
 
static BOOL isxmlspace (WCHAR ch)
 
static struct assemblyadd_assembly (ACTIVATION_CONTEXT *actctx, enum assembly_type at)
 
static struct dll_redirectadd_dll_redirect (struct assembly *assembly)
 
static PCOMPATIBILITY_CONTEXT_ELEMENT add_compat_context (struct assembly *assembly)
 
static void free_assembly_identity (struct assembly_identity *ai)
 
static struct entityadd_entity (struct entity_array *array, DWORD kind)
 
static void free_entity_array (struct entity_array *array)
 
static BOOL is_matching_string (const WCHAR *str1, const WCHAR *str2)
 
static BOOL is_matching_identity (const struct assembly_identity *id1, const struct assembly_identity *id2)
 
static BOOL add_dependent_assembly_id (struct actctx_loader *acl, struct assembly_identity *ai)
 
static void free_depend_manifests (struct actctx_loader *acl)
 
static WCHARbuild_assembly_dir (struct assembly_identity *ai)
 
static void append_string (WCHAR *buffer, const WCHAR *prefix, const WCHAR *str)
 
static WCHARbuild_assembly_id (const struct assembly_identity *ai)
 
static ACTIVATION_CONTEXTcheck_actctx (HANDLE h)
 
static void actctx_addref (ACTIVATION_CONTEXT *actctx)
 
static void actctx_release (ACTIVATION_CONTEXT *actctx)
 
static BOOL set_error (xmlbuf_t *xmlbuf)
 
static BOOL is_xmlns_attr (const struct xml_attr *attr)
 
static void push_xmlns (xmlbuf_t *xmlbuf, const struct xml_attr *attr)
 
static xmlstr_t find_xmlns (xmlbuf_t *xmlbuf, const xmlstr_t *name)
 
static BOOL next_xml_attr (xmlbuf_t *xmlbuf, struct xml_attr *attr, BOOL *end)
 
static void read_xml_elem (xmlbuf_t *xmlbuf, struct xml_elem *elem)
 
static BOOL next_xml_elem (xmlbuf_t *xmlbuf, struct xml_elem *elem, const struct xml_elem *parent)
 
static BOOL parse_xml_header (xmlbuf_t *xmlbuf)
 
static BOOL parse_text_content (xmlbuf_t *xmlbuf, xmlstr_t *content)
 
static BOOL parse_version (const xmlstr_t *str, struct assembly_version *version)
 
static void parse_expect_no_attr (xmlbuf_t *xmlbuf, BOOL *end)
 
static void parse_expect_end_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_unknown_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_assembly_identity_elem (xmlbuf_t *xmlbuf, ACTIVATION_CONTEXT *actctx, struct assembly_identity *ai, const struct xml_elem *parent)
 
static enum comclass_threadingmodel parse_com_class_threadingmodel (xmlstr_t *value)
 
static OLEMISC get_olemisc_value (const WCHAR *str, int len)
 
static DWORD parse_com_class_misc (const xmlstr_t *value)
 
static BOOL com_class_add_progid (const xmlstr_t *progid, struct entity *entity)
 
static void parse_com_class_progid (xmlbuf_t *xmlbuf, struct entity *entity, const struct xml_elem *parent)
 
static void parse_com_class_elem (xmlbuf_t *xmlbuf, struct dll_redirect *dll, struct actctx_loader *acl, const struct xml_elem *parent)
 
static BOOL parse_nummethods (const xmlstr_t *str, struct entity *entity)
 
static void parse_add_interface_class (xmlbuf_t *xmlbuf, struct entity_array *entities, struct actctx_loader *acl, WCHAR *clsid)
 
static void parse_cominterface_proxy_stub_elem (xmlbuf_t *xmlbuf, struct dll_redirect *dll, struct actctx_loader *acl, const struct xml_elem *parent)
 
static BOOL parse_typelib_flags (const xmlstr_t *value, struct entity *entity)
 
static BOOL parse_typelib_version (const xmlstr_t *str, struct entity *entity)
 
static void parse_typelib_elem (xmlbuf_t *xmlbuf, struct dll_redirect *dll, struct actctx_loader *acl, const struct xml_elem *parent)
 
static int aligned_string_len (int len)
 
static int get_assembly_version (struct assembly *assembly, WCHAR *ret)
 
static void parse_window_class_elem (xmlbuf_t *xmlbuf, struct dll_redirect *dll, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_binding_redirect_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_description_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_com_interface_external_proxy_stub_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_clr_class_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_clr_surrogate_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_dependent_assembly_elem (xmlbuf_t *xmlbuf, struct actctx_loader *acl, const struct xml_elem *parent, BOOL optional)
 
static void parse_dependency_elem (xmlbuf_t *xmlbuf, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_noinherit_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_noinheritable_elem (xmlbuf_t *xmlbuf, const struct xml_elem *parent)
 
static void parse_file_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_supportedos_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_compatibility_application_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_compatibility_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_settings_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, struct xml_elem *parent)
 
static void parse_windows_settings_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_application_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_requested_execution_level_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_requested_privileges_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_security_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_trust_info_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent)
 
static void parse_assembly_elem (xmlbuf_t *xmlbuf, struct assembly *assembly, struct actctx_loader *acl, const struct xml_elem *parent, struct assembly_identity *expected_ai)
 
static NTSTATUS parse_manifest_buffer (struct actctx_loader *acl, struct assembly *assembly, struct assembly_identity *ai, xmlbuf_t *xmlbuf)
 
static NTSTATUS parse_manifest (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, BOOL shared, const void *buffer, SIZE_T size)
 
static NTSTATUS open_nt_file (HANDLE *handle, UNICODE_STRING *name)
 
static NTSTATUS get_module_filename (HMODULE module, UNICODE_STRING *str, USHORT extra_len)
 
static NTSTATUS get_manifest_in_module (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, BOOL shared, HANDLE hModule, LPCWSTR resname, ULONG lang)
 
IMAGE_RESOURCE_DIRECTORYfind_entry_by_name (IMAGE_RESOURCE_DIRECTORY *dir, LPCWSTR name, void *root, int want_dir)
 
IMAGE_RESOURCE_DIRECTORYfind_first_entry (IMAGE_RESOURCE_DIRECTORY *dir, void *root, int want_dir)
 
static IMAGE_RESOURCE_DIRECTORYfind_first_id_entry (IMAGE_RESOURCE_DIRECTORY *dir, void *root, int want_dir)
 
static NTSTATUS search_manifest_in_module (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, BOOL shared, HANDLE hModule, ULONG lang)
 
static NTSTATUS get_manifest_in_pe_file (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, BOOL shared, HANDLE file, LPCWSTR resname, ULONG lang)
 
static NTSTATUS get_manifest_in_manifest_file (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, BOOL shared, HANDLE file)
 
static NTSTATUS get_manifest_in_associated_manifest (struct actctx_loader *acl, struct assembly_identity *ai, LPCWSTR filename, LPCWSTR directory, HMODULE module, LPCWSTR resname)
 
static WCHARlookup_manifest_file (HANDLE dir, struct assembly_identity *ai)
 
static NTSTATUS lookup_winsxs (struct actctx_loader *acl, struct assembly_identity *ai)
 
static NTSTATUS lookup_assembly (struct actctx_loader *acl, struct assembly_identity *ai)
 
static NTSTATUS parse_depend_manifests (struct actctx_loader *acl)
 
static NTSTATUS find_query_actctx (HANDLE *handle, DWORD flags, ULONG class)
 
static NTSTATUS build_dllredirect_section (ACTIVATION_CONTEXT *actctx, struct strsection_header **section)
 
static struct string_indexfind_string_index (const struct strsection_header *section, const UNICODE_STRING *name)
 
static struct guid_indexfind_guid_index (const struct guidsection_header *section, const GUID *guid)
 
static struct dllredirect_dataget_dllredirect_data (ACTIVATION_CONTEXT *ctxt, struct string_index *index)
 
static NTSTATUS find_dll_redirection (ACTIVATION_CONTEXT *actctx, const UNICODE_STRING *name, PACTCTX_SECTION_KEYED_DATA data)
 
static struct string_indexget_wndclass_first_index (ACTIVATION_CONTEXT *actctx)
 
static struct wndclass_redirect_dataget_wndclass_data (ACTIVATION_CONTEXT *ctxt, struct string_index *index)
 
static NTSTATUS build_wndclass_section (ACTIVATION_CONTEXT *actctx, struct strsection_header **section)
 
static NTSTATUS find_window_class (ACTIVATION_CONTEXT *actctx, const UNICODE_STRING *name, PACTCTX_SECTION_KEYED_DATA data)
 
static _Must_inspect_result_ NTSTATUS build_tlib_section (ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
 
static struct tlibredirect_dataget_tlib_data (ACTIVATION_CONTEXT *actctx, struct guid_index *index)
 
static NTSTATUS find_tlib_redirection (ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
 
static void generate_uuid (ULONG *seed, GUID *guid)
 
static void get_comserver_datalen (const struct entity_array *entities, const struct dll_redirect *dll, unsigned int *count, unsigned int *len, unsigned int *module_len)
 
static _Must_inspect_result_ NTSTATUS add_comserver_record (const struct guidsection_header *section, const struct entity_array *entities, const struct dll_redirect *dll, struct guid_index **index, ULONG *data_offset, ULONG *module_offset, ULONG *seed, ULONG rosterindex)
 
static _Must_inspect_result_ NTSTATUS build_comserver_section (ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
 
static struct comclassredirect_dataget_comclass_data (ACTIVATION_CONTEXT *actctx, struct guid_index *index)
 
static _Must_inspect_result_ NTSTATUS find_comserver_redirection (ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
 
static void get_ifaceps_datalen (const struct entity_array *entities, unsigned int *count, unsigned int *len)
 
static _Must_inspect_result_ NTSTATUS add_ifaceps_record (struct guidsection_header *section, struct entity_array *entities, struct guid_index **index, ULONG *data_offset, ULONG rosterindex)
 
static _Must_inspect_result_ NTSTATUS build_ifaceps_section (ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
 
static struct ifacepsredirect_dataget_ifaceps_data (ACTIVATION_CONTEXT *actctx, struct guid_index *index)
 
static _Must_inspect_result_ NTSTATUS find_cominterface_redirection (ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
 
static _Must_inspect_result_ NTSTATUS build_clr_surrogate_section (ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
 
static struct clrsurrogate_dataget_surrogate_data (ACTIVATION_CONTEXT *actctx, const struct guid_index *index)
 
static _Must_inspect_result_ NTSTATUS find_clr_surrogate (ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
 
static void get_progid_datalen (struct entity_array *entities, unsigned int *count, unsigned int *total_len)
 
static void write_progid_record (struct strsection_header *section, const WCHAR *progid, const GUID *alias, struct string_index **index, ULONG *data_offset, ULONG *global_offset, ULONG rosterindex)
 
static _Must_inspect_result_ NTSTATUS add_progid_record (ACTIVATION_CONTEXT *actctx, struct strsection_header *section, const struct entity_array *entities, struct string_index **index, ULONG *data_offset, ULONG *global_offset, ULONG rosterindex)
 
static _Must_inspect_result_ NTSTATUS build_progid_section (ACTIVATION_CONTEXT *actctx, struct strsection_header **section)
 
static struct progidredirect_dataget_progid_data (ACTIVATION_CONTEXT *actctx, const struct string_index *index)
 
static NTSTATUS find_progid_redirection (ACTIVATION_CONTEXT *actctx, const UNICODE_STRING *name, PACTCTX_SECTION_KEYED_DATA data)
 
static NTSTATUS find_string (ACTIVATION_CONTEXT *actctx, ULONG section_kind, const UNICODE_STRING *section_name, DWORD flags, PACTCTX_SECTION_KEYED_DATA data)
 
static NTSTATUS find_guid (ACTIVATION_CONTEXT *actctx, ULONG section_kind, const GUID *guid, DWORD flags, PACTCTX_SECTION_KEYED_DATA data)
 
void actctx_init (PVOID *pOldShimData)
 
NTSTATUS NTAPI RtlCreateActivationContext (IN ULONG Flags, IN PACTIVATION_CONTEXT_DATA ActivationContextData, IN ULONG ExtraBytes, IN PVOID NotificationRoutine, IN PVOID NotificationContext, OUT PACTIVATION_CONTEXT *ActCtx)
 
VOID NTAPI RtlAddRefActivationContext (HANDLE handle)
 
VOID NTAPI RtlReleaseActivationContext (HANDLE handle)
 
NTSTATUS NTAPI RtlZombifyActivationContext (PVOID Context)
 
NTSTATUS NTAPI RtlActivateActivationContextEx (ULONG flags, PTEB tebAddress, HANDLE handle, PULONG_PTR cookie)
 
NTSTATUS NTAPI RtlActivateActivationContext (ULONG flags, HANDLE handle, PULONG_PTR cookie)
 
NTSTATUS NTAPI RtlDeactivateActivationContext (ULONG flags, ULONG_PTR cookie)
 
VOID NTAPI RtlFreeActivationContextStack (IN PACTIVATION_CONTEXT_STACK Stack)
 
VOID NTAPI RtlFreeThreadActivationContextStack (VOID)
 
NTSTATUS NTAPI RtlGetActiveActivationContext (HANDLE *handle)
 
BOOLEAN NTAPI RtlIsActivationContextActive (HANDLE handle)
 
NTSTATUS NTAPI RtlQueryInformationActivationContext (ULONG flags, HANDLE handle, PVOID subinst, ULONG class, PVOID buffer, SIZE_T bufsize, SIZE_T *retlen)
 
NTSTATUS NTAPI RtlQueryInformationActiveActivationContext (ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer OPTIONAL, SIZE_T *pcbWrittenOrRequired OPTIONAL)
 
NTSTATUS NTAPI RtlpFindActivationContextSection_CheckParameters (ULONG flags, const GUID *guid, ULONG section_kind, const UNICODE_STRING *section_name, PACTCTX_SECTION_KEYED_DATA data)
 
NTSTATUS NTAPI RtlFindActivationContextSectionString (ULONG flags, const GUID *guid, ULONG section_kind, const UNICODE_STRING *section_name, PVOID ptr)
 
NTSTATUS WINAPI RtlFindActivationContextSectionGuid (ULONG flags, const GUID *extguid, ULONG section_kind, const GUID *guid, void *ptr)
 
NTSTATUS NTAPI RtlAllocateActivationContextStack (IN PACTIVATION_CONTEXT_STACK *Stack)
 
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast (IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
 
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast (IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
 

Variables

BOOLEAN RtlpNotAllowingMultipleActivation
 
static const xmlstr_t empty_xmlstr
 
static const WCHAR current_archW [] = {'n','o','n','e',0}
 
static const WCHAR asmv1W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','1',0}
 
static const WCHAR asmv2W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','2',0}
 
static const WCHAR asmv3W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','3',0}
 
static const WCHAR assemblyW [] = {'a','s','s','e','m','b','l','y',0}
 
static const WCHAR assemblyIdentityW [] = {'a','s','s','e','m','b','l','y','I','d','e','n','t','i','t','y',0}
 
static const WCHAR bindingRedirectW [] = {'b','i','n','d','i','n','g','R','e','d','i','r','e','c','t',0}
 
static const WCHAR clrClassW [] = {'c','l','r','C','l','a','s','s',0}
 
static const WCHAR clrSurrogateW [] = {'c','l','r','S','u','r','r','o','g','a','t','e',0}
 
static const WCHAR comClassW [] = {'c','o','m','C','l','a','s','s',0}
 
static const WCHAR comInterfaceExternalProxyStubW [] = {'c','o','m','I','n','t','e','r','f','a','c','e','E','x','t','e','r','n','a','l','P','r','o','x','y','S','t','u','b',0}
 
static const WCHAR comInterfaceProxyStubW [] = {'c','o','m','I','n','t','e','r','f','a','c','e','P','r','o','x','y','S','t','u','b',0}
 
static const WCHAR dependencyW [] = {'d','e','p','e','n','d','e','n','c','y',0}
 
static const WCHAR dependentAssemblyW [] = {'d','e','p','e','n','d','e','n','t','A','s','s','e','m','b','l','y',0}
 
static const WCHAR descriptionW [] = {'d','e','s','c','r','i','p','t','i','o','n',0}
 
static const WCHAR fileW [] = {'f','i','l','e',0}
 
static const WCHAR hashW [] = {'h','a','s','h',0}
 
static const WCHAR noInheritW [] = {'n','o','I','n','h','e','r','i','t',0}
 
static const WCHAR noInheritableW [] = {'n','o','I','n','h','e','r','i','t','a','b','l','e',0}
 
static const WCHAR typelibW [] = {'t','y','p','e','l','i','b',0}
 
static const WCHAR windowClassW [] = {'w','i','n','d','o','w','C','l','a','s','s',0}
 
static const WCHAR clsidW [] = {'c','l','s','i','d',0}
 
static const WCHAR hashalgW [] = {'h','a','s','h','a','l','g',0}
 
static const WCHAR helpdirW [] = {'h','e','l','p','d','i','r',0}
 
static const WCHAR iidW [] = {'i','i','d',0}
 
static const WCHAR languageW [] = {'l','a','n','g','u','a','g','e',0}
 
static const WCHAR manifestVersionW [] = {'m','a','n','i','f','e','s','t','V','e','r','s','i','o','n',0}
 
static const WCHAR g_nameW [] = {'n','a','m','e',0}
 
static const WCHAR neutralW [] = {'n','e','u','t','r','a','l',0}
 
static const WCHAR newVersionW [] = {'n','e','w','V','e','r','s','i','o','n',0}
 
static const WCHAR oldVersionW [] = {'o','l','d','V','e','r','s','i','o','n',0}
 
static const WCHAR optionalW [] = {'o','p','t','i','o','n','a','l',0}
 
static const WCHAR processorArchitectureW [] = {'p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e',0}
 
static const WCHAR progidW [] = {'p','r','o','g','i','d',0}
 
static const WCHAR publicKeyTokenW [] = {'p','u','b','l','i','c','K','e','y','T','o','k','e','n',0}
 
static const WCHAR threadingmodelW [] = {'t','h','r','e','a','d','i','n','g','M','o','d','e','l',0}
 
static const WCHAR tlbidW [] = {'t','l','b','i','d',0}
 
static const WCHAR typeW [] = {'t','y','p','e',0}
 
static const WCHAR versionW [] = {'v','e','r','s','i','o','n',0}
 
static const WCHAR xmlnsW [] = {'x','m','l','n','s',0}
 
static const WCHAR versionedW [] = {'v','e','r','s','i','o','n','e','d',0}
 
static const WCHAR yesW [] = {'y','e','s',0}
 
static const WCHAR noW [] = {'n','o',0}
 
static const WCHAR restrictedW [] = {'R','E','S','T','R','I','C','T','E','D',0}
 
static const WCHAR controlW [] = {'C','O','N','T','R','O','L',0}
 
static const WCHAR hiddenW [] = {'H','I','D','D','E','N',0}
 
static const WCHAR hasdiskimageW [] = {'H','A','S','D','I','S','K','I','M','A','G','E',0}
 
static const WCHAR flagsW [] = {'f','l','a','g','s',0}
 
static const WCHAR miscstatusW [] = {'m','i','s','c','S','t','a','t','u','s',0}
 
static const WCHAR miscstatusiconW [] = {'m','i','s','c','S','t','a','t','u','s','I','c','o','n',0}
 
static const WCHAR miscstatuscontentW [] = {'m','i','s','c','S','t','a','t','u','s','C','o','n','t','e','n','t',0}
 
static const WCHAR miscstatusthumbnailW [] = {'m','i','s','c','S','t','a','t','u','s','T','h','u','m','b','n','a','i','l',0}
 
static const WCHAR miscstatusdocprintW [] = {'m','i','s','c','S','t','a','t','u','s','D','o','c','P','r','i','n','t',0}
 
static const WCHAR baseInterfaceW [] = {'b','a','s','e','I','n','t','e','r','f','a','c','e',0}
 
static const WCHAR nummethodsW [] = {'n','u','m','M','e','t','h','o','d','s',0}
 
static const WCHAR proxyStubClsid32W [] = {'p','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0}
 
static const WCHAR runtimeVersionW [] = {'r','u','n','t','i','m','e','V','e','r','s','i','o','n',0}
 
static const WCHAR mscoreeW [] = {'M','S','C','O','R','E','E','.','D','L','L',0}
 
static const WCHAR mscoree2W [] = {'m','s','c','o','r','e','e','.','d','l','l',0}
 
static const WCHAR activatewhenvisibleW [] = {'a','c','t','i','v','a','t','e','w','h','e','n','v','i','s','i','b','l','e',0}
 
static const WCHAR actslikebuttonW [] = {'a','c','t','s','l','i','k','e','b','u','t','t','o','n',0}
 
static const WCHAR actslikelabelW [] = {'a','c','t','s','l','i','k','e','l','a','b','e','l',0}
 
static const WCHAR alignableW [] = {'a','l','i','g','n','a','b','l','e',0}
 
static const WCHAR alwaysrunW [] = {'a','l','w','a','y','s','r','u','n',0}
 
static const WCHAR canlinkbyole1W [] = {'c','a','n','l','i','n','k','b','y','o','l','e','1',0}
 
static const WCHAR cantlinkinsideW [] = {'c','a','n','t','l','i','n','k','i','n','s','i','d','e',0}
 
static const WCHAR ignoreactivatewhenvisibleW [] = {'i','g','n','o','r','e','a','c','t','i','v','a','t','e','w','h','e','n','v','i','s','i','b','l','e',0}
 
static const WCHAR imemodeW [] = {'i','m','e','m','o','d','e',0}
 
static const WCHAR insertnotreplaceW [] = {'i','n','s','e','r','t','n','o','t','r','e','p','l','a','c','e',0}
 
static const WCHAR insideoutW [] = {'i','n','s','i','d','e','o','u','t',0}
 
static const WCHAR invisibleatruntimeW [] = {'i','n','v','i','s','i','b','l','e','a','t','r','u','n','t','i','m','e',0}
 
static const WCHAR islinkobjectW [] = {'i','s','l','i','n','k','o','b','j','e','c','t',0}
 
static const WCHAR nouiactivateW [] = {'n','o','u','i','a','c','t','i','v','a','t','e',0}
 
static const WCHAR onlyiconicW [] = {'o','n','l','y','i','c','o','n','i','c',0}
 
static const WCHAR recomposeonresizeW [] = {'r','e','c','o','m','p','o','s','e','o','n','r','e','s','i','z','e',0}
 
static const WCHAR renderingisdeviceindependentW [] = {'r','e','n','d','e','r','i','n','g','i','s','d','e','v','i','c','e','i','n','d','e','p','e','n','d','e','n','t',0}
 
static const WCHAR setclientsitefirstW [] = {'s','e','t','c','l','i','e','n','t','s','i','t','e','f','i','r','s','t',0}
 
static const WCHAR simpleframeW [] = {'s','i','m','p','l','e','f','r','a','m','e',0}
 
static const WCHAR staticW [] = {'s','t','a','t','i','c',0}
 
static const WCHAR supportsmultilevelundoW [] = {'s','u','p','p','o','r','t','s','m','u','l','t','i','l','e','v','e','l','u','n','d','o',0}
 
static const WCHAR wantstomenumergeW [] = {'w','a','n','t','s','t','o','m','e','n','u','m','e','r','g','e',0}
 
static const WCHAR compatibilityW [] = {'c','o','m','p','a','t','i','b','i','l','i','t','y',0}
 
static const WCHAR compatibilityNSW [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','c','o','m','p','a','t','i','b','i','l','i','t','y','.','v','1',0}
 
static const WCHAR applicationW [] = {'a','p','p','l','i','c','a','t','i','o','n',0}
 
static const WCHAR supportedOSW [] = {'s','u','p','p','o','r','t','e','d','O','S',0}
 
static const WCHAR IdW [] = {'I','d',0}
 
static const WCHAR requestedExecutionLevelW [] = {'r','e','q','u','e','s','t','e','d','E','x','e','c','u','t','i','o','n','L','e','v','e','l',0}
 
static const WCHAR requestedPrivilegesW [] = {'r','e','q','u','e','s','t','e','d','P','r','i','v','i','l','e','g','e','s',0}
 
static const WCHAR securityW [] = {'s','e','c','u','r','i','t','y',0}
 
static const WCHAR trustInfoW [] = {'t','r','u','s','t','I','n','f','o',0}
 
static const WCHAR windowsSettingsW [] = {'w','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}
 
static const WCHAR autoElevateW [] = {'a','u','t','o','E','l','e','v','a','t','e',0}
 
static const WCHAR disableThemingW [] = {'d','i','s','a','b','l','e','T','h','e','m','i','n','g',0}
 
static const WCHAR disableWindowFilteringW [] = {'d','i','s','a','b','l','e','W','i','n','d','o','w','F','i','l','t','e','r','i','n','g',0}
 
static const WCHAR windowsSettings2005NSW [] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}
 
static const WCHAR windowsSettings2011NSW [] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','1','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}
 
static const WCHAR windowsSettings2016NSW [] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','6','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}
 
static const WCHAR windowsSettings2017NSW [] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','7','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0}
 
static const WCHAR dpiAwareW [] = {'d','p','i','A','w','a','r','e',0}
 
static const WCHAR dpiAwarenessW [] = {'d','p','i','A','w','a','r','e','n','e','s','s',0}
 
static const WCHAR gdiScalingW [] = {'g','d','i','S','c','a','l','i','n','g',0}
 
static const WCHAR highResolutionScrollingAwareW [] = {'h','i','g','h','R','e','s','o','l','u','t','i','o','n','S','c','r','o','l','l','i','n','g','A','w','a','r','e',0}
 
static const WCHAR longPathAwareW [] = {'l','o','n','g','P','a','t','h','A','w','a','r','e',0}
 
static const WCHAR magicFutureSettingW [] = {'m','a','g','i','c','F','u','t','u','r','e','S','e','t','t','i','n','g',0}
 
static const WCHAR printerDriverIsolationW [] = {'p','r','i','n','t','e','r','D','r','i','v','e','r','I','s','o','l','a','t','i','o','n',0}
 
static const WCHAR ultraHighResolutionScrollingAwareW [] = {'u','l','t','r','a','H','i','g','h','R','e','s','o','l','u','t','i','o','n','S','c','r','o','l','l','i','n','g','A','w','a','r','e',0}
 
static const struct olemisc_entry olemisc_values []
 
static const WCHAR g_xmlW [] = {'?','x','m','l',0}
 
static const WCHAR manifestv1W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','1',0}
 
static const WCHAR manifestv2W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','2',0}
 
static const WCHAR manifestv3W [] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','a','s','m','.','v','3',0}
 
static const WCHAR dotManifestW [] = {'.','m','a','n','i','f','e','s','t',0}
 
static const WCHAR version_formatW [] = {'%','u','.','%','u','.','%','u','.','%','u',0}
 
static const WCHAR wildcardW [] = {'*',0}
 
static ACTIVATION_CONTEXT_WRAPPED system_actctx = { ACTCTX_MAGIC_MARKER, { 1 } }
 
static ACTIVATION_CONTEXTprocess_actctx = &system_actctx.ActivationContext
 
static ACTIVATION_CONTEXTimplicit_actctx = &system_actctx.ActivationContext
 

Macro Definition Documentation

◆ ACTCTX_FAKE_COOKIE

#define ACTCTX_FAKE_COOKIE   ((ULONG_PTR) 0xf00bad)

Definition at line 44 of file actctx.c.

◆ ACTCTX_FAKE_HANDLE

#define ACTCTX_FAKE_HANDLE   ((HANDLE) 0xf00baa)

Definition at line 43 of file actctx.c.

◆ ACTCTX_FLAGS_ALL

#define ACTCTX_FLAGS_ALL
Value:
(\
ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID |\
ACTCTX_FLAG_LANGID_VALID |\
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID |\
ACTCTX_FLAG_RESOURCE_NAME_VALID |\
ACTCTX_FLAG_SET_PROCESS_DEFAULT |\
ACTCTX_FLAG_APPLICATION_NAME_VALID |\
ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF |\
ACTCTX_FLAG_HMODULE_VALID )

Definition at line 28 of file actctx.c.

◆ ACTCTX_MAGIC_MARKER

#define ACTCTX_MAGIC_MARKER   (PVOID)'gMcA'

Definition at line 41 of file actctx.c.

◆ FIND_ACTCTX_RETURN_ASSEMBLY_METADATA

#define FIND_ACTCTX_RETURN_ASSEMBLY_METADATA   0x00000004

Definition at line 5780 of file actctx.c.

◆ FIND_ACTCTX_RETURN_FLAGS

#define FIND_ACTCTX_RETURN_FLAGS   0x00000002

Definition at line 5779 of file actctx.c.

◆ FIND_ACTCTX_VALID_MASK

#define FIND_ACTCTX_VALID_MASK   (FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX | FIND_ACTCTX_RETURN_FLAGS | FIND_ACTCTX_RETURN_ASSEMBLY_METADATA)

Definition at line 5781 of file actctx.c.

◆ GUIDSECTION_MAGIC

#define GUIDSECTION_MAGIC   0x64487347 /* dHsG */

Definition at line 39 of file actctx.c.

◆ MAX_NAMESPACES

#define MAX_NAMESPACES   64

Definition at line 46 of file actctx.c.

◆ NDEBUG

#define NDEBUG

Definition at line 21 of file actctx.c.

◆ STRSECTION_MAGIC

#define STRSECTION_MAGIC   0x64487353 /* dHsS */

Definition at line 38 of file actctx.c.

Typedef Documentation

◆ ACTIVATION_CONTEXT

◆ ACTIVATION_CONTEXT_WRAPPED

◆ ASSEMBLY_STORAGE_MAP

◆ ASSEMBLY_STORAGE_MAP_ENTRY

◆ PACTIVATION_CONTEXT_WRAPPED

◆ PASSEMBLY_STORAGE_MAP

◆ PASSEMBLY_STORAGE_MAP_ENTRY

◆ PIACTIVATION_CONTEXT

Enumeration Type Documentation

◆ assembly_type

Enumerator
APPLICATION_MANIFEST 
ASSEMBLY_MANIFEST 
ASSEMBLY_SHARED_MANIFEST 

Definition at line 458 of file actctx.c.

459{
463};
@ APPLICATION_MANIFEST
Definition: actctx.c:460
@ ASSEMBLY_SHARED_MANIFEST
Definition: actctx.c:462
@ ASSEMBLY_MANIFEST
Definition: actctx.c:461

◆ comclass_miscfields

Enumerator
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 

Definition at line 184 of file actctx.c.

185{
186 MiscStatus = 1,
187 MiscStatusIcon = 2,
191};
@ MiscStatusContent
Definition: actctx.c:1374
@ MiscStatusThumbnail
Definition: actctx.c:1375
@ MiscStatus
Definition: actctx.c:1372
@ MiscStatusDocPrint
Definition: actctx.c:1376
@ MiscStatusIcon
Definition: actctx.c:1373

◆ comclass_threadingmodel

Enumerator
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 

Definition at line 175 of file actctx.c.

176{
182};
@ ThreadingModel_No
Definition: actctx.c:1366
@ ThreadingModel_Both
Definition: actctx.c:1367
@ ThreadingModel_Neutral
Definition: actctx.c:1368
@ ThreadingModel_Free
Definition: actctx.c:1365
@ ThreadingModel_Apartment
Definition: actctx.c:1364

◆ context_sections

Enumerator
WINDOWCLASS_SECTION 
DLLREDIRECT_SECTION 
TLIBREDIRECT_SECTION 
SERVERREDIRECT_SECTION 
IFACEREDIRECT_SECTION 
CLRSURROGATES_SECTION 
PROGIDREDIRECT_SECTION 

Definition at line 482 of file actctx.c.

483{
491};
@ SERVERREDIRECT_SECTION
Definition: actctx.c:487
@ IFACEREDIRECT_SECTION
Definition: actctx.c:488
@ CLRSURROGATES_SECTION
Definition: actctx.c:489
@ PROGIDREDIRECT_SECTION
Definition: actctx.c:490
@ TLIBREDIRECT_SECTION
Definition: actctx.c:486
@ WINDOWCLASS_SECTION
Definition: actctx.c:484
@ DLLREDIRECT_SECTION
Definition: actctx.c:485

◆ ifaceps_mask

Enumerator
NumMethods 
BaseIface 
NumMethods 
BaseIface 

Definition at line 217 of file actctx.c.

218{
219 NumMethods = 1,
220 BaseIface = 2
221};
@ BaseIface
Definition: actctx.c:1557
@ NumMethods
Definition: actctx.c:1556

Function Documentation

◆ actctx_addref()

static void actctx_addref ( ACTIVATION_CONTEXT actctx)
inlinestatic

Definition at line 1180 of file actctx.c.

1181{
1182 InterlockedExchangeAdd( &actctx->RefCount, 1 );
1183}
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define actctx
Definition: kernel32.h:8

Referenced by find_guid(), find_string(), and RtlAddRefActivationContext().

◆ actctx_init()

void actctx_init ( PVOID pOldShimData)

Definition at line 5075 of file actctx.c.

5076{
5077 ACTCTXW ctx;
5078 HANDLE handle;
5079 WCHAR buffer[1024];
5081
5082 ctx.cbSize = sizeof(ctx);
5083 ctx.lpSource = NULL;
5084 ctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
5085 ctx.hModule = NtCurrentTeb()->ProcessEnvironmentBlock->ImageBaseAddress;
5087
5089 {
5091 }
5092
5093 /* ReactOS specific:
5094 Now that we have found the process_actctx we can initialize the process compat subsystem */
5096
5097
5098 ctx.dwFlags = 0;
5099 ctx.hModule = NULL;
5100 ctx.lpResourceName = NULL;
5101 ctx.lpSource = buffer;
5103
5105 {
5106 RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\forwardcompatible.manifest");
5107 }
5108 else
5109 {
5110 RtlStringCchCatW(buffer, RTL_NUMBER_OF(buffer), L"\\winsxs\\manifests\\systemcompatible.manifest");
5111 }
5112
5114 if (NT_SUCCESS(Status))
5115 {
5117 }
5118 else
5119 {
5120 DPRINT1("Failed to create the implicit act ctx. Status: 0x%x!!!\n", Status);
5121 }
5122}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
static DWORD RosGetProcessCompatVersion(VOID)
Definition: compat_undoc.h:22
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
GLuint buffer
Definition: glext.h:5915
NTSYSAPI NTSTATUS WINAPI RtlCreateActivationContext(HANDLE *, const void *)
#define NtCurrentTeb
VOID NTAPI LdrpInitializeProcessCompat(PVOID pProcessActctx, PVOID *pOldShimData)
Definition: ldrinit.c:1576
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
NTSTRSAFEAPI RtlStringCchCatW(_Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:601
#define L(x)
Definition: ntvdm.h:50
#define SharedUserData
static ACTIVATION_CONTEXT * implicit_actctx
Definition: actctx.c:766
static ACTIVATION_CONTEXT * process_actctx
Definition: actctx.c:765
static ACTIVATION_CONTEXT * check_actctx(HANDLE h)
Definition: actctx.c:1158
#define CREATEPROCESS_MANIFEST_RESOURCE_ID
Definition: winuser.h:621
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by LdrpInitializeProcess().

◆ actctx_release()

static void actctx_release ( ACTIVATION_CONTEXT actctx)
static

Definition at line 1185 of file actctx.c.

1186{
1188
1189 if (InterlockedExchangeAdd(&actctx->RefCount, -1) == 1)
1190 {
1191 unsigned int i, j;
1192
1193 for (i = 0; i < actctx->num_assemblies; i++)
1194 {
1195 struct assembly *assembly = &actctx->assemblies[i];
1196 for (j = 0; j < assembly->num_dlls; j++)
1197 {
1198 struct dll_redirect *dll = &assembly->dlls[j];
1199 free_entity_array( &dll->entities );
1200 RtlFreeHeap( RtlGetProcessHeap(), 0, dll->name );
1201 RtlFreeHeap( RtlGetProcessHeap(), 0, dll->hash );
1202 }
1203 RtlFreeHeap( RtlGetProcessHeap(), 0, assembly->dlls );
1204 RtlFreeHeap( RtlGetProcessHeap(), 0, assembly->manifest.info );
1205 RtlFreeHeap( RtlGetProcessHeap(), 0, assembly->directory );
1206 RtlFreeHeap( RtlGetProcessHeap(), 0, assembly->compat_contexts );
1209 }
1210 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->config.info );
1211 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->appdir.info );
1212 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->assemblies );
1213 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->dllredirect_section );
1214 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->wndclass_section );
1215 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->tlib_section );
1216 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->comserver_section );
1217 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->ifaceps_section );
1218 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->clrsurrogate_section );
1219 RtlFreeHeap( RtlGetProcessHeap(), 0, actctx->progid_section );
1220
1221 pActual = CONTAINING_RECORD(actctx, ACTIVATION_CONTEXT_WRAPPED, ActivationContext);
1222 pActual->MagicMarker = 0;
1223 RtlFreeHeap(RtlGetProcessHeap(), 0, pActual);
1224 }
1225}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static HMODULE dll
Definition: str.c:188
static void free_entity_array(struct entity_array *array)
Definition: actctx.c:952
static void free_assembly_identity(struct assembly_identity *ai)
Definition: actctx.c:915
WCHAR * directory
Definition: actctx.c:470
struct dll_redirect * dlls
Definition: actctx.c:472
struct assembly_identity id
Definition: actctx.c:468
unsigned int num_dlls
Definition: actctx.c:473
struct file_info manifest
Definition: actctx.c:469
struct entity_array entities
Definition: actctx.c:475
COMPATIBILITY_CONTEXT_ELEMENT * compat_contexts
Definition: actctx.c:476
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by RtlCreateActivationContext(), and RtlReleaseActivationContext().

◆ add_assembly()

static struct assembly * add_assembly ( ACTIVATION_CONTEXT actctx,
enum assembly_type  at 
)
static

Definition at line 839 of file actctx.c.

840{
841 struct assembly *assembly;
842
843 DPRINT("add_assembly() actctx %p, activeframe ??\n", actctx);
844
845 if (actctx->num_assemblies == actctx->allocated_assemblies)
846 {
847 void *ptr;
848 unsigned int new_count;
849 if (actctx->assemblies)
850 {
851 new_count = actctx->allocated_assemblies * 2;
852 ptr = RtlReAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
853 actctx->assemblies, new_count * sizeof(*assembly) );
854 }
855 else
856 {
857 new_count = 4;
858 ptr = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, new_count * sizeof(*assembly) );
859 }
860 if (!ptr) return NULL;
861 actctx->assemblies = ptr;
862 actctx->allocated_assemblies = new_count;
863 }
864
865 assembly = &actctx->assemblies[actctx->num_assemblies++];
866 assembly->type = at;
867 return assembly;
868}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
Definition: heap.c:2667
static PVOID ptr
Definition: dispmode.c:27
#define DPRINT
Definition: sndvol32.h:71
BSTR type
Definition: cache.c:326

Referenced by parse_manifest().

◆ add_compat_context()

static PCOMPATIBILITY_CONTEXT_ELEMENT add_compat_context ( struct assembly assembly)
static

Definition at line 896 of file actctx.c.

897{
898 void *ptr;
900 {
901 unsigned int new_count = assembly->num_compat_contexts + 1;
902 ptr = RtlReAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
904 new_count * sizeof(COMPATIBILITY_CONTEXT_ELEMENT) );
905 }
906 else
907 {
908 ptr = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(COMPATIBILITY_CONTEXT_ELEMENT) );
909 }
910 if (!ptr) return NULL;
913}
ULONG num_compat_contexts
Definition: actctx.c:477

Referenced by parse_supportedos_elem().

◆ add_comserver_record()

static _Must_inspect_result_ NTSTATUS add_comserver_record ( const struct guidsection_header section,
const struct entity_array entities,
const struct dll_redirect dll,
struct guid_index **  index,
ULONG data_offset,
ULONG module_offset,
ULONG seed,
ULONG  rosterindex 
)
static

Definition at line 4086 of file actctx.c.

4089{
4090 unsigned int i;
4092
4093 for (i = 0; i < entities->num; i++)
4094 {
4095 struct entity *entity = &entities->base[i];
4096 if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION)
4097 {
4098 ULONG module_len, progid_len, str_len = 0;
4100 struct guid_index *alias_index;
4101 struct clrclass_data *clrdata;
4103 WCHAR *ptrW;
4104
4105 if (entity->u.comclass.progid)
4106 progid_len = strlenW(entity->u.comclass.progid)*sizeof(WCHAR);
4107 else
4108 progid_len = 0;
4109
4110 module_len = dll ? strlenW(dll->name)*sizeof(WCHAR) : strlenW(mscoreeW)*sizeof(WCHAR);
4111
4112 /* setup new index entry */
4114 Status = RtlGUIDFromString(&str, &(*index)->guid);
4115 if (!NT_SUCCESS(Status))
4116 return Status;
4117
4118 (*index)->data_offset = *data_offset;
4119 (*index)->data_len = sizeof(*data); /* additional length added later */
4120 (*index)->rosterindex = rosterindex;
4121
4122 /* Setup new index entry for alias guid. Alias index records are placed after
4123 normal records, so normal guids are hit first on search. Note that class count
4124 is doubled. */
4125 alias_index = (*index) + section->count/2;
4126 generate_uuid(seed, &alias_index->guid);
4127 alias_index->data_offset = (*index)->data_offset;
4128 alias_index->data_len = 0;
4129 alias_index->rosterindex = (*index)->rosterindex;
4130
4131 /* setup data */
4132 data = (struct comclassredirect_data*)((BYTE*)section + (*index)->data_offset);
4133 data->size = sizeof(*data);
4134 data->res = 0;
4135 data->res1[0] = 0;
4136 data->res1[1] = 0;
4137 data->model = entity->u.comclass.model;
4138 data->clsid = (*index)->guid;
4139 data->alias = alias_index->guid;
4140 data->clsid2 = data->clsid;
4141 if (entity->u.comclass.tlbid)
4142 {
4144 Status = RtlGUIDFromString(&str, &data->tlbid);
4145 if (!NT_SUCCESS(Status))
4146 return Status;
4147 }
4148 else
4149 memset(&data->tlbid, 0, sizeof(data->tlbid));
4150 data->name_len = module_len;
4151 data->name_offset = *module_offset;
4152 data->progid_len = progid_len;
4153 data->progid_offset = data->progid_len ? data->size : 0; /* in case of clrClass additional offset is added later */
4154 data->clrdata_len = 0; /* will be set later */
4155 data->clrdata_offset = entity->u.comclass.name ? sizeof(*data) : 0;
4156 data->miscstatus = entity->u.comclass.miscstatus;
4157 data->miscstatuscontent = entity->u.comclass.miscstatuscontent;
4158 data->miscstatusthumbnail = entity->u.comclass.miscstatusthumbnail;
4159 data->miscstatusicon = entity->u.comclass.miscstatusicon;
4160 data->miscstatusdocprint = entity->u.comclass.miscstatusdocprint;
4161
4162 /* mask describes which misc* data is available */
4163 data->miscmask = 0;
4164 if (data->miscstatus)
4165 data->miscmask |= MiscStatus;
4166 if (data->miscstatuscontent)
4167 data->miscmask |= MiscStatusContent;
4168 if (data->miscstatusthumbnail)
4169 data->miscmask |= MiscStatusThumbnail;
4170 if (data->miscstatusicon)
4171 data->miscmask |= MiscStatusIcon;
4172 if (data->miscstatusdocprint)
4173 data->miscmask |= MiscStatusDocPrint;
4174
4175 if (data->clrdata_offset)
4176 {
4177 clrdata = (struct clrclass_data*)((BYTE*)data + data->clrdata_offset);
4178
4179 clrdata->size = sizeof(*clrdata);
4180 clrdata->res[0] = 0;
4181 clrdata->res[1] = 2; /* FIXME: unknown field */
4182 clrdata->module_len = strlenW(mscoreeW)*sizeof(WCHAR);
4183 clrdata->module_offset = *module_offset + data->name_len + sizeof(WCHAR);
4184 clrdata->name_len = strlenW(entity->u.comclass.name)*sizeof(WCHAR);
4185 clrdata->name_offset = clrdata->size;
4186 clrdata->version_len = entity->u.comclass.version ? strlenW(entity->u.comclass.version)*sizeof(WCHAR) : 0;
4187 clrdata->version_offset = clrdata->version_len ? clrdata->name_offset + clrdata->name_len + sizeof(WCHAR) : 0;
4188 clrdata->res2[0] = 0;
4189 clrdata->res2[1] = 0;
4190
4191 data->clrdata_len = clrdata->size + clrdata->name_len + sizeof(WCHAR);
4192
4193 /* module name */
4194 ptrW = (WCHAR*)((BYTE*)section + clrdata->module_offset);
4195 memcpy(ptrW, mscoree2W, clrdata->module_len);
4196 ptrW[clrdata->module_len/sizeof(WCHAR)] = 0;
4197
4198 ptrW = (WCHAR*)((BYTE*)section + data->name_offset);
4199 memcpy(ptrW, mscoreeW, data->name_len);
4200 ptrW[data->name_len/sizeof(WCHAR)] = 0;
4201
4202 /* class name */
4203 ptrW = (WCHAR*)((BYTE*)clrdata + clrdata->name_offset);
4204 memcpy(ptrW, entity->u.comclass.name, clrdata->name_len);
4205 ptrW[clrdata->name_len/sizeof(WCHAR)] = 0;
4206
4207 /* runtime version, optional */
4208 if (clrdata->version_len)
4209 {
4210 data->clrdata_len += clrdata->version_len + sizeof(WCHAR);
4211
4212 ptrW = (WCHAR*)((BYTE*)clrdata + clrdata->version_offset);
4213 memcpy(ptrW, entity->u.comclass.version, clrdata->version_len);
4214 ptrW[clrdata->version_len/sizeof(WCHAR)] = 0;
4215 }
4216
4217 if (data->progid_len)
4218 data->progid_offset += data->clrdata_len;
4219 (*index)->data_len += sizeof(*clrdata);
4220 }
4221 else
4222 {
4223 clrdata = NULL;
4224
4225 /* module name */
4226 ptrW = (WCHAR*)((BYTE*)section + data->name_offset);
4227 memcpy(ptrW, dll->name, data->name_len);
4228 ptrW[data->name_len/sizeof(WCHAR)] = 0;
4229 }
4230
4231 /* progid string */
4232 if (data->progid_len)
4233 {
4234 ptrW = (WCHAR*)((BYTE*)data + data->progid_offset);
4235 memcpy(ptrW, entity->u.comclass.progid, data->progid_len);
4236 ptrW[data->progid_len/sizeof(WCHAR)] = 0;
4237 }
4238
4239 /* string block length */
4240 str_len = 0;
4241 if (clrdata)
4242 {
4243 str_len += clrdata->name_len + sizeof(WCHAR);
4244 if (clrdata->version_len)
4245 str_len += clrdata->version_len + sizeof(WCHAR);
4246 }
4247 if (progid_len)
4248 str_len += progid_len + sizeof(WCHAR);
4249
4250 (*index)->data_len += aligned_string_len(str_len);
4251 alias_index->data_len = (*index)->data_len;
4252
4253 /* move to next data record */
4254 (*data_offset) += sizeof(*data) + aligned_string_len(str_len);
4255 (*module_offset) += module_len + sizeof(WCHAR);
4256
4257 if (clrdata)
4258 {
4259 (*data_offset) += sizeof(*clrdata);
4260 (*module_offset) += clrdata->module_len + sizeof(WCHAR);
4261 }
4262 (*index) += 1;
4263 }
4264 }
4265
4266 return STATUS_SUCCESS;
4267}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define strlenW(s)
Definition: unicode.h:28
const WCHAR * str
#define memset(x, y, z)
Definition: compat.h:39
static int aligned_string_len(int len)
Definition: actctx.c:1958
static const WCHAR mscoree2W[]
Definition: actctx.c:672
static void generate_uuid(ULONG *seed, GUID *guid)
Definition: actctx.c:4020
static const WCHAR mscoreeW[]
Definition: actctx.c:671
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG module_len
Definition: sxs.c:92
DWORD res2[2]
Definition: sxs.c:98
DWORD res[2]
Definition: sxs.c:91
ULONG size
Definition: sxs.c:90
ULONG version_offset
Definition: sxs.c:97
ULONG name_offset
Definition: sxs.c:95
ULONG module_offset
Definition: sxs.c:93
ULONG name_len
Definition: sxs.c:94
ULONG version_len
Definition: sxs.c:96
unsigned int num
Definition: actctx.c:447
struct entity * base
Definition: actctx.c:446
Definition: actctx.c:388
struct entity::@4767::@4769 comclass
union entity::@4767 u
DWORD kind
Definition: actctx.c:389
GUID guid
Definition: actctx.c:1083
ULONG rosterindex
Definition: actctx.c:1086
ULONG data_offset
Definition: actctx.c:1084
ULONG data_len
Definition: actctx.c:1085
Definition: parser.c:56
#define str_len
Definition: treelist.c:89
uint32_t ULONG
Definition: typedefs.h:59
unsigned char BYTE
Definition: xxhash.c:193

Referenced by build_comserver_section().

◆ add_dependent_assembly_id()

static BOOL add_dependent_assembly_id ( struct actctx_loader acl,
struct assembly_identity ai 
)
static

Definition at line 1022 of file actctx.c.

1024{
1025 unsigned int i;
1026
1027 /* check if we already have that assembly */
1028
1029 for (i = 0; i < acl->actctx->num_assemblies; i++)
1030 if (is_matching_identity( ai, &acl->actctx->assemblies[i].id ))
1031 {
1032 DPRINT( "reusing existing assembly for %S arch %S version %u.%u.%u.%u\n",
1033 ai->name, ai->arch, ai->version.major, ai->version.minor,
1034 ai->version.build, ai->version.revision );
1035 return TRUE;
1036 }
1037
1038 for (i = 0; i < acl->num_dependencies; i++)
1039 if (is_matching_identity( ai, &acl->dependencies[i] ))
1040 {
1041 DPRINT( "reusing existing dependency for %S arch %S version %u.%u.%u.%u\n",
1042 ai->name, ai->arch, ai->version.major, ai->version.minor,
1043 ai->version.build, ai->version.revision );
1044 return TRUE;
1045 }
1046
1048 {
1049 void *ptr;
1050 unsigned int new_count;
1051 if (acl->dependencies)
1052 {
1053 new_count = acl->allocated_dependencies * 2;
1054 ptr = RtlReAllocateHeap(RtlGetProcessHeap(), 0, acl->dependencies,
1055 new_count * sizeof(acl->dependencies[0]));
1056 }
1057 else
1058 {
1059 new_count = 4;
1060 ptr = RtlAllocateHeap(RtlGetProcessHeap(), 0, new_count * sizeof(acl->dependencies[0]));
1061 }
1062 if (!ptr) return FALSE;
1063 acl->dependencies = ptr;
1064 acl->allocated_dependencies = new_count;
1065 }
1066 acl->dependencies[acl->num_dependencies++] = *ai;
1067
1068 return TRUE;
1069}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL is_matching_identity(const struct assembly_identity *id1, const struct assembly_identity *id2)
Definition: actctx.c:1002
struct assembly * assemblies
Definition: actctx.c:523
unsigned int num_assemblies
Definition: actctx.c:524
unsigned int allocated_dependencies
Definition: actctx.c:542
struct assembly_identity * dependencies
Definition: actctx.c:540
unsigned int num_dependencies
Definition: actctx.c:541
ACTIVATION_CONTEXT * actctx
Definition: actctx.c:539
WCHAR * name
Definition: actctx.c:92
WCHAR * arch
Definition: actctx.c:93
struct assembly_version version
Definition: actctx.c:97

Referenced by parse_dependent_assembly_elem().

◆ add_dll_redirect()

static struct dll_redirect * add_dll_redirect ( struct assembly assembly)
static

Definition at line 870 of file actctx.c.

871{
872 DPRINT("add_dll_redirect() to assembly %p, num_dlls %d\n", assembly, assembly->allocated_dlls);
873
875 {
876 void *ptr;
877 unsigned int new_count;
878 if (assembly->dlls)
879 {
880 new_count = assembly->allocated_dlls * 2;
881 ptr = RtlReAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
882 assembly->dlls, new_count * sizeof(*assembly->dlls) );
883 }
884 else
885 {
886 new_count = 4;
887 ptr = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, new_count * sizeof(*assembly->dlls) );
888 }
889 if (!ptr) return NULL;
890 assembly->dlls = ptr;
891 assembly->allocated_dlls = new_count;
892 }
893 return &assembly->dlls[assembly->num_dlls++];
894}
unsigned int allocated_dlls
Definition: actctx.c:474

Referenced by parse_file_elem().

◆ add_entity()

static struct entity * add_entity ( struct entity_array array,
DWORD  kind 
)
static

Definition at line 924 of file actctx.c.

925{
926 struct entity* entity;
927
928 if (array->num == array->allocated)
929 {
930 void *ptr;
931 unsigned int new_count;
932 if (array->base)
933 {
934 new_count = array->allocated * 2;
935 ptr = RtlReAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
936 array->base, new_count * sizeof(*array->base) );
937 }
938 else
939 {
940 new_count = 4;
941 ptr = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, new_count * sizeof(*array->base) );
942 }
943 if (!ptr) return NULL;
944 array->base = ptr;
945 array->allocated = new_count;
946 }
947 entity = &array->base[array->num++];
948 entity->kind = kind;
949 return entity;
950}
unsigned num
Definition: undname.c:60

Referenced by parse_add_interface_class(), parse_clr_class_elem(), parse_clr_surrogate_elem(), parse_com_class_elem(), parse_com_interface_external_proxy_stub_elem(), parse_cominterface_proxy_stub_elem(), parse_settings_elem(), parse_typelib_elem(), and parse_window_class_elem().

◆ add_ifaceps_record()

static _Must_inspect_result_ NTSTATUS add_ifaceps_record ( struct guidsection_header section,
struct entity_array entities,
struct guid_index **  index,
ULONG data_offset,
ULONG  rosterindex 
)
static

Definition at line 4403 of file actctx.c.

4405{
4406 unsigned int i;
4407
4408 for (i = 0; i < entities->num; i++)
4409 {
4410 struct entity *entity = &entities->base[i];
4411 if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION)
4412 {
4413 struct ifacepsredirect_data *data = (struct ifacepsredirect_data*)((BYTE*)section + *data_offset);
4417
4418 if (entity->u.ifaceps.name)
4419 name_len = strlenW(entity->u.ifaceps.name)*sizeof(WCHAR);
4420 else
4421 name_len = 0;
4422
4423 /* setup index */
4425 Status = RtlGUIDFromString(&str, &(*index)->guid);
4426 if (!NT_SUCCESS(Status))
4427 return Status;
4428 (*index)->data_offset = *data_offset;
4429 (*index)->data_len = sizeof(*data) + name_len ? aligned_string_len(name_len + sizeof(WCHAR)) : 0;
4430 (*index)->rosterindex = rosterindex;
4431
4432 /* setup data record */
4433 data->size = sizeof(*data);
4434 data->mask = entity->u.ifaceps.mask;
4435
4436 /* proxyStubClsid32 value is only stored for external PS,
4437 if set it's used as iid, otherwise 'iid' attribute value is used */
4438 if (entity->u.ifaceps.ps32)
4439 {
4441 Status = RtlGUIDFromString(&str, &data->iid);
4442 if (!NT_SUCCESS(Status))
4443 return Status;
4444 }
4445 else
4446 data->iid = (*index)->guid;
4447
4448 data->nummethods = entity->u.ifaceps.nummethods;
4449
4450 if (entity->u.ifaceps.tlib)
4451 {
4453 Status = RtlGUIDFromString(&str, &data->tlbid);
4454 if (!NT_SUCCESS(Status))
4455 return Status;
4456 }
4457 else
4458 memset(&data->tlbid, 0, sizeof(data->tlbid));
4459
4460 if (entity->u.ifaceps.base)
4461 {
4463 Status = RtlGUIDFromString(&str, &data->base);
4464 if (!NT_SUCCESS(Status))
4465 return Status;
4466 }
4467 else
4468 memset(&data->base, 0, sizeof(data->base));
4469
4470 data->name_len = name_len;
4471 data->name_offset = data->name_len ? sizeof(*data) : 0;
4472
4473 /* name string */
4474 if (data->name_len)
4475 {
4476 WCHAR *ptrW = (WCHAR*)((BYTE*)data + data->name_offset);
4477 memcpy(ptrW, entity->u.ifaceps.name, data->name_len);
4478 ptrW[data->name_len/sizeof(WCHAR)] = 0;
4479 }
4480
4481 /* move to next record */
4482 (*index) += 1;
4483 *data_offset += sizeof(*data);
4484 if (data->name_len)
4485 *data_offset += aligned_string_len(data->name_len + sizeof(WCHAR));
4486 }
4487 }
4488
4489 return STATUS_SUCCESS;
4490}
struct entity::@4767::@4770 ifaceps

Referenced by build_ifaceps_section().

◆ add_progid_record()

static _Must_inspect_result_ NTSTATUS add_progid_record ( ACTIVATION_CONTEXT actctx,
struct strsection_header section,
const struct entity_array entities,
struct string_index **  index,
ULONG data_offset,
ULONG global_offset,
ULONG  rosterindex 
)
static

Definition at line 4838 of file actctx.c.

4840{
4841 unsigned int i, j;
4843
4844 for (i = 0; i < entities->num; i++)
4845 {
4846 struct entity *entity = &entities->base[i];
4847 if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION)
4848 {
4849 const struct progids *progids = &entity->u.comclass.progids;
4850 struct comclassredirect_data *comclass;
4851 struct guid_index *guid_index;
4853 GUID clsid;
4854
4857 if (!NT_SUCCESS(Status))
4858 return Status;
4859
4860 guid_index = find_guid_index(actctx->comserver_section, &clsid);
4861 comclass = get_comclass_data(actctx, guid_index);
4862
4863 if (entity->u.comclass.progid)
4864 write_progid_record(section, entity->u.comclass.progid, &comclass->alias,
4865 index, data_offset, global_offset, rosterindex);
4866
4867 for (j = 0; j < progids->num; j++)
4869 index, data_offset, global_offset, rosterindex);
4870 }
4871 }
4872 return Status;
4873}
GLuint index
Definition: glext.h:6031
REFCLSID clsid
Definition: msctf.c:82
static void write_progid_record(struct strsection_header *section, const WCHAR *progid, const GUID *alias, struct string_index **index, ULONG *data_offset, ULONG *global_offset, ULONG rosterindex)
Definition: actctx.c:4792
static struct comclassredirect_data * get_comclass_data(ACTIVATION_CONTEXT *actctx, struct guid_index *index)
Definition: actctx.c:4335
static struct guid_index * find_guid_index(const struct guidsection_header *section, const GUID *guid)
Definition: actctx.c:3560
WCHAR ** progids
Definition: actctx.c:382
unsigned int num
Definition: actctx.c:383

Referenced by build_progid_section().

◆ aligned_string_len()

◆ append_string()

static void append_string ( WCHAR buffer,
const WCHAR prefix,
const WCHAR str 
)
inlinestatic

Definition at line 1110 of file actctx.c.

1111{
1112 WCHAR *p = buffer;
1113
1114 if (!str) return;
1115 strcatW( buffer, prefix );
1116 p += strlenW(p);
1117 *p++ = '"';
1118 strcpyW( p, str );
1119 p += strlenW(p);
1120 *p++ = '"';
1121 *p = 0;
1122}
GLfloat GLfloat p
Definition: glext.h:8902
#define strcatW(d, s)
Definition: unicode.h:30
#define strcpyW(d, s)
Definition: unicode.h:29

Referenced by build_assembly_id().

◆ build_assembly_dir()

static WCHAR * build_assembly_dir ( struct assembly_identity ai)
static

Definition at line 1079 of file actctx.c.

1080{
1081 static const WCHAR undW[] = {'_',0};
1082 static const WCHAR noneW[] = {'n','o','n','e',0};
1083 static const WCHAR mskeyW[] = {'d','e','a','d','b','e','e','f',0};
1084
1085 const WCHAR *arch = ai->arch ? ai->arch : noneW;
1086 const WCHAR *key = ai->public_key ? ai->public_key : noneW;
1087 const WCHAR *lang = ai->language ? ai->language : noneW;
1088 const WCHAR *name = ai->name ? ai->name : noneW;
1089 SIZE_T size = (strlenW(arch) + 1 + strlenW(name) + 1 + strlenW(key) + 24 + 1 +
1090 strlenW(lang) + 1) * sizeof(WCHAR) + sizeof(mskeyW);
1091 WCHAR *ret;
1092
1093 if (!(ret = RtlAllocateHeap( RtlGetProcessHeap(), 0, size ))) return NULL;
1094
1095 strcpyW( ret, arch );
1096 strcatW( ret, undW );
1097 strcatW( ret, name );
1098 strcatW( ret, undW );
1099 strcatW( ret, key );
1100 strcatW( ret, undW );
1102 ai->version.major, ai->version.minor, ai->version.build, ai->version.revision );
1103 strcatW( ret, undW );
1104 strcatW( ret, lang );
1105 strcatW( ret, undW );
1106 strcatW( ret, mskeyW );
1107 return ret;
1108}
GLsizeiptr size
Definition: glext.h:5919
#define sprintfW
Definition: unicode.h:58
static const WCHAR version_formatW[]
Definition: actctx.c:761
WCHAR * public_key
Definition: actctx.c:94
WCHAR * language
Definition: actctx.c:95
Definition: copy.c:22
Definition: name.c:39
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static const WCHAR lang[]
Definition: wbemdisp.c:287
int ret

Referenced by lookup_assembly().

◆ build_assembly_id()

static WCHAR * build_assembly_id ( const struct assembly_identity ai)
static

Definition at line 1124 of file actctx.c.

1125{
1126 static const WCHAR archW[] =
1127 {',','p','r','o','c','e','s','s','o','r','A','r','c','h','i','t','e','c','t','u','r','e','=',0};
1128 static const WCHAR public_keyW[] =
1129 {',','p','u','b','l','i','c','K','e','y','T','o','k','e','n','=',0};
1130 static const WCHAR typeW2[] =
1131 {',','t','y','p','e','=',0};
1132 static const WCHAR versionW2[] =
1133 {',','v','e','r','s','i','o','n','=',0};
1134
1135 WCHAR version[64], *ret;
1136 SIZE_T size = 0;
1137
1139 ai->version.major, ai->version.minor, ai->version.build, ai->version.revision );
1140 if (ai->name) size += strlenW(ai->name) * sizeof(WCHAR);
1141 if (ai->arch) size += strlenW(archW) + strlenW(ai->arch) + 2;
1142 if (ai->public_key) size += strlenW(public_keyW) + strlenW(ai->public_key) + 2;
1143 if (ai->type) size += strlenW(typeW2) + strlenW(ai->type) + 2;
1144 size += strlenW(versionW2) + strlenW(version) + 2;
1145
1146 if (!(ret = RtlAllocateHeap( RtlGetProcessHeap(), 0, (size + 1) * sizeof(WCHAR) )))
1147 return NULL;
1148
1149 if (ai->name) strcpyW( ret, ai->name );
1150 else *ret = 0;
1151 append_string( ret, archW, ai->arch );
1152 append_string( ret, public_keyW, ai->public_key );
1153 append_string( ret, typeW2, ai->type );
1154 append_string( ret, versionW2, version );
1155 return ret;
1156}
static const WCHAR version[]
Definition: asmname.c:66
static const WCHAR archW[]
Definition: name.c:49
static void append_string(WCHAR *buffer, const WCHAR *prefix, const WCHAR *str)
Definition: actctx.c:1110
WCHAR * type
Definition: actctx.c:96

Referenced by RtlQueryInformationActivationContext().

◆ build_clr_surrogate_section()

static _Must_inspect_result_ NTSTATUS build_clr_surrogate_section ( ACTIVATION_CONTEXT actctx,
struct guidsection_header **  section 
)
static

Definition at line 4606 of file actctx.c.

4607{
4608 unsigned int i, j, total_len = 0, count = 0;
4609 struct guidsection_header *header;
4610 struct clrsurrogate_data *data;
4611 struct guid_index *index;
4613
4614 /* compute section length */
4615 for (i = 0; i < actctx->num_assemblies; i++)
4616 {
4617 struct assembly *assembly = &actctx->assemblies[i];
4618 for (j = 0; j < assembly->entities.num; j++)
4619 {
4620 struct entity *entity = &assembly->entities.base[j];
4621 if (entity->kind == ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES)
4622 {
4623 ULONG len;
4624
4625 total_len += sizeof(*index) + sizeof(*data);
4626 len = strlenW(entity->u.clrsurrogate.name) + 1;
4627 if (entity->u.clrsurrogate.version)
4628 len += strlenW(entity->u.clrsurrogate.version) + 1;
4629 total_len += aligned_string_len(len*sizeof(WCHAR));
4630
4631 count++;
4632 }
4633 }
4634 }
4635
4636 total_len += sizeof(*header);
4637
4638 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
4639 if (!header) return STATUS_NO_MEMORY;
4640
4641 memset(header, 0, sizeof(*header));
4642 header->magic = GUIDSECTION_MAGIC;
4643 header->size = sizeof(*header);
4644 header->count = count;
4645 header->index_offset = sizeof(*header);
4646 index = (struct guid_index*)((BYTE*)header + header->index_offset);
4647 data_offset = header->index_offset + count*sizeof(*index);
4648
4649 for (i = 0; i < actctx->num_assemblies; i++)
4650 {
4651 struct assembly *assembly = &actctx->assemblies[i];
4652 for (j = 0; j < assembly->entities.num; j++)
4653 {
4654 struct entity *entity = &assembly->entities.base[j];
4655 if (entity->kind == ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES)
4656 {
4657 ULONG version_len, name_len;
4659 WCHAR *ptrW;
4661
4662 if (entity->u.clrsurrogate.version)
4663 version_len = strlenW(entity->u.clrsurrogate.version)*sizeof(WCHAR);
4664 else
4665 version_len = 0;
4666 name_len = strlenW(entity->u.clrsurrogate.name)*sizeof(WCHAR);
4667
4668 /* setup new index entry */
4670 Status = RtlGUIDFromString(&str, &index->guid);
4671 if (!NT_SUCCESS(Status))
4672 {
4673 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4674 return Status;
4675 }
4676
4677 index->data_offset = data_offset;
4678 index->data_len = sizeof(*data) + aligned_string_len(name_len + sizeof(WCHAR) + (version_len ? version_len + sizeof(WCHAR) : 0));
4679 index->rosterindex = i + 1;
4680
4681 /* setup data */
4682 data = (struct clrsurrogate_data*)((BYTE*)header + index->data_offset);
4683 data->size = sizeof(*data);
4684 data->res = 0;
4685 data->clsid = index->guid;
4686 data->version_offset = version_len ? data->size : 0;
4687 data->version_len = version_len;
4688 data->name_offset = data->size + version_len;
4689 if (version_len)
4690 data->name_offset += sizeof(WCHAR);
4691 data->name_len = name_len;
4692
4693 /* surrogate name */
4694 ptrW = (WCHAR*)((BYTE*)data + data->name_offset);
4695 memcpy(ptrW, entity->u.clrsurrogate.name, data->name_len);
4696 ptrW[data->name_len/sizeof(WCHAR)] = 0;
4697
4698 /* runtime version */
4699 if (data->version_len)
4700 {
4701 ptrW = (WCHAR*)((BYTE*)data + data->version_offset);
4702 memcpy(ptrW, entity->u.clrsurrogate.version, data->version_len);
4703 ptrW[data->version_len/sizeof(WCHAR)] = 0;
4704 }
4705
4706 data_offset += index->data_offset;
4707 index++;
4708 }
4709 }
4710 }
4711
4712 *section = header;
4713
4714 return STATUS_SUCCESS;
4715}
#define index(s, c)
Definition: various.h:29
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define GUIDSECTION_MAGIC
Definition: actctx.c:39
ULONG version_len
Definition: actctx.c:1638
struct entity::@4767::@4772 clrsurrogate

Referenced by find_clr_surrogate().

◆ build_comserver_section()

static _Must_inspect_result_ NTSTATUS build_comserver_section ( ACTIVATION_CONTEXT actctx,
struct guidsection_header **  section 
)
static

Definition at line 4272 of file actctx.c.

4273{
4274 unsigned int i, j, total_len = 0, class_count = 0, names_len = 0;
4275 struct guidsection_header *header;
4276 ULONG module_offset, data_offset;
4277 struct guid_index *index;
4278 ULONG seed;
4280
4281 /* compute section length */
4282 for (i = 0; i < actctx->num_assemblies; i++)
4283 {
4284 struct assembly *assembly = &actctx->assemblies[i];
4285 get_comserver_datalen(&assembly->entities, NULL, &class_count, &total_len, &names_len);
4286 for (j = 0; j < assembly->num_dlls; j++)
4287 {
4288 struct dll_redirect *dll = &assembly->dlls[j];
4289 get_comserver_datalen(&dll->entities, dll, &class_count, &total_len, &names_len);
4290 }
4291 }
4292
4293 total_len += aligned_string_len(names_len);
4294 total_len += sizeof(*header);
4295
4296 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
4297 if (!header) return STATUS_NO_MEMORY;
4298
4299 memset(header, 0, sizeof(*header));
4300 header->magic = GUIDSECTION_MAGIC;
4301 header->size = sizeof(*header);
4302 header->count = 2*class_count;
4303 header->index_offset = sizeof(*header) + aligned_string_len(names_len);
4304 index = (struct guid_index*)((BYTE*)header + header->index_offset);
4305 module_offset = sizeof(*header);
4306 data_offset = header->index_offset + 2*class_count*sizeof(*index);
4307
4308 seed = NtGetTickCount();
4309 for (i = 0; i < actctx->num_assemblies; i++)
4310 {
4311 struct assembly *assembly = &actctx->assemblies[i];
4312 Status = add_comserver_record(header, &assembly->entities, NULL, &index, &data_offset, &module_offset, &seed, i+1);
4313 if (!NT_SUCCESS(Status))
4314 {
4315 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4316 return Status;
4317 }
4318 for (j = 0; j < assembly->num_dlls; j++)
4319 {
4320 struct dll_redirect *dll = &assembly->dlls[j];
4321 Status = add_comserver_record(header, &dll->entities, dll, &index, &data_offset, &module_offset, &seed, i+1);
4322 if (!NT_SUCCESS(Status))
4323 {
4324 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4325 return Status;
4326 }
4327 }
4328 }
4329
4330 *section = header;
4331
4332 return STATUS_SUCCESS;
4333}
#define NtGetTickCount
Definition: rtlp.h:163
static _Must_inspect_result_ NTSTATUS add_comserver_record(const struct guidsection_header *section, const struct entity_array *entities, const struct dll_redirect *dll, struct guid_index **index, ULONG *data_offset, ULONG *module_offset, ULONG *seed, ULONG rosterindex)
Definition: actctx.c:4086
static void get_comserver_datalen(const struct entity_array *entities, const struct dll_redirect *dll, unsigned int *count, unsigned int *len, unsigned int *module_len)
Definition: actctx.c:4035

Referenced by find_comserver_redirection(), and find_progid_redirection().

◆ build_dllredirect_section()

static NTSTATUS build_dllredirect_section ( ACTIVATION_CONTEXT actctx,
struct strsection_header **  section 
)
static

Definition at line 3438 of file actctx.c.

3439{
3440 unsigned int i, j, total_len = 0, dll_count = 0;
3441 struct strsection_header *header;
3442 struct dllredirect_data *data;
3443 struct string_index *index;
3445
3446 DPRINT("actctx %p, num_assemblies %d\n", actctx, actctx->num_assemblies);
3447
3448 /* compute section length */
3449 for (i = 0; i < actctx->num_assemblies; i++)
3450 {
3451 struct assembly *assembly = &actctx->assemblies[i];
3452 for (j = 0; j < assembly->num_dlls; j++)
3453 {
3454 struct dll_redirect *dll = &assembly->dlls[j];
3455
3456 /* each entry needs index, data and string data */
3457 total_len += sizeof(*index);
3458 total_len += sizeof(*data);
3459 total_len += aligned_string_len((strlenW(dll->name)+1)*sizeof(WCHAR));
3460
3461 DPRINT("assembly %d (%p), dll %d: dll name %S\n", i, assembly, j, dll->name);
3462 }
3463
3465 }
3466
3467 total_len += sizeof(*header);
3468
3469 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
3470 if (!header) return STATUS_NO_MEMORY;
3471
3472 memset(header, 0, sizeof(*header));
3473 header->magic = STRSECTION_MAGIC;
3474 header->size = sizeof(*header);
3475 header->count = dll_count;
3476 header->index_offset = sizeof(*header);
3477 index = (struct string_index*)((BYTE*)header + header->index_offset);
3478 name_offset = header->index_offset + header->count*sizeof(*index);
3479
3480 for (i = 0; i < actctx->num_assemblies; i++)
3481 {
3482 struct assembly *assembly = &actctx->assemblies[i];
3483
3484 DPRINT("assembly->num_dlls %d\n", assembly->num_dlls);
3485
3486 for (j = 0; j < assembly->num_dlls; j++)
3487 {
3488 struct dll_redirect *dll = &assembly->dlls[j];
3490 WCHAR *ptrW;
3491
3492 DPRINT("%d: dll name %S\n", j, dll->name);
3493 /* setup new index entry */
3494 str.Buffer = dll->name;
3495 str.Length = (USHORT)strlenW(dll->name)*sizeof(WCHAR);
3496 str.MaximumLength = str.Length + sizeof(WCHAR);
3497 /* hash original class name */
3499
3500 index->name_offset = name_offset;
3501 index->name_len = str.Length;
3502 index->data_offset = index->name_offset + aligned_string_len(str.MaximumLength);
3503 index->data_len = sizeof(*data);
3504 index->rosterindex = i + 1;
3505
3506 /* setup data */
3507 data = (struct dllredirect_data*)((BYTE*)header + index->data_offset);
3508 data->size = sizeof(*data);
3509 data->unk = 2; /* FIXME: seems to be constant */
3510 memset(data->res, 0, sizeof(data->res));
3511
3512 /* dll name */
3513 ptrW = (WCHAR*)((BYTE*)header + index->name_offset);
3514 memcpy(ptrW, dll->name, index->name_len);
3515 ptrW[index->name_len/sizeof(WCHAR)] = 0;
3516
3517 name_offset += sizeof(*data) + aligned_string_len(str.MaximumLength);
3518
3519 index++;
3520 }
3521 }
3522
3523 *section = header;
3524
3525 return STATUS_SUCCESS;
3526}
LONG dll_count
Definition: itss.c:49
#define HASH_STRING_ALGORITHM_X65599
Definition: rtlstr.c:33
NTSYSAPI NTSTATUS NTAPI RtlHashUnicodeString(_In_ CONST UNICODE_STRING *String, _In_ BOOLEAN CaseInSensitive, _In_ ULONG HashAlgorithm, _Out_ PULONG HashValue)
unsigned short USHORT
Definition: pedump.c:61
#define STRSECTION_MAGIC
Definition: actctx.c:38
ULONG name_offset
Definition: actctx.c:1062

Referenced by find_dll_redirection().

◆ build_ifaceps_section()

static _Must_inspect_result_ NTSTATUS build_ifaceps_section ( ACTIVATION_CONTEXT actctx,
struct guidsection_header **  section 
)
static

Definition at line 4495 of file actctx.c.

4496{
4497 unsigned int i, j, total_len = 0, count = 0;
4498 struct guidsection_header *header;
4499 struct guid_index *index;
4501
4502 /* compute section length */
4503 for (i = 0; i < actctx->num_assemblies; i++)
4504 {
4505 struct assembly *assembly = &actctx->assemblies[i];
4506
4507 get_ifaceps_datalen(&assembly->entities, &count, &total_len);
4508 for (j = 0; j < assembly->num_dlls; j++)
4509 {
4510 struct dll_redirect *dll = &assembly->dlls[j];
4511 get_ifaceps_datalen(&dll->entities, &count, &total_len);
4512 }
4513 }
4514
4515 total_len += sizeof(*header);
4516
4517 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
4518 if (!header) return STATUS_NO_MEMORY;
4519
4520 memset(header, 0, sizeof(*header));
4521 header->magic = GUIDSECTION_MAGIC;
4522 header->size = sizeof(*header);
4523 header->count = count;
4524 header->index_offset = sizeof(*header);
4525 index = (struct guid_index*)((BYTE*)header + header->index_offset);
4526 data_offset = header->index_offset + count*sizeof(*index);
4527
4528 for (i = 0; i < actctx->num_assemblies; i++)
4529 {
4530 struct assembly *assembly = &actctx->assemblies[i];
4532
4533 Status = add_ifaceps_record(header, &assembly->entities, &index, &data_offset, i + 1);
4534 if (!NT_SUCCESS(Status))
4535 {
4536 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4537 return Status;
4538 }
4539
4540 for (j = 0; j < assembly->num_dlls; j++)
4541 {
4542 struct dll_redirect *dll = &assembly->dlls[j];
4543 Status = add_ifaceps_record(header, &dll->entities, &index, &data_offset, i + 1);
4544 if (!NT_SUCCESS(Status))
4545 {
4546 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4547 return Status;
4548 }
4549 }
4550 }
4551
4552 *section = header;
4553
4554 return STATUS_SUCCESS;
4555}
static void get_ifaceps_datalen(const struct entity_array *entities, unsigned int *count, unsigned int *len)
Definition: actctx.c:4383
static _Must_inspect_result_ NTSTATUS add_ifaceps_record(struct guidsection_header *section, struct entity_array *entities, struct guid_index **index, ULONG *data_offset, ULONG rosterindex)
Definition: actctx.c:4403

Referenced by find_cominterface_redirection().

◆ build_progid_section()

static _Must_inspect_result_ NTSTATUS build_progid_section ( ACTIVATION_CONTEXT actctx,
struct strsection_header **  section 
)
static

Definition at line 4878 of file actctx.c.

4879{
4880 unsigned int i, j, total_len = 0, count = 0;
4881 struct strsection_header *header;
4882 ULONG data_offset, global_offset;
4883 struct string_index *index;
4885
4886 /* compute section length */
4887 for (i = 0; i < actctx->num_assemblies; i++)
4888 {
4889 struct assembly *assembly = &actctx->assemblies[i];
4890
4891 get_progid_datalen(&assembly->entities, &count, &total_len);
4892 for (j = 0; j < assembly->num_dlls; j++)
4893 {
4894 struct dll_redirect *dll = &assembly->dlls[j];
4895 get_progid_datalen(&dll->entities, &count, &total_len);
4896 }
4897 }
4898
4899 total_len += sizeof(*header);
4900
4901 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
4902 if (!header) return STATUS_NO_MEMORY;
4903
4904 memset(header, 0, sizeof(*header));
4905 header->magic = STRSECTION_MAGIC;
4906 header->size = sizeof(*header);
4907 header->count = count;
4908 header->global_offset = header->size;
4909 header->global_len = count*sizeof(GUID);
4910 header->index_offset = header->size + header->global_len;
4911
4912 index = (struct string_index*)((BYTE*)header + header->index_offset);
4913 data_offset = header->index_offset + count*sizeof(*index);
4914 global_offset = header->global_offset;
4915
4916 for (i = 0; i < actctx->num_assemblies; i++)
4917 {
4918 struct assembly *assembly = &actctx->assemblies[i];
4919
4920 Status = add_progid_record(actctx, header, &assembly->entities, &index, &data_offset, &global_offset, i + 1);
4921 if (!NT_SUCCESS(Status))
4922 {
4923 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4924 return Status;
4925 }
4926
4927 for (j = 0; j < assembly->num_dlls; j++)
4928 {
4929 struct dll_redirect *dll = &assembly->dlls[j];
4930 Status = add_progid_record(actctx, header, &dll->entities, &index, &data_offset, &global_offset, i + 1);
4931 if (!NT_SUCCESS(Status))
4932 {
4933 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
4934 return Status;
4935 }
4936 }
4937 }
4938
4939 *section = header;
4940
4941 return STATUS_SUCCESS;
4942}
static _Must_inspect_result_ NTSTATUS add_progid_record(ACTIVATION_CONTEXT *actctx, struct strsection_header *section, const struct entity_array *entities, struct string_index **index, ULONG *data_offset, ULONG *global_offset, ULONG rosterindex)
Definition: actctx.c:4838
static void get_progid_datalen(struct entity_array *entities, unsigned int *count, unsigned int *total_len)
Definition: actctx.c:4767
ULONG data_offset
Definition: actctx.c:1064

Referenced by find_progid_redirection().

◆ build_tlib_section()

static _Must_inspect_result_ NTSTATUS build_tlib_section ( ACTIVATION_CONTEXT actctx,
struct guidsection_header **  section 
)
static

Definition at line 3846 of file actctx.c.

3847{
3848 unsigned int i, j, k, total_len = 0, tlib_count = 0, names_len = 0;
3849 struct guidsection_header *header;
3850 ULONG module_offset, data_offset;
3851 struct tlibredirect_data *data;
3852 struct guid_index *index;
3853
3854 /* compute section length */
3855 for (i = 0; i < actctx->num_assemblies; i++)
3856 {
3857 struct assembly *assembly = &actctx->assemblies[i];
3858 for (j = 0; j < assembly->num_dlls; j++)
3859 {
3860 struct dll_redirect *dll = &assembly->dlls[j];
3861 for (k = 0; k < dll->entities.num; k++)
3862 {
3863 struct entity *entity = &dll->entities.base[k];
3864 if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION)
3865 {
3866 /* each entry needs index, data and string data for module name and help string */
3867 total_len += sizeof(*index);
3868 total_len += sizeof(*data);
3869 /* help string is stored separately */
3870 if (*entity->u.typelib.helpdir)
3871 total_len += aligned_string_len((strlenW(entity->u.typelib.helpdir)+1)*sizeof(WCHAR));
3872
3873 /* module names are packed one after another */
3874 names_len += (strlenW(dll->name)+1)*sizeof(WCHAR);
3875
3876 tlib_count++;
3877 }
3878 }
3879 }
3880 }
3881
3882 total_len += aligned_string_len(names_len);
3883 total_len += sizeof(*header);
3884
3885 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
3886 if (!header) return STATUS_NO_MEMORY;
3887
3888 memset(header, 0, sizeof(*header));
3889 header->magic = GUIDSECTION_MAGIC;
3890 header->size = sizeof(*header);
3891 header->count = tlib_count;
3892 header->index_offset = sizeof(*header) + aligned_string_len(names_len);
3893 index = (struct guid_index*)((BYTE*)header + header->index_offset);
3894 module_offset = sizeof(*header);
3895 data_offset = header->index_offset + tlib_count*sizeof(*index);
3896
3897 for (i = 0; i < actctx->num_assemblies; i++)
3898 {
3899 struct assembly *assembly = &actctx->assemblies[i];
3900 for (j = 0; j < assembly->num_dlls; j++)
3901 {
3902 struct dll_redirect *dll = &assembly->dlls[j];
3903 for (k = 0; k < dll->entities.num; k++)
3904 {
3905 struct entity *entity = &dll->entities.base[k];
3906 if (entity->kind == ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION)
3907 {
3908 ULONG module_len, help_len;
3910 WCHAR *ptrW;
3912
3913 if (*entity->u.typelib.helpdir)
3914 help_len = strlenW(entity->u.typelib.helpdir)*sizeof(WCHAR);
3915 else
3916 help_len = 0;
3917
3918 module_len = strlenW(dll->name)*sizeof(WCHAR);
3919
3920 /* setup new index entry */
3922 Status = RtlGUIDFromString(&str, &index->guid);
3923 if (!NT_SUCCESS(Status))
3924 {
3925 RtlFreeHeap(RtlGetProcessHeap(), 0, header);
3926 return Status;
3927 }
3928 index->data_offset = data_offset;
3929 index->data_len = sizeof(*data) + aligned_string_len(help_len);
3930 index->rosterindex = i + 1;
3931
3932 /* setup data */
3933 data = (struct tlibredirect_data*)((BYTE*)header + index->data_offset);
3934 data->size = sizeof(*data);
3935 data->res = 0;
3936 data->name_len = module_len;
3937 data->name_offset = module_offset;
3938 /* FIXME: resourceid handling is really weird, and it doesn't seem to be useful */
3939 data->langid = 0;
3940 data->flags = entity->u.typelib.flags;
3941 data->help_len = help_len;
3942 data->help_offset = sizeof(*data);
3943 data->major_version = entity->u.typelib.major;
3944 data->minor_version = entity->u.typelib.minor;
3945
3946 /* module name */
3947 ptrW = (WCHAR*)((BYTE*)header + data->name_offset);
3948 memcpy(ptrW, dll->name, data->name_len);
3949 ptrW[data->name_len/sizeof(WCHAR)] = 0;
3950
3951 /* help string */
3952 if (data->help_len)
3953 {
3954 ptrW = (WCHAR*)((BYTE*)data + data->help_offset);
3955 memcpy(ptrW, entity->u.typelib.helpdir, data->help_len);
3956 ptrW[data->help_len/sizeof(WCHAR)] = 0;
3957 }
3958
3959 data_offset += sizeof(*data);
3960 if (help_len)
3961 data_offset += aligned_string_len(help_len + sizeof(WCHAR));
3962
3963 module_offset += module_len + sizeof(WCHAR);
3964
3965 index++;
3966 }
3967 }
3968 }
3969 }
3970
3971 *section = header;
3972
3973 return STATUS_SUCCESS;
3974}
int k
Definition: mpi.c:3369
struct entity::@4767::@4768 typelib
ULONG help_len
Definition: oleaut.c:795

Referenced by find_tlib_redirection().

◆ build_wndclass_section()

static NTSTATUS build_wndclass_section ( ACTIVATION_CONTEXT actctx,
struct strsection_header **  section 
)
static

Definition at line 3640 of file actctx.c.

3641{
3642 unsigned int i, j, k, total_len = 0, class_count = 0;
3644 struct strsection_header *header;
3645 struct string_index *index;
3647
3648 /* compute section length */
3649 for (i = 0; i < actctx->num_assemblies; i++)
3650 {
3651 struct assembly *assembly = &actctx->assemblies[i];
3652 for (j = 0; j < assembly->num_dlls; j++)
3653 {
3654 struct dll_redirect *dll = &assembly->dlls[j];
3655 for (k = 0; k < dll->entities.num; k++)
3656 {
3657 struct entity *entity = &dll->entities.base[k];
3658 if (entity->kind == ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION)
3659 {
3660 int class_len = strlenW(entity->u.class.name) + 1;
3661 int len;
3662
3663 /* each class entry needs index, data and string data */
3664 total_len += sizeof(*index);
3665 total_len += sizeof(*data);
3666 /* original name is stored separately */
3667 total_len += aligned_string_len(class_len*sizeof(WCHAR));
3668 /* versioned name and module name are stored one after another */
3669 if (entity->u.class.versioned)
3670 len = get_assembly_version(assembly, NULL) + class_len + 1 /* '!' separator */;
3671 else
3672 len = class_len;
3673 len += strlenW(dll->name) + 1;
3674 total_len += aligned_string_len(len*sizeof(WCHAR));
3675
3676 class_count++;
3677 }
3678 }
3679 }
3680 }
3681
3682 total_len += sizeof(*header);
3683
3684 header = RtlAllocateHeap(RtlGetProcessHeap(), 0, total_len);
3685 if (!header) return STATUS_NO_MEMORY;
3686
3687 memset(header, 0, sizeof(*header));
3688 header->magic = STRSECTION_MAGIC;
3689 header->size = sizeof(*header);
3690 header->count = class_count;
3691 header->index_offset = sizeof(*header);
3692 index = (struct string_index*)((BYTE*)header + header->index_offset);
3693 name_offset = header->index_offset + header->count*sizeof(*index);
3694
3695 for (i = 0; i < actctx->num_assemblies; i++)
3696 {
3697 struct assembly *assembly = &actctx->assemblies[i];
3698 for (j = 0; j < assembly->num_dlls; j++)
3699 {
3700 struct dll_redirect *dll = &assembly->dlls[j];
3701 for (k = 0; k < dll->entities.num; k++)
3702 {
3703 struct entity *entity = &dll->entities.base[k];
3704 if (entity->kind == ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION)
3705 {
3706 static const WCHAR exclW[] = {'!',0};
3707 ULONG versioned_len, module_len;
3709 WCHAR *ptrW;
3710
3711 /* setup new index entry */
3712 str.Buffer = entity->u.class.name;
3713 str.Length = (USHORT)strlenW(entity->u.class.name)*sizeof(WCHAR);
3714 str.MaximumLength = str.Length + sizeof(WCHAR);
3715 /* hash original class name */
3717
3718 /* include '!' separator too */
3719 if (entity->u.class.versioned)
3720 versioned_len = (get_assembly_version(assembly, NULL) + 1)*sizeof(WCHAR) + str.Length;
3721 else
3722 versioned_len = str.Length;
3723 module_len = strlenW(dll->name)*sizeof(WCHAR);
3724
3725 index->name_offset = name_offset;
3726 index->name_len = str.Length;
3727 index->data_offset = index->name_offset + aligned_string_len(str.MaximumLength);
3728 index->data_len = sizeof(*data) + versioned_len + module_len + 2*sizeof(WCHAR) /* two nulls */;
3729 index->rosterindex = i + 1;
3730
3731 /* setup data */
3732 data = (struct wndclass_redirect_data*)((BYTE*)header + index->data_offset);
3733 data->size = sizeof(*data);
3734 data->res = 0;
3735 data->name_len = versioned_len;
3736 data->name_offset = sizeof(*data);
3737 data->module_len = module_len;
3738 data->module_offset = index->data_offset + data->name_offset + data->name_len + sizeof(WCHAR);
3739
3740 /* original class name */
3741 ptrW = (WCHAR*)((BYTE*)header + index->name_offset);
3742 memcpy(ptrW, entity->u.class.name, index->name_len);
3743 ptrW[index->name_len/sizeof(WCHAR)] = 0;
3744
3745 /* module name */
3746 ptrW = (WCHAR*)((BYTE*)header + data->module_offset);
3747 memcpy(ptrW, dll->name, data->module_len);
3748 ptrW[data->module_len/sizeof(WCHAR)] = 0;
3749
3750 /* versioned name */
3751 ptrW = (WCHAR*)((BYTE*)data + data->name_offset);
3752 if (entity->u.class.versioned)
3753 {
3755 strcatW(ptrW, exclW);
3756 strcatW(ptrW, entity->u.class.name);
3757 }
3758 else
3759 {
3760 memcpy(ptrW, entity->u.class.name, index->name_len);
3761 ptrW[index->name_len/sizeof(WCHAR)] = 0;
3762 }
3763
3764 name_offset += sizeof(*data);
3765 name_offset += aligned_string_len(str.MaximumLength) + aligned_string_len(versioned_len + module_len + 2*sizeof(WCHAR));
3766
3767 index++;
3768 }
3769 }
3770 }
3771 }
3772
3773 *section = header;
3774
3775 return STATUS_SUCCESS;
3776}
static int get_assembly_version(struct assembly *assembly, WCHAR *ret)
Definition: actctx.c:1963
struct entity::@4767::@4771 class

Referenced by find_window_class().

◆ check_actctx()

static ACTIVATION_CONTEXT * check_actctx ( HANDLE  h)
static

Definition at line 1158 of file actctx.c.

1159{
1162
1163 if (!h || h == INVALID_HANDLE_VALUE) return NULL;
1164 _SEH2_TRY
1165 {
1166 if (actctx)
1167 {
1168 pActual = CONTAINING_RECORD(actctx, ACTIVATION_CONTEXT_WRAPPED, ActivationContext);
1169 if (pActual->MagicMarker == ACTCTX_MAGIC_MARKER) ret = &pActual->ActivationContext;
1170 }
1171 }
1173 {
1174 DPRINT1("Invalid activation context handle!\n");
1175 }
1176 _SEH2_END;
1177 return ret;
1178}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define ACTCTX_MAGIC_MARKER
Definition: actctx.c:41
ACTIVATION_CONTEXT ActivationContext
Definition: actctx.c:566

Referenced by actctx_init(), RtlAddRefActivationContext(), RtlFindActivationContextSectionGuid(), RtlFindActivationContextSectionString(), RtlQueryInformationActivationContext(), and RtlReleaseActivationContext().

◆ com_class_add_progid()

static BOOL com_class_add_progid ( const xmlstr_t progid,
struct entity entity 
)
static

Definition at line 1635 of file actctx.c.

1636{
1637 struct progids *progids = &entity->u.comclass.progids;
1638
1639 if (progids->allocated == 0)
1640 {
1641 progids->allocated = 4;
1642 if (!(progids->progids = RtlAllocateHeap(RtlGetProcessHeap(), 0, progids->allocated * sizeof(WCHAR*)))) return FALSE;
1643 }
1644
1645 if (progids->allocated == progids->num)
1646 {
1647 WCHAR **new_progids = RtlReAllocateHeap(RtlGetProcessHeap(), 0, progids->progids,
1648 2 * progids->allocated * sizeof(WCHAR*));
1649 if (!new_progids) return FALSE;
1650 progids->allocated *= 2;
1651 progids->progids = new_progids;
1652 }
1653
1654 if (!(progids->progids[progids->num] = xmlstrdupW(progid))) return FALSE;
1655 progids->num++;
1656
1657 return TRUE;
1658}
#define progid(str)
Definition: exdisp.idl:31
static WCHAR * xmlstrdupW(const xmlstr_t *str)
Definition: actctx.c:777
unsigned int allocated
Definition: actctx.c:384

Referenced by parse_com_class_progid().

◆ find_clr_surrogate()

static _Must_inspect_result_ NTSTATUS find_clr_surrogate ( ACTIVATION_CONTEXT actctx,
const GUID guid,
ACTCTX_SECTION_KEYED_DATA *  data 
)
static

Definition at line 4725 of file actctx.c.

4726{
4727 struct clrsurrogate_data *surrogate;
4728 struct guid_index *index = NULL;
4729
4730 if (!(actctx->sections & CLRSURROGATES_SECTION)) return STATUS_SXS_KEY_NOT_FOUND;
4731
4732 if (!actctx->clrsurrogate_section)
4733 {
4735
4737 if (status) return status;
4738
4739 if (InterlockedCompareExchangePointer((void**)&actctx->clrsurrogate_section, section, NULL))
4740 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
4741 }
4742
4743 index = find_guid_index(actctx->clrsurrogate_section, guid);
4744 if (!index) return STATUS_SXS_KEY_NOT_FOUND;
4745
4746 surrogate = get_surrogate_data(actctx, index);
4747
4748 data->ulDataFormatVersion = 1;
4749 data->lpData = surrogate;
4750 /* full length includes string length with nulls */
4751 data->ulLength = surrogate->size + surrogate->name_len + sizeof(WCHAR);
4752 if (surrogate->version_len)
4753 data->ulLength += surrogate->version_len + sizeof(WCHAR);
4754
4755 data->lpSectionGlobalData = NULL;
4756 data->ulSectionGlobalDataLength = 0;
4757 data->lpSectionBase = actctx->clrsurrogate_section;
4758 data->ulSectionTotalLength = RtlSizeHeap( RtlGetProcessHeap(), 0, actctx->clrsurrogate_section );
4759 data->hActCtx = NULL;
4760
4761 if (data->cbSize >= FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex) + sizeof(ULONG))
4762 data->ulAssemblyRosterIndex = index->rosterindex;
4763
4764 return STATUS_SUCCESS;
4765}
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
const GUID * guid
NTSYSAPI SIZE_T NTAPI RtlSizeHeap(_In_ PVOID HeapHandle, _In_ ULONG Flags, _In_ PVOID MemoryPointer)
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1389
static _Must_inspect_result_ NTSTATUS build_clr_surrogate_section(ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
Definition: actctx.c:4606
static struct clrsurrogate_data * get_surrogate_data(ACTIVATION_CONTEXT *actctx, const struct guid_index *index)
Definition: actctx.c:4717
Definition: ps.c:97
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by find_guid().

◆ find_cominterface_redirection()

static _Must_inspect_result_ NTSTATUS find_cominterface_redirection ( ACTIVATION_CONTEXT actctx,
const GUID guid,
ACTCTX_SECTION_KEYED_DATA *  data 
)
static

Definition at line 4565 of file actctx.c.

4566{
4567 struct ifacepsredirect_data *iface;
4568 struct guid_index *index = NULL;
4569
4570 if (!(actctx->sections & IFACEREDIRECT_SECTION)) return STATUS_SXS_KEY_NOT_FOUND;
4571
4572 if (!actctx->ifaceps_section)
4573 {
4575
4577 if (status) return status;
4578
4579 if (InterlockedCompareExchangePointer((void**)&actctx->ifaceps_section, section, NULL))
4580 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
4581 }
4582
4583 index = find_guid_index(actctx->ifaceps_section, guid);
4584 if (!index) return STATUS_SXS_KEY_NOT_FOUND;
4585
4586 iface = get_ifaceps_data(actctx, index);
4587
4588 data->ulDataFormatVersion = 1;
4589 data->lpData = iface;
4590 data->ulLength = iface->size + (iface->name_len ? iface->name_len + sizeof(WCHAR) : 0);
4591 data->lpSectionGlobalData = NULL;
4592 data->ulSectionGlobalDataLength = 0;
4593 data->lpSectionBase = actctx->ifaceps_section;
4594 data->ulSectionTotalLength = RtlSizeHeap( RtlGetProcessHeap(), 0, actctx->ifaceps_section );
4595 data->hActCtx = NULL;
4596
4597 if (data->cbSize >= FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex) + sizeof(ULONG))
4598 data->ulAssemblyRosterIndex = index->rosterindex;
4599
4600 return STATUS_SUCCESS;
4601}
static struct ifacepsredirect_data * get_ifaceps_data(ACTIVATION_CONTEXT *actctx, struct guid_index *index)
Definition: actctx.c:4557
static _Must_inspect_result_ NTSTATUS build_ifaceps_section(ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
Definition: actctx.c:4495

Referenced by find_guid().

◆ find_comserver_redirection()

static _Must_inspect_result_ NTSTATUS find_comserver_redirection ( ACTIVATION_CONTEXT actctx,
const GUID guid,
ACTCTX_SECTION_KEYED_DATA *  data 
)
static

Definition at line 4343 of file actctx.c.

4344{
4345 struct comclassredirect_data *comclass;
4346 struct guid_index *index = NULL;
4347
4348 if (!(actctx->sections & SERVERREDIRECT_SECTION)) return STATUS_SXS_KEY_NOT_FOUND;
4349
4350 if (!actctx->comserver_section)
4351 {
4353
4355 if (status) return status;
4356
4357 if (InterlockedCompareExchangePointer((void**)&actctx->comserver_section, section, NULL))
4358 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
4359 }
4360
4361 index = find_guid_index(actctx->comserver_section, guid);
4362 if (!index) return STATUS_SXS_KEY_NOT_FOUND;
4363
4364 comclass = get_comclass_data(actctx, index);
4365
4366 data->ulDataFormatVersion = 1;
4367 data->lpData = comclass;
4368 /* full length includes string length with nulls */
4369 data->ulLength = comclass->size + comclass->clrdata_len;
4370 if (comclass->progid_len) data->ulLength += comclass->progid_len + sizeof(WCHAR);
4371 data->lpSectionGlobalData = (BYTE*)actctx->comserver_section + actctx->comserver_section->names_offset;
4372 data->ulSectionGlobalDataLength = actctx->comserver_section->names_len;
4373 data->lpSectionBase = actctx->comserver_section;
4374 data->ulSectionTotalLength = RtlSizeHeap( RtlGetProcessHeap(), 0, actctx->comserver_section );
4375 data->hActCtx = NULL;
4376
4377 if (data->cbSize >= FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex) + sizeof(ULONG))
4378 data->ulAssemblyRosterIndex = index->rosterindex;
4379
4380 return STATUS_SUCCESS;
4381}
static _Must_inspect_result_ NTSTATUS build_comserver_section(ACTIVATION_CONTEXT *actctx, struct guidsection_header **section)
Definition: actctx.c:4272

Referenced by find_guid().

◆ find_dll_redirection()

static NTSTATUS find_dll_redirection ( ACTIVATION_CONTEXT actctx,
const UNICODE_STRING name,
PACTCTX_SECTION_KEYED_DATA  data 
)
static

Definition at line 3585 of file actctx.c.

3587{
3588 struct dllredirect_data *dll;
3589 struct string_index *index;
3590
3591 DPRINT("sections: 0x%08X\n", actctx->sections);
3592 if (!(actctx->sections & DLLREDIRECT_SECTION)) return STATUS_SXS_KEY_NOT_FOUND;
3593
3594 DPRINT("actctx->dllredirect_section: %p\n", actctx->dllredirect_section);
3595 if (!actctx->dllredirect_section)
3596 {
3597 struct strsection_header *section;
3598
3600 if (status) return status;
3601
3602 if (InterlockedCompareExchangePointer((void**)&actctx->dllredirect_section, section, NULL))
3603 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
3604 }
3605
3606 index = find_string_index(actctx->dllredirect_section, name);
3607 DPRINT("index: %d\n", index);
3608 if (!index) return STATUS_SXS_KEY_NOT_FOUND;
3609
3610 if (data)
3611 {
3613
3614 data->ulDataFormatVersion = 1;
3615 data->lpData = dll;
3616 data->ulLength = dll->size;
3617 data->lpSectionGlobalData = NULL;
3618 data->ulSectionGlobalDataLength = 0;
3619 data->lpSectionBase = actctx->dllredirect_section;
3620 data->ulSectionTotalLength = RtlSizeHeap( RtlGetProcessHeap(), 0, actctx->dllredirect_section );
3621 data->hActCtx = NULL;
3622
3623 if (data->cbSize >= FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex) + sizeof(ULONG))
3624 data->ulAssemblyRosterIndex = index->rosterindex;
3625 }
3626
3627 return STATUS_SUCCESS;
3628}
static NTSTATUS build_dllredirect_section(ACTIVATION_CONTEXT *actctx, struct strsection_header **section)
Definition: actctx.c:3438
static struct dllredirect_data * get_dllredirect_data(ACTIVATION_CONTEXT *ctxt, struct string_index *index)
Definition: actctx.c:3580
static struct string_index * find_string_index(const struct strsection_header *section, const UNICODE_STRING *name)
Definition: actctx.c:3528

Referenced by find_string().

◆ find_entry_by_name()

IMAGE_RESOURCE_DIRECTORY * find_entry_by_name ( IMAGE_RESOURCE_DIRECTORY dir,
LPCWSTR  name,
void root,
int  want_dir 
)

Definition at line 130 of file res.c.

133{
136 int min, max, res, pos;
137 size_t namelen;
138
139 if (!((ULONG_PTR)name & 0xFFFF0000)) return find_entry_by_id( dir, (ULONG_PTR)name & 0xFFFF, root, want_dir );
142 min = 0;
143 max = dir->NumberOfNamedEntries - 1;
144 while (min <= max)
145 {
146 pos = (min + max) / 2;
147 str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].NameOffset);
148 res = _wcsnicmp( name, str->NameString, str->Length );
149 if (!res && namelen == str->Length)
150 {
151 if (!entry[pos].DataIsDirectory == !want_dir)
152 {
153 DPRINT("root %p dir %p name %ws ret %p\n",
154 root, dir, name, (const char*)root + entry[pos].OffsetToDirectory);
155 return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].OffsetToDirectory);
156 }
157 break;
158 }
159 if (res < 0) max = pos - 1;
160 else min = pos + 1;
161 }
162 DPRINT("root %p dir %p name %ws not found\n", root, dir, name);
163 return NULL;
164}
unsigned int dir
Definition: maze.c:112
GLuint res
Definition: glext.h:9613
GLint namelen
Definition: glext.h:7232
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
uint32_t entry
Definition: isohybrid.c:63
#define min(a, b)
Definition: monoChain.cc:55
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(IMAGE_RESOURCE_DIRECTORY *dir, WORD id, void *root, int want_dir)
Definition: res.c:95
Definition: pedump.c:414
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by search_manifest_in_module().

◆ find_first_entry()

IMAGE_RESOURCE_DIRECTORY * find_first_entry ( IMAGE_RESOURCE_DIRECTORY dir,
void root,
int  want_dir 
)

Definition at line 75 of file res.c.

77{
79 int pos;
80
81 for (pos = 0; pos < dir->NumberOfNamedEntries + dir->NumberOfIdEntries; pos++)
82 {
83 if (!entry[pos].DataIsDirectory == !want_dir)
84 return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].OffsetToDirectory);
85 }
86 return NULL;
87}

Referenced by search_manifest_in_module().

◆ find_first_id_entry()

static IMAGE_RESOURCE_DIRECTORY * find_first_id_entry ( IMAGE_RESOURCE_DIRECTORY dir,
void root,
int  want_dir 
)
static

Definition at line 2928 of file actctx.c.

2930{
2932 int pos;
2933
2934 for (pos = dir->NumberOfNamedEntries; pos < dir->NumberOfNamedEntries + dir->NumberOfIdEntries; pos++)
2935 {
2936 if (!entry[pos].DataIsDirectory == !want_dir)
2937 return (IMAGE_RESOURCE_DIRECTORY *)((char *)root + entry[pos].OffsetToDirectory);
2938 }
2939 return NULL;
2940}

Referenced by search_manifest_in_module().

◆ find_guid()

static NTSTATUS find_guid ( ACTIVATION_CONTEXT actctx,
ULONG  section_kind,
const GUID guid,
DWORD  flags,
PACTCTX_SECTION_KEYED_DATA  data 
)
static

Definition at line 5040 of file actctx.c.

5042{
5044
5045 switch (section_kind)
5046 {
5047 case ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION:
5049 break;
5050 case ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION:
5052 break;
5053 case ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION:
5055 break;
5056 case ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES:
5058 break;
5059 default:
5060 DPRINT("Unknown section_kind %x\n", section_kind);
5062 }
5063
5064 if (status != STATUS_SUCCESS) return status;
5065
5066 if (flags & FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX)
5067 {
5069 data->hActCtx = actctx;
5070 }
5071 return STATUS_SUCCESS;
5072}
GLbitfield flags
Definition: glext.h:7161
#define STATUS_SXS_SECTION_NOT_FOUND
Definition: ntstatus.h:1382
static _Must_inspect_result_ NTSTATUS find_clr_surrogate(ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
Definition: actctx.c:4725
static void actctx_addref(ACTIVATION_CONTEXT *actctx)
Definition: actctx.c:1180
static _Must_inspect_result_ NTSTATUS find_cominterface_redirection(ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
Definition: actctx.c:4565
static _Must_inspect_result_ NTSTATUS find_comserver_redirection(ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
Definition: actctx.c:4343
static NTSTATUS find_tlib_redirection(ACTIVATION_CONTEXT *actctx, const GUID *guid, ACTCTX_SECTION_KEYED_DATA *data)
Definition: actctx.c:3981

Referenced by RtlFindActivationContextSectionGuid().

◆ find_guid_index()

static struct guid_index * find_guid_index ( const struct guidsection_header section,
const GUID guid 
)
static

Definition at line 3560 of file actctx.c.

3561{
3562 struct guid_index *iter, *index = NULL;
3563 ULONG i;
3564
3565 iter = (struct guid_index*)((BYTE*)section + section->index_offset);
3566
3567 for (i = 0; i < section->count; i++)
3568 {
3569 if (!memcmp(guid, &iter->guid, sizeof(*guid)))
3570 {
3571 index = iter;
3572 break;
3573 }
3574 iter++;
3575 }
3576
3577 return index;
3578}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112

Referenced by add_progid_record(), find_clr_surrogate(), find_cominterface_redirection(), find_comserver_redirection(), and find_tlib_redirection().

◆ find_progid_redirection()

static NTSTATUS find_progid_redirection ( ACTIVATION_CONTEXT actctx,
const UNICODE_STRING name,
PACTCTX_SECTION_KEYED_DATA  data 
)
static

Definition at line 4949 of file actctx.c.

4951{
4953 struct string_index *index;
4954
4955 if (!(actctx->sections & PROGIDREDIRECT_SECTION)) return STATUS_SXS_KEY_NOT_FOUND;
4956
4957 if (!actctx->comserver_section)
4958 {
4960
4962 if (status) return status;
4963
4964 if (InterlockedCompareExchangePointer((void**)&actctx->comserver_section, section, NULL))
4965 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
4966 }
4967
4968 if (!actctx->progid_section)
4969 {
4970 struct strsection_header *section;
4971
4973 if (status) return status;
4974
4975 if (InterlockedCompareExchangePointer((void**)&actctx->progid_section, section, NULL))
4976 RtlFreeHeap(RtlGetProcessHeap(), 0, section);
4977 }
4978
4979 index = find_string_index(actctx->progid_section, name);
4980 if (!index) return STATUS_SXS_KEY_NOT_FOUND;
4981
4982 if (data)
4983 {
4985
4986 data->ulDataFormatVersion = 1;
4987 data->lpData = progid;
4988 data->ulLength = progid->size;
4989 data->lpSectionGlobalData = (BYTE*)actctx->progid_section + actctx->progid_section->global_offset;
4990 data->ulSectionGlobalDataLength = actctx->progid_section->global_len;
4991 data->lpSectionBase = actctx->progid_section;
4992 data->ulSectionTotalLength = RtlSizeHeap( RtlGetProcessHeap(), 0, actctx->progid_section );
4993 data->hActCtx = NULL;
4994
4995 if (data->cbSize >= FIELD_OFFSET(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex) + sizeof(ULONG))
4996 data->ulAssemblyRosterIndex = index->rosterindex;
4997 }
4998
4999 return STATUS_SUCCESS;
5000}
static struct progidredirect_data * get_progid_data(ACTIVATION_CONTEXT *actctx, const struct string_index *index)
Definition: actctx.c:4944
static _Must_inspect_result_ NTSTATUS build_progid_section(ACTIVATION_CONTEXT *actctx, struct strsection_header **section)
Definition: actctx.c:4878

Referenced by find_string().

◆ find_query_actctx()

static NTSTATUS find_query_actctx ( HANDLE handle,
DWORD  flags,
ULONG  class 
)
static

Definition at line 3403 of file actctx.c.

3404{
3406
3407 if (