mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 19:43:31 +08:00
[APPHELP_APITEST] Deduplicate the IsUserAdmin() helper.
This commit is contained in:
parent
f1cff6ef27
commit
a8755711b9
@ -5,7 +5,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* data.c */
|
||||
void test_create_db_imp(const WCHAR* name, int win10);
|
||||
DWORD test_get_db_size();
|
||||
@ -21,6 +20,8 @@ void silence_debug_output(void); // Silence output if the environment var
|
||||
#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
|
||||
|
||||
/* register.cpp */
|
||||
BOOL IsUserAdmin();
|
||||
|
||||
static DWORD g_WinVersion;
|
||||
|
||||
@ -42,7 +43,6 @@ typedef VOID* HSDB;
|
||||
typedef INT PATH_TYPE;
|
||||
|
||||
|
||||
|
||||
#define SDB_MAX_SDBS 16
|
||||
#define SDB_MAX_EXES_VISTA 16
|
||||
#define SDB_MAX_LAYERS 8
|
||||
@ -50,8 +50,6 @@ typedef INT PATH_TYPE;
|
||||
|
||||
#define SDBQUERYRESULT_EXPECTED_SIZE_VISTA 456
|
||||
|
||||
|
||||
|
||||
typedef struct tagSDBQUERYRESULT_VISTA
|
||||
{
|
||||
TAGREF atrExes[SDB_MAX_EXES_VISTA];
|
||||
@ -67,7 +65,6 @@ typedef struct tagSDBQUERYRESULT_VISTA
|
||||
GUID rgGuidDB[SDB_MAX_SDBS];
|
||||
} SDBQUERYRESULT_VISTA, *PSDBQUERYRESULT_VISTA;
|
||||
|
||||
|
||||
#define SDBQUERYRESULT_EXPECTED_SIZE_2k3 344
|
||||
|
||||
#define SDB_MAX_EXES_2k3 4
|
||||
@ -86,16 +83,10 @@ typedef struct tagSDBQUERYRESULT_2k3
|
||||
GUID rgGuidDB[SDB_MAX_SDBS];
|
||||
} SDBQUERYRESULT_2k3, *PSDBQUERYRESULT_2k3;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
C_ASSERT(sizeof(SDBQUERYRESULT_VISTA) == SDBQUERYRESULT_EXPECTED_SIZE_VISTA);
|
||||
C_ASSERT(sizeof(SDBQUERYRESULT_2k3) == SDBQUERYRESULT_EXPECTED_SIZE_2k3);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
@ -1189,27 +1189,6 @@ static void test_is_testdb(PDB pdb)
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL IsUserAdmin()
|
||||
{
|
||||
BOOL Result;
|
||||
SID_IDENTIFIER_AUTHORITY NtAuthority = { SECURITY_NT_AUTHORITY };
|
||||
PSID AdministratorsGroup;
|
||||
|
||||
Result = AllocateAndInitializeSid(&NtAuthority, 2,
|
||||
SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
&AdministratorsGroup);
|
||||
if (Result)
|
||||
{
|
||||
if (!CheckTokenMembership( NULL, AdministratorsGroup, &Result))
|
||||
Result = FALSE;
|
||||
FreeSid(AdministratorsGroup);
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
template<typename SDBQUERYRESULT_T>
|
||||
static void check_adwExeFlags(DWORD adwExeFlags_0, SDBQUERYRESULT_T& query, const char* file, int line, size_t cur)
|
||||
@ -1599,8 +1578,6 @@ static void test_MatchApplicationsEx(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void test_TagRef(void)
|
||||
{
|
||||
WCHAR tmpdir[MAX_PATH], dbpath[MAX_PATH];
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include <strsafe.h>
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "apphelp_apitest.h"
|
||||
|
||||
static const unsigned char rawDB[] =
|
||||
{
|
||||
/* Header: Major, Minor, 'sdbf' */
|
||||
@ -90,7 +92,7 @@ BOOL IsUserAdmin()
|
||||
&AdministratorsGroup);
|
||||
if (Result)
|
||||
{
|
||||
if (!CheckTokenMembership( NULL, AdministratorsGroup, &Result))
|
||||
if (!CheckTokenMembership(NULL, AdministratorsGroup, &Result))
|
||||
Result = FALSE;
|
||||
FreeSid(AdministratorsGroup);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user