ver16.c 4.3 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 "wine/winbase16.h"
25
#include "winver.h"
26
#include "wine/debug.h"
27

28
WINE_DEFAULT_DEBUG_CHANNEL(ver);
29

30 31

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

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

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

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

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

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

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

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

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

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

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

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

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

    return retv;
}