Added a first-cut version of MapVirtualKeyExW() that has the same
[wine] / dlls / version / ver16.c
1 /*
2  * Implementation of VER.DLL
3  *
4  * Copyright 1999 Ulrich Weigand
5  */
6
7 #include "winbase.h"
8 #include "wine/winbase16.h"
9 #include "winver.h"
10 #include "ldt.h"
11 #include "debugtools.h"
12
13 DEFAULT_DEBUG_CHANNEL(ver);
14
15
16 /*************************************************************************
17  * GetFileVersionInfoSize16                  [VER.6]
18  */
19 DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
20 {
21     TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
22     return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
23 }
24
25 /*************************************************************************
26  * GetFileVersionInfo16                      [VER.7]
27  */
28 DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
29                                    DWORD cbBuf, LPVOID lpvData )
30 {
31     TRACE("(%s, %08lx, %ld, %p)\n", 
32                 debugstr_a(lpszFileName), handle, cbBuf, lpvData );
33
34     return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData );
35 }
36
37 /*************************************************************************
38  * VerFindFile16                             [VER.8]
39  */
40 DWORD WINAPI VerFindFile16( UINT16 flags, LPCSTR lpszFilename, 
41                             LPCSTR lpszWinDir, LPCSTR lpszAppDir,
42                             LPSTR lpszCurDir, UINT16 *lpuCurDirLen,
43                             LPSTR lpszDestDir, UINT16 *lpuDestDirLen )
44 {
45     UINT curDirLen, destDirLen;
46     DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir,
47                                  lpszCurDir, &curDirLen, lpszDestDir, &destDirLen );
48
49     *lpuCurDirLen = (UINT16)curDirLen;
50     *lpuDestDirLen = (UINT16)destDirLen;
51     return retv;
52 }
53
54 /*************************************************************************
55  * VerInstallFile16                          [VER.9]
56  */
57 DWORD WINAPI VerInstallFile16( UINT16 flags, 
58                                LPCSTR lpszSrcFilename, LPCSTR lpszDestFilename, 
59                                LPCSTR lpszSrcDir, LPCSTR lpszDestDir, LPCSTR lpszCurDir,
60                                LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen )
61 {
62     UINT filelen;
63     DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename, 
64                                     lpszSrcDir, lpszDestDir, lpszCurDir, 
65                                     lpszTmpFile, &filelen);
66
67     *lpwTmpFileLen = (UINT16)filelen;
68     return retv;
69 }
70
71 /*************************************************************************
72  * VerLanguageName16                        [VER.10]
73  */
74 DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang )
75 {
76     return VerLanguageNameA( uLang, lpszLang, cbLang );
77 }
78
79 /*************************************************************************
80  * VerQueryValue16                          [VER.11]
81  */
82 DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPCSTR lpszSubBlock, 
83                               SEGPTR *lpspBuffer, UINT16 *lpcb )
84 {
85     LPVOID lpvBlock = PTR_SEG_TO_LIN( spvBlock );
86     LPVOID buffer = lpvBlock;
87     UINT buflen;
88     DWORD retv;
89
90     TRACE("(%p, %s, %p, %p)\n", 
91                 lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb );
92
93     retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen );
94     if ( !retv ) return FALSE;
95
96     if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 )
97     {
98         FIXME("offset %08X too large relative to %04X:%04X\n",
99                (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) );
100         return FALSE;
101     }
102
103     if (lpcb) *lpcb = buflen;
104     *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock));
105
106     return retv;
107 }
108