2 * Implementation of VER.DLL
4 * Copyright 1999 Ulrich Weigand
8 #include "wine/winbase16.h"
11 #include "debugtools.h"
13 DEFAULT_DEBUG_CHANNEL(ver
);
16 /*************************************************************************
17 * GetFileResourceSize16 [VER.2]
19 DWORD WINAPI
GetFileResourceSize16( LPCSTR lpszFileName
,
20 SEGPTR spszResType
, SEGPTR spszResId
,
21 LPDWORD lpdwFileOffset
)
23 LPCSTR lpszResType
= HIWORD( spszResType
)? PTR_SEG_TO_LIN( spszResType
)
24 : (LPCSTR
)spszResType
;
25 LPCSTR lpszResId
= HIWORD( spszResId
)? PTR_SEG_TO_LIN( spszResId
)
28 return GetFileResourceSize( lpszFileName
,
29 lpszResType
, lpszResId
, lpdwFileOffset
);
32 /*************************************************************************
33 * GetFileResource16 [VER.3]
35 DWORD WINAPI
GetFileResource16( LPCSTR lpszFileName
,
36 SEGPTR spszResType
, SEGPTR spszResId
,
38 DWORD dwResLen
, LPVOID lpvData
)
40 LPCSTR lpszResType
= HIWORD( spszResType
)? PTR_SEG_TO_LIN( spszResType
)
41 : (LPCSTR
)spszResType
;
42 LPCSTR lpszResId
= HIWORD( spszResId
)? PTR_SEG_TO_LIN( spszResId
)
45 return GetFileResource( lpszFileName
, lpszResType
, lpszResId
,
46 dwFileOffset
, dwResLen
, lpvData
);
49 /*************************************************************************
50 * GetFileVersionInfoSize16 [VER.6]
52 DWORD WINAPI
GetFileVersionInfoSize16( LPCSTR lpszFileName
, LPDWORD lpdwHandle
)
54 TRACE("(%s, %p)\n", debugstr_a(lpszFileName
), lpdwHandle
);
55 return GetFileVersionInfoSizeA( lpszFileName
, lpdwHandle
);
58 /*************************************************************************
59 * GetFileVersionInfo16 [VER.7]
61 DWORD WINAPI
GetFileVersionInfo16( LPCSTR lpszFileName
, DWORD handle
,
62 DWORD cbBuf
, LPVOID lpvData
)
64 TRACE("(%s, %08lx, %ld, %p)\n",
65 debugstr_a(lpszFileName
), handle
, cbBuf
, lpvData
);
67 return GetFileVersionInfoA( lpszFileName
, handle
, cbBuf
, lpvData
);
70 /*************************************************************************
71 * VerFindFile16 [VER.8]
73 DWORD WINAPI
VerFindFile16( UINT16 flags
, LPCSTR lpszFilename
,
74 LPCSTR lpszWinDir
, LPCSTR lpszAppDir
,
75 LPSTR lpszCurDir
, UINT16
*lpuCurDirLen
,
76 LPSTR lpszDestDir
, UINT16
*lpuDestDirLen
)
78 UINT curDirLen
, destDirLen
;
79 DWORD retv
= VerFindFileA( flags
, lpszFilename
, lpszWinDir
, lpszAppDir
,
80 lpszCurDir
, &curDirLen
, lpszDestDir
, &destDirLen
);
82 *lpuCurDirLen
= (UINT16
)curDirLen
;
83 *lpuDestDirLen
= (UINT16
)destDirLen
;
87 /*************************************************************************
88 * VerInstallFile16 [VER.9]
90 DWORD WINAPI
VerInstallFile16( UINT16 flags
,
91 LPCSTR lpszSrcFilename
, LPCSTR lpszDestFilename
,
92 LPCSTR lpszSrcDir
, LPCSTR lpszDestDir
, LPCSTR lpszCurDir
,
93 LPSTR lpszTmpFile
, UINT16
*lpwTmpFileLen
)
96 DWORD retv
= VerInstallFileA( flags
, lpszSrcFilename
, lpszDestFilename
,
97 lpszSrcDir
, lpszDestDir
, lpszCurDir
,
98 lpszTmpFile
, &filelen
);
100 *lpwTmpFileLen
= (UINT16
)filelen
;
104 /*************************************************************************
105 * VerLanguageName16 [VER.10]
107 DWORD WINAPI
VerLanguageName16( UINT16 uLang
, LPSTR lpszLang
, UINT16 cbLang
)
109 return VerLanguageNameA( uLang
, lpszLang
, cbLang
);
112 /*************************************************************************
113 * VerQueryValue16 [VER.11]
115 DWORD WINAPI
VerQueryValue16( SEGPTR spvBlock
, LPCSTR lpszSubBlock
,
116 SEGPTR
*lpspBuffer
, UINT16
*lpcb
)
118 LPVOID lpvBlock
= PTR_SEG_TO_LIN( spvBlock
);
119 LPVOID buffer
= lpvBlock
;
123 TRACE("(%p, %s, %p, %p)\n",
124 lpvBlock
, debugstr_a(lpszSubBlock
), lpspBuffer
, lpcb
);
126 retv
= VerQueryValueA( lpvBlock
, lpszSubBlock
, &buffer
, &buflen
);
127 if ( !retv
) return FALSE
;
129 if ( OFFSETOF( spvBlock
) + ((char *) buffer
- (char *) lpvBlock
) >= 0x10000 )
131 FIXME("offset %08X too large relative to %04X:%04X\n",
132 (char *) buffer
- (char *) lpvBlock
, SELECTOROF( spvBlock
), OFFSETOF( spvBlock
) );
136 if (lpcb
) *lpcb
= buflen
;
137 *lpspBuffer
= (SEGPTR
) ((char *) spvBlock
+ ((char *) buffer
- (char *) lpvBlock
));