win12.hlp (Table of Contents; Topic list)
PrfWriteProfileData (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINSHELLDATA
 
BOOL PrfWriteProfileData(hini, pszAppName, pszKeyName, pchBinaryData,
    cchData)
HINI hini;              /* initialization-file handle      */
PSZ pszAppName;         /* pointer to application name     */
PSZ pszKeyName;         /* pointer to keyname              */
PVOID pchBinaryData;    /* pointer to data in profile file */
ULONG cchData;          /* data length                     */
 
The PrfWriteProfileData function places binary data in the specified profile
file. The location of the data is determined by the application name and
keyname passed to the function. This data can then be retrieved by using the
PrfQueryProfileData function, with the application name and keyname
specified in the pszAppName and pszKeyName parameters of the
PrfWriteProfileData function.
 
Parameter      Description
────────────────────────────────────────────────────────────────────────────
 
hini           Identifies the file in which to place the binary data. This
               parameter can be a file handle or one of the following
               values:
 
               Value               Meaning
               ─────────────────────────────────────────────────────────────
               HINI_USERPROFILE    Specifies the user profile.
 
               HINI_SYSTEMPROFILE  Specifies the system profile.
 
pszAppName     Points to the null-terminated string that contains the
               application name. The string, including the terminating null
               character, must be less than 1024 bytes long. The application
               name is case-sensitive. If no application field in the
               profile file matches pszAppName, a new application field is
               created.
 
pszKeyName     Points to the null-terminated string that contains the
               keyname. The string must be less than 1024 bytes long,
               including the terminating null character. If this parameter
               is NULL, all keynames and their data are deleted. The keyname
               is case-sensitive. If no keyname matches pszKeyName, a new
               keyname field is created. If the keyname already exists, the
               existing value is overwritten.
 
pchBinaryData  Points to the binary data placed in the profile file. There
               is no explicit terminating character. If this parameter is
               NULL, the previous value associated with the pszKeyName
               parameter is deleted; otherwise, the data string becomes the
               value, even if its length is zero. The data should not exceed
               64K.
 
cchData        Specifies the size (in bytes) of the pchBinaryData
               parameter.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs. If the profile file exists but is somehow corrupted, this function
returns FALSE.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INVALID_PARM
     PMERR_MEMORY_ALLOC
     PMERR_MEMORY_ALLOCATION_ERR
     PMERR_MEMORY_DEALLOCATION_ERR
 
Comments
 
The application must know the size of the stored data when it calls
PrfQueryProfileData to retrieve the data. It can retrieve the size of the
stored data by calling the PrfQueryProfileSize function.
 
See Also
 
PrfQueryProfileData, PrfQueryProfileSize, WinWriteProfileData