ReactOS 0.4.15-dev-8393-g61b7fb9
actctx.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for actctx.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 DEBUG_CHANNEL (actctx)
 
HANDLE WINAPI CreateActCtxA (PCACTCTXA pActCtx)
 
HANDLE WINAPI CreateActCtxW (PCACTCTXW pActCtx)
 
BOOL WINAPI ActivateActCtx (HANDLE hActCtx, ULONG_PTR *ulCookie)
 
BOOL WINAPI DeactivateActCtx (DWORD dwFlags, ULONG_PTR ulCookie)
 
BOOL WINAPI GetCurrentActCtx (HANDLE *phActCtx)
 
void WINAPI AddRefActCtx (HANDLE hActCtx)
 
void WINAPI ReleaseActCtx (HANDLE hActCtx)
 
BOOL WINAPI ZombifyActCtx (HANDLE hActCtx)
 
BOOL WINAPI FindActCtxSectionStringA (DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
 
BOOL WINAPI FindActCtxSectionStringW (DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
 
BOOL WINAPI FindActCtxSectionGuid (DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
 
BOOL WINAPI QueryActCtxW (DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInst, ULONG ulClass, PVOID pvBuff, SIZE_T cbBuff, SIZE_T *pcbLen)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file actctx.c.

Function Documentation

◆ ActivateActCtx()

BOOL WINAPI ActivateActCtx ( HANDLE  hActCtx,
ULONG_PTR ulCookie 
)

Definition at line 123 of file actctx.c.

124{
126
127 if ((status = RtlActivateActivationContext( 0, hActCtx, ulCookie )))
128 {
130 return FALSE;
131 }
132 return TRUE;
133}
LONG NTSTATUS
Definition: precomp.h:26
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
NTSYSAPI NTSTATUS WINAPI RtlActivateActivationContext(DWORD, HANDLE, ULONG_PTR *)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
Definition: ps.c:97

◆ AddRefActCtx()

void WINAPI AddRefActCtx ( HANDLE  hActCtx)

Definition at line 168 of file actctx.c.

169{
171}
NTSYSAPI void WINAPI RtlAddRefActivationContext(HANDLE)
Definition: actctx.c:5404

◆ CreateActCtxA()

HANDLE WINAPI CreateActCtxA ( PCACTCTXA  pActCtx)

Definition at line 26 of file actctx.c.

27{
28 ACTCTXW actw;
29 SIZE_T len;
31 LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL;
32
33 TRACE("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
34
35 if (!pActCtx || pActCtx->cbSize != sizeof(*pActCtx))
36 {
39 }
40
41 actw.cbSize = sizeof(actw);
42 actw.dwFlags = pActCtx->dwFlags;
43 if (pActCtx->lpSource)
44 {
45 len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpSource, -1, NULL, 0);
46 src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
47 if (!src) return INVALID_HANDLE_VALUE;
48 MultiByteToWideChar(CP_ACP, 0, pActCtx->lpSource, -1, src, len);
49 }
50 actw.lpSource = src;
51
52 if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID)
53 actw.wProcessorArchitecture = pActCtx->wProcessorArchitecture;
54 if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID)
55 actw.wLangId = pActCtx->wLangId;
56 if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID)
57 {
58 len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpAssemblyDirectory, -1, NULL, 0);
59 assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
60 if (!assdir) goto done;
61 MultiByteToWideChar(CP_ACP, 0, pActCtx->lpAssemblyDirectory, -1, assdir, len);
62 actw.lpAssemblyDirectory = assdir;
63 }
64 if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID)
65 {
66 if ((ULONG_PTR)pActCtx->lpResourceName >> 16)
67 {
68 len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpResourceName, -1, NULL, 0);
69 resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
70 if (!resname) goto done;
71 MultiByteToWideChar(CP_ACP, 0, pActCtx->lpResourceName, -1, resname, len);
72 actw.lpResourceName = resname;
73 }
74 else actw.lpResourceName = (LPCWSTR)pActCtx->lpResourceName;
75 }
76 if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID)
77 {
78 len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpApplicationName, -1, NULL, 0);
79 appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
80 if (!appname) goto done;
81 MultiByteToWideChar(CP_ACP, 0, pActCtx->lpApplicationName, -1, appname, len);
82 actw.lpApplicationName = appname;
83 }
84 if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID)
85 actw.hModule = pActCtx->hModule;
86
87 ret = CreateActCtxW(&actw);
88
89done:
91 HeapFree(GetProcessHeap(), 0, assdir);
92 HeapFree(GetProcessHeap(), 0, resname);
93 HeapFree(GetProcessHeap(), 0, appname);
94 return ret;
95}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
GLenum src
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by init_funcs(), load_v6_module(), and prepare_and_run_test().

◆ CreateActCtxW()

HANDLE WINAPI CreateActCtxW ( PCACTCTXW  pActCtx)

Definition at line 102 of file actctx.c.

103{
105 HANDLE hActCtx;
106
107 TRACE("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
108
109 if ((status = RtlCreateActivationContext(0, (PVOID)pActCtx, 0, NULL, NULL, &hActCtx)))
110 {
113 }
114 return hActCtx;
115}
NTSYSAPI NTSTATUS WINAPI RtlCreateActivationContext(HANDLE *, const void *)

Referenced by _CreateActCtxFromFile(), _CreateV5ActCtx(), create_test_actctx(), CreateActCtxA(), GetServiceMainFunctions(), init_funcs(), init_pointers(), and wWinMain().

◆ DeactivateActCtx()

BOOL WINAPI DeactivateActCtx ( DWORD  dwFlags,
ULONG_PTR  ulCookie 
)

Definition at line 140 of file actctx.c.

141{
143 return TRUE;
144}
NTSYSAPI void WINAPI RtlDeactivateActivationContext(DWORD, ULONG_PTR)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ DEBUG_CHANNEL()

DEBUG_CHANNEL ( actctx  )

◆ FindActCtxSectionGuid()

BOOL WINAPI FindActCtxSectionGuid ( DWORD  dwFlags,
const GUID lpExtGuid,
ULONG  ulId,
const GUID lpSearchGuid,
PACTCTX_SECTION_KEYED_DATA  pInfo 
)

Definition at line 265 of file actctx.c.

268{
270
271 if ((status = RtlFindActivationContextSectionGuid(dwFlags, lpExtGuid, ulId, lpSearchGuid, pInfo)))
272 {
274 return FALSE;
275 }
276
277 return TRUE;
278}
NTSYSAPI NTSTATUS NTAPI RtlFindActivationContextSectionGuid(ULONG flags, const GUID *extguid, ULONG section_kind, const GUID *guid, void *ptr)
Definition: actctx.c:5958

Referenced by actctx_get_miscstatus(), actctx_get_typelib_module(), CoGetClassObject(), CoGetPSClsid(), init_funcs(), ProgIDFromCLSID(), query_typelib_path(), and SxsLookupClrGuid().

◆ FindActCtxSectionStringA()

BOOL WINAPI FindActCtxSectionStringA ( DWORD  dwFlags,
const GUID lpExtGuid,
ULONG  ulId,
LPCSTR  lpSearchStr,
PACTCTX_SECTION_KEYED_DATA  pInfo 
)

Definition at line 206 of file actctx.c.

209{
210 LPWSTR search_str;
211 DWORD len;
212 BOOL ret;
213
214 TRACE("%08x %s %u %s %p\n", dwFlags, debugstr_guid(lpExtGuid),
215 ulId, debugstr_a(lpSearchStr), pInfo);
216
217 if (!lpSearchStr || !pInfo)
218 {
220 return FALSE;
221 }
222
223 len = MultiByteToWideChar(CP_ACP, 0, lpSearchStr, -1, NULL, 0);
224 search_str = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
225 MultiByteToWideChar(CP_ACP, 0, lpSearchStr, -1, search_str, len);
226
227 ret = FindActCtxSectionStringW(dwFlags, lpExtGuid, ulId, search_str, pInfo);
228
229 HeapFree(GetProcessHeap(), 0, search_str);
230 return ret;
231}
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:238
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31

Referenced by init_funcs(), and load_v6_module().

◆ FindActCtxSectionStringW()

BOOL WINAPI FindActCtxSectionStringW ( DWORD  dwFlags,
const GUID lpExtGuid,
ULONG  ulId,
LPCWSTR  lpSearchStr,
PACTCTX_SECTION_KEYED_DATA  pInfo 
)

Definition at line 238 of file actctx.c.

241{
244
245 if (!pInfo)
246 {
248 return FALSE;
249 }
250
251 RtlInitUnicodeString(&us, lpSearchStr);
252 if ((status = RtlFindActivationContextSectionString(dwFlags, lpExtGuid, ulId, &us, pInfo)))
253 {
255 return FALSE;
256 }
257 return TRUE;
258}
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5907
static const BYTE us[]
Definition: encode.c:689
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by CLSIDFromProgID(), FindActCtxSectionStringA(), get_versioned_classname(), init_funcs(), START_TEST(), TestClassRedirection(), and TestLibDependency().

◆ GetCurrentActCtx()

BOOL WINAPI GetCurrentActCtx ( HANDLE phActCtx)

Definition at line 151 of file actctx.c.

152{
154
155 if ((status = RtlGetActiveActivationContext(phActCtx)))
156 {
158 return FALSE;
159 }
160 return TRUE;
161}
NTSYSAPI NTSTATUS WINAPI RtlGetActiveActivationContext(HANDLE *)
Definition: actctx.c:5572

◆ QueryActCtxW()

BOOL WINAPI QueryActCtxW ( DWORD  dwFlags,
HANDLE  hActCtx,
PVOID  pvSubInst,
ULONG  ulClass,
PVOID  pvBuff,
SIZE_T  cbBuff,
SIZE_T pcbLen 
)

Definition at line 286 of file actctx.c.

289{
291
292 if ((status = RtlQueryInformationActivationContext( dwFlags, hActCtx, pvSubInst, ulClass,
293 pvBuff, cbBuff, pcbLen )))
294 {
296 return FALSE;
297 }
298 return TRUE;
299}
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG, HANDLE, PVOID, ULONG, PVOID, SIZE_T, SIZE_T *)
Definition: actctx.c:5605

◆ ReleaseActCtx()

void WINAPI ReleaseActCtx ( HANDLE  hActCtx)

Definition at line 178 of file actctx.c.

179{
181}
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5415

◆ ZombifyActCtx()

BOOL WINAPI ZombifyActCtx ( HANDLE  hActCtx)

Definition at line 188 of file actctx.c.

189{
191
192 if ((status = RtlZombifyActivationContext(hActCtx)))
193 {
195 return FALSE;
196 }
197 return TRUE;
198}
NTSYSAPI NTSTATUS WINAPI RtlZombifyActivationContext(HANDLE)
Definition: actctx.c:5429