#include <stdio.h>
#include <initguid.h>
#include <windows.h>
#include <psapi.h>
#include <oaidl.h>
#include "wine/test.h"
Go to the source code of this file.
|
| DEFINE_EXPECT (reportSuccess) |
|
static int | strcmp_wa (LPCWSTR strw, const char *stra) |
|
static const WCHAR * | mystrrchr (const WCHAR *str, WCHAR ch) |
|
static BSTR | a2bstr (const char *str) |
|
static HRESULT WINAPI | Dispatch_QueryInterface (IDispatch *iface, REFIID riid, void **ppv) |
|
static ULONG WINAPI | Dispatch_AddRef (IDispatch *iface) |
|
static ULONG WINAPI | Dispatch_Release (IDispatch *iface) |
|
static HRESULT WINAPI | Dispatch_GetTypeInfoCount (IDispatch *iface, UINT *pctinfo) |
|
static HRESULT WINAPI | Dispatch_GetTypeInfo (IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) |
|
static HRESULT WINAPI | Dispatch_GetIDsOfNames (IDispatch *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) |
|
static HRESULT WINAPI | Dispatch_Invoke (IDispatch *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) |
|
static HRESULT WINAPI | ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv) |
|
static ULONG WINAPI | ClassFactory_AddRef (IClassFactory *iface) |
|
static ULONG WINAPI | ClassFactory_Release (IClassFactory *iface) |
|
static HRESULT WINAPI | ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv) |
|
static HRESULT WINAPI | ClassFactory_LockServer (IClassFactory *iface, BOOL dolock) |
|
static void | run_script_file (const char *file_name, DWORD expected_exit_code) |
|
static void | run_script (const char *name, const char *script_data, size_t script_size, DWORD expected_exit_code) |
|
static void | run_simple_script (const char *script, DWORD expected_exit_code) |
|
static BOOL WINAPI | test_enum_proc (HMODULE module, LPCSTR type, LPSTR name, LONG_PTR param) |
|
static BOOL | init_key (const char *key_name, const char *def_value, BOOL init) |
|
static BOOL | init_registry (BOOL init) |
|
static BOOL | register_activex (void) |
|
| START_TEST (run) |
|
◆ CHECK_CALLED
Value: do { \
ok(called_ ##
func,
"expected " #
func "\n"); \
}while(0)
#define expect_(expected, got, precision)
Definition at line 53 of file run.c.
◆ CHECK_EXPECT
Value:
Definition at line 47 of file run.c.
◆ CHECK_EXPECT2
Value:
Definition at line 41 of file run.c.
◆ CLEAR_CALLED
Definition at line 38 of file run.c.
◆ COBJMACROS
Definition at line 21 of file run.c.
◆ CONST_VTABLE
Definition at line 22 of file run.c.
◆ DEFINE_EXPECT
Definition at line 32 of file run.c.
◆ DISPID_TESTOBJ_OK
#define DISPID_TESTOBJ_OK 10000 |
Definition at line 61 of file run.c.
◆ DISPID_TESTOBJ_REPORTSUCCESS
#define DISPID_TESTOBJ_REPORTSUCCESS 10002 |
Definition at line 63 of file run.c.
◆ DISPID_TESTOBJ_TRACE
#define DISPID_TESTOBJ_TRACE 10001 |
Definition at line 62 of file run.c.
◆ DISPID_TESTOBJ_WSCRIPTFULLNAME
#define DISPID_TESTOBJ_WSCRIPTFULLNAME 10003 |
Definition at line 64 of file run.c.
◆ DISPID_TESTOBJ_WSCRIPTPATH
#define DISPID_TESTOBJ_WSCRIPTPATH 10004 |
Definition at line 65 of file run.c.
◆ DISPID_TESTOBJ_WSCRIPTSCRIPTFULLNAME
#define DISPID_TESTOBJ_WSCRIPTSCRIPTFULLNAME 10006 |
Definition at line 67 of file run.c.
◆ DISPID_TESTOBJ_WSCRIPTSCRIPTNAME
#define DISPID_TESTOBJ_WSCRIPTSCRIPTNAME 10005 |
Definition at line 66 of file run.c.
◆ PSAPI_VERSION
Definition at line 24 of file run.c.
◆ SET_EXPECT
Definition at line 35 of file run.c.
◆ TESTOBJ_CLSID
#define TESTOBJ_CLSID "{178fc166-f585-4e24-9c13-4bb7faf80646}" |
Definition at line 69 of file run.c.
◆ a2bstr()
Definition at line 95 of file run.c.
96{
99
103
105}
#define MultiByteToWideChar
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
◆ ClassFactory_AddRef()
◆ ClassFactory_CreateInstance()
Definition at line 322 of file run.c.
323{
324 ok(!outer,
"outer = %p\n", outer);
326}
◆ ClassFactory_LockServer()
◆ ClassFactory_QueryInterface()
Definition at line 301 of file run.c.
302{
306 }
307
310}
const GUID IID_IClassFactory
#define IsEqualGUID(rguid1, rguid2)
◆ ClassFactory_Release()
◆ DEFINE_EXPECT()
DEFINE_EXPECT |
( |
reportSuccess |
| ) |
|
◆ Dispatch_AddRef()
◆ Dispatch_GetIDsOfNames()
Definition at line 141 of file run.c.
143{
145
146 for(
i=0;
i<cNames;
i++) {
151 }
else if(!
strcmp_wa(rgszNames[
i],
"reportSuccess")) {
153 }
else if(!
strcmp_wa(rgszNames[
i],
"wscriptFullName")) {
155 }
else if(!
strcmp_wa(rgszNames[
i],
"wscriptPath")) {
157 }
else if(!
strcmp_wa(rgszNames[
i],
"wscriptScriptName")) {
159 }
else if(!
strcmp_wa(rgszNames[
i],
"wscriptScriptFullName")) {
161 }else {
164 }
165 }
166
168}
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
static int strcmp_wa(LPCWSTR strw, const char *stra)
#define DISPID_TESTOBJ_WSCRIPTFULLNAME
#define DISPID_TESTOBJ_REPORTSUCCESS
#define DISPID_TESTOBJ_WSCRIPTSCRIPTNAME
#define DISPID_TESTOBJ_TRACE
#define DISPID_TESTOBJ_OK
#define DISPID_TESTOBJ_WSCRIPTSCRIPTFULLNAME
#define DISPID_TESTOBJ_WSCRIPTPATH
#define DISP_E_UNKNOWNNAME
◆ Dispatch_GetTypeInfo()
Definition at line 134 of file run.c.
136{
137 ok(0,
"unexpected call\n");
139}
◆ Dispatch_GetTypeInfoCount()
Definition at line 128 of file run.c.
129{
130 ok(0,
"unexpected call\n");
132}
◆ Dispatch_Invoke()
Definition at line 170 of file run.c.
172{
173 switch(dispIdMember) {
176
178 ok(pdp->cArgs == 2,
"cArgs = %d\n", pdp->cArgs);
179 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
180
181 expr = pdp->rgvarg+1;
184
188
192 if(pVarResult)
194 break;
195 }
198 ok(pdp->cArgs == 1,
"cArgs = %d\n", pdp->cArgs);
199 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
200 ok(
V_VT(pdp->rgvarg) ==
VT_BSTR,
"V_VT(psp->rgvargs) = %d\n",
V_VT(pdp->rgvarg));
202 if(pVarResult)
204 break;
207
209 ok(pdp->cArgs == 0,
"cArgs = %d\n", pdp->cArgs);
210 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
211 if(pVarResult)
213 break;
215 {
218
220 ok(pdp->cArgs == 0,
"cArgs = %d\n", pdp->cArgs);
221 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
228 break;
229 }
231 {
235
237 ok(pdp->cArgs == 0,
"cArgs = %d\n", pdp->cArgs);
238 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
246 break;
247 }
249 {
253
255 ok(pdp->cArgs == 0,
"cArgs = %d\n", pdp->cArgs);
256 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
259 if(!
res ||
res >
sizeof(fullPath))
263 break;
264 }
266 {
269
271 ok(pdp->cArgs == 0,
"cArgs = %d\n", pdp->cArgs);
272 ok(!pdp->cNamedArgs,
"cNamedArgs = %d\n", pdp->cNamedArgs);
275 if(!
res ||
res >
sizeof(fullPath))
279 break;
280 }
281 default:
282 ok(0,
"unexpected dispIdMember %d\n", dispIdMember);
284 }
285
287}
static WCHAR fullName[MAX_STRING_RESOURCE_LEN]
#define GetModuleFileNameExW(w, x, y, z)
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
#define CHECK_EXPECT(func)
static BSTR a2bstr(const char *str)
static const WCHAR * mystrrchr(const WCHAR *str, WCHAR ch)
static const char * script_name
static HANDLE wscript_process
BSTR WINAPI SysAllocString(LPCOLESTR str)
_In_ DWORD _Out_ _In_ WORD wFlags
◆ Dispatch_QueryInterface()
◆ Dispatch_Release()
◆ init_key()
Definition at line 435 of file run.c.
436{
439
443 }
444
448
449 if(def_value)
451
454}
ACPI_SIZE strlen(const char *String)
#define RegCloseKey(hKey)
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegSetValueA(HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
#define HKEY_CLASSES_ROOT
Referenced by init_registry().
◆ init_registry()
◆ mystrrchr()
◆ register_activex()
Definition at line 461 of file run.c.
462{
465
469 }
470
473 ok(
hres ==
S_OK,
"Could not register script engine: %08x\n",
hres);
475}
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
static IClassFactory testobj_cf
static const GUID CLSID_TestObj
static BOOL init_registry(BOOL init)
Referenced by START_TEST().
◆ run_script()
Definition at line 376 of file run.c.
377{
383
385 ok(
ext !=
NULL,
"no script extension\n");
387 return;
388
390
395 return;
396
401 return;
402
404
406}
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
static const WCHAR *const ext[]
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define sprintf(buf, format,...)
static void run_script_file(const char *file_name, DWORD expected_exit_code)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
DWORD WINAPI GetLastError(void)
Referenced by run_simple_script(), and test_enum_proc().
◆ run_script_file()
Definition at line 343 of file run.c.
344{
350
353
355
357 if(!bres) {
358 win_skip(
"script.exe is not available\n");
360 return;
361 }
362
365
368 ok(
exit_code == expected_exit_code,
"exit_code = %u, expected %u\n",
exit_code, expected_exit_code);
369
372
374}
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
#define CHECK_CALLED(func)
#define CLEAR_CALLED(func)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Referenced by run_script(), and START_TEST().
◆ run_simple_script()
Definition at line 408 of file run.c.
409{
411}
static void run_script(const char *name, const char *script_data, size_t script_size, DWORD expected_exit_code)
Referenced by START_TEST().
◆ START_TEST()
Definition at line 477 of file run.c.
478{
481
483
485 skip(
"Could not register ActiveX object.\n");
487 return;
488 }
489
493 }else {
495
497 "winetest.reportSuccess();\n"
498 "WScript.Quit(3);\n"
499 "winetest.ok(false, 'not quit?');\n", 3);
500}
501
504}
BOOL WINAPI EnumResourceNamesA(HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG_PTR lparam)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static void run_simple_script(const char *script, DWORD expected_exit_code)
static BOOL register_activex(void)
static BOOL WINAPI test_enum_proc(HMODULE module, LPCSTR type, LPSTR name, LONG_PTR param)
int winetest_get_mainargs(char ***pargv)
◆ strcmp_wa()
Definition at line 77 of file run.c.
78{
82}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
GLenum GLuint GLenum GLsizei const GLchar * buf
static const char * strw(LPCWSTR x)
◆ test_enum_proc()
Definition at line 413 of file run.c.
414{
415 const char *script_data;
418
420
425
428 while(script_size && !script_data[script_size-1])
429 script_size--;
430
433}
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
GLuint GLuint GLsizei GLenum type
Referenced by START_TEST().
◆ ClassFactoryVtbl
const IClassFactoryVtbl ClassFactoryVtbl |
|
static |
Initial value:= {
}
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition at line 333 of file run.c.
◆ CLSID_TestObj
Initial value:=
{0x178fc166,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}
Definition at line 71 of file run.c.
Referenced by register_activex().
◆ script_name
◆ testobj
◆ testobj_cf
◆ testobj_vtbl
IDispatchVtbl testobj_vtbl |
|
static |
Initial value:= {
}
static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
static ULONG WINAPI Dispatch_Release(IDispatch *iface)
static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition at line 289 of file run.c.
◆ wscript_process