GetFileResource

3.1

  #include <ver.h>    

  BOOL GetFileResource(lpszFileName, lpszResType, lpszResID, dwFileOffset, dwResLen, lpvData)    
  LPCSTR lpszFileName; /* address of buffer for filename */
  LPCSTR lpszResType; /* address of buffer for resource type */
  LPCSTR lpszResID; /* address of buffer for resource ID */
  DWORD dwFileOffset; /* resource offset in file */
  DWORD dwResLen; /* size of resource buffer */
  void FAR* lpvData; /* address of buffer for resource copy */

The GetFileResource function copies the specified resource from the specified file into the specified buffer. To obtain the appropriate buffer size, the application can call the GetFileResourceSize function before calling GetFileResource.

Parameters

lpszFileName

Points to the buffer that contains the name of the file containing the resource.

lpszResType

Points to a value that is created by using the MAKEINTRESOURCE macro with the numbered resource type. This value is typically VS_FILE_INFO.

lpszResID

Points to a value that is created by using the MAKEINTRESOURCE macro with the numbered resource identifier. This value is typically VS_VERSION_INFO.

dwFileOffset

Specifies the offset of the resource within the file. The GetFileResourceSize function returns this value. If this parameter is NULL, the GetFileResource function searches the file for the resource.

dwResLen

Specifies the buffer size, in bytes, identified by the lpvData parameter. The GetFileResourceSize function returns the buffer size required to hold the resource. If the buffer is not large enough, the resource data is truncated to the size of the buffer.

lpvData

Points to the buffer that will receive a copy of the resource. If the buffer is not large enough, the resource data is truncated.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero, indicating the function could not find the file, could not find the resource, or produced an MS-DOS error. The GetFileResource function returns no information about the type of error that occurred.

Comments

If the dwFileOffset parameter is zero, the GetFileResource function determines the location of the resource by using the lpszResType and lpszResID parameters.

If dwFileOffset is not zero, GetFileResource assumes that dwFileOffset is the return value of GetFileResourceSize and, therefore, ignores lpszResType and lpszResID.

See Also

GetFileResourceSize