The MsiGetUserInfo function returns the registered user information for an installed product.
Syntax
C++USERINFOSTATE MsiGetUserInfo(
__in LPCTSTR szProduct,
__out LPTSTR lpUserNameBuf,
__inout DWORD *pcchUserNameBuf,
__out LPTSTR lpOrgNameBuf,
__inout DWORD *pcchOrgNameBuf,
__in LPTSTR lpSerialBuf,
__inout DWORD *pcchSerialBuf
);
Parameters
- szProduct [in]
-
Specifies the product code for the product to be queried.
- lpUserNameBuf [out]
-
Pointer to a variable that receives the name of the user.
- pcchUserNameBuf [in, out]
-
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpUserNameBuf parameter. This size should include the terminating null character.
- lpOrgNameBuf [out]
-
Pointer to a buffer that receives the organization name.
- pcchOrgNameBuf [in, out]
-
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpOrgNameBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. If the buffer passed in is too small, the count returned does not include the terminating null character.
- lpSerialBuf [in]
-
Pointer to a buffer that receives the product ID.
- pcchSerialBuf [in, out]
-
Pointer to a variable that specifies the size, in characters, of the buffer pointed to by the lpSerialBuf parameter. On input, this is the full size of the buffer, including a space for a terminating null character. If the buffer passed in is too small, the count returned does not include the terminating null character.
Return Value
Value | Meaning |
---|---|
|
Some or all of the user information is absent. |
|
One of the function parameters was invalid. |
|
A buffer is too small to hold the requested data. |
|
The function completed successfully. |
|
The product code does not identify a known product. |
Remarks
When the MsiGetUserInfo function returns, the pcchNameBuf parameter contains the length of the class string stored in the buffer. The count returned does not include the terminating null character. If the buffer is not big enough, the MsiGetUserInfo function returns USERINFOSTATE_MOREDATA, and MsiGetUserInfo contains the size of the string, in characters, without counting the null character.
The user information is considered to be present even in the absence of a company name.
Requirements
Version | Windows Installer 5.0 on Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003, Windows XP, and Windows 2000. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
---|---|
Header | Msi.h |
Library | Msi.lib |
DLL | Msi.dll |
Unicode and ANSI names | MsiGetUserInfoW (Unicode) and MsiGetUserInfoA (ANSI) |
See Also
Send comments about this topic to Microsoft
Build date: 8/13/2009
© 2009 Microsoft Corporation. All rights reserved.