ReactOS 0.4.16-dev-2320-ge1853c6
comtest.c File Reference
#include <stdio.h>
#include "windows.h"
#include "ole2.h"
#include "mscoree.h"
#include "corerror.h"
#include "shlwapi.h"
#include "shlobj.h"
#include "wine/test.h"
#include "initguid.h"
#include "interfaces.h"
Include dependency graph for comtest.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Typedefs

typedef enum _run_type run_type
 

Enumerations

enum  _run_type { run_type_current_working_directory = 0 , run_type_exe_directory , run_type_system32 }
 

Functions

 DEFINE_GUID (IID_ITest2, 0x50adb433, 0xf6c5, 0x3b30, 0x92, 0x0a, 0x55, 0x57, 0x11, 0x86, 0x75, 0x09)
 
static BOOL write_resource_file (const char *path_tmp, const char *name_res, const char *name_file, char *path_file)
 
static BOOL compile_cs_to_dll (char *source_path, char *dest_path)
 
static void run_test (BOOL expect_success)
 
static void run_registry_test (run_type run)
 
static void get_dll_path_for_run (char *path_dll, UINT path_dll_size, run_type run)
 
static void prepare_and_run_test (const char *dll_source, run_type run)
 
static void cleanup_test (run_type run)
 
static void run_child_process (const char *dll_source, run_type run)
 
 START_TEST (comtest)
 

Variables

HMODULE hmscoree
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file comtest.c.

Typedef Documentation

◆ run_type

Enumeration Type Documentation

◆ _run_type

Enumerator
run_type_current_working_directory 
run_type_exe_directory 
run_type_system32 

Definition at line 38 of file comtest.c.

39{
43} run_type;
enum _run_type run_type
@ run_type_current_working_directory
Definition: comtest.c:40
@ run_type_system32
Definition: comtest.c:42
@ run_type_exe_directory
Definition: comtest.c:41

Function Documentation

◆ cleanup_test()

static void cleanup_test ( run_type  run)
static

Definition at line 337 of file comtest.c.

338{
339 char path_dll[MAX_PATH];
341
342 get_dll_path_for_run(path_dll, sizeof(path_dll), run);
343
344 if (!PathFileExistsA(path_dll))
345 return;
346
347 success = DeleteFileA(path_dll);
348 if (!success)
349 {
350 Sleep(500);
351 success = DeleteFileA(path_dll);
352 }
353 ok(success, "DeleteFileA failed: %ld\n", GetLastError());
354}
#define ok(value,...)
Definition: atltest.h:57
static void get_dll_path_for_run(char *path_dll, UINT path_dll_size, run_type run)
Definition: comtest.c:211
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI PathFileExistsA(const char *path)
Definition: path.c:2590
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ compile_cs_to_dll()

static BOOL compile_cs_to_dll ( char source_path,
char dest_path 
)
static

Definition at line 73 of file comtest.c.

74{
75 const char *path_csc = "C:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\csc.exe";
76 char cmdline[2 * MAX_PATH + 74];
77 char path_temp[MAX_PATH];
79 STARTUPINFOA si = { 0 };
80 BOOL ret;
81
82 if (!PathFileExistsA(path_csc))
83 {
84 skip("Can't find csc.exe\n");
85 return FALSE;
86 }
87
88 GetTempPathA(MAX_PATH, path_temp);
89 PathAppendA(path_temp, "comtest.dll");
90
91 sprintf(cmdline, "%s /t:library /out:\"%s\" \"%s\"", path_csc, path_temp, source_path);
92
93 si.cb = sizeof(si);
94 ret = CreateProcessA(path_csc, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
95 ok(ret, "Could not create process: %lu\n", GetLastError());
96
100
101 ret = PathFileExistsA(path_temp);
102 ok(ret, "Compilation failed\n");
103
104 ret = MoveFileA(path_temp, dest_path);
105 ok(ret, "Could not move %s to %s: %lu\n", path_temp, dest_path, GetLastError());
106 return ret;
107}
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
return ret
Definition: mutex.c:146
#define sprintf
Definition: sprintf.c:45
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
BOOL WINAPI MoveFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName)
Definition: moveansi.c:23
#define PathAppendA
Definition: pathcch.h:309
#define wait_child_process
Definition: test.h:177
TCHAR * cmdline
Definition: stretchblt.cpp:32

Referenced by prepare_and_run_test().

◆ DEFINE_GUID()

DEFINE_GUID ( IID_ITest2  ,
0x50adb433  ,
0xf6c5  ,
0x3b30  ,
0x92  ,
0x0a  ,
0x55  ,
0x57  ,
0x11  ,
0x86  ,
0x75  ,
0x09   
)

◆ get_dll_path_for_run()

static void get_dll_path_for_run ( char path_dll,
UINT  path_dll_size,
run_type  run 
)
static

Definition at line 211 of file comtest.c.

212{
213 char path_tmp[MAX_PATH];
214
215 GetTempPathA(MAX_PATH, path_tmp);
216
217 switch (run)
218 {
220 strcpy(path_dll, path_tmp);
221 PathAppendA(path_dll, "comtest.dll");
222 break;
224 GetModuleFileNameA(NULL, path_dll, path_dll_size);
225 PathRemoveFileSpecA(path_dll);
226 PathAppendA(path_dll, "comtest.dll");
227 break;
229 GetSystemDirectoryA(path_dll, path_dll_size);
230 PathAppendA(path_dll, "comtest.dll");
231 break;
232 }
233}
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2202
BOOL WINAPI PathRemoveFileSpecA(char *path)
Definition: path.c:1108
strcpy
Definition: string.h:131

Referenced by cleanup_test(), and prepare_and_run_test().

◆ prepare_and_run_test()

static void prepare_and_run_test ( const char dll_source,
run_type  run 
)
static

Definition at line 234 of file comtest.c.

235{
236 char path_tmp[MAX_PATH];
237 char path_tmp_manifest[MAX_PATH];
238 char path_dll[MAX_PATH];
239 char path_dll_source[MAX_PATH];
240 char path_manifest_dll[MAX_PATH];
241 char path_manifest_exe[MAX_PATH];
243 ACTCTXA context = {0};
245 HANDLE handle_context = 0;
246
247 path_manifest_exe[0] = path_manifest_dll[0] = path_dll_source[0] = 0;
248
249 GetTempPathA(MAX_PATH, path_tmp);
250 GetTempPathA(MAX_PATH, path_tmp_manifest);
251 PathAppendA(path_tmp_manifest, "manifests");
252
253 CreateDirectoryA(path_tmp_manifest, NULL);
254
255 if (run == run_type_system32)
256 {
257 if (!IsUserAnAdmin())
258 {
259 skip("Can't test dll in system32 due to user not being admin.\n");
260 return;
261 }
262 }
263
264 if (!write_resource_file(path_tmp, dll_source, "comtest.cs", path_dll_source))
265 {
266 ok(0, "run: %d, Failed to create file for testing\n", run);
267 goto cleanup;
268 }
269
270 get_dll_path_for_run(path_dll, sizeof(path_dll), run);
271
272 if (!compile_cs_to_dll(path_dll_source, path_dll))
273 goto cleanup;
274
275 if (!write_resource_file(path_tmp_manifest, "comtest_exe.manifest", "exe.manifest", path_manifest_exe))
276 {
277 ok(0, "run: %d, Failed to create file for testing\n", run);
278 goto cleanup;
279 }
280
281 if (!write_resource_file(path_tmp_manifest, "comtest_dll.manifest", "comtest.manifest", path_manifest_dll))
282 {
283 ok(0, "run: %d, Failed to create file for testing\n", run);
284 goto cleanup;
285 }
286
287 context.cbSize = sizeof(ACTCTXA);
288 context.lpSource = path_manifest_exe;
289 context.lpAssemblyDirectory = path_tmp_manifest;
290 context.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
291
292 handle_context = CreateActCtxA(&context);
293 ok(handle_context != NULL && handle_context != INVALID_HANDLE_VALUE, "run: %d, CreateActCtxA failed: %ld\n", run, GetLastError());
294
295 if (handle_context == NULL || handle_context == INVALID_HANDLE_VALUE)
296 {
297 ok(0, "run: %d, Failed to create activation context\n", run);
298 goto cleanup;
299 }
300
301 success = ActivateActCtx(handle_context, &cookie);
302 ok(success, "run: %d, ActivateActCtx failed: %ld\n", run, GetLastError());
303
305 SetCurrentDirectoryA(path_tmp);
306
309
310cleanup:
311 if (handle_context != NULL && handle_context != INVALID_HANDLE_VALUE)
312 {
314 ok(success, "run: %d, DeactivateActCtx failed: %ld\n", run, GetLastError());
315 ReleaseActCtx(handle_context);
316 }
317 if (*path_manifest_exe)
318 {
319 success = DeleteFileA(path_manifest_exe);
320 ok(success, "run: %d, DeleteFileA failed: %ld\n", run, GetLastError());
321 }
322 if(*path_manifest_dll)
323 {
324 success = DeleteFileA(path_manifest_dll);
325 ok(success, "run: %d, DeleteFileA failed: %ld\n", run, GetLastError());
326 }
327 if(*path_dll_source)
328 {
329 success = DeleteFileA(path_dll_source);
330 ok(success, "run: %d, DeleteFileA failed: %ld\n", run, GetLastError());
331 }
332 RemoveDirectoryA(path_tmp_manifest);
333 /* dll cleanup is handled by the parent, because it might still be used by the child */
334}
static void run_registry_test(run_type run)
Definition: comtest.c:156
static BOOL compile_cs_to_dll(char *source_path, char *dest_path)
Definition: comtest.c:73
static BOOL write_resource_file(const char *path_tmp, const char *name_res, const char *name_file, char *path_file)
Definition: comtest.c:45
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static void cleanup(void)
Definition: main.c:1335
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:682
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2125
HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx)
Definition: actctx.c:26
#define run_test(test)
Definition: ms_seh.c:71
BOOL WINAPI IsUserAnAdmin(void)
Definition: shellord.c:2808
Definition: http.c:7252
Definition: cookie.c:34
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ run_child_process()

static void run_child_process ( const char dll_source,
run_type  run 
)
static

Definition at line 356 of file comtest.c.

357{
358 char cmdline[MAX_PATH];
359 char exe[MAX_PATH];
360 char **argv;
362 STARTUPINFOA si = { 0 };
363 BOOL ret;
364
366
367 if (strstr(argv[0], ".exe"))
368 sprintf(exe, "%s", argv[0]);
369 else
370 sprintf(exe, "%s.exe", argv[0]);
371 sprintf(cmdline, "\"%s\" %s %s %d", argv[0], argv[1], dll_source, run);
372
373 si.cb = sizeof(si);
374 ret = CreateProcessA(exe, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
375 ok(ret, "Could not create process: %lu\n", GetLastError());
376
378
381
382 /* Cleanup dll, because it might still have been used by the child */
383 cleanup_test(run);
384}
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3415
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)
static void cleanup_test(void)
Definition: shlexec.c:2780

◆ run_registry_test()

static void run_registry_test ( run_type  run)
static

Definition at line 156 of file comtest.c.

157{
158 char buffer[256];
159 ITest *test = NULL;
160 HRESULT hr, result_expected;
161 IUnknown *unk = NULL;
162 HKEY hkey;
163 DWORD ret;
164 int i = 0;
165
166 if (run == run_type_exe_directory) result_expected = S_OK;
167 else result_expected = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
168
169 sprintf(buffer, "CLSID\\%s", wine_dbgstr_guid(&CLSID_Test));
172 {
173 win_skip("cannot run the registry tests due to user not being admin\n");
174 RegCloseKey(hkey);
175 return;
176 }
177 ok(ret == ERROR_SUCCESS, "RegCreateKeyA returned %lx\n", ret);
178
179 ret = RegSetKeyValueA(hkey, "InprocServer32", NULL, REG_SZ, "mscoree.dll", 11);
180 ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %lx\n", ret);
181 ret = RegSetKeyValueA(hkey, "InprocServer32", "Assembly", REG_SZ, "comtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 74);
182 ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %lx\n", ret);
183 ret = RegSetKeyValueA(hkey, "InprocServer32", "Class", REG_SZ, "DLL.Test", 8);
184 ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %lx\n", ret);
185 ret = RegSetKeyValueA(hkey, "InprocServer32", "CodeBase", REG_SZ, "file:///U:/invalid/path/to/comtest.dll", 41);
186 ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %lx\n", ret);
187
188 hr = CoCreateInstance(&CLSID_Test, NULL, CLSCTX_INPROC_SERVER, &IID_ITest, (void**)&test);
189 todo_wine_if(result_expected != S_OK)
190 ok(hr == result_expected, "Expected %lx, got %lx\n", result_expected, hr);
191
192 if (hr == S_OK)
193 {
194 hr = ITest_Func(test, &i);
195 ok(hr == S_OK, "Got %lx\n", hr);
196 ok(i == 42, "Expected 42, got %d\n", i);
197 hr = ITest_QueryInterface(test, &IID_ITest2, (void**)&unk);
198 ok(hr == S_OK, "ITest_QueryInterface returned %lx\n", hr);
199 if (hr == S_OK) IUnknown_Release(unk);
200 ITest_Release(test);
201 }
202
203 RegDeleteKeyValueA(hkey, "InprocServer32", "CodeBase");
204 RegDeleteKeyValueA(hkey, "InprocServer32", "Class");
205 RegDeleteKeyValueA(hkey, "InprocServer32", "Assembly");
206 RegDeleteKeyValueA(hkey, "InprocServer32", NULL);
207 RegDeleteKeyA(hkey, "InprocServer32");
208 RegCloseKey(hkey);
209}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1179
LONG WINAPI RegSetKeyValueA(IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL, IN LPCSTR lpValueName OPTIONAL, IN DWORD dwType, IN LPCVOID lpData OPTIONAL, IN DWORD cbData)
Definition: reg.c:2210
LONG WINAPI RegDeleteKeyValueA(IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL, IN LPCSTR lpValueName OPTIONAL)
Definition: reg.c:1392
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
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 S_OK
Definition: intsafe.h:52
#define REG_SZ
Definition: layer.c:22
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const GUID CLSID_Test
Definition: atl.c:35
#define test
Definition: rosglue.h:37
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206
HRESULT hr
Definition: shlfolder.c:183
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by prepare_and_run_test().

◆ run_test()

static void run_test ( BOOL  expect_success)
static

Definition at line 109 of file comtest.c.

110{
111 typedef HRESULT (WINAPI *_DllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
112 ITest *test = NULL;
113 HRESULT hr;
114 _DllGetClassObject getClassObject;
115 IClassFactory *classFactory = NULL;
116 HRESULT result_expected = expect_success ? S_OK : HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
117
118 hr = CoCreateInstance(&CLSID_Test, NULL, CLSCTX_INPROC_SERVER, &IID_ITest, (void**)&test);
119 todo_wine_if(!expect_success)
120 ok(hr == result_expected, "Expected %lx, got %lx\n", result_expected, hr);
121
122 if (hr == S_OK)
123 {
124 int i = 0;
125 hr = ITest_Func(test, &i);
126 ok(hr == S_OK, "Got %lx\n", hr);
127 ok(i == 42, "Expected 42, got %d\n", i);
128 ITest_Release(test);
129 }
130
131 getClassObject = (_DllGetClassObject)GetProcAddress(hmscoree, "DllGetClassObject");
132 hr = getClassObject(&CLSID_Test, &IID_IClassFactory, (void **)&classFactory);
133 todo_wine_if(!expect_success)
134 ok(hr == result_expected, "Expected %lx, got %lx\n", result_expected, hr);
135
136 if (hr == S_OK)
137 {
138 ITest *test2 = NULL;
139 hr = IClassFactory_CreateInstance(classFactory, NULL, &IID_ITest, (void **)&test2);
140 todo_wine_if(!expect_success)
141 ok(hr == S_OK, "Got %lx\n", hr);
142
143 if (hr == S_OK)
144 {
145 int i = 0;
146 hr = ITest_Func(test2, &i);
147 ok(hr == S_OK, "Got %lx\n", hr);
148 ok(i == 42, "Expected 42, got %d\n", i);
149 ITest_Release(test2);
150 }
151 IClassFactory_Release(classFactory);
152 }
153
154}
const GUID IID_IClassFactory
HMODULE hmscoree
Definition: comtest.c:34
#define GetProcAddress(x, y)
Definition: compat.h:753
void test2()
Definition: ehthrow.cxx:284
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6

◆ START_TEST()

START_TEST ( comtest  )

Definition at line 386 of file comtest.c.

387{
388 int argc;
389 char **argv;
390
392
393 hmscoree = LoadLibraryA("mscoree.dll");
394 if (!hmscoree)
395 {
396 skip(".NET or mono not available\n");
397 return;
398 }
399
401 if (argc > 2)
402 {
403 const char *dll_source = argv[2];
404 run_type run = atoi(argv[3]);
405 prepare_and_run_test(dll_source, run);
406
407 goto cleanup;
408 }
409
413
414cleanup:
417}
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP int __cdecl atoi(const char *)
Definition: string.c:1715
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
static void run_child_process(void)
Definition: actctx.c:2713
static void prepare_and_run_test(void)
Definition: sxs.c:112

◆ write_resource_file()

static BOOL write_resource_file ( const char path_tmp,
const char name_res,
const char name_file,
char path_file 
)
static

Definition at line 45 of file comtest.c.

46{
47 HRSRC rsrc;
48 void *rsrc_data;
49 DWORD rsrc_size;
50 BOOL ret;
51 HANDLE hfile;
52
54 if (!rsrc) return FALSE;
55
57 if (!rsrc_data) return FALSE;
58
59 rsrc_size = SizeofResource(GetModuleHandleA(NULL), rsrc);
60 if (!rsrc_size) return FALSE;
61
62 strcpy(path_file, path_tmp);
63 PathAppendA(path_file, name_file);
65 if (hfile == INVALID_HANDLE_VALUE) return FALSE;
66
67 ret = WriteFile(hfile, rsrc_data, rsrc_size, &rsrc_size, NULL);
68
69 CloseHandle(hfile);
70 return ret;
71}
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
#define RT_RCDATA
Definition: pedump.c:372
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by prepare_and_run_test().

Variable Documentation

◆ hmscoree

HMODULE hmscoree

Definition at line 34 of file comtest.c.

Referenced by run_test(), and START_TEST().