ReactOS 0.4.15-dev-7788-g1ad9096
winver.h File Reference
#include <specstrings.h>
#include <verrsrc.h>
Include dependency graph for winver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VerQueryValue   VerQueryValueA
 
#define VerFindFile   VerFindFileA
 
#define VerInstallFile   VerInstallFileA
 
#define GetFileVersionInfoSize   GetFileVersionInfoSizeA
 
#define GetFileVersionInfo   GetFileVersionInfoA
 
#define VerLanguageName   VerLanguageNameA
 
#define VerQueryValue   VerQueryValueA
 
#define GetFileVersionInfoSizeEx   GetFileVersionInfoSizeExA
 

Functions

DWORD WINAPI VerFindFileA (DWORD, LPCSTR, LPCSTR, LPCSTR, LPSTR, PUINT, LPSTR, PUINT)
 
DWORD WINAPI VerFindFileW (DWORD, LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, PUINT, LPWSTR, PUINT)
 
DWORD WINAPI VerInstallFileA (DWORD, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPSTR, PUINT)
 
DWORD WINAPI VerInstallFileW (DWORD, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, PUINT)
 
DWORD WINAPI GetFileVersionInfoSizeA (LPCSTR, PDWORD)
 
DWORD WINAPI GetFileVersionInfoSizeW (LPCWSTR, PDWORD)
 
BOOL WINAPI GetFileVersionInfoA (LPCSTR, DWORD, DWORD, PVOID)
 
BOOL WINAPI GetFileVersionInfoW (LPCWSTR, DWORD, DWORD, PVOID)
 
DWORD WINAPI VerLanguageNameA (DWORD, LPSTR, DWORD)
 
DWORD WINAPI VerLanguageNameW (DWORD, LPWSTR, DWORD)
 
BOOL WINAPI VerQueryValueA (LPCVOID, LPCSTR, LPVOID *, PUINT)
 
BOOL WINAPI VerQueryValueW (LPCVOID, LPCWSTR, LPVOID *, PUINT)
 
DWORD WINAPI GetFileVersionInfoSizeExA (_In_ DWORD dwFlags, _In_ LPCSTR lpwstrFilename, _Out_ LPDWORD lpdwHandle)
 
DWORD WINAPI GetFileVersionInfoSizeExW (_In_ DWORD dwFlags, _In_ LPCWSTR lpwstrFilename, _Out_ LPDWORD lpdwHandle)
 

Macro Definition Documentation

◆ GetFileVersionInfo

#define GetFileVersionInfo   GetFileVersionInfoA

Definition at line 54 of file winver.h.

◆ GetFileVersionInfoSize

#define GetFileVersionInfoSize   GetFileVersionInfoSizeA

Definition at line 53 of file winver.h.

◆ GetFileVersionInfoSizeEx

#define GetFileVersionInfoSizeEx   GetFileVersionInfoSizeExA

Definition at line 57 of file winver.h.

◆ VerFindFile

#define VerFindFile   VerFindFileA

Definition at line 51 of file winver.h.

◆ VerInstallFile

#define VerInstallFile   VerInstallFileA

Definition at line 52 of file winver.h.

◆ VerLanguageName

#define VerLanguageName   VerLanguageNameA

Definition at line 55 of file winver.h.

◆ VerQueryValue [1/2]

#define VerQueryValue   VerQueryValueA

Definition at line 56 of file winver.h.

◆ VerQueryValue [2/2]

#define VerQueryValue   VerQueryValueA

Definition at line 56 of file winver.h.

Function Documentation

◆ GetFileVersionInfoA()

BOOL WINAPI GetFileVersionInfoA ( LPCSTR  filename,
DWORD  handle,
DWORD  datasize,
PVOID  data 
)

Definition at line 853 of file version.c.

854{
856}
static SIZE_T datasize
Definition: asm.c:30
BOOL WINAPI GetFileVersionInfoExA(DWORD flags, LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:822
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const char * filename
Definition: ioapi.h:137
#define FILE_VER_GET_LOCALISED
Definition: verrsrc.h:147

Referenced by _fetch_versioninfo(), create_file_with_version(), debugsymbols_GetModuleVersionInformation(), get_file_version(), get_version_info(), GetDriverVersion(), is_stub_dll(), START_TEST(), test_32bit_win(), test_extra_block(), test_info(), and test_VerQueryValueA().

◆ GetFileVersionInfoSizeA()

DWORD WINAPI GetFileVersionInfoSizeA ( LPCSTR  ,
PDWORD   
)

◆ GetFileVersionInfoSizeExA()

DWORD WINAPI GetFileVersionInfoSizeExA ( _In_ DWORD  dwFlags,
_In_ LPCSTR  lpwstrFilename,
_Out_ LPDWORD  lpdwHandle 
)

◆ GetFileVersionInfoSizeExW()

DWORD WINAPI GetFileVersionInfoSizeExW ( _In_ DWORD  dwFlags,
_In_ LPCWSTR  lpwstrFilename,
_Out_ LPDWORD  lpdwHandle 
)

◆ GetFileVersionInfoSizeW()

DWORD WINAPI GetFileVersionInfoSizeW ( LPCWSTR  ,
PDWORD   
)

◆ GetFileVersionInfoW()

◆ VerFindFileA()

DWORD WINAPI VerFindFileA ( DWORD  flags,
LPCSTR  lpszFilename,
LPCSTR  lpszWinDir,
LPCSTR  lpszAppDir,
LPSTR  lpszCurDir,
PUINT  lpuCurDirLen,
LPSTR  lpszDestDir,
PUINT  lpuDestDirLen 
)

Definition at line 1194 of file version.c.

1203{
1204 DWORD retval = 0;
1205 const char *curDir;
1206 const char *destDir;
1207 unsigned int curDirSizeReq;
1208 unsigned int destDirSizeReq;
1209 char winDir[MAX_PATH], systemDir[MAX_PATH];
1210
1211 /* Print out debugging information */
1212 TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1213 flags, debugstr_a(lpszFilename), debugstr_a(lpszWinDir), debugstr_a(lpszAppDir),
1214 lpuCurDirLen, lpuCurDirLen ? *lpuCurDirLen : 0,
1215 lpuDestDirLen, lpuDestDirLen ? *lpuDestDirLen : 0 );
1216
1217 /* Figure out where the file should go; shared files default to the
1218 system directory */
1219
1220 GetSystemDirectoryA(systemDir, sizeof(systemDir));
1221 curDir = "";
1222
1224 {
1225 destDir = systemDir;
1226 /* Were we given a filename? If so, try to find the file. */
1227 if(lpszFilename)
1228 {
1229 if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
1230 else if(lpszAppDir && testFileExistenceA(lpszAppDir, lpszFilename, FALSE))
1231 curDir = lpszAppDir;
1232
1233 if(!testFileExistenceA(systemDir, lpszFilename, FALSE))
1234 retval |= VFF_CURNEDEST;
1235 }
1236 }
1237 else /* not a shared file */
1238 {
1239 destDir = lpszAppDir ? lpszAppDir : "";
1240 if(lpszFilename)
1241 {
1242 GetWindowsDirectoryA( winDir, MAX_PATH );
1243 if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
1244 else if(testFileExistenceA(winDir, lpszFilename, FALSE))
1245 curDir = winDir;
1246 else if(testFileExistenceA(systemDir, lpszFilename, FALSE))
1247 curDir = systemDir;
1248
1249 if (lpszAppDir && lpszAppDir[0])
1250 {
1251 if(!testFileExistenceA(lpszAppDir, lpszFilename, FALSE))
1252 retval |= VFF_CURNEDEST;
1253 }
1254 else if(testFileExistenceA(NULL, lpszFilename, FALSE))
1255 retval |= VFF_CURNEDEST;
1256 }
1257 }
1258
1259 /* Check to see if the file exists and is in use by another application */
1260 if (lpszFilename && testFileExistenceA(curDir, lpszFilename, FALSE)) {
1261 if (lpszFilename && !testFileExistenceA(curDir, lpszFilename, TRUE))
1262 retval |= VFF_FILEINUSE;
1263 }
1264
1265 curDirSizeReq = strlen(curDir) + 1;
1266 destDirSizeReq = strlen(destDir) + 1;
1267
1268 /* Make sure that the pointers to the size of the buffers are
1269 valid; if not, do NOTHING with that buffer. If that pointer
1270 is valid, then make sure that the buffer pointer is valid, too! */
1271
1272 if(lpuDestDirLen && lpszDestDir)
1273 {
1274 if (*lpuDestDirLen < destDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1275 lstrcpynA(lpszDestDir, destDir, *lpuDestDirLen);
1276 *lpuDestDirLen = destDirSizeReq;
1277 }
1278 if(lpuCurDirLen && lpszCurDir)
1279 {
1280 if(*lpuCurDirLen < curDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1281 lstrcpynA(lpszCurDir, curDir, *lpuCurDirLen);
1282 *lpuCurDirLen = curDirSizeReq;
1283 }
1284
1285 TRACE("ret = %u (%s%s%s) curdir=%s destdir=%s\n", retval,
1286 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1287 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1288 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1289 debugstr_a(lpszCurDir), debugstr_a(lpszDestDir));
1290
1291 return retval;
1292}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrcpynA
Definition: compat.h:751
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
static int testFileExistenceA(char const *path, char const *file, BOOL excl)
Definition: version.c:1118
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define debugstr_a
Definition: kernel32.h:31
#define TRACE(s)
Definition: solgame.cpp:4
#define VFF_FILEINUSE
Definition: verrsrc.h:109
#define VFF_BUFFTOOSMALL
Definition: verrsrc.h:110
#define VFF_CURNEDEST
Definition: verrsrc.h:108
#define VFFF_ISSHAREDFILE
Definition: verrsrc.h:105

Referenced by test_find_file().

◆ VerFindFileW()

DWORD WINAPI VerFindFileW ( DWORD  flags,
LPCWSTR  lpszFilename,
LPCWSTR  lpszWinDir,
LPCWSTR  lpszAppDir,
LPWSTR  lpszCurDir,
PUINT  lpuCurDirLen,
LPWSTR  lpszDestDir,
PUINT  lpuDestDirLen 
)

Definition at line 1297 of file version.c.

1300{
1301 static const WCHAR emptyW;
1302 DWORD retval = 0;
1303 const WCHAR *curDir;
1304 const WCHAR *destDir;
1305 unsigned int curDirSizeReq;
1306 unsigned int destDirSizeReq;
1307 WCHAR winDir[MAX_PATH], systemDir[MAX_PATH];
1308
1309 /* Print out debugging information */
1310 TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1311 flags, debugstr_w(lpszFilename), debugstr_w(lpszWinDir), debugstr_w(lpszAppDir),
1312 lpuCurDirLen, lpuCurDirLen ? *lpuCurDirLen : 0,
1313 lpuDestDirLen, lpuDestDirLen ? *lpuDestDirLen : 0 );
1314
1315 /* Figure out where the file should go; shared files default to the
1316 system directory */
1317
1318 GetSystemDirectoryW(systemDir, ARRAY_SIZE(systemDir));
1319 curDir = &emptyW;
1320
1322 {
1323 destDir = systemDir;
1324 /* Were we given a filename? If so, try to find the file. */
1325 if(lpszFilename)
1326 {
1327 if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
1328 else if(lpszAppDir && testFileExistenceW(lpszAppDir, lpszFilename, FALSE))
1329 {
1330 curDir = lpszAppDir;
1331 retval |= VFF_CURNEDEST;
1332 }
1333 }
1334 }
1335 else /* not a shared file */
1336 {
1337 destDir = lpszAppDir ? lpszAppDir : &emptyW;
1338 if(lpszFilename)
1339 {
1340 GetWindowsDirectoryW( winDir, MAX_PATH );
1341 if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
1342 else if(testFileExistenceW(winDir, lpszFilename, FALSE))
1343 {
1344 curDir = winDir;
1345 retval |= VFF_CURNEDEST;
1346 }
1347 else if(testFileExistenceW(systemDir, lpszFilename, FALSE))
1348 {
1349 curDir = systemDir;
1350 retval |= VFF_CURNEDEST;
1351 }
1352 }
1353 }
1354
1355 if (lpszFilename && !testFileExistenceW(curDir, lpszFilename, TRUE))
1356 retval |= VFF_FILEINUSE;
1357
1358 curDirSizeReq = lstrlenW(curDir) + 1;
1359 destDirSizeReq = lstrlenW(destDir) + 1;
1360
1361 /* Make sure that the pointers to the size of the buffers are
1362 valid; if not, do NOTHING with that buffer. If that pointer
1363 is valid, then make sure that the buffer pointer is valid, too! */
1364
1365 if(lpuDestDirLen && lpszDestDir)
1366 {
1367 if (*lpuDestDirLen < destDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1368 lstrcpynW(lpszDestDir, destDir, *lpuDestDirLen);
1369 *lpuDestDirLen = destDirSizeReq;
1370 }
1371 if(lpuCurDirLen && lpszCurDir)
1372 {
1373 if(*lpuCurDirLen < curDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1374 lstrcpynW(lpszCurDir, curDir, *lpuCurDirLen);
1375 *lpuCurDirLen = curDirSizeReq;
1376 }
1377
1378 TRACE("ret = %u (%s%s%s) curdir=%s destdir=%s\n", retval,
1379 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1380 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1381 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1382 debugstr_w(lpszCurDir), debugstr_w(lpszDestDir));
1383 return retval;
1384}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
static int testFileExistenceW(const WCHAR *path, const WCHAR *file, BOOL excl)
Definition: version.c:1153
static const WCHAR emptyW[]
Definition: navigate.c:40
#define debugstr_w
Definition: kernel32.h:32
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ VerInstallFileA()

DWORD WINAPI VerInstallFileA ( DWORD  flags,
LPCSTR  srcfilename,
LPCSTR  destfilename,
LPCSTR  srcdir,
LPCSTR  destdir,
LPCSTR  curdir,
LPSTR  tmpfile,
PUINT  tmpfilelen 
)

Definition at line 1439 of file version.c.

1442{
1443 LPCSTR pdest;
1444 char destfn[260],tmpfn[260],srcfn[260];
1445 HFILE hfsrc,hfdst;
1446 DWORD attr,xret,tmplast;
1447 LONG ret;
1448 LPBYTE buf1,buf2;
1449 OFSTRUCT ofs;
1450
1451 TRACE("(%x,%s,%s,%s,%s,%s,%p,%d)\n",
1452 flags,debugstr_a(srcfilename),debugstr_a(destfilename),
1453 debugstr_a(srcdir),debugstr_a(destdir),debugstr_a(curdir),
1454 tmpfile,*tmpfilelen);
1455 xret = 0;
1456 if (!srcdir || !srcfilename) return VIF_CANNOTREADSRC;
1457 sprintf(srcfn,"%s\\%s",srcdir,srcfilename);
1458 if (!destdir || !*destdir) pdest = srcdir;
1459 else pdest = destdir;
1460 sprintf(destfn,"%s\\%s",pdest,destfilename);
1461 hfsrc=LZOpenFileA(srcfn,&ofs,OF_READ);
1462 if (hfsrc < 0)
1463 return VIF_CANNOTREADSRC;
1464 sprintf(tmpfn,"%s\\%s",pdest,destfilename);
1465 tmplast=strlen(pdest)+1;
1466 attr = GetFileAttributesA(tmpfn);
1469 LZClose(hfsrc);
1470 return VIF_WRITEPROT;
1471 }
1472 /* FIXME: check if file currently in use and return VIF_FILEINUSE */
1473 }
1475 if (flags & VIFF_FORCEINSTALL) {
1476 if (tmpfile[0]) {
1477 sprintf(tmpfn,"%s\\%s",pdest,tmpfile);
1478 tmplast = strlen(pdest)+1;
1479 attr = GetFileAttributesA(tmpfn);
1480 /* if it exists, it has been copied by the call before.
1481 * we jump over the copy part...
1482 */
1483 }
1484 }
1486 char *s;
1487
1488 GetTempFileNameA(pdest,"ver",0,tmpfn); /* should not fail ... */
1489 s=strrchr(tmpfn,'\\');
1490 if (s)
1491 tmplast = s-tmpfn;
1492 else
1493 tmplast = 0;
1494 hfdst = OpenFile(tmpfn,&ofs,OF_CREATE);
1495 if (hfdst == HFILE_ERROR) {
1496 LZClose(hfsrc);
1497 return VIF_CANNOTCREATE; /* | translated dos error */
1498 }
1499 ret = LZCopy(hfsrc,hfdst);
1500 _lclose(hfdst);
1501 if (ret < 0) {
1502 /* translate LZ errors into VIF_xxx */
1503 switch (ret) {
1505 case LZERROR_READ:
1506 case LZERROR_BADVALUE:
1507 case LZERROR_UNKNOWNALG:
1508 xret = VIF_CANNOTREADSRC;
1509 break;
1511 case LZERROR_WRITE:
1512 xret = VIF_OUTOFSPACE;
1513 break;
1514 case LZERROR_GLOBALLOC:
1515 case LZERROR_GLOBLOCK:
1516 xret = VIF_OUTOFMEMORY;
1517 break;
1518 default: /* unknown error, should not happen */
1519 FIXME("Unknown LZCopy error %d, ignoring.\n", ret);
1520 xret = 0;
1521 break;
1522 }
1523 if (xret) {
1524 LZClose(hfsrc);
1525 return xret;
1526 }
1527 }
1528 }
1529 if (!(flags & VIFF_FORCEINSTALL)) {
1530 VS_FIXEDFILEINFO *destvffi,*tmpvffi;
1531 buf1 = _fetch_versioninfo(destfn,&destvffi);
1532 if (buf1) {
1533 buf2 = _fetch_versioninfo(tmpfn,&tmpvffi);
1534 if (buf2) {
1535 char *tbuf1,*tbuf2;
1536 static const CHAR trans_array[] = "\\VarFileInfo\\Translation";
1537 UINT len1,len2;
1538
1539 len1=len2=40;
1540
1541 /* compare file versions */
1542 if ((destvffi->dwFileVersionMS > tmpvffi->dwFileVersionMS)||
1543 ((destvffi->dwFileVersionMS==tmpvffi->dwFileVersionMS)&&
1544 (destvffi->dwFileVersionLS > tmpvffi->dwFileVersionLS)
1545 )
1546 )
1547 xret |= VIF_MISMATCH|VIF_SRCOLD;
1548 /* compare filetypes and filesubtypes */
1549 if ((destvffi->dwFileType!=tmpvffi->dwFileType) ||
1550 (destvffi->dwFileSubtype!=tmpvffi->dwFileSubtype)
1551 )
1552 xret |= VIF_MISMATCH|VIF_DIFFTYPE;
1553 if (VerQueryValueA(buf1,trans_array,(LPVOID*)&tbuf1,&len1) &&
1554 VerQueryValueA(buf2,trans_array,(LPVOID*)&tbuf2,&len2)
1555 ) {
1556 /* Do something with tbuf1 and tbuf2
1557 * generates DIFFLANG|MISMATCH
1558 */
1559 }
1560 HeapFree(GetProcessHeap(), 0, buf2);
1561 } else
1563 HeapFree(GetProcessHeap(), 0, buf1);
1564 }
1565 }
1566 if (xret) {
1567 if (*tmpfilelen<strlen(tmpfn+tmplast)) {
1568 xret|=VIF_BUFFTOOSMALL;
1569 DeleteFileA(tmpfn);
1570 } else {
1571 strcpy(tmpfile,tmpfn+tmplast);
1572 *tmpfilelen = strlen(tmpfn+tmplast)+1;
1573 xret|=VIF_TEMPFILE;
1574 }
1575 } else {
1577 if (!DeleteFileA(destfn)) {
1579 DeleteFileA(tmpfn);
1580 LZClose(hfsrc);
1581 return xret;
1582 }
1583 if ((!(flags & VIFF_DONTDELETEOLD)) &&
1584 curdir &&
1585 *curdir &&
1586 lstrcmpiA(curdir,pdest)
1587 ) {
1588 char curfn[260];
1589
1590 sprintf(curfn,"%s\\%s",curdir,destfilename);
1592 /* FIXME: check if in use ... if it is, VIF_CANNOTDELETECUR */
1593 if (!DeleteFileA(curfn))
1595 }
1596 }
1597 if (!MoveFileA(tmpfn,destfn)) {
1599 DeleteFileA(tmpfn);
1600 }
1601 }
1602 LZClose(hfsrc);
1603 return xret;
1604}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define FIXME(fmt,...)
Definition: debug.h:111
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
BOOL WINAPI MoveFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName)
Definition: move.c:1137
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:993
static LPBYTE _fetch_versioninfo(LPSTR fn, VS_FIXEDFILEINFO **vffi)
Definition: version.c:1387
static DWORD _error2vif(DWORD error)
Definition: version.c:1424
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
GLdouble s
Definition: gl.h:2039
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3914
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
LONG WINAPI LZCopy(HFILE src, HFILE dest)
Definition: lzexpand.c:467
void WINAPI LZClose(HFILE fd)
Definition: lzexpand.c:595
HFILE WINAPI LZOpenFileA(LPSTR fn, LPOFSTRUCT ofs, WORD mode)
Definition: lzexpand.c:551
#define LZERROR_BADVALUE
Definition: lzexpand.h:13
#define LZERROR_GLOBALLOC
Definition: lzexpand.h:11
#define LZERROR_UNKNOWNALG
Definition: lzexpand.h:14
#define LZERROR_WRITE
Definition: lzexpand.h:10
#define LZERROR_READ
Definition: lzexpand.h:9
#define LZERROR_BADINHANDLE
Definition: lzexpand.h:7
#define LZERROR_BADOUTHANDLE
Definition: lzexpand.h:8
#define LZERROR_GLOBLOCK
Definition: lzexpand.h:12
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int UINT
Definition: ndis.h:50
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
long LONG
Definition: pedump.c:60
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
Definition: cookie.c:202
DWORD dwFileVersionLS
Definition: compat.h:903
DWORD dwFileVersionMS
Definition: compat.h:902
DWORD dwFileSubtype
Definition: compat.h:910
unsigned char * LPBYTE
Definition: typedefs.h:53
#define VIFF_FORCEINSTALL
Definition: verrsrc.h:114
#define VIF_OUTOFMEMORY
Definition: verrsrc.h:133
#define VIF_BUFFTOOSMALL
Definition: verrsrc.h:136
#define VIF_CANNOTRENAME
Definition: verrsrc.h:131
#define VIF_CANNOTREADSRC
Definition: verrsrc.h:134
#define VIF_CANNOTDELETE
Definition: verrsrc.h:130
#define VIFF_DONTDELETEOLD
Definition: verrsrc.h:115
#define VIF_TEMPFILE
Definition: verrsrc.h:118
#define VIF_CANNOTCREATE
Definition: verrsrc.h:129
#define VIF_CANNOTDELETECUR
Definition: verrsrc.h:132
#define VIF_OUTOFSPACE
Definition: verrsrc.h:126
#define VIF_SRCOLD
Definition: verrsrc.h:120
#define VIF_MISMATCH
Definition: verrsrc.h:119
#define VIF_DIFFTYPE
Definition: verrsrc.h:123
#define VIF_WRITEPROT
Definition: verrsrc.h:124
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HFILE_ERROR
Definition: winbase.h:111
#define OF_READ
Definition: winbase.h:116
#define OF_CREATE
Definition: winbase.h:125
int HFILE
Definition: windef.h:298
const char * LPCSTR
Definition: xmlstorage.h:183
char CHAR
Definition: xmlstorage.h:175

Referenced by test_install_file(), and VerInstallFileW().

◆ VerInstallFileW()

DWORD WINAPI VerInstallFileW ( DWORD  flags,
LPCWSTR  srcfilename,
LPCWSTR  destfilename,
LPCWSTR  srcdir,
LPCWSTR  destdir,
LPCWSTR  curdir,
LPWSTR  tmpfile,
PUINT  tmpfilelen 
)

Definition at line 1610 of file version.c.

1613{
1614 LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL;
1615 DWORD ret = 0;
1616 UINT len;
1617
1618 if (srcfilename)
1619 {
1620 len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
1621 if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
1622 WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
1623 else
1625 }
1626 if (srcdir && !ret)
1627 {
1628 len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL );
1629 if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len )))
1630 WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL );
1631 else
1633 }
1634 if (destfilename && !ret)
1635 {
1636 len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL );
1637 if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len )))
1638 WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL );
1639 else
1641 }
1642 if (destdir && !ret)
1643 {
1644 len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL );
1645 if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len )))
1646 WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL );
1647 else
1649 }
1650 if (curdir && !ret)
1651 {
1652 len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL );
1653 if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len )))
1654 WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL );
1655 else
1657 }
1658 if (!ret)
1659 {
1660 len = *tmpfilelen * sizeof(WCHAR);
1661 wtmpf = HeapAlloc( GetProcessHeap(), 0, len );
1662 if (!wtmpf)
1664 }
1665 if (!ret)
1666 ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len);
1667 if (!ret)
1668 *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen );
1669 else if (ret & VIF_BUFFTOOSMALL)
1670 *tmpfilelen = len; /* FIXME: not correct */
1671
1672 HeapFree( GetProcessHeap(), 0, wsrcf );
1673 HeapFree( GetProcessHeap(), 0, wsrcd );
1674 HeapFree( GetProcessHeap(), 0, wdestf );
1675 HeapFree( GetProcessHeap(), 0, wdestd );
1676 HeapFree( GetProcessHeap(), 0, wtmpf );
1677 HeapFree( GetProcessHeap(), 0, wcurd );
1678 return ret;
1679}
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
DWORD WINAPI VerInstallFileA(DWORD flags, LPCSTR srcfilename, LPCSTR destfilename, LPCSTR srcdir, LPCSTR destdir, LPCSTR curdir, LPSTR tmpfile, PUINT tmpfilelen)
Definition: version.c:1439
GLenum GLsizei len
Definition: glext.h:6722
char * LPSTR
Definition: xmlstorage.h:182

◆ VerLanguageNameA()

DWORD WINAPI VerLanguageNameA ( DWORD  wLang,
LPSTR  szLang,
DWORD  nSize 
)

Definition at line 1688 of file lang.c.

1689{
1690 return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
1691}
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: lang.c:1028
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:27

◆ VerLanguageNameW()

DWORD WINAPI VerLanguageNameW ( DWORD  wLang,
LPWSTR  szLang,
DWORD  nSize 
)

Definition at line 1699 of file lang.c.

1700{
1701 return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
1702}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108

Referenced by CFileVersionInfo::GetLangName().

◆ VerQueryValueA()

BOOL WINAPI VerQueryValueA ( LPCVOID  pBlock,
LPCSTR  lpSubBlock,
LPVOID lplpBuffer,
PUINT  puLen 
)

Definition at line 993 of file version.c.

995{
996 static const char rootA[] = "\\";
997 const VS_VERSION_INFO_STRUCT16 *info = pBlock;
998
999 TRACE("(%p,%s,%p,%p)\n",
1000 pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
1001
1002 if (!pBlock)
1003 return FALSE;
1004
1005 if (lpSubBlock == NULL || lpSubBlock[0] == '\0')
1006 lpSubBlock = rootA;
1007
1008 if ( !VersionInfoIs16( info ) )
1009 {
1010 BOOL ret, isText;
1011 INT len;
1012 LPWSTR lpSubBlockW;
1013 UINT value_len;
1014
1015 len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
1016 lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1017
1018 if (!lpSubBlockW)
1019 return FALSE;
1020
1021 MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
1022
1023 ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
1024 if (puLen) *puLen = value_len;
1025
1026 HeapFree(GetProcessHeap(), 0, lpSubBlockW);
1027
1028 if (ret && isText)
1029 {
1030 /* Set lpBuffer so it points to the 'empty' area where we store
1031 * the converted strings
1032 */
1033 LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
1034 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1035 len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
1036 lpBufferA + pos, info->wLength - pos, NULL, NULL);
1037 *lplpBuffer = lpBufferA + pos;
1038 if (puLen) *puLen = len;
1039 }
1040 return ret;
1041 }
1042
1043 return VersionInfo16_QueryValue(info, lpSubBlock, lplpBuffer, puLen);
1044}
static BOOL VersionInfo16_QueryValue(const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: version.c:903
static BOOL VersionInfo32_QueryValue(const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen, BOOL *pbText)
Definition: version.c:947
#define VersionInfoIs16(ver)
Definition: version.c:583
unsigned int BOOL
Definition: ntddk_ex.h:94
int32_t INT
Definition: typedefs.h:58
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by debugsymbols_GetModuleVersionInformation(), get_file_version(), get_version_info(), GetDriverVersion(), is_stub_dll(), test_32bit_win(), test_extra_block(), test_GetFileVersionInfoEx(), test_info(), test_VerQueryValue_InvalidLength(), test_VerQueryValueA(), and VerInstallFileA().

◆ VerQueryValueW()

BOOL WINAPI VerQueryValueW ( LPCVOID  pBlock,
LPCWSTR  lpSubBlock,
LPVOID lplpBuffer,
PUINT  puLen 
)

Definition at line 1049 of file version.c.

1051{
1052 static const WCHAR rootW[] = { '\\', 0 };
1053 static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
1054 '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
1055
1056 const VS_VERSION_INFO_STRUCT32 *info = pBlock;
1057
1058 TRACE("(%p,%s,%p,%p)\n",
1059 pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
1060
1061 if (!pBlock)
1062 return FALSE;
1063
1064 if (!lpSubBlock || !lpSubBlock[0])
1065 lpSubBlock = rootW;
1066
1067 if ( VersionInfoIs16( info ) )
1068 {
1069 BOOL ret;
1070 int len;
1071 LPSTR lpSubBlockA;
1072
1073 len = WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, NULL, 0, NULL, NULL);
1074 lpSubBlockA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
1075
1076 if (!lpSubBlockA)
1077 return FALSE;
1078
1079 WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, lpSubBlockA, len, NULL, NULL);
1080
1081 ret = VersionInfo16_QueryValue(pBlock, lpSubBlockA, lplpBuffer, puLen);
1082
1083 HeapFree(GetProcessHeap(), 0, lpSubBlockA);
1084
1085 if (ret && wcsicmp( lpSubBlock, rootW ) && wcsicmp( lpSubBlock, varfileinfoW ))
1086 {
1087 /* Set lpBuffer so it points to the 'empty' area where we store
1088 * the converted strings
1089 */
1090 LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
1091 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1092 DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
1093
1094 len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
1095 lpBufferW + pos, max/sizeof(WCHAR) - pos );
1096 *lplpBuffer = lpBufferW + pos;
1097 if (puLen) *puLen = len;
1098 }
1099 return ret;
1100 }
1101
1102 return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
1103}
static const WCHAR rootW[]
Definition: chain.c:69
struct tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO
#define wcsicmp
Definition: compat.h:15
#define max(a, b)
Definition: svc.c:63

Referenced by capGetDriverDescriptionW(), check_native_ie(), do_file_copyW(), fetch_module_versioninfo(), file_version_matches(), filesys_GetFileVersion(), fill_file_description(), get_file_version(), get_module_version(), GetExecutableVendor(), GetFileVersion(), CFileVersionInfo::GetFixedInfo(), CQueryAssociations::GetString(), CFileVersionInfo::GetString(), GetVersionFromFileExW(), GetVersionInfoString(), Imm32LoadImeVerInfo(), CFileVersionInfo::Load(), COpenWithList::LoadInfo(), LPK_ApplyMirroring(), match_languages(), msi_get_disk_file_version(), pSetupGetVersionInfoFromImage(), SdbGetFileAttributes(), SdbpGetStringAttr(), SdbpReadFileVersion(), search_file(), set_msi_assembly_prop(), test_32bit_win(), test_VerQueryValue_InvalidLength(), and VerQueryValueWrapW().