* UPDATE HISTORY:
* 06-07-2003 CSH Created
*/
+#ifndef __REGTESTS_H
+#define __REGTESTS_H
#include <stdio.h>
#include <string.h>
+typedef DWORD (STDCALL _LPTHREAD_START_ROUTINE)(LPVOID lpParameter);
+
+typedef struct __FILETIME
+{
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+} _FILETIME, *_PFILETIME, *_LPFILETIME;
+
extern void SetupOnce();
#define _SetupOnce() \
/* Valid values for Command parameter of TestRoutine */
#define TESTCMD_RUN 0 /* Buffer contains information about what failed */
-#define TESTCMD_TESTNAME 1 /* Buffer contains description of test */
-#define TESTCMD_TIMEOUT 2 /* Buffer contains timeout for test (DWORD, default is 5000 ms) */
+#define TESTCMD_TESTTYPE 1 /* Buffer contains type of test */
+#define TESTCMD_TESTNAME 2 /* Buffer contains description of test */
+#define TESTCMD_TIMEOUT 3 /* Buffer contains timeout for test (DWORD, default is 5000 ms) */
+
+/* Test types */
+#define TT_NORMAL 0
/* Valid values for return values of TestRoutine */
-#define TS_EXCEPTION -1
+#define TS_TIMEDOUT ((DWORD)-2)
+#define TS_EXCEPTION ((DWORD)-1)
#define TS_OK 0
#define TS_FAILED 1
extern char *_Buffer;
/* Macros to simplify tests */
-#define _DispatcherTimeout(FunctionName, TestName, TimeOut) \
+#define _DispatcherTypeTimeout(FunctionName, TestName, TestType, TimeOut) \
void \
FunctionName(int Command) \
{ \
case TESTCMD_RUN: \
RunTest(); \
break; \
+ case TESTCMD_TESTTYPE: \
+ *(PDWORD)_Buffer = (DWORD)TestType; \
+ break; \
case TESTCMD_TESTNAME: \
strcpy(_Buffer, TestName); \
break; \
} \
}
-#define _Dispatcher(FunctionName, TestName) _DispatcherTimeout(FunctionName, TestName, 5000)
+#define _DispatcherTimeout(FunctionName, TestName, TimeOut) \
+ _DispatcherTypeTimeout(FunctionName, TestName, TT_NORMAL, TimeOut)
+
+#define _DispatcherType(FunctionName, TestName, TestType) \
+ _DispatcherTypeTimeout(FunctionName, TestName, TestType, 5000)
+
+#define _Dispatcher(FunctionName, TestName) \
+ _DispatcherTimeout(FunctionName, TestName, 5000)
-static inline void
+static __inline void
AppendAssertion(char *message)
{
if (strlen(_Buffer) != 0)
*/
typedef void STDCALL (*TestDriverMain)(TestOutputRoutine OutputRoutine, char *TestName);
-typedef struct _ROS_TEST
+typedef struct __TEST
{
LIST_ENTRY ListEntry;
TestRoutine Routine;
-} ROS_TEST, *PROS_TEST;
+} _TEST, *_PTEST;
extern VOID InitializeTests();
extern VOID RegisterTests();
extern VOID PerformTests(TestOutputRoutine OutputRoutine, LPSTR TestName);
-typedef struct _API_DESCRIPTION
+typedef struct __API_DESCRIPTION
{
PCHAR FileName;
PCHAR FunctionName;
PCHAR ForwardedFunctionName;
PVOID FunctionAddress;
PVOID MockFunctionAddress;
-} API_DESCRIPTION, *PAPI_DESCRIPTION;
+} _API_DESCRIPTION, *_PAPI_DESCRIPTION;
-extern API_DESCRIPTION ExternalDependencies[];
+extern _API_DESCRIPTION ExternalDependencies[];
extern ULONG MaxExternalDependency;
HANDLE STDCALL
HANDLE STDCALL
_CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, DWORD dwStackSize,
- LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter,
+ _LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter,
DWORD dwCreationFlags, LPDWORD lpThreadId);
WINBOOL STDCALL
DWORD STDCALL
_WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
+DWORD STDCALL
+_GetLastError();
+
+VOID STDCALL
+_CloseHandle(HANDLE handle);
-static inline PCHAR
-FrameworkGetExportedFunctionNameInternal(PAPI_DESCRIPTION ApiDescription)
+BOOL STDCALL
+_GetThreadTimes(HANDLE hThread,
+ _LPFILETIME lpCreationTime,
+ _LPFILETIME lpExitTime,
+ _LPFILETIME lpKernelTime,
+ _LPFILETIME lpUserTime);
+
+BOOL STDCALL
+_SetPriorityClass(HANDLE hProcess, DWORD dwPriorityClass);
+
+BOOL STDCALL
+_SetThreadPriority(HANDLE hThread, int nPriority);
+
+HANDLE STDCALL
+_GetCurrentProcess();
+
+HANDLE STDCALL
+_GetCurrentThread();
+
+VOID STDCALL
+_Sleep(DWORD dwMilliseconds);
+
+
+static __inline PCHAR
+FrameworkGetExportedFunctionNameInternal(_PAPI_DESCRIPTION ApiDescription)
{
if (ApiDescription->ForwardedFunctionName != NULL)
{
}
}
-static inline PVOID
-FrameworkGetFunction(PAPI_DESCRIPTION ApiDescription)
+static __inline PVOID
+FrameworkGetFunction(_PAPI_DESCRIPTION ApiDescription)
{
HANDLE hModule;
PVOID function = NULL;
return function;
}
-static inline PVOID
+static __inline PVOID
FrameworkGetHookInternal(ULONG index)
{
PVOID address;
}
-static inline VOID
+static __inline VOID
_SetHook(PCHAR name,
PVOID address)
{
- PAPI_DESCRIPTION api;
+ _PAPI_DESCRIPTION api;
ULONG index;
for (index = 0; index <= MaxExternalDependency; index++)
}
}
-typedef struct _HOOK
+typedef struct __HOOK
{
PCHAR FunctionName;
PVOID FunctionAddress;
-} HOOK, *PHOOK;
+} _HOOK, *_PHOOK;
-static inline VOID
-_SetHooks(PHOOK hookTable)
+static __inline VOID
+_SetHooks(_PHOOK hookTable)
{
- PHOOK hook;
+ _PHOOK hook;
hook = &hookTable[0];
while (hook->FunctionName != NULL)
}
}
-static inline VOID
-_UnsetHooks(PHOOK hookTable)
+static __inline VOID
+_UnsetHooks(_PHOOK hookTable)
{
- PHOOK hook;
+ _PHOOK hook;
hook = &hookTable[0];
while (hook->FunctionName != NULL)
}
}
-static inline VOID
+static __inline VOID
_UnsetAllHooks()
{
- PAPI_DESCRIPTION api;
+ _PAPI_DESCRIPTION api;
ULONG index;
for (index = 0; index <= MaxExternalDependency; index++)
api->MockFunctionAddress = NULL;
}
}
+
+#endif /* __REGTESTS_H */