shlwapi/tests: Fix some failures on XP and W2K3.
[wine/multimedia.git] / dlls / version / ver16.c
blob3ffb920708f97ebcd8eea0af4d748e073b4bc8be
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "wine/winbase16.h"
25 #include "winver.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ver);
31 /*************************************************************************
32 * GetFileVersionInfoSize [VER.6]
34 DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
36 TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
37 return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
40 /*************************************************************************
41 * GetFileVersionInfo [VER.7]
43 DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
44 DWORD cbBuf, LPVOID lpvData )
46 TRACE("(%s, %08x, %d, %p)\n",
47 debugstr_a(lpszFileName), handle, cbBuf, lpvData );
49 return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData );
52 /*************************************************************************
53 * VerFindFile [VER.8]
55 DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename,
56 LPSTR lpszWinDir, LPSTR lpszAppDir,
57 LPSTR lpszCurDir, UINT16 *lpuCurDirLen,
58 LPSTR lpszDestDir, UINT16 *lpuDestDirLen )
60 UINT curDirLen, destDirLen;
61 DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir,
62 lpszCurDir, &curDirLen, lpszDestDir, &destDirLen );
64 *lpuCurDirLen = (UINT16)curDirLen;
65 *lpuDestDirLen = (UINT16)destDirLen;
66 return retv;
69 /*************************************************************************
70 * VerInstallFile [VER.9]
72 DWORD WINAPI VerInstallFile16( UINT16 flags,
73 LPSTR lpszSrcFilename, LPSTR lpszDestFilename,
74 LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir,
75 LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen )
77 UINT filelen;
78 DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename,
79 lpszSrcDir, lpszDestDir, lpszCurDir,
80 lpszTmpFile, &filelen);
82 *lpwTmpFileLen = (UINT16)filelen;
83 return retv;
86 /*************************************************************************
87 * VerLanguageName [VER.10]
89 DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang )
91 return VerLanguageNameA( uLang, lpszLang, cbLang );
94 /*************************************************************************
95 * VerQueryValue [VER.11]
97 DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock,
98 SEGPTR *lpspBuffer, UINT16 *lpcb )
100 LPVOID lpvBlock = MapSL( spvBlock );
101 LPVOID buffer = lpvBlock;
102 UINT buflen;
103 DWORD retv;
105 TRACE("(%p, %s, %p, %p)\n",
106 lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb );
108 retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen );
109 if ( !retv ) return FALSE;
111 if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 )
113 FIXME("offset %08X too large relative to %04X:%04X\n",
114 (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) );
115 return FALSE;
118 if (lpcb) *lpcb = buflen;
119 *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock));
121 return retv;