ReactOS  0.4.12-dev-945-g5a2911d
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 1199 of file version.c.

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

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

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

1618 {
1619  LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL;
1620  DWORD ret = 0;
1621  UINT len;
1622 
1623  if (srcfilename)
1624  {
1625  len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL );
1626  if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len )))
1627  WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL );
1628  else
1629  ret = VIF_OUTOFMEMORY;
1630  }
1631  if (srcdir && !ret)
1632  {
1633  len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL );
1634  if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len )))
1635  WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL );
1636  else
1637  ret = VIF_OUTOFMEMORY;
1638  }
1639  if (destfilename && !ret)
1640  {
1641  len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL );
1642  if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len )))
1643  WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL );
1644  else
1645  ret = VIF_OUTOFMEMORY;
1646  }
1647  if (destdir && !ret)
1648  {
1649  len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL );
1650  if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len )))
1651  WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL );
1652  else
1653  ret = VIF_OUTOFMEMORY;
1654  }
1655  if (curdir && !ret)
1656  {
1657  len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL );
1658  if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len )))
1659  WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL );
1660  else
1661  ret = VIF_OUTOFMEMORY;
1662  }
1663  if (!ret)
1664  {
1665  len = *tmpfilelen * sizeof(WCHAR);
1666  wtmpf = HeapAlloc( GetProcessHeap(), 0, len );
1667  if (!wtmpf)
1668  ret = VIF_OUTOFMEMORY;
1669  }
1670  if (!ret)
1671  ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len);
1672  if (!ret)
1673  *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen );
1674  else if (ret & VIF_BUFFTOOSMALL)
1675  *tmpfilelen = len; /* FIXME: not correct */
1676 
1677  HeapFree( GetProcessHeap(), 0, wsrcf );
1678  HeapFree( GetProcessHeap(), 0, wsrcd );
1679  HeapFree( GetProcessHeap(), 0, wdestf );
1680  HeapFree( GetProcessHeap(), 0, wdestd );
1681  HeapFree( GetProcessHeap(), 0, wtmpf );
1682  HeapFree( GetProcessHeap(), 0, wcurd );
1683  return ret;
1684 }
#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
DWORD WINAPI VerInstallFileA(DWORD flags, LPCSTR srcfilename, LPCSTR destfilename, LPCSTR srcdir, LPCSTR destdir, LPCSTR curdir, LPSTR tmpfile, PUINT tmpfilelen)
Definition: version.c:1444
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)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
#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
#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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
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)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
#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 rootW[] = { '\\', 0 };
1058  static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
1059  '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
1060 
1061  const VS_VERSION_INFO_STRUCT32 *info = pBlock;
1062 
1063  TRACE("(%p,%s,%p,%p)\n",
1064  pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen );
1065 
1066  if (!pBlock)
1067  return FALSE;
1068 
1069  if (!lpSubBlock || !lpSubBlock[0])
1070  lpSubBlock = rootW;
1071 
1072  if ( VersionInfoIs16( info ) )
1073  {
1074  BOOL ret;
1075  int len;
1076  LPSTR lpSubBlockA;
1077 
1078  len = WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, NULL, 0, NULL, NULL);
1079  lpSubBlockA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char));
1080 
1081  if (!lpSubBlockA)
1082  return FALSE;
1083 
1084  WideCharToMultiByte(CP_ACP, 0, lpSubBlock, -1, lpSubBlockA, len, NULL, NULL);
1085 
1086  ret = VersionInfo16_QueryValue(pBlock, lpSubBlockA, lplpBuffer, puLen);
1087 
1088  HeapFree(GetProcessHeap(), 0, lpSubBlockA);
1089 
1090  if (ret && strcmpiW( lpSubBlock, rootW ) && strcmpiW( lpSubBlock, varfileinfoW ))
1091  {
1092  /* Set lpBuffer so it points to the 'empty' area where we store
1093  * the converted strings
1094  */
1095  LPWSTR lpBufferW = (LPWSTR)((LPSTR)pBlock + info->wLength);
1096  DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
1097  DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength;
1098 
1099  len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
1100  lpBufferW + pos, max/sizeof(WCHAR) - pos );
1101  *lplpBuffer = lpBufferW + pos;
1102  if (puLen) *puLen = len;
1103  }
1104  return ret;
1105  }
1106 
1107  return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
1108 }
#define max(a, b)
Definition: svc.c:63
#define WideCharToMultiByte
Definition: compat.h:101
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#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
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)
__wchar_t WCHAR
Definition: xmlstorage.h:180
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

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().