Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
623dad09
Commit
623dad09
authored
May 26, 2009
by
Francois Gouget
Committed by
Alexandre Julliard
May 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi/tests: Tweak the get_user_sid() functions to simplify their use.
Now the function deals with all errors and win_skips() itself.
parent
97dea95e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
40 deletions
+34
-40
install.c
dlls/msi/tests/install.c
+19
-30
package.c
dlls/msi/tests/package.c
+15
-10
No files found.
dlls/msi/tests/install.c
View file @
623dad09
...
...
@@ -1346,26 +1346,35 @@ static BOOL check_win9x(void)
return
FALSE
;
}
static
void
get_user_sid
(
LPSTR
*
usersid
)
static
LPSTR
get_user_sid
(
LPSTR
*
usersid
)
{
HANDLE
token
;
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
)
;
static
HMODULE
hadvapi32
=
NULL
;
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
*
usersid
=
NULL
;
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
return
;
if
(
!
hadvapi32
)
{
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
{
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
}
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
size
=
sizeof
(
buf
);
GetTokenInformation
(
token
,
TokenUser
,
buf
,
size
,
&
size
);
user
=
(
PTOKEN_USER
)
buf
;
pConvertSidToStringSidA
(
user
->
User
.
Sid
,
usersid
);
ok
(
*
usersid
!=
NULL
,
"pConvertSidToStringSidA failed lre=%d
\n
"
,
GetLastError
());
CloseHandle
(
token
);
return
*
usersid
;
}
static
BOOL
check_record
(
MSIHANDLE
rec
,
UINT
field
,
LPCSTR
val
)
...
...
@@ -2511,12 +2520,8 @@ static void test_publish_registerproduct(void)
static
const
CHAR
userugkey
[]
=
"Software
\\
Microsoft
\\
Installer
\\
UpgradeCodes"
"
\\
51AAE0C44620A5E4788506E91F249BD2"
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
get_date_str
(
date
);
GetTempPath
(
MAX_PATH
,
temp
);
...
...
@@ -2756,12 +2761,8 @@ static void test_publish_publishproduct(void)
static
const
CHAR
machprod
[]
=
"Installer
\\
Products
\\
84A88FD7F6998CE40A22FB59F6B9C2BB"
;
static
const
CHAR
machup
[]
=
"Installer
\\
UpgradeCodes
\\
51AAE0C44620A5E4788506E91F249BD2"
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
GetTempPath
(
MAX_PATH
,
temp
);
...
...
@@ -2952,12 +2953,8 @@ static void test_publish_publishfeatures(void)
static
const
CHAR
classfeat
[]
=
"Software
\\
Classes
\\
Installer
\\
Features"
"
\\
84A88FD7F6998CE40A22FB59F6B9C2BB"
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
maximus"
,
500
);
...
...
@@ -3114,12 +3111,8 @@ static void test_publish_registeruser(void)
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
"
"UserData
\\
%s
\\
Products
\\
84A88FD7F6998CE40A22FB59F6B9C2BB
\\
InstallProperties"
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
get_owner_company
(
&
owner
,
&
company
);
...
...
@@ -3197,12 +3190,8 @@ static void test_publish_processcomponents(void)
static
const
CHAR
compkey
[]
=
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
Components"
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
maximus"
,
500
);
...
...
dlls/msi/tests/package.c
View file @
623dad09
...
...
@@ -34,26 +34,35 @@ char CURR_DIR[MAX_PATH];
static
UINT
(
WINAPI
*
pMsiApplyMultiplePatchesA
)(
LPCSTR
,
LPCSTR
,
LPCSTR
);
static
void
get_user_sid
(
LPSTR
*
usersid
)
static
LPSTR
get_user_sid
(
LPSTR
*
usersid
)
{
HANDLE
token
;
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
)
;
static
HMODULE
hadvapi32
=
NULL
;
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
*
usersid
=
NULL
;
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
return
;
if
(
!
hadvapi32
)
{
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
{
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
}
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
size
=
sizeof
(
buf
);
GetTokenInformation
(
token
,
TokenUser
,
buf
,
size
,
&
size
);
user
=
(
PTOKEN_USER
)
buf
;
pConvertSidToStringSidA
(
user
->
User
.
Sid
,
usersid
);
ok
(
*
usersid
!=
NULL
,
"pConvertSidToStringSidA failed lre=%d
\n
"
,
GetLastError
());
CloseHandle
(
token
);
return
*
usersid
;
}
/* RegDeleteTreeW from dlls/advapi32/registry.c */
...
...
@@ -7336,12 +7345,8 @@ static void test_appsearch_complocator(void)
DWORD
size
;
UINT
r
;
get_user_sid
(
&
usersid
);
if
(
!
usersid
)
{
skip
(
"ConvertSidToStringSidA is not available
\n
"
);
if
(
!
get_user_sid
(
&
usersid
))
return
;
}
create_test_file
(
"FileName1"
);
create_test_file
(
"FileName4"
);
...
...
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