Release 20030408.
[wine/gsoc-2012-control.git] / dlls / version / ver16.c
blob9243d920bfde013bb5757d8b7f6d95869cfd653f
1 /*
2 * Implementation of VER.DLL
4 * Copyright 1999 Ulrich Weigand
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "winbase.h"
22 #include "wine/winbase16.h"
23 #include "winver.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(ver);
29 /*************************************************************************
30 * GetFileVersionInfoSize [VER.6]
32 DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
34 TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
35 return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
38 /*************************************************************************
39 * GetFileVersionInfo [VER.7]
41 DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
42 DWORD cbBuf, LPVOID lpvData )
44 TRACE("(%s, %08lx, %ld, %p)\n",
45 debugstr_a(lpszFileName), handle, cbBuf, lpvData );
47 return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData );
50 /*************************************************************************
51 * VerFindFile [VER.8]
53 DWORD WINAPI VerFindFile16( UINT16 flags, LPCSTR lpszFilename,
54 LPCSTR lpszWinDir, LPCSTR lpszAppDir,
55 LPSTR lpszCurDir, UINT16 *lpuCurDirLen,
56 LPSTR lpszDestDir, UINT16 *lpuDestDirLen )
58 UINT curDirLen, destDirLen;
59 DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir,
60 lpszCurDir, &curDirLen, lpszDestDir, &destDirLen );
62 *lpuCurDirLen = (UINT16)curDirLen;
63 *lpuDestDirLen = (UINT16)destDirLen;
64 return retv;
67 /*************************************************************************
68 * VerInstallFile [VER.9]
70 DWORD WINAPI VerInstallFile16( UINT16 flags,
71 LPCSTR lpszSrcFilename, LPCSTR lpszDestFilename,
72 LPCSTR lpszSrcDir, LPCSTR lpszDestDir, LPCSTR lpszCurDir,
73 LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen )
75 UINT filelen;
76 DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename,
77 lpszSrcDir, lpszDestDir, lpszCurDir,
78 lpszTmpFile, &filelen);
80 *lpwTmpFileLen = (UINT16)filelen;
81 return retv;
84 /*************************************************************************
85 * VerLanguageName [VER.10]
87 DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang )
89 return VerLanguageNameA( uLang, lpszLang, cbLang );
92 /*************************************************************************
93 * VerQueryValue [VER.11]
95 DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPCSTR lpszSubBlock,
96 SEGPTR *lpspBuffer, UINT16 *lpcb )
98 LPVOID lpvBlock = MapSL( spvBlock );
99 LPVOID buffer = lpvBlock;
100 UINT buflen;
101 DWORD retv;
103 TRACE("(%p, %s, %p, %p)\n",
104 lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb );
106 retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen );
107 if ( !retv ) return FALSE;
109 if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 )
111 FIXME("offset %08X too large relative to %04X:%04X\n",
112 (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) );
113 return FALSE;
116 if (lpcb) *lpcb = buflen;
117 *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock));
119 return retv;