ReactOS 0.4.16-dev-1493-ge7358c5
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 975 of file version.c.

976{
978}
static SIZE_T datasize
Definition: asm.c:30
BOOL WINAPI GetFileVersionInfoExA(DWORD flags, LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:944
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(), SHLWAPI_GetModuleVersion(), START_TEST(), test_32bit_win(), test_extra_block(), test_info(), Test_VerQueryValueA(), 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  filename,
LPCSTR  win_dir,
LPCSTR  app_dir,
LPSTR  cur_dir,
PUINT  curdir_len,
LPSTR  dest,
PUINT  dest_len 
)

Definition at line 1281 of file version.c.

1283{
1284 DWORD retval = 0;
1285 const char *curDir;
1286 const char *destDir;
1287 char winDir[MAX_PATH], systemDir[MAX_PATH];
1288
1289 TRACE("flags = %lx filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1291 curdir_len, curdir_len ? *curdir_len : 0, dest_len, dest_len ? *dest_len : 0 );
1292
1293 /* Figure out where the file should go; shared files default to the
1294 system directory */
1295
1296 GetSystemDirectoryA(systemDir, sizeof(systemDir));
1297 curDir = "";
1298
1300 {
1301 destDir = systemDir;
1302 /* Were we given a filename? If so, try to find the file. */
1303 if(filename)
1304 {
1305 if(file_existsA(destDir, filename, FALSE)) curDir = destDir;
1307 curDir = app_dir;
1308
1309 if(!file_existsA(systemDir, filename, FALSE))
1311 }
1312 }
1313 else /* not a shared file */
1314 {
1315 destDir = app_dir ? app_dir : "";
1316 if(filename)
1317 {
1318 GetWindowsDirectoryA( winDir, MAX_PATH );
1319 if(file_existsA(destDir, filename, FALSE)) curDir = destDir;
1320 else if(file_existsA(winDir, filename, FALSE))
1321 curDir = winDir;
1322 else if(file_existsA(systemDir, filename, FALSE))
1323 curDir = systemDir;
1324
1325 if (app_dir && app_dir[0])
1326 {
1329 }
1330 else if(file_existsA(NULL, filename, FALSE))
1332 }
1333 }
1334
1335 /* Check to see if the file exists and is in use by another application */
1336 if (filename && file_existsA(curDir, filename, FALSE))
1337 {
1338 if (filename && !file_existsA(curDir, filename, TRUE))
1340 }
1341
1342 if (dest_len && dest)
1343 {
1344 UINT len = strlen(destDir) + 1;
1345 if (*dest_len < len) retval |= VFF_BUFFTOOSMALL;
1346 lstrcpynA(dest, destDir, *dest_len);
1347 *dest_len = len;
1348 }
1349 if (curdir_len && cur_dir)
1350 {
1351 UINT len = strlen(curDir) + 1;
1352 if (*curdir_len < len) retval |= VFF_BUFFTOOSMALL;
1353 lstrcpynA(cur_dir, curDir, *curdir_len);
1354 *curdir_len = len;
1355 }
1356
1357 TRACE("ret = %lu (%s%s%s) curdir=%s destdir=%s\n", retval,
1358 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1359 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1360 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1361 debugstr_a(cur_dir), debugstr_a(dest));
1362
1363 return retval;
1364}
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 BOOL file_existsA(char const *path, char const *file, BOOL excl)
Definition: version.c:1227
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
static WCHAR app_dir[MAX_PATH]
Definition: actctx.c:469
static char * dest
Definition: rtl.c:135
unsigned int UINT
Definition: ndis.h:50
#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
int retval
Definition: wcstombs.cpp:91

Referenced by test_find_file().

◆ VerFindFileW()

DWORD WINAPI VerFindFileW ( DWORD  flags,
LPCWSTR  filename,
LPCWSTR  win_dir,
LPCWSTR  app_dir,
LPWSTR  cur_dir,
PUINT  curdir_len,
LPWSTR  dest,
PUINT  dest_len 
)

Definition at line 1369 of file version.c.

1371{
1372 DWORD retval = 0;
1373 const WCHAR *curDir;
1374 const WCHAR *destDir;
1375
1376 TRACE("flags = %lx filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1378 curdir_len, curdir_len ? *curdir_len : 0, dest_len, dest_len ? *dest_len : 0 );
1379
1380 /* Figure out where the file should go; shared files default to the
1381 system directory */
1382
1383 curDir = L"";
1384
1386 {
1387 destDir = system_dir;
1388 /* Were we given a filename? If so, try to find the file. */
1389 if(filename)
1390 {
1391 if(file_existsW(destDir, filename, FALSE)) curDir = destDir;
1393 {
1394 curDir = app_dir;
1396 }
1397 }
1398 }
1399 else /* not a shared file */
1400 {
1401 destDir = app_dir ? app_dir : L"";
1402 if(filename)
1403 {
1404 if(file_existsW(destDir, filename, FALSE)) curDir = destDir;
1406 {
1407 curDir = windows_dir;
1409 }
1411 {
1412 curDir = system_dir;
1414 }
1415 }
1416 }
1417
1418 if (filename && !file_existsW(curDir, filename, TRUE))
1420
1421 if (dest_len && dest)
1422 {
1423 UINT len = lstrlenW(destDir) + 1;
1424 if (*dest_len < len) retval |= VFF_BUFFTOOSMALL;
1425 lstrcpynW(dest, destDir, *dest_len);
1426 *dest_len = len;
1427 }
1428 if (curdir_len && cur_dir)
1429 {
1430 UINT len = lstrlenW(curDir) + 1;
1431 if (*curdir_len < len) retval |= VFF_BUFFTOOSMALL;
1432 lstrcpynW(cur_dir, curDir, *curdir_len);
1433 *curdir_len = len;
1434 }
1435
1436 TRACE("ret = %lu (%s%s%s) curdir=%s destdir=%s\n", retval,
1437 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1438 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1439 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1440 debugstr_w(cur_dir), debugstr_w(dest));
1441 return retval;
1442}
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
const WCHAR system_dir[]
Definition: file.c:68
const WCHAR windows_dir[]
Definition: file.c:67
static BOOL file_existsW(const WCHAR *path, const WCHAR *file, BOOL excl)
Definition: version.c:1252
#define L(x)
Definition: resources.c:13
#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 1447 of file version.c.

1450{
1451 LPCSTR pdest;
1452 char destfn[260],tmpfn[260],srcfn[260];
1453 HFILE hfsrc,hfdst;
1454 DWORD attr,xret,tmplast;
1455 LONG ret;
1456 LPBYTE buf1,buf2;
1457 OFSTRUCT ofs;
1458
1459 TRACE("(%x,%s,%s,%s,%s,%s,%p,%d)\n",
1460 flags,debugstr_a(srcfilename),debugstr_a(destfilename),
1461 debugstr_a(srcdir),debugstr_a(destdir),debugstr_a(curdir),
1462 tmpfile,*tmpfilelen);
1463 xret = 0;
1464 if (!srcdir || !srcfilename) return VIF_CANNOTREADSRC;
1465 sprintf(srcfn,"%s\\%s",srcdir,srcfilename);
1466 if (!destdir || !*destdir) pdest = srcdir;
1467 else pdest = destdir;
1468 sprintf(destfn,"%s\\%s",pdest,destfilename);
1469 hfsrc=LZOpenFileA(srcfn,&ofs,OF_READ);
1470 if (hfsrc < 0)
1471 return VIF_CANNOTREADSRC;
1472 sprintf(tmpfn,"%s\\%s",pdest,destfilename);
1473 tmplast=strlen(pdest)+1;
1474 attr = GetFileAttributesA(tmpfn);
1477 LZClose(hfsrc);
1478 return VIF_WRITEPROT;
1479 }
1480 /* FIXME: check if file currently in use and return VIF_FILEINUSE */
1481 }
1483 if (flags & VIFF_FORCEINSTALL) {
1484 if (tmpfile[0]) {
1485 sprintf(tmpfn,"%s\\%s",pdest,tmpfile);
1486 tmplast = strlen(pdest)+1;
1487 attr = GetFileAttributesA(tmpfn);
1488 /* if it exists, it has been copied by the call before.
1489 * we jump over the copy part...
1490 */
1491 }
1492 }
1494 char *s;
1495
1496 GetTempFileNameA(pdest,"ver",0,tmpfn); /* should not fail ... */
1497 s=strrchr(tmpfn,'\\');
1498 if (s)
1499 tmplast = s-tmpfn;
1500 else
1501 tmplast = 0;
1502 hfdst = OpenFile(tmpfn,&ofs,OF_CREATE);
1503 if (hfdst == HFILE_ERROR) {
1504 LZClose(hfsrc);
1505 return VIF_CANNOTCREATE; /* | translated dos error */
1506 }
1507 ret = LZCopy(hfsrc,hfdst);
1508 _lclose(hfdst);
1509 if (ret < 0) {
1510 /* translate LZ errors into VIF_xxx */
1511 switch (ret) {
1513 case LZERROR_READ:
1514 case LZERROR_BADVALUE:
1515 case LZERROR_UNKNOWNALG:
1516 xret = VIF_CANNOTREADSRC;
1517 break;
1519 case LZERROR_WRITE:
1520 xret = VIF_OUTOFSPACE;
1521 break;
1522 case LZERROR_GLOBALLOC:
1523 case LZERROR_GLOBLOCK:
1524 xret = VIF_OUTOFMEMORY;
1525 break;
1526 default: /* unknown error, should not happen */
1527 FIXME("Unknown LZCopy error %d, ignoring.\n", ret);
1528 xret = 0;
1529 break;
1530 }
1531 if (xret) {
1532 LZClose(hfsrc);
1533 return xret;
1534 }
1535 }
1536 }
1537 if (!(flags & VIFF_FORCEINSTALL)) {
1538 VS_FIXEDFILEINFO *destvffi,*tmpvffi;
1539 buf1 = _fetch_versioninfo(destfn,&destvffi);
1540 if (buf1) {
1541 buf2 = _fetch_versioninfo(tmpfn,&tmpvffi);
1542 if (buf2) {
1543 char *tbuf1,*tbuf2;
1544 static const CHAR trans_array[] = "\\VarFileInfo\\Translation";
1545 UINT len1,len2;
1546
1547 len1=len2=40;
1548
1549 /* compare file versions */
1550 if ((destvffi->dwFileVersionMS > tmpvffi->dwFileVersionMS)||
1551 ((destvffi->dwFileVersionMS==tmpvffi->dwFileVersionMS)&&
1552 (destvffi->dwFileVersionLS > tmpvffi->dwFileVersionLS)
1553 )
1554 )
1555 xret |= VIF_MISMATCH|VIF_SRCOLD;
1556 /* compare filetypes and filesubtypes */
1557 if ((destvffi->dwFileType!=tmpvffi->dwFileType) ||
1558 (destvffi->dwFileSubtype!=tmpvffi->dwFileSubtype)
1559 )
1560 xret |= VIF_MISMATCH|VIF_DIFFTYPE;
1561 if (VerQueryValueA(buf1,trans_array,(LPVOID*)&tbuf1,&len1) &&
1562 VerQueryValueA(buf2,trans_array,(LPVOID*)&tbuf2,&len2)
1563 ) {
1564 /* Do something with tbuf1 and tbuf2
1565 * generates DIFFLANG|MISMATCH
1566 */
1567 }
1568 HeapFree(GetProcessHeap(), 0, buf2);
1569 } else
1571 HeapFree(GetProcessHeap(), 0, buf1);
1572 }
1573 }
1574 if (xret) {
1575 if (*tmpfilelen<strlen(tmpfn+tmplast)) {
1576 xret|=VIF_BUFFTOOSMALL;
1577 DeleteFileA(tmpfn);
1578 } else {
1579 strcpy(tmpfile,tmpfn+tmplast);
1580 *tmpfilelen = strlen(tmpfn+tmplast)+1;
1581 xret|=VIF_TEMPFILE;
1582 }
1583 } else {
1585 if (!DeleteFileA(destfn)) {
1587 DeleteFileA(tmpfn);
1588 LZClose(hfsrc);
1589 return xret;
1590 }
1591 if ((!(flags & VIFF_DONTDELETEOLD)) &&
1592 curdir &&
1593 *curdir &&
1594 lstrcmpiA(curdir,pdest)
1595 ) {
1596 char curfn[260];
1597
1598 sprintf(curfn,"%s\\%s",curdir,destfilename);
1600 /* FIXME: check if in use ... if it is, VIF_CANNOTDELETECUR */
1601 if (!DeleteFileA(curfn))
1603 }
1604 }
1605 if (!MoveFileA(tmpfn,destfn)) {
1607 DeleteFileA(tmpfn);
1608 }
1609 }
1610 LZClose(hfsrc);
1611 return xret;
1612}
#define FIXME(fmt,...)
Definition: precomp.h:53
#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
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4227
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1001
static LPBYTE _fetch_versioninfo(LPSTR fn, VS_FIXEDFILEINFO **vffi)
Definition: version.c:1395
static DWORD _error2vif(DWORD error)
Definition: version.c:1432
return ret
Definition: mutex.c:146
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
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
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
long LONG
Definition: pedump.c:60
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
strcpy
Definition: string.h:131
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
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HFILE_ERROR
Definition: winbase.h:119
#define OF_READ
Definition: winbase.h:124
#define OF_CREATE
Definition: winbase.h:133
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 1618 of file version.c.

1621{
1622 LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL;
1623 DWORD ret = 0;
1624 UINT len;
1625
1626 if (srcfilename)
1627 {
1628 len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
1629 if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
1630 WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
1631 else
1633 }
1634 if (srcdir && !ret)
1635 {
1636 len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL );
1637 if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len )))
1638 WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL );
1639 else
1641 }
1642 if (destfilename && !ret)
1643 {
1644 len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL );
1645 if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len )))
1646 WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL );
1647 else
1649 }
1650 if (destdir && !ret)
1651 {
1652 len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL );
1653 if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len )))
1654 WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL );
1655 else
1657 }
1658 if (curdir && !ret)
1659 {
1660 len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL );
1661 if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len )))
1662 WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL );
1663 else
1665 }
1666 if (!ret)
1667 {
1668 len = *tmpfilelen * sizeof(WCHAR);
1669 wtmpf = HeapAlloc( GetProcessHeap(), 0, len );
1670 if (!wtmpf)
1672 }
1673 if (!ret)
1674 ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len);
1675 if (!ret)
1676 *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen );
1677 else if (ret & VIF_BUFFTOOSMALL)
1678 *tmpfilelen = len; /* FIXME: not correct */
1679
1680 HeapFree( GetProcessHeap(), 0, wsrcf );
1681 HeapFree( GetProcessHeap(), 0, wsrcd );
1682 HeapFree( GetProcessHeap(), 0, wdestf );
1683 HeapFree( GetProcessHeap(), 0, wdestd );
1684 HeapFree( GetProcessHeap(), 0, wtmpf );
1685 HeapFree( GetProcessHeap(), 0, wcurd );
1686 return ret;
1687}
#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:1447
char * LPSTR
Definition: xmlstorage.h:182

◆ VerLanguageNameA()

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

Definition at line 3076 of file locale.c.

3077{
3078 return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3079}
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: locale.c:1609
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2125
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:32

◆ VerLanguageNameW()

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

Definition at line 3087 of file locale.c.

3088{
3089 return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3090}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675

Referenced by CFileVersionInfo::GetLangName().

◆ VerQueryValueA()

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

Definition at line 1115 of file version.c.

1117{
1118 static const char rootA[] = "\\";
1119 const VS_VERSION_INFO_STRUCT16 *info = pBlock;
1120
1121 TRACE("(%p,%s,%p,%p)\n",
1122 pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
1123
1124 if (!pBlock)
1125 return FALSE;
1126
1127 if (lpSubBlock == NULL || lpSubBlock[0] == '\0')
1128 lpSubBlock = rootA;
1129
1130 if ( !VersionInfoIs16( info ) )
1131 {
1132 BOOL ret, isText;
1133 INT len;
1134 LPWSTR lpSubBlockW;
1135 UINT value_len;
1136
1137 len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
1138 lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1139
1140 if (!lpSubBlockW)
1141 return FALSE;
1142
1143 MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
1144
1145 ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
1146 if (puLen) *puLen = value_len;
1147
1148 HeapFree(GetProcessHeap(), 0, lpSubBlockW);
1149
1150 if (ret && isText)
1151 {
1152 /* Set lpBuffer so it points to the 'empty' area where we store
1153 * the converted strings
1154 */
1155 LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
1156 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1157 len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
1158 lpBufferA + pos, info->wLength - pos, NULL, NULL);
1159 *lplpBuffer = lpBufferA + pos;
1160 if (puLen) *puLen = len;
1161 }
1162 return ret;
1163 }
1164
1165 return VersionInfo16_QueryValue(info, lpSubBlock, lplpBuffer, puLen);
1166}
static BOOL VersionInfo16_QueryValue(const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: version.c:1025
static BOOL VersionInfo32_QueryValue(const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen, BOOL *pbText)
Definition: version.c:1069
#define VersionInfoIs16(ver)
Definition: version.c:102
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(), SHLWAPI_GetModuleVersion(), test_32bit_win(), test_extra_block(), test_GetFileVersionInfoEx(), test_info(), test_VerQueryValue_InvalidLength(), Test_VerQueryValueA(), test_VerQueryValueA(), and VerInstallFileA().

◆ VerQueryValueW()

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

Definition at line 1171 of file version.c.

1173{
1174 const VS_VERSION_INFO_STRUCT32 *info = pBlock;
1175
1176 TRACE("(%p,%s,%p,%p)\n",
1177 pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
1178
1179 if (!pBlock)
1180 return FALSE;
1181
1182 if (!lpSubBlock || !lpSubBlock[0])
1183 lpSubBlock = L"\\";
1184
1185 if ( VersionInfoIs16( info ) )
1186 {
1187 BOOL ret;
1188 int len;
1189 LPSTR lpSubBlockA;
1190
1191 len = WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, NULL, 0, NULL, NULL);
1192 lpSubBlockA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
1193
1194 if (!lpSubBlockA)
1195 return FALSE;
1196
1197 WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, lpSubBlockA, len, NULL, NULL);
1198
1199 ret = VersionInfo16_QueryValue(pBlock, lpSubBlockA, lplpBuffer, puLen);
1200
1201 HeapFree(GetProcessHeap(), 0, lpSubBlockA);
1202
1203 if (ret && wcscmp( lpSubBlock, L"\\" ) && wcsicmp( lpSubBlock, L"\\VarFileInfo\\Translation" ))
1204 {
1205 /* Set lpBuffer so it points to the 'empty' area where we store
1206 * the converted strings
1207 */
1208 LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
1209 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1210 DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
1211
1212 len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
1213 lpBufferW + pos, max/sizeof(WCHAR) - pos );
1214 *lplpBuffer = lpBufferW + pos;
1215 if (puLen) *puLen = len;
1216 }
1217 return ret;
1218 }
1219
1220 return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
1221}
struct tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO
#define wcsicmp
Definition: compat.h:15
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#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(), GetProcessDefaultLayout(), 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_StaticVersionInfo(), test_VerQueryValue_InvalidLength(), Test_VerQueryValueW(), TestDllProductVersion(), and VerQueryValueWrapW().