Ignore:
Timestamp:
Apr 28, 2001, 3:33:49 PM (24 years ago)
Author:
sandervl
Message:

resync with latest wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/shelllink.c

    r4561 r5618  
    1 /* $Id: shelllink.c,v 1.2 2000-11-06 10:20:56 sandervl Exp $ */
    21/*
    32 *
     
    65 *
    76 */
    8 #ifdef __WIN32OS2__
    9 #define ICOM_CINTERFACE 1
    10 #include <odin.h>
    11 #endif
     7
     8#include "config.h"
    129
    1310#include <string.h>
     
    1815#endif
    1916#include <errno.h>
    20 #ifndef __WIN32OS2__
    21 #include <sys/wait.h>
     17#ifdef HAVE_SYS_WAIT_H
     18# include <sys/wait.h>
    2219#endif
    23 
    2420#include "debugtools.h"
    2521#include "winerror.h"
    2622#include "winbase.h"
    2723#include "winnls.h"
     24#include "winreg.h"
    2825
    2926#include "shlobj.h"
    30 #include "wine/winestring.h"
    3127#include "wine/undocshell.h"
    3228#ifndef __WIN32OS2__
     
    3834#include "shell32_main.h"
    3935#include "shlguid.h"
    40 #include "file.h"
    41 #include "options.h"
    4236
    4337DEFAULT_DEBUG_CHANNEL(shell);
     
    355349
    356350    if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE)))
     351    {
     352        TRACE("LoadLibraryExA (%s) failed, error %ld\n", szFileName, GetLastError());
    357353        goto error1;
     354    }
    358355
    359356    if (nIndex)
     357    {
    360358        hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_GROUP_ICONA);
     359        TRACE("FindResourceA (%s) called, return 0x%x, error %ld\n", szFileName, hResInfo, GetLastError());
     360    }
    361361    else
    362362        if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &hResInfo))
     363        {
     364            TRACE("EnumResourceNamesA failed, error %ld\n", GetLastError());
    363365            goto error2;
     366        }
    364367
    365368    if (!hResInfo)
     369    {
     370        TRACE("ExtractFromEXEDLL failed, error %ld\n", GetLastError());
    366371        goto error2;
     372    }
    367373
    368374    if (!(hResData = LoadResource(hModule, hResInfo)))
     375    {
     376        TRACE("LoadResource failed, error %ld\n", GetLastError());
    369377        goto error2;
     378    }
    370379    if (!(pIconDir = LockResource(hResData)))
     380    {
     381        TRACE("LockResource failed, error %ld\n", GetLastError());
    371382        goto error3;
     383    }
    372384
    373385    for (i = 0; i < pIconDir->idCount; i++)
     
    381393
    382394    if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA)))
     395    {
     396        TRACE("Second FindResourceA failed, error %ld\n", GetLastError());
    383397        goto error2;
     398    }
    384399    if (!(hResData = LoadResource(hModule, hResInfo)))
     400    {
     401        TRACE("Second LoadResource failed, error %ld\n", GetLastError());
    385402        goto error2;
     403    }
    386404    if (!(pIcon = LockResource(hResData)))
     405    {
     406        TRACE("Second LockResource failed, error %ld\n", GetLastError());
    387407        goto error3;
     408    }
    388409
    389410    if(!SaveIconResAsXPM(pIcon, szXPMFileName))
     411    {
     412        TRACE("Failed saving icon as XPM, error %ld\n", GetLastError());
    390413        goto error3;
     414    }
    391415
    392416    FreeResource(hResData);
     
    461485inline static char *get_unix_file_name( const char *dos )
    462486{
    463     DOS_FULL_NAME path;
    464 
    465     if (!DOSFS_GetFullName( dos, FALSE, &path )) return NULL;
    466     return HEAP_strdupA( GetProcessHeap(), 0, path.long_name );
     487    char buffer[MAX_PATH];
     488
     489    if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL;
     490    return HEAP_strdupA( GetProcessHeap(), 0, buffer );
    467491}
    468492
     
    491515    return NULL;
    492516}
    493 #endif //#ifndef __WIN32OS2__
    494 
     517#endif //__WIN32OS2__
    495518
    496519static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
     
    505528    char *work_dir = NULL;
    506529    BOOL bDesktop;
     530    HKEY hkey;
    507531
    508532    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
     
    522546    return NOERROR;
    523547#else
    524     PROFILE_GetWineIniString( "wine", "ShellLinker", "", buffer, sizeof(buffer) );
     548    buffer[0] = 0;
     549    if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine",
     550                        0, KEY_ALL_ACCESS, &hkey ))
     551    {
     552        DWORD type, count = sizeof(buffer);
     553        if (RegQueryValueExA( hkey, "ShellLinker", 0, &type, buffer, &count )) buffer[0] = 0;
     554        RegCloseKey( hkey );
     555    }
    525556    if (!*buffer) return NOERROR;
    526557    shell_link_app = HEAP_strdupA( GetProcessHeap(), 0, buffer );
     
    571602
    572603    /* extract the icon */
    573     if (!(icon_name = extract_icon( This->sIcoPath ? This->sIcoPath : This->sPath,
    574                                     This->iIcoNdx ))) goto done;
     604    if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ?
     605                                      This->sIcoPath : This->sPath,
     606                                      This->iIcoNdx ))) goto done;
     607
    575608
    576609    TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",
     
    590623        argv[pos++] = path_name;
    591624        argv[pos++] = bDesktop ? "--desktop" : "--menu";
    592         if (This->sArgs)
     625        if (This->sArgs && strlen(This->sArgs))
    593626        {
    594627            argv[pos++] = "--args";
     
    600633            argv[pos++] = icon_name;
    601634        }
    602         if (This->sWorkDir)
     635        if (This->sWorkDir && strlen(This->sWorkDir))
    603636        {
    604637            argv[pos++] = "--workdir";
    605638            argv[pos++] = This->sWorkDir;
    606639        }
    607         if (This->sDescription)
     640        if (This->sDescription && strlen(This->sDescription))
    608641        {
    609642            argv[pos++] = "--descr";
     
    633666    HeapFree( GetProcessHeap(), 0, work_dir );
    634667    return ret;
    635 #endif //__WIN32OS2__
     668#endif
    636669}
    637670
     
    10201053        ICOM_THIS(IShellLinkImpl, iface);
    10211054       
    1022         FIXME("(%p)->()\n",This);
    1023         lstrcpynA(pszDir,"c:\\", cchMaxPath);
     1055        TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath);
     1056
     1057        lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath );
     1058
    10241059        return NOERROR;
    10251060}
     
    10411076        ICOM_THIS(IShellLinkImpl, iface);
    10421077       
    1043         FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
    1044         lstrcpynA(pszArgs, "", cchMaxPath);
     1078        TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);
     1079
     1080        lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath );
     1081
    10451082        return NOERROR;
    10461083}
     
    10971134        ICOM_THIS(IShellLinkImpl, iface);
    10981135       
    1099         FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
    1100         lstrcpynA(pszIconPath,"shell32.dll",cchIconPath);
    1101         *piIcon=1;
     1136        TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);
     1137
     1138        lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath );
     1139        *piIcon = This->iIcoNdx;
     1140
    11021141        return NOERROR;
    11031142}
     
    12151254       
    12161255        FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);
    1217         lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);
     1256        MultiByteToWideChar( CP_ACP, 0, "c:\\foo.bar", -1, pszFile, cchMaxPath );
    12181257        return NOERROR;
    12191258}
     
    12411280       
    12421281        FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
    1243         lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);
     1282        MultiByteToWideChar( CP_ACP, 0, "Description, FIXME", -1, pszName, cchMaxName );
    12441283        return NOERROR;
    12451284}
     
    12631302        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    12641303       
    1265         FIXME("(%p)->()\n",This);
    1266         lstrcpynAtoW(pszDir,"c:\\", cchMaxPath);
     1304        TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath);
     1305
     1306        MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath );
     1307
    12671308        return NOERROR;
    12681309}
     
    12861327        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    12871328       
    1288         FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
    1289         lstrcpynAtoW(pszArgs, "", cchMaxPath);
     1329        TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);
     1330
     1331        MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath );
     1332
    12901333        return NOERROR;
    12911334}
     
    13431386        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    13441387       
    1345         FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
    1346         lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath);
    1347         *piIcon=1;
     1388        TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);
     1389
     1390        MultiByteToWideChar( CP_ACP, 0, This->sIcoPath ? This->sIcoPath : "", -1, pszIconPath, cchIconPath );
     1391        *piIcon = This->iIcoNdx;
     1392
    13481393        return NOERROR;
    13491394}
Note: See TracChangeset for help on using the changeset viewer.