ver16.c 4.32 KB
Newer Older
1 2 3 4
/*
 * Implementation of VER.DLL
 *
 * Copyright 1999 Ulrich Weigand
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
19 20
 */

21 22 23
#include <stdarg.h>

#include "windef.h"
24
#include "winbase.h"
25
#include "wine/winbase16.h"
26
#include "winver.h"
27
#include "wine/debug.h"
28

29
WINE_DEFAULT_DEBUG_CHANNEL(ver);
30

31 32

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
33
 * GetFileVersionInfoSize                  [VER.6]
34 35 36
 */
DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle )
{
37
    TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle );
38
    return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle );
39 40 41
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
42
 * GetFileVersionInfo                      [VER.7]
43 44 45 46
 */
DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle,
                                   DWORD cbBuf, LPVOID lpvData )
{
47
    TRACE("(%s, %08x, %d, %p)\n",
48 49
                debugstr_a(lpszFileName), handle, cbBuf, lpvData );

50
    return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData );
51 52 53
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
54
 * VerFindFile                             [VER.8]
55
 */
56 57
DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename,
                            LPSTR lpszWinDir, LPSTR lpszAppDir,
58 59 60
                            LPSTR lpszCurDir, UINT16 *lpuCurDirLen,
                            LPSTR lpszDestDir, UINT16 *lpuDestDirLen )
{
61 62
    UINT curDirLen, destDirLen;
    DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir,
63 64 65 66 67 68 69 70
                                 lpszCurDir, &curDirLen, lpszDestDir, &destDirLen );

    *lpuCurDirLen = (UINT16)curDirLen;
    *lpuDestDirLen = (UINT16)destDirLen;
    return retv;
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
71
 * VerInstallFile                          [VER.9]
72
 */
73
DWORD WINAPI VerInstallFile16( UINT16 flags,
74 75
                               LPSTR lpszSrcFilename, LPSTR lpszDestFilename,
                               LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir,
76 77
                               LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen )
{
78
    UINT filelen;
79 80
    DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename,
                                    lpszSrcDir, lpszDestDir, lpszCurDir,
81 82 83 84 85 86 87
                                    lpszTmpFile, &filelen);

    *lpwTmpFileLen = (UINT16)filelen;
    return retv;
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
88
 * VerLanguageName                        [VER.10]
89 90 91
 */
DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang )
{
92
    return VerLanguageNameA( uLang, lpszLang, cbLang );
93 94 95
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
96
 * VerQueryValue                          [VER.11]
97
 */
98
DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock,
99 100
                              SEGPTR *lpspBuffer, UINT16 *lpcb )
{
101
    LPVOID lpvBlock = MapSL( spvBlock );
102
    LPVOID buffer = lpvBlock;
103
    UINT buflen;
104 105
    DWORD retv;

106
    TRACE("(%p, %s, %p, %p)\n",
107 108
                lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb );

109
    retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen );
110 111
    if ( !retv ) return FALSE;

112
    if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 )
113
    {
114
        FIXME("offset %08X too large relative to %04X:%04X\n",
115
               (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) );
116 117 118
        return FALSE;
    }

119
    if (lpcb) *lpcb = buflen;
120
    *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock));
121 122 123

    return retv;
}