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
45c00da4
Commit
45c00da4
authored
May 27, 2009
by
Paul Vriens
Committed by
Alexandre Julliard
May 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi/tests: Prevent crash when ConvertSidToStringSidA is not available.
parent
8921b936
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
25 deletions
+32
-25
install.c
dlls/msi/tests/install.c
+9
-11
package.c
dlls/msi/tests/package.c
+23
-14
No files found.
dlls/msi/tests/install.c
View file @
45c00da4
...
...
@@ -40,6 +40,8 @@ static UINT (WINAPI *pMsiSourceListEnumSourcesA)
static
UINT
(
WINAPI
*
pMsiSourceListGetInfoA
)
(
LPCSTR
,
LPCSTR
,
MSIINSTALLCONTEXT
,
DWORD
,
LPCSTR
,
LPSTR
,
LPDWORD
);
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
static
HMODULE
hsrclient
=
0
;
static
BOOL
(
WINAPI
*
pSRRemoveRestorePoint
)(
DWORD
);
static
BOOL
(
WINAPI
*
pSRSetRestorePointA
)(
RESTOREPOINTINFOA
*
,
STATEMGRSTATUS
*
);
...
...
@@ -1316,6 +1318,7 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv)
static
void
init_functionpointers
(
void
)
{
HMODULE
hmsi
=
GetModuleHandleA
(
"msi.dll"
);
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func); \
...
...
@@ -1326,6 +1329,8 @@ static void init_functionpointers(void)
GET_PROC
(
hmsi
,
MsiSourceListEnumSourcesA
);
GET_PROC
(
hmsi
,
MsiSourceListGetInfoA
);
GET_PROC
(
hadvapi32
,
ConvertSidToStringSidA
);
hsrclient
=
LoadLibraryA
(
"srclient.dll"
);
GET_PROC
(
hsrclient
,
SRRemoveRestorePoint
);
GET_PROC
(
hsrclient
,
SRSetRestorePointA
);
...
...
@@ -1352,21 +1357,14 @@ static LPSTR get_user_sid(LPSTR *usersid)
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
static
HMODULE
hadvapi32
=
NULL
;
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
*
usersid
=
NULL
;
if
(
!
hadvapi32
)
if
(
!
pConvertSidToStringSidA
)
{
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
{
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
*
usersid
=
NULL
;
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
size
=
sizeof
(
buf
);
GetTokenInformation
(
token
,
TokenUser
,
buf
,
size
,
&
size
);
...
...
dlls/msi/tests/package.c
View file @
45c00da4
...
...
@@ -34,27 +34,38 @@ char CURR_DIR[MAX_PATH];
static
UINT
(
WINAPI
*
pMsiApplyMultiplePatchesA
)(
LPCSTR
,
LPCSTR
,
LPCSTR
);
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
static
void
init_functionpointers
(
void
)
{
HMODULE
hmsi
=
GetModuleHandleA
(
"msi.dll"
);
HMODULE
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func);
GET_PROC
(
hmsi
,
MsiApplyMultiplePatchesA
);
GET_PROC
(
hadvapi32
,
ConvertSidToStringSidA
);
#undef GET_PROC
}
static
LPSTR
get_user_sid
(
LPSTR
*
usersid
)
{
HANDLE
token
;
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
static
HMODULE
hadvapi32
=
NULL
;
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
*
usersid
=
NULL
;
if
(
!
hadvapi32
)
if
(
!
pConvertSidToStringSidA
)
{
hadvapi32
=
GetModuleHandleA
(
"advapi32.dll"
);
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
if
(
!
pConvertSidToStringSidA
)
{
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
win_skip
(
"ConvertSidToStringSidA is not available
\n
"
);
return
NULL
;
}
*
usersid
=
NULL
;
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
size
=
sizeof
(
buf
);
GetTokenInformation
(
token
,
TokenUser
,
buf
,
size
,
&
size
);
...
...
@@ -11622,9 +11633,7 @@ static void test_MsiApplyPatch(void)
START_TEST
(
package
)
{
HMODULE
hmsi
=
GetModuleHandleA
(
"msi.dll"
);
pMsiApplyMultiplePatchesA
=
(
void
*
)
GetProcAddress
(
hmsi
,
"MsiApplyMultiplePatchesA"
);
init_functionpointers
();
GetCurrentDirectoryA
(
MAX_PATH
,
CURR_DIR
);
...
...
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