ReactOS  0.4.12-dev-375-g61fed54
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  ,
DWORD  ,
DWORD  ,
PVOID   
)

Definition at line 858 of file version.c.

859 {
861 }
const char * filename
Definition: ioapi.h:135
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FILE_VER_GET_LOCALISED
Definition: verrsrc.h:147
BOOL WINAPI GetFileVersionInfoExA(DWORD flags, LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:827

Referenced by _fetch_versioninfo(), create_file_with_version(), 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  ,
LPCSTR  ,
LPCSTR  ,
LPCSTR  ,
LPSTR  ,
PUINT  ,
LPSTR  ,
PUINT   
)

Definition at line 1200 of file version.c.

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

Referenced by test_find_file().

◆ VerFindFileW()

DWORD WINAPI VerFindFileW ( DWORD  ,
LPCWSTR  ,
LPCWSTR  ,
LPCWSTR  ,
LPWSTR  ,
PUINT  ,
LPWSTR  ,
PUINT   
)

Definition at line 1303 of file version.c.

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

◆ VerInstallFileA()

DWORD WINAPI VerInstallFileA ( DWORD  ,
LPCSTR  ,
LPCSTR  ,
LPCSTR  ,
LPCSTR  ,
LPCSTR  ,
LPSTR  ,
PUINT   
)

Definition at line 1445 of file version.c.

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

Referenced by test_install_file(), and VerInstallFileW().

◆ VerInstallFileW()

DWORD WINAPI VerInstallFileW ( DWORD  ,
LPCWSTR  ,
LPCWSTR  ,
LPCWSTR  ,
LPCWSTR  ,
LPCWSTR  ,
LPWSTR  ,
PUINT   
)

Definition at line 1616 of file version.c.

1619 {
1620  LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL;
1621  DWORD ret = 0;
1622  UINT len;
1623 
1624  if (srcfilename)
1625  {
1626  len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
1627  if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
1628  WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
1629  else
1630  ret = VIF_OUTOFMEMORY;
1631  }
1632  if (srcdir && !ret)
1633  {
1634  len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL );
1635  if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len )))
1636  WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL );
1637  else
1638  ret = VIF_OUTOFMEMORY;
1639  }
1640  if (destfilename && !ret)
1641  {
1642  len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL );
1643  if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len )))
1644  WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL );
1645  else
1646  ret = VIF_OUTOFMEMORY;
1647  }
1648  if (destdir && !ret)
1649  {
1650  len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL );
1651  if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len )))
1652  WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL );
1653  else
1654  ret = VIF_OUTOFMEMORY;
1655  }
1656  if (curdir && !ret)
1657  {
1658  len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL );
1659  if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len )))
1660  WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL );
1661  else
1662  ret = VIF_OUTOFMEMORY;
1663  }
1664  if (!ret)
1665  {
1666  len = *tmpfilelen * sizeof(WCHAR);
1667  wtmpf = HeapAlloc( GetProcessHeap(), 0, len );
1668  if (!wtmpf)
1669  ret = VIF_OUTOFMEMORY;
1670  }
1671  if (!ret)
1672  ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len);
1673  if (!ret)
1674  *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen );
1675  else if (ret & VIF_BUFFTOOSMALL)
1676  *tmpfilelen = len; /* FIXME: not correct */
1677 
1678  HeapFree( GetProcessHeap(), 0, wsrcf );
1679  HeapFree( GetProcessHeap(), 0, wsrcd );
1680  HeapFree( GetProcessHeap(), 0, wdestf );
1681  HeapFree( GetProcessHeap(), 0, wdestd );
1682  HeapFree( GetProcessHeap(), 0, wtmpf );
1683  HeapFree( GetProcessHeap(), 0, wcurd );
1684  return ret;
1685 }
#define VIF_BUFFTOOSMALL
Definition: verrsrc.h:136
#define WideCharToMultiByte
Definition: compat.h:101
#define VIF_OUTOFMEMORY
Definition: verrsrc.h:133
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
#define WCHAR
Definition: msvc.h:43
DWORD WINAPI VerInstallFileA(DWORD flags, LPCSTR srcfilename, LPCSTR destfilename, LPCSTR srcdir, LPCSTR destdir, LPCSTR curdir, LPSTR tmpfile, PUINT tmpfilelen)
Definition: version.c:1445
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP FILE *__cdecl tmpfile(void)
Definition: file.c:3912
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int UINT
Definition: ndis.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ VerLanguageNameA()

DWORD WINAPI VerLanguageNameA ( DWORD  ,
LPSTR  ,
DWORD   
)

Definition at line 1675 of file lang.c.

1676 {
1677  return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
1678 }
#define MAKELCID(lgid, srtid)
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:27
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: lang.c:1015
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2024
#define SORT_DEFAULT

◆ VerLanguageNameW()

DWORD WINAPI VerLanguageNameW ( DWORD  ,
LPWSTR  ,
DWORD   
)

Definition at line 1686 of file lang.c.

1687 {
1688  return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
1689 }
#define MAKELCID(lgid, srtid)
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:27
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2024
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1095
#define SORT_DEFAULT

Referenced by CFileVersionInfo::GetLangName().

◆ VerQueryValueA()

BOOL WINAPI VerQueryValueA ( LPCVOID  ,
LPCSTR  ,
LPVOID ,
PUINT   
)

Definition at line 998 of file version.c.

1000 {
1001  static const char rootA[] = "\\";
1002  const VS_VERSION_INFO_STRUCT16 *info = pBlock;
1003 
1004  TRACE("(%p,%s,%p,%p)\n",
1005  pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen );
1006 
1007  if (!pBlock)
1008  return FALSE;
1009 
1010  if (lpSubBlock == NULL || lpSubBlock[0] == '\0')
1011  lpSubBlock = rootA;
1012 
1013  if ( !VersionInfoIs16( info ) )
1014  {
1015  BOOL ret, isText;
1016  INT len;
1017  LPWSTR lpSubBlockW;
1018  UINT value_len;
1019 
1020  len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
1021  lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1022 
1023  if (!lpSubBlockW)
1024  return FALSE;
1025 
1026  MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
1027 
1028  ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
1029  if (puLen) *puLen = value_len;
1030 
1031  HeapFree(GetProcessHeap(), 0, lpSubBlockW);
1032 
1033  if (ret && isText)
1034  {
1035  /* Set lpBuffer so it points to the 'empty' area where we store
1036  * the converted strings
1037  */
1038  LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
1039  DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1040  len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
1041  lpBufferA + pos, info->wLength - pos, NULL, NULL);
1042  *lplpBuffer = lpBufferA + pos;
1043  if (puLen) *puLen = len;
1044  }
1045  return ret;
1046  }
1047 
1048  return VersionInfo16_QueryValue(info, lpSubBlock, lplpBuffer, puLen);
1049 }
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
static BOOL VersionInfo16_QueryValue(const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: version.c:908
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
#define VersionInfoIs16(ver)
Definition: version.c:588
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL VersionInfo32_QueryValue(const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen, BOOL *pbText)
Definition: version.c:952
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define debugstr_a
Definition: kernel32.h:31
unsigned int UINT
Definition: ndis.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by 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  ,
LPCWSTR  ,
LPVOID ,
PUINT   
)

Definition at line 1054 of file version.c.

1056 {
1057  static const WCHAR nullW[] = { 0 };
1058  static const WCHAR rootW[] = { '\\', 0 };
1059  static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
1060  '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
1061 
1062  const VS_VERSION_INFO_STRUCT32 *info = pBlock;
1063 
1064  TRACE("(%p,%s,%p,%p)\n",
1065  pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
1066 
1067  if (!pBlock)
1068  return FALSE;
1069 
1070  if (lpSubBlock == NULL || lpSubBlock[0] == nullW[0])
1071  lpSubBlock = rootW;
1072 
1073  if ( VersionInfoIs16( info ) )
1074  {
1075  BOOL ret;
1076  int len;
1077  LPSTR lpSubBlockA;
1078 
1079  len = WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, NULL, 0, NULL, NULL);
1080  lpSubBlockA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
1081 
1082  if (!lpSubBlockA)
1083  return FALSE;
1084 
1085  WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, lpSubBlockA, len, NULL, NULL);
1086 
1087  ret = VersionInfo16_QueryValue(pBlock, lpSubBlockA, lplpBuffer, puLen);
1088 
1089  HeapFree(GetProcessHeap(), 0, lpSubBlockA);
1090 
1091  if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW ))
1092  {
1093  /* Set lpBuffer so it points to the 'empty' area where we store
1094  * the converted strings
1095  */
1096  LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
1097  DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1098  DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
1099 
1100  len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
1101  lpBufferW + pos, max/sizeof(WCHAR) - pos );
1102  *lplpBuffer = lpBufferW + pos;
1103  if (puLen) *puLen = len;
1104  }
1105  return ret;
1106  }
1107 
1108  return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
1109 }
#define max(a, b)
Definition: svc.c:63
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR rootW[]
Definition: chain.c:69
struct tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO
#define CP_ACP
Definition: compat.h:99
static BOOL VersionInfo16_QueryValue(const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen)
Definition: version.c:908
char * LPSTR
Definition: xmlstorage.h:182
#define VersionInfoIs16(ver)
Definition: version.c:588
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL VersionInfo32_QueryValue(const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen, BOOL *pbText)
Definition: version.c:952
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR nullW[]
Definition: json.c:33

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