ReactOS  0.4.15-dev-1152-g6c94e4f
DefaultActCtx.c File Reference
#include "precomp.h"
Include dependency graph for DefaultActCtx.c:

Go to the source code of this file.

Functions

 START_TEST (DefaultActCtx)
 
HANDLE _CreateActCtxFromFile (LPCWSTR FileName, int line)
 
 START_TEST (ActCtxWithXmlNamespaces)
 

Function Documentation

◆ _CreateActCtxFromFile()

HANDLE _CreateActCtxFromFile ( LPCWSTR  FileName,
int  line 
)

Definition at line 74 of file FindActCtxSectionStringW.c.

75 {
76  ACTCTXW ActCtx = {sizeof(ACTCTX)};
77  HANDLE h;
79 
80  ok (GetModuleFileNameW(NULL, buffer, MAX_PATH), "GetModuleFileName failed\n");
81  separator = wcsrchr(buffer, L'\\');
82  if (separator)
84 
85  ActCtx.lpSource = buffer;
86 
87  SetLastError(0xdeaddead);
89  ok_(__FILE__, line)(h != INVALID_HANDLE_VALUE, "CreateActCtx failed for %S\n", FileName);
90  // In win10 last error is unchanged and in win2k3 it is ERROR_BAD_EXE_FORMAT
91  ok_(__FILE__, line)(GetLastError() == ERROR_BAD_EXE_FORMAT || GetLastError() == 0xdeaddead, "Wrong last error %lu\n", GetLastError());
92 
93  return h;
94 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
static const WCHAR separator[]
Definition: asmname.c:65
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define ERROR_BAD_EXE_FORMAT
Definition: winerror.h:251
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define SetLastError(x)
Definition: compat.h:500
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define wcsrchr
Definition: compat.h:16
struct _FileName FileName
Definition: fatprocs.h:893
#define ok(value,...)
Definition: atltest.h:57
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:104
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by START_TEST().

◆ START_TEST() [1/2]

START_TEST ( DefaultActCtx  )

Definition at line 23 of file DefaultActCtx.c.

24 {
25  DWORD buffer[256];
26  BOOL res;
27  PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION details = (PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION)buffer;
28  PACTIVATION_CONTEXT_DETAILED_INFORMATION info = (PACTIVATION_CONTEXT_DETAILED_INFORMATION)buffer;
29  HANDLE h;
30  DWORD i;
31  ACTCTX_SECTION_KEYED_DATA KeyedData = { 0 };
32 
33  res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
34  NULL,
35  NULL,
36  ActivationContextDetailedInformation,
37  &buffer,
38  sizeof(buffer),
39  NULL);
40  ok(res == TRUE, "Expected success\n");
41  if(res)
42  {
43  ok(info->lpRootManifestPath == NULL, "Expected null lpRootManifestPath, got %S\n", info->lpRootManifestPath);
44  ok(info->lpRootConfigurationPath == NULL, "Expected null lpRootConfigurationPath, got %S\n", info->lpRootConfigurationPath);
45  ok(info->lpAppDirPath == NULL, "Expected null lpAppDirPath, got %S\n", info->lpAppDirPath);
46  ok(info->ulAssemblyCount == 0, "Expected 0 assemblies\n");
47  }
48  else
49  {
50  skip("ActivationContextDetailedInformation failed\n");
51  }
52 
53 
54  i = 0;
55  res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
56  NULL,
57  &i,
58  AssemblyDetailedInformationInActivationContext,
59  &buffer,
60  sizeof(buffer),
61  NULL);
62  ok(res == TRUE, "Expected success\n");
63  if (res)
64  {
65  ok(details->lpAssemblyEncodedAssemblyIdentity == NULL, "Expected null lpAssemblyEncodedAssemblyIdentity, got %S\n", details->lpAssemblyEncodedAssemblyIdentity);
66  ok(details->lpAssemblyManifestPath == NULL, "Expected null lpAssemblyManifestPath, got %S\n", details->lpAssemblyManifestPath);
67  ok(details->lpAssemblyPolicyPath == NULL, "Expected null lpAssemblyPolicyPath, got %S\n", details->lpAssemblyPolicyPath);
68  ok(details->lpAssemblyDirectoryName == NULL, "Expected null lpAssemblyDirectoryName, got %S\n", details->lpAssemblyDirectoryName);
69  }
70  else
71  {
72  skip("AssemblyDetailedInformationInActivationContext failed\n");
73  }
74 
75  i = 1;
76  res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
77  NULL,
78  &i,
79  AssemblyDetailedInformationInActivationContext,
80  &buffer,
81  sizeof(buffer),
82  NULL);
83  ok(res == TRUE, "Expected success\n"); /* This is FALSE in win10 */
84  if (res)
85  {
86  ok(details->lpAssemblyEncodedAssemblyIdentity == NULL, "Expected null lpAssemblyEncodedAssemblyIdentity, got %S\n", details->lpAssemblyEncodedAssemblyIdentity);
87  ok(details->lpAssemblyManifestPath == NULL, "Expected null lpAssemblyManifestPath, got %S\n", details->lpAssemblyManifestPath);
88  ok(details->lpAssemblyPolicyPath == NULL, "Expected null lpAssemblyPolicyPath, got %S\n", details->lpAssemblyPolicyPath);
89  ok(details->lpAssemblyDirectoryName == NULL, "Expected null lpAssemblyDirectoryName, got %S\n", details->lpAssemblyDirectoryName);
90  }
91  else
92  {
93  skip("AssemblyDetailedInformationInActivationContext failed\n");
94  }
95 
96  res = GetCurrentActCtx (&h);
97  ok(res == TRUE, "Expected success\n");
98  ok(h == NULL, "Expected null current context\n");
99 
100  KeyedData.cbSize = sizeof(KeyedData);
101  res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
102  NULL,
103  ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
104  L"Microsoft.Windows.SysyemCompatible",
105  &KeyedData);
106  ok(res == FALSE, "Expected failure\n");
107 
108  KeyedData.cbSize = sizeof(KeyedData);
109  res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
110  NULL,
111  ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
112  L"System Default Context",
113  &KeyedData);
114  ok(res == FALSE, "Expected failure\n");
115 
116  KeyedData.cbSize = sizeof(KeyedData);
117  res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
118  NULL,
119  ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
120  L"Microsoft.Windows.Common-Controls",
121  &KeyedData);
122  ok(res == TRUE, "Expected success\n");
123  if (res)
124  {
125  ok(KeyedData.hActCtx == NULL, "Expected null handle for common control context\n");
126  ok(KeyedData.ulAssemblyRosterIndex != 0, "%lu\n", KeyedData.ulAssemblyRosterIndex);
127  }
128  else
129  {
130  skip("ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION failed\n");
131  }
132 
133 }
#define TRUE
Definition: types.h:120
BOOL WINAPI GetCurrentActCtx(OUT PHANDLE phActCtx)
Definition: actctx.c:298
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
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:156
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
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
GLuint res
Definition: glext.h:9613
int details
Definition: msacm.c:1365

◆ START_TEST() [2/2]

START_TEST ( ActCtxWithXmlNamespaces  )

Definition at line 137 of file DefaultActCtx.c.

138 {
139  // _CreateActCtxFromFile() contains all the assertions we need.
140  (void)_CreateActCtxFromFile(L"xmlns.manifest", __LINE__);
141 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
HANDLE _CreateActCtxFromFile(LPCWSTR FileName, int line)
static const WCHAR L[]
Definition: oid.c:1250