ReactOS 0.4.16-dev-979-g79f281e
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(), 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  lpszFilename,
LPCSTR  lpszWinDir,
LPCSTR  lpszAppDir,
LPSTR  lpszCurDir,
PUINT  lpuCurDirLen,
LPSTR  lpszDestDir,
PUINT  lpuDestDirLen 
)

Definition at line 1202 of file version.c.

1211{
1212 DWORD retval = 0;
1213 const char *curDir;
1214 const char *destDir;
1215 unsigned int curDirSizeReq;
1216 unsigned int destDirSizeReq;
1217 char winDir[MAX_PATH], systemDir[MAX_PATH];
1218
1219 /* Print out debugging information */
1220 TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1221 flags, debugstr_a(lpszFilename), debugstr_a(lpszWinDir), debugstr_a(lpszAppDir),
1222 lpuCurDirLen, lpuCurDirLen ? *lpuCurDirLen : 0,
1223 lpuDestDirLen, lpuDestDirLen ? *lpuDestDirLen : 0 );
1224
1225 /* Figure out where the file should go; shared files default to the
1226 system directory */
1227
1228 GetSystemDirectoryA(systemDir, sizeof(systemDir));
1229 curDir = "";
1230
1232 {
1233 destDir = systemDir;
1234 /* Were we given a filename? If so, try to find the file. */
1235 if(lpszFilename)
1236 {
1237 if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
1238 else if(lpszAppDir && testFileExistenceA(lpszAppDir, lpszFilename, FALSE))
1239 curDir = lpszAppDir;
1240
1241 if(!testFileExistenceA(systemDir, lpszFilename, FALSE))
1243 }
1244 }
1245 else /* not a shared file */
1246 {
1247 destDir = lpszAppDir ? lpszAppDir : "";
1248 if(lpszFilename)
1249 {
1250 GetWindowsDirectoryA( winDir, MAX_PATH );
1251 if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
1252 else if(testFileExistenceA(winDir, lpszFilename, FALSE))
1253 curDir = winDir;
1254 else if(testFileExistenceA(systemDir, lpszFilename, FALSE))
1255 curDir = systemDir;
1256
1257 if (lpszAppDir && lpszAppDir[0])
1258 {
1259 if(!testFileExistenceA(lpszAppDir, lpszFilename, FALSE))
1261 }
1262 else if(testFileExistenceA(NULL, lpszFilename, FALSE))
1264 }
1265 }
1266
1267 /* Check to see if the file exists and is in use by another application */
1268 if (lpszFilename && testFileExistenceA(curDir, lpszFilename, FALSE)) {
1269 if (lpszFilename && !testFileExistenceA(curDir, lpszFilename, TRUE))
1271 }
1272
1273 curDirSizeReq = strlen(curDir) + 1;
1274 destDirSizeReq = strlen(destDir) + 1;
1275
1276 /* Make sure that the pointers to the size of the buffers are
1277 valid; if not, do NOTHING with that buffer. If that pointer
1278 is valid, then make sure that the buffer pointer is valid, too! */
1279
1280 if(lpuDestDirLen && lpszDestDir)
1281 {
1282 if (*lpuDestDirLen < destDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1283 lstrcpynA(lpszDestDir, destDir, *lpuDestDirLen);
1284 *lpuDestDirLen = destDirSizeReq;
1285 }
1286 if(lpuCurDirLen && lpszCurDir)
1287 {
1288 if(*lpuCurDirLen < curDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1289 lstrcpynA(lpszCurDir, curDir, *lpuCurDirLen);
1290 *lpuCurDirLen = curDirSizeReq;
1291 }
1292
1293 TRACE("ret = %u (%s%s%s) curdir=%s destdir=%s\n", retval,
1294 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1295 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1296 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1297 debugstr_a(lpszCurDir), debugstr_a(lpszDestDir));
1298
1299 return retval;
1300}
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:1126
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
int retval
Definition: wcstombs.cpp:91

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 1305 of file version.c.

1308{
1309 static const WCHAR emptyW;
1310 DWORD retval = 0;
1311 const WCHAR *curDir;
1312 const WCHAR *destDir;
1313 unsigned int curDirSizeReq;
1314 unsigned int destDirSizeReq;
1315 WCHAR winDir[MAX_PATH], systemDir[MAX_PATH];
1316
1317 /* Print out debugging information */
1318 TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
1319 flags, debugstr_w(lpszFilename), debugstr_w(lpszWinDir), debugstr_w(lpszAppDir),
1320 lpuCurDirLen, lpuCurDirLen ? *lpuCurDirLen : 0,
1321 lpuDestDirLen, lpuDestDirLen ? *lpuDestDirLen : 0 );
1322
1323 /* Figure out where the file should go; shared files default to the
1324 system directory */
1325
1326 GetSystemDirectoryW(systemDir, ARRAY_SIZE(systemDir));
1327 curDir = &emptyW;
1328
1330 {
1331 destDir = systemDir;
1332 /* Were we given a filename? If so, try to find the file. */
1333 if(lpszFilename)
1334 {
1335 if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
1336 else if(lpszAppDir && testFileExistenceW(lpszAppDir, lpszFilename, FALSE))
1337 {
1338 curDir = lpszAppDir;
1340 }
1341 }
1342 }
1343 else /* not a shared file */
1344 {
1345 destDir = lpszAppDir ? lpszAppDir : &emptyW;
1346 if(lpszFilename)
1347 {
1348 GetWindowsDirectoryW( winDir, MAX_PATH );
1349 if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
1350 else if(testFileExistenceW(winDir, lpszFilename, FALSE))
1351 {
1352 curDir = winDir;
1354 }
1355 else if(testFileExistenceW(systemDir, lpszFilename, FALSE))
1356 {
1357 curDir = systemDir;
1359 }
1360 }
1361 }
1362
1363 if (lpszFilename && !testFileExistenceW(curDir, lpszFilename, TRUE))
1365
1366 curDirSizeReq = lstrlenW(curDir) + 1;
1367 destDirSizeReq = lstrlenW(destDir) + 1;
1368
1369 /* Make sure that the pointers to the size of the buffers are
1370 valid; if not, do NOTHING with that buffer. If that pointer
1371 is valid, then make sure that the buffer pointer is valid, too! */
1372
1373 if(lpuDestDirLen && lpszDestDir)
1374 {
1375 if (*lpuDestDirLen < destDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1376 lstrcpynW(lpszDestDir, destDir, *lpuDestDirLen);
1377 *lpuDestDirLen = destDirSizeReq;
1378 }
1379 if(lpuCurDirLen && lpszCurDir)
1380 {
1381 if(*lpuCurDirLen < curDirSizeReq) retval |= VFF_BUFFTOOSMALL;
1382 lstrcpynW(lpszCurDir, curDir, *lpuCurDirLen);
1383 *lpuCurDirLen = curDirSizeReq;
1384 }
1385
1386 TRACE("ret = %u (%s%s%s) curdir=%s destdir=%s\n", retval,
1387 (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
1388 (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
1389 (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "",
1390 debugstr_w(lpszCurDir), debugstr_w(lpszDestDir));
1391 return retval;
1392}
#define ARRAY_SIZE(A)
Definition: main.h:20
#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:1161
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 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:4224
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
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
unsigned int UINT
Definition: ndis.h:50
#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
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HFILE_ERROR
Definition: winbase.h:112
#define OF_READ
Definition: winbase.h:117
#define OF_CREATE
Definition: winbase.h:126
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
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 3073 of file locale.c.

3074{
3075 return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3076}
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: locale.c:1600
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2115
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:27

◆ VerLanguageNameW()

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

Definition at line 3084 of file locale.c.

3085{
3086 return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3087}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666

Referenced by CFileVersionInfo::GetLangName().

◆ VerQueryValueA()

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

Definition at line 1001 of file version.c.

1003{
1004 static const char rootA[] = "\\";
1005 const VS_VERSION_INFO_STRUCT16 *info = pBlock;
1006
1007 TRACE("(%p,%s,%p,%p)\n",
1008 pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
1009
1010 if (!pBlock)
1011 return FALSE;
1012
1013 if (lpSubBlock == NULL || lpSubBlock[0] == '\0')
1014 lpSubBlock = rootA;
1015
1016 if ( !VersionInfoIs16( info ) )
1017 {
1018 BOOL ret, isText;
1019 INT len;
1020 LPWSTR lpSubBlockW;
1021 UINT value_len;
1022
1023 len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
1024 lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1025
1026 if (!lpSubBlockW)
1027 return FALSE;
1028
1029 MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
1030
1031 ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
1032 if (puLen) *puLen = value_len;
1033
1034 HeapFree(GetProcessHeap(), 0, lpSubBlockW);
1035
1036 if (ret && isText)
1037 {
1038 /* Set lpBuffer so it points to the 'empty' area where we store
1039 * the converted strings
1040 */
1041 LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
1042 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1043 len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
1044 lpBufferA + pos, info->wLength - pos, NULL, NULL);
1045 *lplpBuffer = lpBufferA + pos;
1046 if (puLen) *puLen = len;
1047 }
1048 return ret;
1049 }
1050
1051 return VersionInfo16_QueryValue(info, lpSubBlock, lplpBuffer, puLen);
1052}
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(), test_VerQueryValueA(), and VerInstallFileA().

◆ VerQueryValueW()

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

Definition at line 1057 of file version.c.

1059{
1060 static const WCHAR rootW[] = { '\\', 0 };
1061 static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
1062 '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
1063
1064 const VS_VERSION_INFO_STRUCT32 *info = pBlock;
1065
1066 TRACE("(%p,%s,%p,%p)\n",
1067 pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
1068
1069 if (!pBlock)
1070 return FALSE;
1071
1072 if (!lpSubBlock || !lpSubBlock[0])
1073 lpSubBlock = rootW;
1074
1075 if ( VersionInfoIs16( info ) )
1076 {
1077 BOOL ret;
1078 int len;
1079 LPSTR lpSubBlockA;
1080
1081 len = WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, NULL, 0, NULL, NULL);
1082 lpSubBlockA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
1083
1084 if (!lpSubBlockA)
1085 return FALSE;
1086
1087 WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, lpSubBlockA, len, NULL, NULL);
1088
1089 ret = VersionInfo16_QueryValue(pBlock, lpSubBlockA, lplpBuffer, puLen);
1090
1091 HeapFree(GetProcessHeap(), 0, lpSubBlockA);
1092
1093 if (ret && wcsicmp( lpSubBlock, rootW ) && wcsicmp( lpSubBlock, varfileinfoW ))
1094 {
1095 /* Set lpBuffer so it points to the 'empty' area where we store
1096 * the converted strings
1097 */
1098 LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
1099 DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1100 DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
1101
1102 len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
1103 lpBufferW + pos, max/sizeof(WCHAR) - pos );
1104 *lplpBuffer = lpBufferW + pos;
1105 if (puLen) *puLen = len;
1106 }
1107 return ret;
1108 }
1109
1110 return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
1111}
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(), 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(), and VerQueryValueWrapW().