Commit dbbc40af authored by Alexandre Julliard's avatar Alexandre Julliard

version: Moved GetFileResourceSize16/GetFileResource16 to ver16.c.

parent e84c42d9
...@@ -408,61 +408,3 @@ DWORD find_resource( HFILE lzfd, LPCSTR type, LPCSTR id, DWORD *reslen, DWORD *o ...@@ -408,61 +408,3 @@ DWORD find_resource( HFILE lzfd, LPCSTR type, LPCSTR id, DWORD *reslen, DWORD *o
} }
return magic; return magic;
} }
/*************************************************************************
* GetFileResourceSize [VER.2]
*/
DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType,
LPCSTR lpszResId, LPDWORD lpdwFileOffset )
{
HFILE lzfd;
OFSTRUCT ofs;
DWORD reslen = 0;
TRACE("(%s,type=%p,id=%p,off=%p)\n",
debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId );
lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
if (lzfd >= 0)
{
if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, lpdwFileOffset )) reslen = 0;
LZClose( lzfd );
}
return reslen;
}
/*************************************************************************
* GetFileResource [VER.3]
*/
DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType,
LPCSTR lpszResId, DWORD dwFileOffset,
DWORD dwResLen, LPVOID lpvData )
{
HFILE lzfd;
OFSTRUCT ofs;
DWORD reslen = dwResLen;
TRACE("(%s,type=%p,id=%p,off=%d,len=%d,data=%p)\n",
debugstr_a(lpszFileName), lpszResType, lpszResId,
dwFileOffset, dwResLen, lpvData );
lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
if ( lzfd < 0 ) return 0;
if ( !dwFileOffset )
{
if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, &dwFileOffset ))
{
LZClose( lzfd );
return 0;
}
}
LZSeek( lzfd, dwFileOffset, SEEK_SET );
reslen = LZRead( lzfd, lpvData, min( reslen, dwResLen ) );
LZClose( lzfd );
return reslen;
}
...@@ -23,11 +23,71 @@ ...@@ -23,11 +23,71 @@
#include "windef.h" #include "windef.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "winver.h" #include "winver.h"
#include "lzexpand.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ver); WINE_DEFAULT_DEBUG_CHANNEL(ver);
extern DWORD find_resource( HFILE lzfd, LPCSTR type, LPCSTR id, DWORD *reslen, DWORD *offset );
/*************************************************************************
* GetFileResourceSize [VER.2]
*/
DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType,
LPCSTR lpszResId, LPDWORD lpdwFileOffset )
{
HFILE lzfd;
OFSTRUCT ofs;
DWORD reslen = 0;
TRACE("(%s,type=%p,id=%p,off=%p)\n",
debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId );
lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
if (lzfd >= 0)
{
if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, lpdwFileOffset )) reslen = 0;
LZClose( lzfd );
}
return reslen;
}
/*************************************************************************
* GetFileResource [VER.3]
*/
DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType,
LPCSTR lpszResId, DWORD dwFileOffset,
DWORD dwResLen, LPVOID lpvData )
{
HFILE lzfd;
OFSTRUCT ofs;
DWORD reslen = dwResLen;
TRACE("(%s,type=%p,id=%p,off=%d,len=%d,data=%p)\n",
debugstr_a(lpszFileName), lpszResType, lpszResId,
dwFileOffset, dwResLen, lpvData );
lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ );
if ( lzfd < 0 ) return 0;
if ( !dwFileOffset )
{
if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, &dwFileOffset ))
{
LZClose( lzfd );
return 0;
}
}
LZSeek( lzfd, dwFileOffset, 0 /* SEEK_SET */ );
reslen = LZRead( lzfd, lpvData, min( reslen, dwResLen ) );
LZClose( lzfd );
return reslen;
}
/************************************************************************* /*************************************************************************
* GetFileVersionInfoSize [VER.6] * GetFileVersionInfoSize [VER.6]
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment