GetDLLVersionLocal now always first looks in the current directory
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1548 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
dbd5e9feaa
commit
be8d9d61ab
1 changed files with 31 additions and 2 deletions
|
@ -2860,7 +2860,35 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
DWORD low, high;
|
DWORD low, high;
|
||||||
DWORD s,d;
|
DWORD s,d;
|
||||||
int flag=0;
|
int flag=0;
|
||||||
s=GetFileVersionInfoSize(line.gettoken_str(1),&d);
|
int alloced=0;
|
||||||
|
char *path=line.gettoken_str(1);
|
||||||
|
if (!((*path == '\\' && path[1] == '\\') || (*path && path[1] == ':'))) {
|
||||||
|
size_t pathlen=lstrlen(path)+GetCurrentDirectory(0, buf)+2;
|
||||||
|
char *nrpath=(char *)malloc(pathlen);
|
||||||
|
alloced=1;
|
||||||
|
GetCurrentDirectory(pathlen, nrpath);
|
||||||
|
if (path[0] != '\\')
|
||||||
|
strcat(nrpath,"\\");
|
||||||
|
else if (nrpath[1] == ':') {
|
||||||
|
nrpath[2]=0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
char *p=nrpath+2;
|
||||||
|
while (*p!='\\') p++;
|
||||||
|
*p=0;
|
||||||
|
}
|
||||||
|
strcat(nrpath,path);
|
||||||
|
FILE *f=fopen(nrpath, "r");
|
||||||
|
if (f) {
|
||||||
|
path=nrpath;
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
free(nrpath);
|
||||||
|
alloced=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s=GetFileVersionInfoSize(path,&d);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -2869,7 +2897,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
{
|
{
|
||||||
UINT uLen;
|
UINT uLen;
|
||||||
VS_FIXEDFILEINFO *pvsf;
|
VS_FIXEDFILEINFO *pvsf;
|
||||||
if (GetFileVersionInfo(line.gettoken_str(1),0,s,buf) && VerQueryValue(buf,"\\",(void**)&pvsf,&uLen))
|
if (GetFileVersionInfo(path,0,s,buf) && VerQueryValue(buf,"\\",(void**)&pvsf,&uLen))
|
||||||
{
|
{
|
||||||
low=pvsf->dwFileVersionLS;
|
low=pvsf->dwFileVersionLS;
|
||||||
high=pvsf->dwFileVersionMS;
|
high=pvsf->dwFileVersionMS;
|
||||||
|
@ -2878,6 +2906,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
GlobalFree(buf);
|
GlobalFree(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (alloced) free(path);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
ERROR_MSG("GetDLLVersionLocal: error reading version info from \"%s\"\n",line.gettoken_str(1));
|
ERROR_MSG("GetDLLVersionLocal: error reading version info from \"%s\"\n",line.gettoken_str(1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue