ReactOS  0.4.13-dev-100-gc8611ae
apphelp_apitest.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagSDBQUERYRESULT_VISTA
 
struct  tagSDBQUERYRESULT_2k3
 

Macros

#define test_create_db   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_db_imp
 
#define test_create_exe   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_exe_imp
 
#define test_create_file   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_file_imp
 
#define test_create_ne   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_ne_imp
 
#define WINVER_ANY   0
 
#define WINVER_WINXP   0x0501
 
#define WINVER_2003   0x0502
 
#define WINVER_VISTA   0x0600
 
#define WINVER_WIN7   0x0601
 
#define WINVER_WIN8   0x0602
 
#define WINVER_WIN10   0x0a00
 
#define SDB_MAX_SDBS   16
 
#define SDB_MAX_EXES_VISTA   16
 
#define SDB_MAX_LAYERS   8
 
#define SHIMREG_DISABLE_LAYER   (0x00000020)
 
#define SDBQUERYRESULT_EXPECTED_SIZE_VISTA   456
 
#define SDBQUERYRESULT_EXPECTED_SIZE_2k3   344
 
#define SDB_MAX_EXES_2k3   4
 

Typedefs

typedef WORD TAG
 
typedef DWORD TAGID
 
typedef DWORD TAGREF
 
typedef UINT64 QWORD
 
typedef VOIDPDB
 
typedef VOIDHSDB
 
typedef INT PATH_TYPE
 
typedef struct tagSDBQUERYRESULT_VISTA SDBQUERYRESULT_VISTA
 
typedef struct tagSDBQUERYRESULT_VISTAPSDBQUERYRESULT_VISTA
 
typedef struct tagSDBQUERYRESULT_2k3 SDBQUERYRESULT_2k3
 
typedef struct tagSDBQUERYRESULT_2k3PSDBQUERYRESULT_2k3
 

Functions

void test_create_db_imp (const WCHAR *name, int win10)
 
DWORD test_get_db_size ()
 
void test_create_exe_imp (const WCHAR *name, int skip_rsrc_exports)
 
void test_create_file_imp (const WCHAR *name, const char *contents, size_t len)
 
void test_create_ne_imp (const WCHAR *name, int skip_names)
 
DWORD get_host_winver (void)
 
DWORD get_module_version (HMODULE mod)
 
void silence_debug_output (void)
 
 C_ASSERT (sizeof(SDBQUERYRESULT_VISTA)==SDBQUERYRESULT_EXPECTED_SIZE_VISTA)
 
 C_ASSERT (sizeof(SDBQUERYRESULT_2k3)==SDBQUERYRESULT_EXPECTED_SIZE_2k3)
 

Variables

static DWORD g_WinVersion
 

Macro Definition Documentation

◆ SDB_MAX_EXES_2k3

#define SDB_MAX_EXES_2k3   4

Definition at line 73 of file apphelp_apitest.h.

◆ SDB_MAX_EXES_VISTA

#define SDB_MAX_EXES_VISTA   16

Definition at line 47 of file apphelp_apitest.h.

◆ SDB_MAX_LAYERS

#define SDB_MAX_LAYERS   8

Definition at line 48 of file apphelp_apitest.h.

◆ SDB_MAX_SDBS

#define SDB_MAX_SDBS   16

Definition at line 46 of file apphelp_apitest.h.

◆ SDBQUERYRESULT_EXPECTED_SIZE_2k3

#define SDBQUERYRESULT_EXPECTED_SIZE_2k3   344

Definition at line 71 of file apphelp_apitest.h.

◆ SDBQUERYRESULT_EXPECTED_SIZE_VISTA

#define SDBQUERYRESULT_EXPECTED_SIZE_VISTA   456

Definition at line 51 of file apphelp_apitest.h.

◆ SHIMREG_DISABLE_LAYER

#define SHIMREG_DISABLE_LAYER   (0x00000020)

Definition at line 49 of file apphelp_apitest.h.

◆ test_create_db

#define test_create_db   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_db_imp

Definition at line 19 of file apphelp_apitest.h.

◆ test_create_exe

#define test_create_exe   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_exe_imp

Definition at line 20 of file apphelp_apitest.h.

◆ test_create_file

#define test_create_file   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_file_imp

Definition at line 21 of file apphelp_apitest.h.

◆ test_create_ne

#define test_create_ne   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_create_ne_imp

Definition at line 22 of file apphelp_apitest.h.

◆ WINVER_2003

#define WINVER_2003   0x0502

Definition at line 29 of file apphelp_apitest.h.

◆ WINVER_ANY

#define WINVER_ANY   0

Definition at line 27 of file apphelp_apitest.h.

◆ WINVER_VISTA

#define WINVER_VISTA   0x0600

Definition at line 30 of file apphelp_apitest.h.

◆ WINVER_WIN10

#define WINVER_WIN10   0x0a00

Definition at line 33 of file apphelp_apitest.h.

◆ WINVER_WIN7

#define WINVER_WIN7   0x0601

Definition at line 31 of file apphelp_apitest.h.

◆ WINVER_WIN8

#define WINVER_WIN8   0x0602

Definition at line 32 of file apphelp_apitest.h.

◆ WINVER_WINXP

#define WINVER_WINXP   0x0501

Definition at line 28 of file apphelp_apitest.h.

Typedef Documentation

◆ HSDB

typedef VOID* HSDB

Definition at line 41 of file apphelp_apitest.h.

◆ PATH_TYPE

static PATH_TYPE

Definition at line 42 of file apphelp_apitest.h.

◆ PDB

static PDB

Definition at line 40 of file apphelp_apitest.h.

◆ PSDBQUERYRESULT_2k3

◆ PSDBQUERYRESULT_VISTA

◆ QWORD

typedef UINT64 QWORD

Definition at line 39 of file apphelp_apitest.h.

◆ SDBQUERYRESULT_2k3

◆ SDBQUERYRESULT_VISTA

◆ TAG

typedef WORD TAG

Definition at line 36 of file apphelp_apitest.h.

◆ TAGID

static TAGID

Definition at line 37 of file apphelp_apitest.h.

◆ TAGREF

typedef DWORD TAGREF

Definition at line 38 of file apphelp_apitest.h.

Function Documentation

◆ C_ASSERT() [1/2]

◆ C_ASSERT() [2/2]

◆ get_host_winver()

DWORD get_host_winver ( void  )

Definition at line 788 of file data.c.

789 {
790  if (!g_WinVersion)
791  {
792  RTL_OSVERSIONINFOEXW rtlinfo = {0};
793  void (__stdcall* pRtlGetVersion)(RTL_OSVERSIONINFOEXW*);
794  pRtlGetVersion = (void (__stdcall*)(RTL_OSVERSIONINFOEXW*))GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
795 
796  rtlinfo.dwOSVersionInfoSize = sizeof(rtlinfo);
797  pRtlGetVersion(&rtlinfo);
798  g_WinVersion = (rtlinfo.dwMajorVersion << 8) | rtlinfo.dwMinorVersion;
799  }
800  return g_WinVersion;
801 }
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:265
ULONG dwMinorVersion
Definition: rtltypes.h:267
static void(__cdecl *p_initterm)(_INITTERMFUN *start
ULONG dwMajorVersion
Definition: rtltypes.h:266
static DWORD g_WinVersion
Definition: data.c:787
#define __stdcall
Definition: typedefs.h:25
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by START_TEST().

◆ get_module_version()

DWORD get_module_version ( HMODULE  mod)

Definition at line 803 of file data.c.

804 {
805  DWORD dwVersion = 0;
807  DWORD dwSize = SizeofResource(mod, hResInfo);
808  if (hResInfo && dwSize)
809  {
810  VS_FIXEDFILEINFO *lpFfi;
811  UINT uLen;
812 
813  HGLOBAL hResData = LoadResource(mod, hResInfo);
814  LPVOID pRes = LockResource(hResData);
815  HLOCAL pResCopy = LocalAlloc(LMEM_FIXED, dwSize);
816 
817  CopyMemory(pResCopy, pRes, dwSize);
818  FreeResource(hResData);
819 
820  if (VerQueryValueW(pResCopy, L"\\", (LPVOID*)&lpFfi, &uLen))
821  {
822  dwVersion = (HIWORD(lpFfi->dwProductVersionMS) << 8) | LOWORD(lpFfi->dwProductVersionMS);
823  if (!dwVersion)
824  dwVersion = (HIWORD(lpFfi->dwFileVersionMS) << 8) | LOWORD(lpFfi->dwFileVersionMS);
825  }
826 
827  LocalFree(pResCopy);
828  }
829 
830  return dwVersion;
831 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define FindResource
Definition: winbase.h:3607
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define RT_VERSION
Definition: pedump.c:376
#define LMEM_FIXED
Definition: winbase.h:349
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
unsigned int UINT
Definition: ndis.h:50
#define VS_VERSION_INFO
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define HIWORD(l)
Definition: typedefs.h:246
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define LOWORD(l)
Definition: pedump.c:82
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
static int mod
Definition: i386-dis.c:1273
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1054

Referenced by run_test(), and START_TEST().

◆ silence_debug_output()

void silence_debug_output ( void  )

Definition at line 833 of file data.c.

834 {
835  if (GetEnvironmentVariableA("SHIM_DEBUG_LEVEL", NULL, 0) == ERROR_ENVVAR_NOT_FOUND)
836  SetEnvironmentVariableA("SHIM_DEBUG_LEVEL", "0");
837  if (GetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", NULL, 0) == ERROR_ENVVAR_NOT_FOUND)
838  SetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", "0");
839 }
#define ERROR_ENVVAR_NOT_FOUND
Definition: winerror.h:261
smooth NULL
Definition: ftsmooth.c:416
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:411
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218

Referenced by START_TEST().

◆ test_create_db_imp()

void test_create_db_imp ( const WCHAR name,
int  win10 
)

Definition at line 770 of file data.c.

771 {
773  winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", wine_dbgstr_w(name));
774  if (file != INVALID_HANDLE_VALUE)
775  {
776  DWORD size;
777  WriteFile(file, rawData, sizeof(rawData), &size, NULL);
778  if (win10)
779  {
782  }
783  CloseHandle(file);
784  }
785 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
#define wine_dbgstr_w
Definition: kernel32.h:34
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
static unsigned char win10Header[8]
Definition: data.c:562
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static BOOL win10
Definition: render.c:66
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_BEGIN
Definition: winbase.h:112
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
static unsigned char rawData[2356]
Definition: data.c:565
Definition: fci.c:126

◆ test_create_exe_imp()

void test_create_exe_imp ( const WCHAR name,
int  skip_rsrc_exports 
)

Definition at line 467 of file data.c.

468 {
469  HANDLE file;
470  char *buf, *cur;
471  DWORD size = 0x800;
472  buf = malloc(size);
473 
475  winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
477  return;
478 
479  memset(buf, 0, size);
480  cur = buf;
481  cur = memcpy(buf, &dos_header, sizeof(dos_header));
482  cur += dos_header.e_lfanew;
483 
484  memcpy(cur, &nt_header, sizeof(nt_header));
485  if (skip_rsrc_exports)
486  {
487  ((IMAGE_NT_HEADERS32*)cur)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = 0;
488  ((IMAGE_NT_HEADERS32*)cur)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = 0;
489  }
490  cur += sizeof(nt_header);
491  memcpy(cur, section_headers, sizeof(section_headers));
492 
493  /* write code section: */
495  memcpy(cur, text_section, sizeof(text_section));
496 
497  if (!skip_rsrc_exports)
498  {
499  /* write resource section: */
501  memcpy(cur, &rsrc_section, sizeof(rsrc_section));
502 
503  /* write minimal export directory: */
504  cur += 0x370;
505  memcpy(cur, &export_dir, sizeof(export_dir));
506  }
507 
508  WriteFile(file, buf, size, &size, NULL);
509  free(buf);
510  CloseHandle(file);
511 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static IMAGE_SECTION_HEADER section_headers[]
Definition: data.c:95
#define free
Definition: debug_ros.c:5
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD PointerToRawData
Definition: pedump.c:290
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
static export_section_t export_dir
Definition: data.c:448
static IMAGE_DOS_HEADER dos_header
Definition: data.c:13
GLsizeiptr size
Definition: glext.h:5919
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
static const rsrc_section_t rsrc_section
Definition: data.c:235
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:140
static const unsigned char text_section[]
Definition: data.c:123
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
#define malloc
Definition: debug_ros.c:4
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
#define memset(x, y, z)
Definition: compat.h:39
static IMAGE_NT_HEADERS32 nt_header
Definition: data.c:36
Definition: fci.c:126

◆ test_create_file_imp()

void test_create_file_imp ( const WCHAR name,
const char contents,
size_t  len 
)

Definition at line 547 of file data.c.

548 {
550  winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
551  if (file != INVALID_HANDLE_VALUE)
552  {
553  if (contents && len)
554  {
555  DWORD size;
556  WriteFile(file, contents, (DWORD)len, &size, NULL);
557  }
558  CloseHandle(file);
559  }
560 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
GLenum GLsizei len
Definition: glext.h:6722
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
Definition: fci.c:126

Referenced by test_crc2_imp(), and test_crc_imp().

◆ test_create_ne_imp()

void test_create_ne_imp ( const WCHAR name,
int  skip_names 
)

Definition at line 515 of file data.c.

516 {
517  HANDLE file;
518  DWORD size;
519  IMAGE_DOS_HEADER MZ_hdr = { IMAGE_DOS_SIGNATURE, 0 };
520  IMAGE_OS2_HEADER NE_hdr = { IMAGE_OS2_SIGNATURE, 0 };
521  static const BYTE NE_names[] =
522  {
523  /* Show that the length is used, not the nullterm*/
524  11,'T','E','S','T','M','O','D','.','h','X','x','x',0,0,0,
525  20,'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0,0,0
526  };
527 
529  winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
531  return;
532 
533  MZ_hdr.e_lfanew = sizeof(MZ_hdr);
534  if (!skip_names)
535  {
536  NE_hdr.ne_restab = sizeof(NE_hdr); /* First entry (pascal string + ordinal) = module name */
537  NE_hdr.ne_nrestab = sizeof(MZ_hdr) + sizeof(NE_hdr) + 16; /* First entry (pascal string + ordinal) = module description */
538  }
539 
540  WriteFile(file, &MZ_hdr, sizeof(MZ_hdr), &size, NULL);
541  WriteFile(file, &NE_hdr, sizeof(NE_hdr), &size, NULL);
542  WriteFile(file, NE_names, sizeof(NE_names), &size, NULL);
543 
544  CloseHandle(file);
545 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define IMAGE_OS2_SIGNATURE
Definition: pedump.c:90
unsigned char BYTE
Definition: mem.h:68
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileW
Definition: compat.h:400
Definition: name.c:36
Definition: fci.c:126

◆ test_get_db_size()

DWORD test_get_db_size ( )

Definition at line 765 of file data.c.

766 {
767  return sizeof(rawData);
768 }
static unsigned char rawData[2356]
Definition: data.c:565

Referenced by test_TagRef().

Variable Documentation

◆ g_WinVersion