ReactOS  0.4.14-dev-1007-g90d795b
sxs.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/heap.h"
#include "wine/debug.h"
Include dependency graph for sxs.c:

Go to the source code of this file.

Classes

struct  _SXS_GUID_INFORMATION_CLR
 
struct  comclassredirect_data
 
struct  clrclass_data
 

Macros

#define SXS_GUID_INFORMATION_CLR_FLAG_IS_SURROGATE   0x1
 
#define SXS_GUID_INFORMATION_CLR_FLAG_IS_CLASS   0x2
 
#define SXS_LOOKUP_CLR_GUID_USE_ACTCTX   0x00000001
 
#define SXS_LOOKUP_CLR_GUID_FIND_SURROGATE   0x00010000
 
#define SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS   0x00020000
 

Typedefs

typedef struct _SXS_GUID_INFORMATION_CLR SXS_GUID_INFORMATION_CLR
 
typedef struct _SXS_GUID_INFORMATION_CLRPSXS_GUID_INFORMATION_CLR
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (sxs)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
BOOL WINAPI SxsLookupClrGuid (DWORD flags, GUID *clsid, HANDLE actctx, void *buffer, SIZE_T buffer_len, SIZE_T *buffer_len_required)
 

Macro Definition Documentation

◆ SXS_GUID_INFORMATION_CLR_FLAG_IS_CLASS

#define SXS_GUID_INFORMATION_CLR_FLAG_IS_CLASS   0x2

Definition at line 58 of file sxs.c.

◆ SXS_GUID_INFORMATION_CLR_FLAG_IS_SURROGATE

#define SXS_GUID_INFORMATION_CLR_FLAG_IS_SURROGATE   0x1

Definition at line 57 of file sxs.c.

◆ SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS

#define SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS   0x00020000

Definition at line 62 of file sxs.c.

◆ SXS_LOOKUP_CLR_GUID_FIND_SURROGATE

#define SXS_LOOKUP_CLR_GUID_FIND_SURROGATE   0x00010000

Definition at line 61 of file sxs.c.

◆ SXS_LOOKUP_CLR_GUID_USE_ACTCTX

#define SXS_LOOKUP_CLR_GUID_USE_ACTCTX   0x00000001

Definition at line 60 of file sxs.c.

Typedef Documentation

◆ PSXS_GUID_INFORMATION_CLR

◆ SXS_GUID_INFORMATION_CLR

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 35 of file sxs.c.

36 {
37  switch(fdwReason)
38  {
39  case DLL_WINE_PREATTACH:
40  return FALSE; /* prefer native version */
41  case DLL_PROCESS_ATTACH:
42  DisableThreadLibraryCalls( hinstDLL );
43  break;
44  }
45  return TRUE;
46 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120

◆ SxsLookupClrGuid()

BOOL WINAPI SxsLookupClrGuid ( DWORD  flags,
GUID clsid,
HANDLE  actctx,
void buffer,
SIZE_T  buffer_len,
SIZE_T buffer_len_required 
)

Definition at line 101 of file sxs.c.

103 {
104  ACTCTX_SECTION_KEYED_DATA guid_info = { sizeof(ACTCTX_SECTION_KEYED_DATA) };
105  ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *assembly_info;
106  SIZE_T bytes_assembly_info;
107  struct comclassredirect_data *redirect_data;
108  struct clrclass_data *class_data;
109  int len_version = 0, len_name, len_identity;
110  const void *ptr_name, *ptr_version, *ptr_identity;
112  char *ret_strings;
113 
114  TRACE("(%x, %s, %p, %p, %08lx, %p): stub\n", flags, wine_dbgstr_guid(clsid), actctx,
115  buffer, buffer_len, buffer_len_required);
116 
118  FIXME("Ignored flags: %x\n", flags & ~SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS);
119 
120  if (!FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, 0,
121  ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, clsid, &guid_info))
122  {
124  return FALSE;
125  }
126 
127  QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex,
128  AssemblyDetailedInformationInActivationContext, NULL, 0, &bytes_assembly_info);
130  {
131  ReleaseActCtx(guid_info.hActCtx);
132  return FALSE;
133  }
134  assembly_info = heap_alloc(bytes_assembly_info);
135  if(!QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex,
136  AssemblyDetailedInformationInActivationContext, assembly_info,
137  bytes_assembly_info, &bytes_assembly_info))
138  {
139  heap_free(assembly_info);
140  ReleaseActCtx(guid_info.hActCtx);
141  return FALSE;
142  }
143 
144  redirect_data = guid_info.lpData;
145  class_data = (void *)((char*)redirect_data + redirect_data->clrdata_offset);
146 
147  ptr_identity = assembly_info->lpAssemblyEncodedAssemblyIdentity;
148  ptr_name = (char *)class_data + class_data->name_offset;
149  ptr_version = (char *)class_data + class_data->version_offset;
150 
151  len_identity = assembly_info->ulEncodedAssemblyIdentityLength + sizeof(WCHAR);
152  len_name = class_data->name_len + sizeof(WCHAR);
153  if (class_data->version_len > 0)
154  len_version = class_data->version_len + sizeof(WCHAR);
155 
156  *buffer_len_required = sizeof(SXS_GUID_INFORMATION_CLR) + len_identity + len_version + len_name;
157  if (!buffer || buffer_len < *buffer_len_required)
158  {
160  heap_free(assembly_info);
161  ReleaseActCtx(guid_info.hActCtx);
162  return FALSE;
163  }
164 
165  ret->cbSize = sizeof(SXS_GUID_INFORMATION_CLR);
167 
168  /* Copy strings into buffer */
169  ret_strings = (char *)ret + sizeof(SXS_GUID_INFORMATION_CLR);
170 
171  memcpy(ret_strings, ptr_identity, len_identity);
172  ret->pcwszAssemblyIdentity = (WCHAR *)ret_strings;
173  ret_strings += len_identity;
174 
175  memcpy(ret_strings, ptr_name, len_name);
176  ret->pcwszTypeName = (WCHAR *)ret_strings;
177  ret_strings += len_name;
178 
179  if (len_version > 0)
180  {
181  memcpy(ret_strings, ptr_version, len_version);
182  ret->pcwszRuntimeVersion = (WCHAR *)ret_strings;
183  }
184  else
185  ret->pcwszRuntimeVersion = NULL;
186 
187  SetLastError(0);
188 
189  ReleaseActCtx(guid_info.hActCtx);
190  heap_free(assembly_info);
191  return TRUE;
192 }
#define TRUE
Definition: types.h:120
BOOL WINAPI QueryActCtxW(IN DWORD dwFlags, IN HANDLE hActCtx, IN PVOID pvSubInstance, IN ULONG ulInfoClass, IN PVOID pvBuffer, IN SIZE_T cbBuffer, IN OUT SIZE_T *pcbWrittenOrRequired OPTIONAL)
Definition: actctx.c:328
const char * wine_dbgstr_guid(const GUID *guid)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define SXS_GUID_INFORMATION_CLR_FLAG_IS_CLASS
Definition: sxs.c:58
#define SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS
Definition: sxs.c:62
#define FIXME(fmt,...)
Definition: debug.h:110
ULONG version_len
Definition: sxs.c:96
smooth NULL
Definition: ftsmooth.c:416
#define actctx
Definition: kernel32.h:8
ULONG version_offset
Definition: sxs.c:97
ULONG name_offset
Definition: sxs.c:95
ULONG name_len
Definition: sxs.c:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
#define SetLastError(x)
Definition: compat.h:417
GLbitfield flags
Definition: glext.h:7161
int ret
REFCLSID clsid
Definition: msctf.c:82
struct _SXS_GUID_INFORMATION_CLR SXS_GUID_INFORMATION_CLR
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#define ERROR_NOT_FOUND
Definition: winerror.h:690
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:183
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by run_test(), and test_SxsLookupClrGuid().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( sxs  )