ReactOS 0.4.15-dev-7928-g68a8619
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)
 
BOOL IsUserAdmin (VOID)
 
 C_ASSERT (sizeof(SDBQUERYRESULT_VISTA)==SDBQUERYRESULT_EXPECTED_SIZE_VISTA)
 
 C_ASSERT (sizeof(SDBQUERYRESULT_2k3)==SDBQUERYRESULT_EXPECTED_SIZE_2k3)
 

Variables

DWORD g_WinVersion
 

Macro Definition Documentation

◆ SDB_MAX_EXES_2k3

#define SDB_MAX_EXES_2k3   4

Definition at line 70 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 68 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 18 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 19 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 20 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 21 of file apphelp_apitest.h.

◆ WINVER_2003

#define WINVER_2003   0x0502

Definition at line 30 of file apphelp_apitest.h.

◆ WINVER_ANY

#define WINVER_ANY   0

Definition at line 28 of file apphelp_apitest.h.

◆ WINVER_VISTA

#define WINVER_VISTA   0x0600

Definition at line 31 of file apphelp_apitest.h.

◆ WINVER_WIN10

#define WINVER_WIN10   0x0a00

Definition at line 34 of file apphelp_apitest.h.

◆ WINVER_WIN7

#define WINVER_WIN7   0x0601

Definition at line 32 of file apphelp_apitest.h.

◆ WINVER_WIN8

#define WINVER_WIN8   0x0602

Definition at line 33 of file apphelp_apitest.h.

◆ WINVER_WINXP

#define WINVER_WINXP   0x0501

Definition at line 29 of file apphelp_apitest.h.

Typedef Documentation

◆ HSDB

typedef VOID* HSDB

Definition at line 42 of file apphelp_apitest.h.

◆ PATH_TYPE

static PATH_TYPE

Definition at line 43 of file apphelp_apitest.h.

◆ PDB

static PDB

Definition at line 41 of file apphelp_apitest.h.

◆ PSDBQUERYRESULT_2k3

◆ PSDBQUERYRESULT_VISTA

◆ QWORD

typedef UINT64 QWORD

Definition at line 40 of file apphelp_apitest.h.

◆ SDBQUERYRESULT_2k3

◆ SDBQUERYRESULT_VISTA

◆ TAG

typedef WORD TAG

Definition at line 37 of file apphelp_apitest.h.

◆ TAGID

static TAGID

Definition at line 38 of file apphelp_apitest.h.

◆ TAGREF

typedef DWORD TAGREF

Definition at line 39 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 796 of file data.c.

797{
798 if (!g_WinVersion)
799 {
800 RTL_OSVERSIONINFOEXW rtlinfo = {0};
801 void (__stdcall* pRtlGetVersion)(RTL_OSVERSIONINFOEXW*);
802 pRtlGetVersion = (void (__stdcall*)(RTL_OSVERSIONINFOEXW*))GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
803
804 rtlinfo.dwOSVersionInfoSize = sizeof(rtlinfo);
805 pRtlGetVersion(&rtlinfo);
806 g_WinVersion = (rtlinfo.dwMajorVersion << 8) | rtlinfo.dwMinorVersion;
807 }
808 return g_WinVersion;
809}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD g_WinVersion
Definition: data.c:795
ULONG dwMajorVersion
Definition: rtltypes.h:270
ULONG dwMinorVersion
Definition: rtltypes.h:271
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
#define __stdcall
Definition: typedefs.h:25

Referenced by START_TEST().

◆ get_module_version()

DWORD get_module_version ( HMODULE  mod)

Definition at line 811 of file data.c.

812{
813 DWORD dwVersion = 0;
815 DWORD dwSize = SizeofResource(mod, hResInfo);
816 if (hResInfo && dwSize)
817 {
818 VS_FIXEDFILEINFO *lpFfi;
819 UINT uLen;
820
821 HGLOBAL hResData = LoadResource(mod, hResInfo);
822 LPVOID pRes = LockResource(hResData);
823 HLOCAL pResCopy = LocalAlloc(LMEM_FIXED, dwSize);
824
825 CopyMemory(pResCopy, pRes, dwSize);
826 FreeResource(hResData);
827
828 if (VerQueryValueW(pResCopy, L"\\", (LPVOID*)&lpFfi, &uLen))
829 {
830 dwVersion = (HIWORD(lpFfi->dwProductVersionMS) << 8) | LOWORD(lpFfi->dwProductVersionMS);
831 if (!dwVersion)
832 dwVersion = (HIWORD(lpFfi->dwFileVersionMS) << 8) | LOWORD(lpFfi->dwFileVersionMS);
833 }
834
835 LocalFree(pResCopy);
836 }
837
838 return dwVersion;
839}
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
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
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
static int mod
Definition: i386-dis.c:1288
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define VS_VERSION_INFO
#define LOWORD(l)
Definition: pedump.c:82
#define RT_VERSION
Definition: pedump.c:376
#define HIWORD(l)
Definition: typedefs.h:247
#define CopyMemory
Definition: winbase.h:1710
#define FindResource
Definition: winbase.h:3793
#define LMEM_FIXED
Definition: winbase.h:368
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by run_test(), and START_TEST().

◆ IsUserAdmin()

BOOL IsUserAdmin ( VOID  )

Definition at line 81 of file register.cpp.

82{
85 PSID AdministratorsGroup;
86
90 0, 0, 0, 0, 0, 0,
91 &AdministratorsGroup);
92 if (Result)
93 {
94 if (!CheckTokenMembership(NULL, AdministratorsGroup, &Result))
95 Result = FALSE;
96 FreeSid(AdministratorsGroup);
97 }
98
99 return Result;
100}
static SID_IDENTIFIER_AUTHORITY NtAuthority
Definition: security.c:40
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define SECURITY_BUILTIN_DOMAIN_RID
Definition: setypes.h:581
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
#define DOMAIN_ALIAS_RID_ADMINS
Definition: setypes.h:652

◆ silence_debug_output()

void silence_debug_output ( void  )

Definition at line 841 of file data.c.

842{
843 if (GetEnvironmentVariableA("SHIM_DEBUG_LEVEL", NULL, 0) == ERROR_ENVVAR_NOT_FOUND)
844 SetEnvironmentVariableA("SHIM_DEBUG_LEVEL", "0");
845 if (GetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", NULL, 0) == ERROR_ENVVAR_NOT_FOUND)
846 SetEnvironmentVariableA("SHIMENG_DEBUG_LEVEL", "0");
847}
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
#define ERROR_ENVVAR_NOT_FOUND
Definition: winerror.h:261

Referenced by START_TEST().

◆ test_create_db_imp()

void test_create_db_imp ( const WCHAR name,
int  win10 
)

Definition at line 778 of file data.c.

779{
781 winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file '%s'\n", wine_dbgstr_w(name));
783 {
784 DWORD size;
785 WriteFile(file, rawData, sizeof(rawData), &size, NULL);
786 if (win10)
787 {
790 }
792 }
793}
#define CloseHandle
Definition: compat.h:739
#define FILE_BEGIN
Definition: compat.h:761
#define SetFilePointer
Definition: compat.h:743
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#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
GLsizeiptr size
Definition: glext.h:5919
#define wine_dbgstr_w
Definition: kernel32.h:34
#define CREATE_ALWAYS
Definition: disk.h:72
static unsigned char rawData[2356]
Definition: data.c:573
static unsigned char win10Header[8]
Definition: data.c:570
static BOOL win10
Definition: render.c:66
#define GENERIC_WRITE
Definition: nt_native.h:90
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
Definition: fci.c:127
Definition: name.c:39

◆ 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
473 buf = malloc(size);
474 winetest_ok(buf != NULL, "malloc failed\n");
475 if (buf == NULL)
476 {
477 return;
478 }
479
481 winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
483 {
484 free(buf);
485 return;
486 }
487
488 memset(buf, 0, size);
489 cur = memcpy(buf, &dos_header, sizeof(dos_header));
491
492 memcpy(cur, &nt_header, sizeof(nt_header));
493 if (skip_rsrc_exports)
494 {
495 ((IMAGE_NT_HEADERS32*)cur)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = 0;
496 ((IMAGE_NT_HEADERS32*)cur)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = 0;
497 }
498 cur += sizeof(nt_header);
500
501 /* write code section: */
504
505 if (!skip_rsrc_exports)
506 {
507 /* write resource section: */
510
511 /* write minimal export directory: */
512 cur += 0x370;
513 memcpy(cur, &export_dir, sizeof(export_dir));
514 }
515
517 free(buf);
519}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:151
FxCollectionEntry * cur
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static IMAGE_DOS_HEADER dos_header
Definition: data.c:13
static IMAGE_SECTION_HEADER section_headers[]
Definition: data.c:95
static const unsigned char text_section[]
Definition: data.c:123
static const rsrc_section_t rsrc_section
Definition: data.c:235
static export_section_t export_dir
Definition: data.c:448
static IMAGE_NT_HEADERS32 nt_header
Definition: data.c:36
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
#define memset(x, y, z)
Definition: compat.h:39
DWORD PointerToRawData
Definition: pedump.c:290

◆ test_create_file_imp()

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

Definition at line 555 of file data.c.

556{
558 winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
560 {
561 if (contents && len)
562 {
563 DWORD size;
565 }
567 }
568}
GLenum GLsizei len
Definition: glext.h:6722
static const char * contents
Definition: parser.c:511

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 523 of file data.c.

524{
525 HANDLE file;
526 DWORD size;
529 static const BYTE NE_names[] =
530 {
531 /* Show that the length is used, not the nullterm*/
532 11,'T','E','S','T','M','O','D','.','h','X','x','x',0,0,0,
533 20,'M','O','D',' ','D','E','S','C','R','I','P','T','I','O','N',' ','H','E','R','E',0,0,0
534 };
535
537 winetest_ok(file != INVALID_HANDLE_VALUE, "can't create file\n");
539 return;
540
541 MZ_hdr.e_lfanew = sizeof(MZ_hdr);
542 if (!skip_names)
543 {
544 NE_hdr.ne_restab = sizeof(NE_hdr); /* First entry (pascal string + ordinal) = module name */
545 NE_hdr.ne_nrestab = sizeof(MZ_hdr) + sizeof(NE_hdr) + 16; /* First entry (pascal string + ordinal) = module description */
546 }
547
548 WriteFile(file, &MZ_hdr, sizeof(MZ_hdr), &size, NULL);
549 WriteFile(file, &NE_hdr, sizeof(NE_hdr), &size, NULL);
550 WriteFile(file, NE_names, sizeof(NE_names), &size, NULL);
551
553}
#define IMAGE_OS2_SIGNATURE
Definition: pedump.c:90
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
unsigned char BYTE
Definition: xxhash.c:193

◆ test_get_db_size()

DWORD test_get_db_size ( )

Definition at line 773 of file data.c.

774{
775 return sizeof(rawData);
776}

Referenced by test_TagRef().

Variable Documentation

◆ g_WinVersion