Commit a6166e17 authored by Jeremy White's avatar Jeremy White Committed by Alexandre Julliard

Revised shell link process to treat empty (e.g. "") strings

identically to NULL strings. Makes many more installers take useful action. Added many trace messages.
parent 0255c8f0
...@@ -343,21 +343,39 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX ...@@ -343,21 +343,39 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX
int i; int i;
if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE))) if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE)))
{
TRACE("LoadLibraryExA (%s) failed, error %ld\n", szFileName, GetLastError());
goto error1; goto error1;
}
if (nIndex) if (nIndex)
{
hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_GROUP_ICONA); hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_GROUP_ICONA);
TRACE("FindResourceA (%s) called, return 0x%x, error %ld\n", szFileName, hResInfo, GetLastError());
}
else else
if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &hResInfo)) if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &hResInfo))
{
TRACE("EnumResourceNamesA failed, error %ld\n", GetLastError());
goto error2; goto error2;
}
if (!hResInfo) if (!hResInfo)
{
TRACE("ExtractFromEXEDLL failed, error %ld\n", GetLastError());
goto error2; goto error2;
}
if (!(hResData = LoadResource(hModule, hResInfo))) if (!(hResData = LoadResource(hModule, hResInfo)))
{
TRACE("LoadResource failed, error %ld\n", GetLastError());
goto error2; goto error2;
}
if (!(pIconDir = LockResource(hResData))) if (!(pIconDir = LockResource(hResData)))
{
TRACE("LockResource failed, error %ld\n", GetLastError());
goto error3; goto error3;
}
for (i = 0; i < pIconDir->idCount; i++) for (i = 0; i < pIconDir->idCount; i++)
if ((pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth) > nMax) if ((pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth) > nMax)
...@@ -369,14 +387,26 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX ...@@ -369,14 +387,26 @@ static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szX
FreeResource(hResData); FreeResource(hResData);
if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA))) if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA)))
{
TRACE("Second FindResourceA failed, error %ld\n", GetLastError());
goto error2; goto error2;
}
if (!(hResData = LoadResource(hModule, hResInfo))) if (!(hResData = LoadResource(hModule, hResInfo)))
{
TRACE("Second LoadResource failed, error %ld\n", GetLastError());
goto error2; goto error2;
}
if (!(pIcon = LockResource(hResData))) if (!(pIcon = LockResource(hResData)))
{
TRACE("Second LockResource failed, error %ld\n", GetLastError());
goto error3; goto error3;
}
if(!SaveIconResAsXPM(pIcon, szXPMFileName)) if(!SaveIconResAsXPM(pIcon, szXPMFileName))
{
TRACE("Failed saving icon as XPM, error %ld\n", GetLastError());
goto error3; goto error3;
}
FreeResource(hResData); FreeResource(hResData);
FreeLibrary(hModule); FreeLibrary(hModule);
...@@ -563,9 +593,11 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile ...@@ -563,9 +593,11 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
if (This->sWorkDir) work_dir = get_unix_file_name( This->sWorkDir ); if (This->sWorkDir) work_dir = get_unix_file_name( This->sWorkDir );
/* extract the icon */ /* extract the icon */
if (!(icon_name = extract_icon( This->sIcoPath ? This->sIcoPath : This->sPath, if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ?
This->sIcoPath : This->sPath,
This->iIcoNdx ))) goto done; This->iIcoNdx ))) goto done;
TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n", TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",
shell_link_app, link_name, bDesktop ? "desktop" : "menu", path_name, shell_link_app, link_name, bDesktop ? "desktop" : "menu", path_name,
This->sArgs ? This->sArgs : "", icon_name, work_dir ? work_dir : "", This->sArgs ? This->sArgs : "", icon_name, work_dir ? work_dir : "",
...@@ -582,7 +614,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile ...@@ -582,7 +614,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
argv[pos++] = "--path"; argv[pos++] = "--path";
argv[pos++] = path_name; argv[pos++] = path_name;
argv[pos++] = bDesktop ? "--desktop" : "--menu"; argv[pos++] = bDesktop ? "--desktop" : "--menu";
if (This->sArgs) if (This->sArgs && strlen(This->sArgs))
{ {
argv[pos++] = "--args"; argv[pos++] = "--args";
argv[pos++] = This->sArgs; argv[pos++] = This->sArgs;
...@@ -592,12 +624,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile ...@@ -592,12 +624,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
argv[pos++] = "--icon"; argv[pos++] = "--icon";
argv[pos++] = icon_name; argv[pos++] = icon_name;
} }
if (This->sWorkDir) if (This->sWorkDir && strlen(This->sWorkDir))
{ {
argv[pos++] = "--workdir"; argv[pos++] = "--workdir";
argv[pos++] = This->sWorkDir; argv[pos++] = This->sWorkDir;
} }
if (This->sDescription) if (This->sDescription && strlen(This->sDescription))
{ {
argv[pos++] = "--descr"; argv[pos++] = "--descr";
argv[pos++] = This->sDescription; argv[pos++] = This->sDescription;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment