MsiGetUserInfoA function (msi.h)
The MsiGetUserInfo function returns the registered user information for an installed product.
Syntax
USERINFOSTATE MsiGetUserInfoA(
[in] LPCSTR szProduct,
[out] LPSTR lpUserNameBuf,
[in, out] LPDWORD pcchUserNameBuf,
[out] LPSTR lpOrgNameBuf,
[in, out] LPDWORD pcchOrgNameBuf,
[in] LPSTR lpSerialBuf,
[in, out] LPDWORD pcchSerialBuf
);
Parameters
[in] szProduct
Specifies the product code for the product to be queried.
[out] lpUserNameBuf
Pointer to a variable that receives the name of the user.
[in, out] pcchUserNameBuf
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.
[out] lpOrgNameBuf
Pointer to a buffer that receives the organization name.
[in, out] pcchOrgNameBuf
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.
[in] lpSerialBuf
Pointer to a buffer that receives the product ID.
[in, out] pcchSerialBuf
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.
Note
The msi.h header defines MsiGetUserInfo as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Installer 5.0 on Windows Server 2012, Windows 8, 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 or Windows XP. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version. |
Target Platform | Windows |
Header | msi.h |
Library | Msi.lib |
DLL | Msi.dll |