2 * Implementation of VER.DLL
4 * Copyright 1999 Ulrich Weigand
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(ver
)
15 /*************************************************************************
16 * GetFileResourceSize16 [VER.2]
18 DWORD WINAPI
GetFileResourceSize16( LPCSTR lpszFileName
,
19 SEGPTR spszResType
, SEGPTR spszResId
,
20 LPDWORD lpdwFileOffset
)
22 LPCSTR lpszResType
= HIWORD( spszResType
)? PTR_SEG_TO_LIN( spszResType
)
23 : (LPCSTR
)spszResType
;
24 LPCSTR lpszResId
= HIWORD( spszResId
)? PTR_SEG_TO_LIN( spszResId
)
27 return GetFileResourceSize( lpszFileName
,
28 lpszResType
, lpszResId
, lpdwFileOffset
);
31 /*************************************************************************
32 * GetFileResource16 [VER.3]
34 DWORD WINAPI
GetFileResource16( LPCSTR lpszFileName
,
35 SEGPTR spszResType
, SEGPTR spszResId
,
37 DWORD dwResLen
, LPVOID lpvData
)
39 LPCSTR lpszResType
= HIWORD( spszResType
)? PTR_SEG_TO_LIN( spszResType
)
40 : (LPCSTR
)spszResType
;
41 LPCSTR lpszResId
= HIWORD( spszResId
)? PTR_SEG_TO_LIN( spszResId
)
44 return GetFileResource( lpszFileName
, lpszResType
, lpszResId
,
45 dwFileOffset
, dwResLen
, lpvData
);
48 /*************************************************************************
49 * GetFileVersionInfoSize16 [VER.6]
51 DWORD WINAPI
GetFileVersionInfoSize16( LPCSTR lpszFileName
, LPDWORD lpdwHandle
)
53 TRACE("(%s, %p)\n", debugstr_a(lpszFileName
), lpdwHandle
);
54 return GetFileVersionInfoSizeA( lpszFileName
, lpdwHandle
);
57 /*************************************************************************
58 * GetFileVersionInfo16 [VER.7]
60 DWORD WINAPI
GetFileVersionInfo16( LPCSTR lpszFileName
, DWORD handle
,
61 DWORD cbBuf
, LPVOID lpvData
)
63 TRACE("(%s, %08lx, %ld, %p)\n",
64 debugstr_a(lpszFileName
), handle
, cbBuf
, lpvData
);
66 return GetFileVersionInfoA( lpszFileName
, handle
, cbBuf
, lpvData
);
69 /*************************************************************************
70 * VerFindFile16 [VER.8]
72 DWORD WINAPI
VerFindFile16( UINT16 flags
, LPCSTR lpszFilename
,
73 LPCSTR lpszWinDir
, LPCSTR lpszAppDir
,
74 LPSTR lpszCurDir
, UINT16
*lpuCurDirLen
,
75 LPSTR lpszDestDir
, UINT16
*lpuDestDirLen
)
77 UINT curDirLen
, destDirLen
;
78 DWORD retv
= VerFindFileA( flags
, lpszFilename
, lpszWinDir
, lpszAppDir
,
79 lpszCurDir
, &curDirLen
, lpszDestDir
, &destDirLen
);
81 *lpuCurDirLen
= (UINT16
)curDirLen
;
82 *lpuDestDirLen
= (UINT16
)destDirLen
;
86 /*************************************************************************
87 * VerInstallFile16 [VER.9]
89 DWORD WINAPI
VerInstallFile16( UINT16 flags
,
90 LPCSTR lpszSrcFilename
, LPCSTR lpszDestFilename
,
91 LPCSTR lpszSrcDir
, LPCSTR lpszDestDir
, LPCSTR lpszCurDir
,
92 LPSTR lpszTmpFile
, UINT16
*lpwTmpFileLen
)
95 DWORD retv
= VerInstallFileA( flags
, lpszSrcFilename
, lpszDestFilename
,
96 lpszSrcDir
, lpszDestDir
, lpszCurDir
,
97 lpszTmpFile
, &filelen
);
99 *lpwTmpFileLen
= (UINT16
)filelen
;
103 /*************************************************************************
104 * VerLanguageName16 [VER.10]
106 DWORD WINAPI
VerLanguageName16( UINT16 uLang
, LPSTR lpszLang
, UINT16 cbLang
)
108 return VerLanguageNameA( uLang
, lpszLang
, cbLang
);
111 /*************************************************************************
112 * VerQueryValue16 [VER.11]
114 DWORD WINAPI
VerQueryValue16( SEGPTR spvBlock
, LPCSTR lpszSubBlock
,
115 SEGPTR
*lpspBuffer
, UINT16
*lpcb
)
117 LPVOID lpvBlock
= PTR_SEG_TO_LIN( spvBlock
);
118 LPVOID buffer
= lpvBlock
;
122 TRACE("(%p, %s, %p, %p)\n",
123 lpvBlock
, debugstr_a(lpszSubBlock
), lpspBuffer
, lpcb
);
125 retv
= VerQueryValueA( lpvBlock
, lpszSubBlock
, &buffer
, &buflen
);
126 if ( !retv
) return FALSE
;
128 if ( OFFSETOF( spvBlock
) + ((char *) buffer
- (char *) lpvBlock
) >= 0x10000 )
130 FIXME("offset %08X too large relative to %04X:%04X\n",
131 (char *) buffer
- (char *) lpvBlock
, SELECTOROF( spvBlock
), OFFSETOF( spvBlock
) );
136 *lpspBuffer
= (SEGPTR
) ((char *) spvBlock
+ ((char *) buffer
- (char *) lpvBlock
));