Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
33b6ad7f
Commit
33b6ad7f
authored
Jul 26, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi/tests: Skip tests if UAC is enabled and the process is not running elevated.
parent
deb1c552
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
install.c
dlls/msi/tests/install.c
+0
-0
package.c
dlls/msi/tests/package.c
+35
-0
patch.c
dlls/msi/tests/patch.c
+40
-0
No files found.
dlls/msi/tests/install.c
View file @
33b6ad7f
This diff is collapsed.
Click to expand it.
dlls/msi/tests/package.c
View file @
33b6ad7f
...
...
@@ -36,6 +36,8 @@ char CURR_DIR[MAX_PATH];
static
UINT
(
WINAPI
*
pMsiApplyMultiplePatchesA
)(
LPCSTR
,
LPCSTR
,
LPCSTR
);
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
static
BOOL
(
WINAPI
*
pGetTokenInformation
)(
HANDLE
,
TOKEN_INFORMATION_CLASS
,
LPVOID
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pOpenProcessToken
)(
HANDLE
,
DWORD
,
PHANDLE
);
static
LONG
(
WINAPI
*
pRegDeleteKeyExA
)(
HKEY
,
LPCSTR
,
REGSAM
,
DWORD
);
static
LONG
(
WINAPI
*
pRegDeleteKeyExW
)(
HKEY
,
LPCWSTR
,
REGSAM
,
DWORD
);
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
...
...
@@ -56,6 +58,8 @@ static void init_functionpointers(void)
GET_PROC
(
hmsi
,
MsiApplyMultiplePatchesA
);
GET_PROC
(
hadvapi32
,
ConvertSidToStringSidA
);
GET_PROC
(
hadvapi32
,
GetTokenInformation
);
GET_PROC
(
hadvapi32
,
OpenProcessToken
);
GET_PROC
(
hadvapi32
,
RegDeleteKeyExA
)
GET_PROC
(
hadvapi32
,
RegDeleteKeyExW
)
GET_PROC
(
hkernel32
,
IsWow64Process
)
...
...
@@ -66,6 +70,25 @@ static void init_functionpointers(void)
#undef GET_PROC
}
static
BOOL
is_process_limited
(
void
)
{
HANDLE
token
;
if
(
!
pOpenProcessToken
||
!
pGetTokenInformation
)
return
FALSE
;
if
(
pOpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
{
BOOL
ret
;
TOKEN_ELEVATION_TYPE
type
=
TokenElevationTypeDefault
;
DWORD
size
;
ret
=
pGetTokenInformation
(
token
,
TokenElevationType
,
&
type
,
sizeof
(
type
),
&
size
);
CloseHandle
(
token
);
return
(
ret
&&
type
==
TokenElevationTypeLimited
);
}
return
FALSE
;
}
static
LONG
delete_key
(
HKEY
key
,
LPCSTR
subkey
,
REGSAM
access
)
{
if
(
pRegDeleteKeyExA
)
...
...
@@ -2440,6 +2463,12 @@ static void test_states(void)
static
const
CHAR
msifile3
[]
=
"winetest3-package.msi"
;
static
const
CHAR
msifile4
[]
=
"winetest4-package.msi"
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
hdb
=
create_package_db
();
ok
(
hdb
,
"failed to create package database
\n
"
);
...
...
@@ -7538,6 +7567,12 @@ static void test_appsearch_complocator(void)
if
(
!
get_user_sid
(
&
usersid
))
return
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
create_test_file
(
"FileName1"
);
create_test_file
(
"FileName4"
);
set_component_path
(
"FileName1"
,
MSIINSTALLCONTEXT_MACHINE
,
...
...
dlls/msi/tests/patch.c
View file @
33b6ad7f
...
...
@@ -35,6 +35,8 @@ static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCON
LPCSTR
,
LPSTR
,
DWORD
*
);
static
UINT
(
WINAPI
*
pMsiEnumPatchesExA
)(
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
,
DWORD
,
LPSTR
,
LPSTR
,
MSIINSTALLCONTEXT
*
,
LPSTR
,
LPDWORD
);
static
BOOL
(
WINAPI
*
pGetTokenInformation
)(
HANDLE
,
TOKEN_INFORMATION_CLASS
,
LPVOID
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pOpenProcessToken
)(
HANDLE
,
DWORD
,
PHANDLE
);
static
const
char
*
msifile
=
"winetest-patch.msi"
;
static
const
char
*
mspfile
=
"winetest-patch.msp"
;
...
...
@@ -138,6 +140,7 @@ static const struct msi_table tables[] =
static
void
init_function_pointers
(
void
)
{
HMODULE
hmsi
=
GetModuleHandleA
(
"msi.dll"
);
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
#define GET_PROC( mod, func ) \
p ## func = (void *)GetProcAddress( mod, #func ); \
...
...
@@ -147,9 +150,31 @@ static void init_function_pointers( void )
GET_PROC
(
hmsi
,
MsiApplyPatchA
);
GET_PROC
(
hmsi
,
MsiGetPatchInfoExA
);
GET_PROC
(
hmsi
,
MsiEnumPatchesExA
);
GET_PROC
(
hadvapi32
,
GetTokenInformation
);
GET_PROC
(
hadvapi32
,
OpenProcessToken
);
#undef GET_PROC
}
static
BOOL
is_process_limited
(
void
)
{
HANDLE
token
;
if
(
!
pOpenProcessToken
||
!
pGetTokenInformation
)
return
FALSE
;
if
(
pOpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
{
BOOL
ret
;
TOKEN_ELEVATION_TYPE
type
=
TokenElevationTypeDefault
;
DWORD
size
;
ret
=
pGetTokenInformation
(
token
,
TokenElevationType
,
&
type
,
sizeof
(
type
),
&
size
);
CloseHandle
(
token
);
return
(
ret
&&
type
==
TokenElevationTypeLimited
);
}
return
FALSE
;
}
static
BOOL
get_program_files_dir
(
char
*
buf
,
char
*
buf2
)
{
HKEY
hkey
;
...
...
@@ -690,6 +715,11 @@ static void test_simple_patch( void )
win_skip
(
"MsiApplyPatchA is not available
\n
"
);
return
;
}
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
patch.txt"
,
1000
);
...
...
@@ -937,6 +967,11 @@ static void test_system_tables( void )
win_skip
(
"MsiApplyPatchA is not available
\n
"
);
return
;
}
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
patch.txt"
,
1000
);
...
...
@@ -1097,6 +1132,11 @@ static void test_patch_registration( void )
win_skip
(
"required functions not available
\n
"
);
return
;
}
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
patch.txt"
,
1000
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment