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
41fe12f1
Commit
41fe12f1
authored
Jun 23, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Jun 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Reimplement MsiGetUserInfo.
parent
72fedf7d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
25 deletions
+71
-25
msi.c
dlls/msi/msi.c
+71
-25
No files found.
dlls/msi/msi.c
View file @
41fe12f1
...
@@ -2295,57 +2295,93 @@ static USERINFOSTATE WINAPI MSI_GetUserInfo(LPCWSTR szProduct,
...
@@ -2295,57 +2295,93 @@ static USERINFOSTATE WINAPI MSI_GetUserInfo(LPCWSTR szProduct,
awstring
*
lpOrgNameBuf
,
LPDWORD
pcchOrgNameBuf
,
awstring
*
lpOrgNameBuf
,
LPDWORD
pcchOrgNameBuf
,
awstring
*
lpSerialBuf
,
LPDWORD
pcchSerialBuf
)
awstring
*
lpSerialBuf
,
LPDWORD
pcchSerialBuf
)
{
{
HKEY
hkey
;
WCHAR
squished_pc
[
SQUISH_GUID_SIZE
]
;
LPWSTR
user
,
org
,
serial
;
LPWSTR
user
,
org
,
serial
;
UINT
r
;
USERINFOSTATE
state
;
USERINFOSTATE
state
;
HKEY
hkey
,
props
;
LPCWSTR
orgptr
;
UINT
r
;
TRACE
(
"%s %p %p %p %p %p %p
\n
"
,
debugstr_w
(
szProduct
),
lpUserNameBuf
,
static
const
WCHAR
szEmpty
[]
=
{
0
};
TRACE
(
"%s %p %p %p %p %p %p
\n
"
,
debugstr_w
(
szProduct
),
lpUserNameBuf
,
pcchUserNameBuf
,
lpOrgNameBuf
,
pcchOrgNameBuf
,
lpSerialBuf
,
pcchUserNameBuf
,
lpOrgNameBuf
,
pcchOrgNameBuf
,
lpSerialBuf
,
pcchSerialBuf
);
pcchSerialBuf
);
if
(
!
szProduct
)
if
(
!
szProduct
||
!
squash_guid
(
szProduct
,
squished_pc
)
)
return
USERINFOSTATE_INVALIDARG
;
return
USERINFOSTATE_INVALIDARG
;
r
=
MSIREG_OpenUninstallKey
(
szProduct
,
&
hkey
,
FALSE
);
if
(
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
if
(
r
!=
ERROR_SUCCESS
)
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
)
{
return
USERINFOSTATE_UNKNOWN
;
return
USERINFOSTATE_UNKNOWN
;
}
if
(
MSIREG_OpenCurrentUserInstallProps
(
szProduct
,
&
props
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenLocalSystemInstallProps
(
szProduct
,
&
props
,
FALSE
)
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hkey
);
return
USERINFOSTATE_ABSENT
;
}
user
=
msi_reg_get_val_str
(
hkey
,
INSTALLPROPERTY_REGOWNERW
);
user
=
msi_reg_get_val_str
(
props
,
INSTALLPROPERTY_REGOWNERW
);
org
=
msi_reg_get_val_str
(
hkey
,
INSTALLPROPERTY_REGCOMPANYW
);
org
=
msi_reg_get_val_str
(
props
,
INSTALLPROPERTY_REGCOMPANYW
);
serial
=
msi_reg_get_val_str
(
hkey
,
INSTALLPROPERTY_PRODUCTIDW
);
serial
=
msi_reg_get_val_str
(
props
,
INSTALLPROPERTY_PRODUCTIDW
);
state
=
USERINFOSTATE_ABSENT
;
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
RegCloseKey
(
props
);
if
(
user
&&
serial
)
state
=
USERINFOSTATE_PRESENT
;
state
=
USERINFOSTATE_PRESENT
;
if
(
user
)
if
(
pcchUserNameBuf
)
{
if
(
lpUserNameBuf
&&
!
user
)
{
{
r
=
msi_strcpy_to_awstring
(
user
,
lpUserNameBuf
,
pcchUserNameBuf
);
(
*
pcchUserNameBuf
)
--
;
goto
done
;
}
r
=
msi_strcpy_to_awstring
(
user
,
lpUserNameBuf
,
pcchUserNameBuf
);
if
(
r
==
ERROR_MORE_DATA
)
if
(
r
==
ERROR_MORE_DATA
)
{
state
=
USERINFOSTATE_MOREDATA
;
state
=
USERINFOSTATE_MOREDATA
;
goto
done
;
}
}
else
}
state
=
USERINFOSTATE_ABSENT
;
if
(
org
)
if
(
pcchOrgNameBuf
)
{
orgptr
=
org
;
if
(
!
orgptr
)
orgptr
=
szEmpty
;
r
=
msi_strcpy_to_awstring
(
orgptr
,
lpOrgNameBuf
,
pcchOrgNameBuf
);
if
(
r
==
ERROR_MORE_DATA
)
{
{
r
=
msi_strcpy_to_awstring
(
org
,
lpOrgNameBuf
,
pcchOrgNameBuf
);
if
(
r
==
ERROR_MORE_DATA
&&
state
==
USERINFOSTATE_PRESENT
)
state
=
USERINFOSTATE_MOREDATA
;
state
=
USERINFOSTATE_MOREDATA
;
goto
done
;
}
}
}
/* msdn states: The user information is considered to be present even in the absence of a company name. */
if
(
serial
)
if
(
pcchSerialBuf
)
{
{
r
=
msi_strcpy_to_awstring
(
serial
,
lpSerialBuf
,
pcchSerialBuf
);
if
(
!
serial
)
if
(
r
==
ERROR_MORE_DATA
&&
state
==
USERINFOSTATE_PRESENT
)
{
(
*
pcchSerialBuf
)
--
;
goto
done
;
}
r
=
msi_strcpy_to_awstring
(
serial
,
lpSerialBuf
,
pcchSerialBuf
);
if
(
r
==
ERROR_MORE_DATA
)
state
=
USERINFOSTATE_MOREDATA
;
state
=
USERINFOSTATE_MOREDATA
;
}
}
else
state
=
USERINFOSTATE_ABSENT
;
msi_free
(
user
);
done:
msi_free
(
org
);
msi_free
(
user
);
msi_free
(
serial
);
msi_free
(
org
);
msi_free
(
serial
);
return
state
;
return
state
;
}
}
...
@@ -2360,6 +2396,11 @@ USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct,
...
@@ -2360,6 +2396,11 @@ USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR szProduct,
{
{
awstring
user
,
org
,
serial
;
awstring
user
,
org
,
serial
;
if
((
lpUserNameBuf
&&
!
pcchUserNameBuf
)
||
(
lpOrgNameBuf
&&
!
pcchOrgNameBuf
)
||
(
lpSerialBuf
&&
!
pcchSerialBuf
))
return
USERINFOSTATE_INVALIDARG
;
user
.
unicode
=
TRUE
;
user
.
unicode
=
TRUE
;
user
.
str
.
w
=
lpUserNameBuf
;
user
.
str
.
w
=
lpUserNameBuf
;
org
.
unicode
=
TRUE
;
org
.
unicode
=
TRUE
;
...
@@ -2381,6 +2422,11 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct,
...
@@ -2381,6 +2422,11 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR szProduct,
LPWSTR
prod
;
LPWSTR
prod
;
UINT
r
;
UINT
r
;
if
((
lpUserNameBuf
&&
!
pcchUserNameBuf
)
||
(
lpOrgNameBuf
&&
!
pcchOrgNameBuf
)
||
(
lpSerialBuf
&&
!
pcchSerialBuf
))
return
USERINFOSTATE_INVALIDARG
;
prod
=
strdupAtoW
(
szProduct
);
prod
=
strdupAtoW
(
szProduct
);
if
(
szProduct
&&
!
prod
)
if
(
szProduct
&&
!
prod
)
return
ERROR_OUTOFMEMORY
;
return
ERROR_OUTOFMEMORY
;
...
...
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