Changeset 77


Ignore:
Timestamp:
Jun 9, 1999, 5:22:27 PM (26 years ago)
Author:
phaller
Message:

Fix: source splitup

Location:
trunk/src/shell32
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/shell32/makefile

    r46 r77  
    1919TARGET = shell32
    2020
    21 OBJS =  shell32.obj initterm.obj
     21OBJS =  shell32.obj sh.obj she.obj drag.obj initterm.obj
    2222
    2323all: $(TARGET).dll $(TARGET).lib
     
    3838
    3939shell32.obj: shell32.cpp shell32.h
     40
     41drag.obj: drag.cpp shell32.h
     42
     43sh.obj: sh.cpp shell32.h
     44
     45she.obj: she.cpp shell32.h
     46
    4047initterm.obj: initterm.cpp
     48
    4149
    4250clean:
  • TabularUnified trunk/src/shell32/shell32.cpp

    r63 r77  
    1 /* $Id: shell32.cpp,v 1.3 1999-06-09 09:17:14 phaller Exp $ */
     1/* $Id: shell32.cpp,v 1.4 1999-06-09 15:22:27 phaller Exp $ */
    22
    33/*
     
    5353 *****************************************************************************/
    5454
    55 //******************************************************************************
    56 //******************************************************************************
    57 VOID WIN32API DragAcceptFiles(HWND hwnd,
    58                                  BOOL fAccept)
    59 {
    60   dprintf(("SHELL32: DragAcceptFiles (%08uxh, %08xh) not implemented.\n",
    61            hwnd,
    62            fAccept));
    63 }
    64 //******************************************************************************
    65 //******************************************************************************
    66 VOID WIN32API DragFinish(HDROP hDrop)
    67 {
    68   dprintf(("SHELL32: DragFinish(%08xh) not implemented.\n",
    69            hDrop));
    70 }
    71 //******************************************************************************
    72 //******************************************************************************
    73 UINT WIN32API DragQueryFileA(HDROP  hDrop,
    74                              UINT   iFile,
    75                              LPTSTR lpszFile,
    76                              UINT   cch)
    77 {
    78   dprintf(("SHELL32: DragQueryFileA(%08xh,%08xh,%s,%08xh) not implemented.\n",
    79            hDrop,
    80            iFile,
    81            lpszFile,
    82            cch));
    83 
    84   return(0);
    85 }
    86 //******************************************************************************
    87 //******************************************************************************
    88 UINT WIN32API DragQueryFileAorW(HDROP  hDrop,
    89                                 UINT   iFile,
    90                                 LPTSTR lpszFile,
    91                                 UINT   cch)
    92 {
    93   dprintf(("SHELL32: DragQueryFileAorW(%08xh,%08xh,%s,%08xh) not implemented.\n",
    94            hDrop,
    95            iFile,
    96            lpszFile,
    97            cch));
    98 
    99   return(0);
    100 }
    101 //******************************************************************************
    102 //******************************************************************************
    103 UINT WIN32API DragQueryFileW(HDROP  hDrop,
    104                                 UINT   iFile,
    105                                 LPWSTR lpszFile,
    106                                 UINT   cch)
    107 {
    108   dprintf(("SHELL32: DragQueryFileW(%08xh,%08xh,%s,%08xh) not implemented.\n",
    109            hDrop,
    110            iFile,
    111            lpszFile,
    112            cch));
    113 
    114   return(0);
    115 }
    116 //******************************************************************************
    117 //******************************************************************************
    118 BOOL WIN32API DragQueryPoint(HDROP   hDrop,
    119                                 LPPOINT lppt)
    120 {
    121   dprintf(("SHELL32: DragQueryPoint (%08xh,%08xh) not implemented.\n",
    122            hDrop,
    123            lppt));
    124 
    125   return(FALSE);
    126 }
    127 //******************************************************************************
    128 //******************************************************************************
     55
    12956//******************************************************************************
    13057//******************************************************************************
     
    351278}
    352279//******************************************************************************
    353 //******************************************************************************
    354 HRESULT WIN32API SHGetMalloc(LPMALLOC *ppMalloc)
    355 {
    356   dprintf(("SHELL32: SHGetMalloc(%08xh) not implemented.\n",
    357            ppMalloc));
    358 
    359   return(0);
    360 }
    361 //******************************************************************************
    362 //******************************************************************************
    363 DWORD WIN32API SHGetFileInfoA(LPCSTR          pszPath,
    364                                  DWORD           dwFileAttributes,
    365                                  SHFILEINFOA     *psfi,
    366                                  UINT            cbFileInfo,
    367                                  UINT            uFlags)
    368 {
    369   dprintf(("SHELL32: SHGetFileInfoA (%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    370            pszPath,
    371            dwFileAttributes,
    372            psfi,
    373            cbFileInfo,
    374            uFlags));
    375 
    376   return(0);
    377 }
    378 //******************************************************************************
    379 //******************************************************************************
    380 DWORD WIN32API SHGetFileInfoW(LPCWSTR         pszPath,
    381                                  DWORD           dwFileAttributes,
    382                                  SHFILEINFOW     *psfi,
    383                                  UINT            cbFileInfo,
    384                                  UINT            uFlags)
    385 {
    386   char *astring = UnicodeToAsciiString((LPWSTR)pszPath);
    387 
    388   dprintf(("SHELL32: SHGetFileInfoW (%s,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    389            astring,
    390            dwFileAttributes,
    391            psfi,
    392            cbFileInfo,
    393            uFlags));
    394 
    395   FreeAsciiString(astring);
    396   return(0);
    397 }
    398 //******************************************************************************
    399 //******************************************************************************
    400 HRESULT WIN32API SHGetDesktopFolder(LPSHELLFOLDER *ppshf)
    401 {
    402   dprintf(("SHELL32: SHGetDesktopFolder(%08xh) not implemented.\n",
    403            ppshf));
    404 
    405   return(1);
    406 }
    407 //******************************************************************************
    408 //******************************************************************************
    409 void WIN32API SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
    410 {
    411   dprintf(("SHELL32: SHAddToRecentDocs(%08xh,%08xh) not implemented.\n",
    412            uFlags,
    413            pv));
    414 }
    415 //******************************************************************************
    416 //******************************************************************************
    417 void WIN32API SHChangeNotify(LONG    wEventId,
    418                                 UINT    uFlags,
    419                                 LPCVOID dwItem1,
    420                                 LPCVOID dwItem2)
    421 {
    422   dprintf(("SHELL32: SHChangeNotify(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    423            wEventId,
    424            uFlags,
    425            dwItem1,
    426            dwItem2));
    427 }
    428 //******************************************************************************
    429 //******************************************************************************
    430 DWORD WIN32API SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
    431 {
    432   dprintf(("SHELL32: SHFileOperationA(%08xh) not implemented.\n",
    433            lpFileOp));
    434 
    435   return(0);
    436 }
    437 //******************************************************************************
    438 
    439 //******************************************************************************
    440 DWORD WIN32API SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
    441 {
    442   dprintf(("SHELL32: SHFileOperationW(%08xh) not implemented.\n",
    443            lpFileOp));
    444 
    445   return(0);
    446 }
    447 //******************************************************************************
    448 
    449 //******************************************************************************
    450 BOOL WIN32API SHGetPathFromIDListA(LPCITEMIDLIST pidl,
    451                                       LPSTR         pszPath)
    452 {
    453   dprintf(("SHELL32: SHGetPathFromIDListA(%08xh,%s) not implemented.\n",
    454            pidl,
    455            pszPath));
    456 
    457   return(FALSE);
    458 }
    459 //******************************************************************************
    460 //******************************************************************************
    461 HRESULT WIN32API SHGetSpecialFolderLocation(HWND         hwndOwner,
    462                                                int          nFolder,
    463                                                LPITEMIDLIST * ppidl)
    464 {
    465   dprintf(("SHELL32: SHGetSpecialFolderLocation(%08xh,%08xh,%08xh) not implemented.\n",
    466            hwndOwner,
    467            nFolder,
    468            ppidl));
    469 
    470   return(1);
    471 }
    472 //******************************************************************************
    473 //******************************************************************************
    474 LPITEMIDLIST WIN32API SHBrowseForFolder(LPBROWSEINFOA lpbi)
    475 {
    476   dprintf(("SHELL32: SHBrowseForFolder(%08xh) not implemented.\n",
    477            lpbi));
    478 
    479   return(NULL);
    480 }
    481 //******************************************************************************
    482280
    483281
     
    489287 */
    490288BOOL WIN32API Shell_NotifyIconA(DWORD dwMessage,
    491                                 PNOTIFYICONDATAA pnid )
     289                           PNOTIFYICONDATAA pnid )
    492290{
    493291  dprintf(("SHELL32: Shell_NotifyIconA(%08xh,%08xh) not implemented.\n",
     
    506304 */
    507305BOOL WIN32API Shell_NotifyIconW(DWORD dwMessage,
    508                                 PNOTIFYICONDATAW pnid )
     306                                         PNOTIFYICONDATAW pnid )
    509307{
    510308  dprintf(("SHELL32: Shell_NotifyIconW(%08xh,%08xh) not implemented.\n",
     
    16321430                                DWORD   idTitle,
    16331431                                DWORD   uType,
    1634                                 LPCVOID arglist) 
    1635 {       
    1636   WCHAR  szText[100],
     1432                                LPCVOID arglist)
     1433{
     1434  WCHAR  szText[100],
    16371435         szTitle[100],
    16381436         szTemp[256];
    1639   LPWSTR pszText = &szText[0], 
     1437  LPWSTR pszText = &szText[0],
    16401438         pszTitle = &szTitle[0];
    16411439  LPVOID args = &arglist;
     
    16981496                                DWORD   idTitle,
    16991497                                DWORD   uType,
    1700                                 LPCVOID arglist) 
     1498                                LPCVOID arglist)
    17011499{
    17021500  char   szText[100],
    17031501         szTitle[100],
    17041502         szTemp[256];
    1705   LPSTR  pszText = &szText[0], 
     1503  LPSTR  pszText = &szText[0],
    17061504         pszTitle = &szTitle[0];
    17071505  LPVOID args = &arglist;
    17081506
    1709   dprintf(("SHELL32: ShellMessageBoxA (%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n", 
     1507  dprintf(("SHELL32: ShellMessageBoxA (%08lx,%08lx,%08lx,%08lx,%08lx,%p)\n",
    17101508           hmod,
    17111509           hwnd,
     
    17401538
    17411539
    1742 
    1743 
    1744 
    1745 #if 0
    1746 typedef DWORD (* WIN32API GetClassPtr)(REFCLSID,REFIID,LPVOID);
    1747 
    1748 static GetClassPtr SH_find_moduleproc(LPSTR   dllname,
    1749                                       HMODULE *xhmod,
    1750                                       LPSTR   name)
    1751 {
    1752   HMODULE hmod;
    1753   FARPROC dllunload,
    1754           nameproc;
    1755 
    1756   if (xhmod)
    1757     *xhmod = 0;
    1758 
    1759   if (!lstrcmpi32A(SHELL32_34(dllname),
    1760                    "shell32.dll"))
    1761     return (GetClassPtr)SHELL32_DllGetClassObject;
    1762 
    1763   hmod = LoadLibraryEx32A(dllname,
    1764                           0,
    1765                           LOAD_WITH_ALTERED_SEARCH_PATH);
    1766   if (!hmod)
    1767     return NULL;
    1768 
    1769   dllunload = GetProcAddress32(hmod,
    1770                                "DllCanUnloadNow");
    1771   if (!dllunload)
    1772     if (xhmod)
    1773       *xhmod = hmod;
    1774 
    1775   nameproc = GetProcAddress32(hmod,
    1776                               name);
    1777   if (!nameproc)
    1778   {
    1779     FreeLibrary32(hmod);
    1780     return NULL;
    1781   }
    1782 
    1783   /* register unloadable dll with unloadproc ... */
    1784   return (GetClassPtr)nameproc;
    1785 }
    1786 
    1787 
    1788 static DWORD SH_get_instance(REFCLSID clsid,
    1789                              LPSTR    dllname,
    1790                              LPVOID   unknownouter,
    1791                              REFIID   refiid,
    1792                              LPVOID inst)
    1793 {
    1794   GetClassPtr    dllgetclassob;
    1795   DWORD      hres;
    1796   LPCLASSFACTORY classfac;
    1797 
    1798   dllgetclassob = SH_find_moduleproc(dllname,
    1799                                      NULL,
    1800                                      "DllGetClassObject");
    1801   if (!dllgetclassob)
    1802           return 0x80070000|GetLastError();
    1803 
    1804 /* FIXME */
    1805 /*
    1806   hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,inst);
    1807   if (hres<0)
    1808           return hres;
    1809 
    1810 */
    1811   hres = (*dllgetclassob)(clsid,
    1812                           (REFIID)&IID_IClassFactory,
    1813                           &classfac);
    1814   if (hres<0)
    1815     return hres;
    1816 
    1817   classfac->lpvtbl->fnCreateInstance(classfac,
    1818                                      unknownouter,
    1819                                      refiid,
    1820                                      inst);
    1821   classfac->lpvtbl->fnRelease(classfac);
    1822 
    1823   return 0;
    1824 }
    1825 
    1826 
    1827 /*************************************************************************
    1828  *              SHELL32_102 [SHELL32.102]
    1829  * unknown
    1830  */
    1831 LRESULT WIN32API SHELL32_102(LPSTR     aclsid,
    1832                                 CLSID     *clsid,
    1833                                 LPUNKNOWN unknownouter,
    1834                                 REFIID    refiid,
    1835                                 LPVOID    inst)
    1836 {
    1837   char  buffer[256],
    1838         xclsid[48],
    1839         xiid[48],
    1840         path[260],
    1841         tmodel[100];
    1842   HKEY  inprockey;
    1843   DWORD pathlen,
    1844         type,
    1845         tmodellen;
    1846   DWORD hres;
    1847 
    1848 
    1849   WINE_StringFromCLSID(refiid,
    1850                        xiid);
    1851 
    1852   if (clsid)
    1853     WINE_StringFromCLSID(clsid,
    1854                          xclsid);
    1855   else
    1856   {
    1857     if (!aclsid)
    1858       return 0x80040154;
    1859 
    1860     strcpy(xclsid,
    1861            aclsid);
    1862   }
    1863 
    1864   dprintf(("SHELL32: .102 (%s. %08xh, %08xh, %08x, %08xh)\n",
    1865            aclsid,
    1866            clsid,
    1867            unknownouter,
    1868            refiid,
    1869            inst));
    1870 
    1871 
    1872   sprintf(buffer,
    1873           "CLSID\\%s\\InProcServer32",
    1874           xclsid);
    1875 
    1876   if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,
    1877                       buffer,
    1878                       0,
    1879                       0x02000000,
    1880                       &inprockey))
    1881     return SH_get_instance(clsid,
    1882                            "shell32.dll",
    1883                            unknownouter,
    1884                            refiid,
    1885                            inst);
    1886 
    1887   pathlen=sizeof(path);
    1888   if (RegQueryValue32A(inprockey,
    1889                        NULL,
    1890                        path,
    1891                        &pathlen))
    1892   {
    1893     RegCloseKey(inprockey);
    1894     return SH_get_instance(clsid,
    1895                            "shell32.dll",
    1896                            unknownouter,
    1897                            refiid,
    1898                            inst);
    1899   }
    1900 
    1901   dprintf (("SHELL32: .102 Server dll is %s\n",
    1902             path));
    1903 
    1904   tmodellen=sizeof(tmodel);
    1905   type=REG_SZ;
    1906 
    1907   if (RegQueryValueEx32A(inprockey,
    1908                          "ThreadingModel",
    1909                          NULL,
    1910                          &type,
    1911                          tmodel,
    1912                          &tmodellen))
    1913   {
    1914     RegCloseKey(inprockey);
    1915     return SH_get_instance(clsid,
    1916                            "shell32.dll",
    1917                            unknownouter,
    1918                            refiid,
    1919                            inst);
    1920   }
    1921 
    1922 
    1923   dprintf (("SHELL32: .102 Threading model is %s\n",
    1924             tmodel));
    1925 
    1926   hres=SH_get_instance(clsid,
    1927                        path,
    1928                        unknownouter,
    1929                        refiid,
    1930                        inst);
    1931   if (hres<0)
    1932     hres=SH_get_instance(clsid,
    1933                          "shell32.dll",
    1934                          unknownouter,
    1935                          refiid,
    1936                          inst);
    1937 
    1938   RegCloseKey(inprockey);
    1939 
    1940   return hres;
    1941 }
    1942 
    1943 
    1944 /*************************************************************************
    1945  *              SHELL_FindExecutable
    1946  * Utility for code sharing between FindExecutable and ShellExecute
    1947  */
    1948 static HINSTANCE32 SHELL_FindExecutable( LPCSTR lpFile,
    1949                                          LPCSTR lpOperation,
    1950                                          LPSTR lpResult)
    1951 {
    1952     char *extension = NULL; /* pointer to file extension */
    1953     char tmpext[5];         /* local copy to mung as we please */
    1954     char filetype[256];     /* registry name for this filetype */
    1955     LONG filetypelen=256;   /* length of above */
    1956     char command[256];      /* command from registry */
    1957     LONG commandlen=256;    /* This is the most DOS can handle :) */
    1958     char buffer[256];       /* Used to GetProfileString */
    1959     HINSTANCE32 retval=31;  /* default - 'No association was found' */
    1960     char *tok;              /* token pointer */
    1961     int i;                  /* random counter */
    1962     char xlpFile[256];      /* result of SearchPath */
    1963 
    1964     TRACE(exec, "%s\n",
    1965                  (lpFile != NULL?lpFile:"-") );
    1966     lpResult[0]='\0'; /* Start off with an empty return string */
    1967 
    1968     /* trap NULL parameters on entry */
    1969     if (( lpFile == NULL ) || ( lpResult == NULL ) || ( lpOperation == NULL ))
    1970     {
    1971     /* FIXME - should throw a warning, perhaps! */
    1972     return 2; /* File not found. Close enough, I guess. */
    1973     }
    1974 
    1975     if (SearchPath32A( NULL, lpFile,".exe",sizeof(xlpFile),xlpFile,NULL))
    1976         lpFile = xlpFile;
    1977 
    1978     /* First thing we need is the file's extension */
    1979     extension = strrchr( xlpFile, '.' ); /* Assume last "." is the one; */
    1980                     /* File->Run in progman uses */
    1981                     /* .\FILE.EXE :( */
    1982     if ((extension == NULL) || (extension == &xlpFile[strlen(xlpFile)]))
    1983     {
    1984     return 31; /* no association */
    1985     }
    1986 
    1987     /* Make local copy & lowercase it for reg & 'programs=' lookup */
    1988     lstrcpyn32A( tmpext, extension, 5 );
    1989     CharLower32A( tmpext );
    1990     TRACE(exec, "%s file\n", tmpext);
    1991 
    1992     /* Three places to check: */
    1993     /* 1. win.ini, [windows], programs (NB no leading '.') */
    1994     /* 2. Registry, HKEY_CLASS_ROOT\<filetype>\shell\open\command */
    1995     /* 3. win.ini, [extensions], extension (NB no leading '.' */
    1996     /* All I know of the order is that registry is checked before */
    1997     /* extensions; however, it'd make sense to check the programs */
    1998     /* section first, so that's what happens here. */
    1999 
    2000     /* See if it's a program - if GetProfileString fails, we skip this
    2001      * section. Actually, if GetProfileString fails, we've probably
    2002      * got a lot more to worry about than running a program... */
    2003     if ( GetProfileString32A("windows", "programs", "exe pif bat com",
    2004                           buffer, sizeof(buffer)) > 0 )
    2005       {
    2006         for (i=0;i<strlen(buffer); i++) buffer[i]=tolower(buffer[i]);
    2007 
    2008         tok = strtok(buffer, " \t"); /* ? */
    2009         while( tok!= NULL)
    2010           {
    2011             if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
    2012               {
    2013                 strcpy(lpResult, xlpFile);
    2014                 /* Need to perhaps check that the file has a path
    2015                  * attached */
    2016                 TRACE(exec, "found %s\n",
    2017                              lpResult);
    2018                                 return 33;
    2019 
    2020         /* Greater than 32 to indicate success FIXME According to the
    2021          * docs, I should be returning a handle for the
    2022          * executable. Does this mean I'm supposed to open the
    2023          * executable file or something? More RTFM, I guess... */
    2024               }
    2025             tok=strtok(NULL, " \t");
    2026           }
    2027       }
    2028 
    2029     /* Check registry */
    2030     if (RegQueryValue16( (HKEY)HKEY_CLASSES_ROOT, tmpext, filetype,
    2031                          &filetypelen ) == SHELL_ERROR_SUCCESS )
    2032     {
    2033     filetype[filetypelen]='\0';
    2034     TRACE(exec, "File type: %s\n",
    2035              filetype);
    2036 
    2037     /* Looking for ...buffer\shell\lpOperation\command */
    2038     strcat( filetype, "\\shell\\" );
    2039     strcat( filetype, lpOperation );
    2040     strcat( filetype, "\\command" );
    2041 
    2042     if (RegQueryValue16( (HKEY)HKEY_CLASSES_ROOT, filetype, command,
    2043                              &commandlen ) == SHELL_ERROR_SUCCESS )
    2044     {
    2045         /* Is there a replace() function anywhere? */
    2046         command[commandlen]='\0';
    2047         strcpy( lpResult, command );
    2048         tok=strstr( lpResult, "%1" );
    2049         if (tok != NULL)
    2050         {
    2051         tok[0]='\0'; /* truncate string at the percent */
    2052         strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
    2053         tok=strstr( command, "%1" );
    2054         if ((tok!=NULL) && (strlen(tok)>2))
    2055         {
    2056             strcat( lpResult, &tok[2] );
    2057         }
    2058         }
    2059         retval=33; /* FIXME see above */
    2060     }
    2061     }
    2062     else /* Check win.ini */
    2063     {
    2064     /* Toss the leading dot */
    2065     extension++;
    2066     if ( GetProfileString32A( "extensions", extension, "", command,
    2067                                   sizeof(command)) > 0)
    2068       {
    2069         if (strlen(command)!=0)
    2070           {
    2071             strcpy( lpResult, command );
    2072             tok=strstr( lpResult, "^" ); /* should be ^.extension? */
    2073             if (tok != NULL)
    2074               {
    2075                 tok[0]='\0';
    2076                 strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
    2077                 tok=strstr( command, "^" ); /* see above */
    2078                 if ((tok != NULL) && (strlen(tok)>5))
    2079                   {
    2080                     strcat( lpResult, &tok[5]);
    2081                   }
    2082               }
    2083             retval=33; /* FIXME - see above */
    2084           }
    2085       }
    2086     }
    2087 
    2088     TRACE(exec, "returning %s\n", lpResult);
    2089     return retval;
    2090 }
    2091 
    2092 /*************************************************************************
    2093  *              ShellExecute16      [SHELL.20]
    2094  */
    2095 HINSTANCE16 WIN32API ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
    2096                                    LPCSTR lpFile, LPCSTR lpParameters,
    2097                                    LPCSTR lpDirectory, INT16 iShowCmd )
    2098 {
    2099     HINSTANCE16 retval=31;
    2100     char old_dir[1024];
    2101     char cmd[256];
    2102 
    2103     TRACE(exec, "(%04x,'%s','%s','%s','%s',%x)\n",
    2104         hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
    2105         lpParameters ? lpParameters : "<null>",
    2106         lpDirectory ? lpDirectory : "<null>", iShowCmd);
    2107 
    2108     if (lpFile==NULL) return 0; /* should not happen */
    2109     if (lpOperation==NULL) /* default is open */
    2110       lpOperation="open";
    2111 
    2112     if (lpDirectory)
    2113     {
    2114         GetCurrentDirectory32A( sizeof(old_dir), old_dir );
    2115         SetCurrentDirectory32A( lpDirectory );
    2116     }
    2117 
    2118     retval = SHELL_FindExecutable( lpFile, lpOperation, cmd );
    2119 
    2120     if (retval > 32)  /* Found */
    2121     {
    2122         if (lpParameters)
    2123         {
    2124             strcat(cmd," ");
    2125             strcat(cmd,lpParameters);
    2126         }
    2127 
    2128         TRACE(exec,"starting %s\n",cmd);
    2129         retval = WinExec32( cmd, iShowCmd );
    2130     }
    2131     if (lpDirectory) SetCurrentDirectory32A( old_dir );
    2132     return retval;
    2133 }
    2134 
    2135 
    2136 /*************************************************************************
    2137  *             ShellExecute32A   (SHELL32.245)
    2138  */
    2139 HINSTANCE32 WIN32API ShellExecute32A( HWND hWnd, LPCSTR lpOperation,
    2140                                     LPCSTR lpFile, LPCSTR lpParameters,
    2141                                     LPCSTR lpDirectory, INT32 iShowCmd )
    2142 {
    2143     return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
    2144                            lpDirectory, iShowCmd );
    2145 }
    2146 
    2147 
    2148 /*************************************************************************
    2149  *             FindExecutable32A   (SHELL32.184)
    2150  */
    2151 HINSTANCE32 WIN32API FindExecutable32A( LPCSTR lpFile, LPCSTR lpDirectory,
    2152                                       LPSTR lpResult )
    2153 {
    2154     HINSTANCE32 retval=31;    /* default - 'No association was found' */
    2155     char old_dir[1024];
    2156 
    2157     TRACE(exec, "File %s, Dir %s\n",
    2158          (lpFile != NULL?lpFile:"-"),
    2159          (lpDirectory != NULL?lpDirectory:"-"));
    2160 
    2161     lpResult[0]='\0'; /* Start off with an empty return string */
    2162 
    2163     /* trap NULL parameters on entry */
    2164     if (( lpFile == NULL ) || ( lpResult == NULL ))
    2165     {
    2166     /* FIXME - should throw a warning, perhaps! */
    2167     return 2; /* File not found. Close enough, I guess. */
    2168     }
    2169 
    2170     if (lpDirectory)
    2171     {
    2172         GetCurrentDirectory32A( sizeof(old_dir), old_dir );
    2173         SetCurrentDirectory32A( lpDirectory );
    2174     }
    2175 
    2176     retval = SHELL_FindExecutable( lpFile, "open", lpResult );
    2177 
    2178     TRACE(exec, "returning %s\n", lpResult);
    2179     if (lpDirectory) SetCurrentDirectory32A( old_dir );
    2180     return retval;
    2181 }
    2182 
    2183 
    2184 
    2185 
    2186 
    2187 /*************************************************************************
    2188  *             ExtractIcon32A   (SHELL32.133)
    2189  */
    2190 HICON32 WIN32API ExtractIcon32A( HINSTANCE32 hInstance, LPCSTR lpszExeFileName,
    2191     UINT32 nIconIndex )
    2192 {
    2193     HGLOBAL16 handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1);
    2194 
    2195     if( handle )
    2196     {
    2197     HICON16* ptr = (HICON16*)GlobalLock16(handle);
    2198     HICON16  hIcon = *ptr;
    2199 
    2200     GlobalFree16(handle);
    2201     return hIcon;
    2202     }
    2203     return 0;
    2204 }
    2205 
    2206 /*************************************************************************
    2207  *             ExtractIcon32W   (SHELL32.180)
    2208  */
    2209 HICON32 WIN32API ExtractIcon32W( HINSTANCE32 hInstance, LPCWSTR lpszExeFileName,
    2210     UINT32 nIconIndex )
    2211 {
    2212     LPSTR   exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
    2213     HICON32 ret = ExtractIcon32A(hInstance,exefn,nIconIndex);
    2214 
    2215     HeapFree(GetProcessHeap(),0,exefn);
    2216     return ret;
    2217 }
    2218 
    2219 
    2220 /*************************************************************************
    2221  *              ExtractAssociatedIcon   [SHELL.36]
    2222  *
    2223  * Return icon for given file (either from file itself or from associated
    2224  * executable) and patch parameters if needed.
    2225  */
    2226 HICON32 WIN32API ExtractAssociatedIcon32A(HINSTANCE32 hInst,LPSTR lpIconPath,
    2227     LPWORD lpiIcon)
    2228 {
    2229     return ExtractAssociatedIcon16(hInst,lpIconPath,lpiIcon);
    2230 }
    2231 
    2232 HICON16 WIN32API ExtractAssociatedIcon16(HINSTANCE16 hInst,LPSTR lpIconPath,
    2233     LPWORD lpiIcon)
    2234 {
    2235     HICON16 hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon);
    2236 
    2237     if( hIcon < 2 )
    2238     {
    2239 
    2240     if( hIcon == 1 ) /* no icons found in given file */
    2241     {
    2242         char  tempPath[0x80];
    2243         USHORT  uRet = FindExecutable16(lpIconPath,NULL,tempPath);
    2244 
    2245         if( uRet > 32 && tempPath[0] )
    2246         {
    2247         strcpy(lpIconPath,tempPath);
    2248         hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon);
    2249 
    2250         if( hIcon > 2 ) return hIcon;
    2251         }
    2252         else hIcon = 0;
    2253     }
    2254 
    2255     if( hIcon == 1 )
    2256         *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
    2257     else
    2258         *lpiIcon = 6;   /* generic icon - found nothing */
    2259 
    2260     GetModuleFileName16(hInst, lpIconPath, 0x80);
    2261     hIcon = LoadIcon16( hInst, MAKEINTRESOURCE16(*lpiIcon));
    2262     }
    2263 
    2264     return hIcon;
    2265 }
    2266 
    2267 /*************************************************************************
    2268  *              FindEnvironmentString   [SHELL.38]
    2269  *
    2270  * Returns a pointer into the DOS environment... Ugh.
    2271  */
    2272 LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry)
    2273 {
    2274     USHORT  l = strlen(entry);
    2275     for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 )
    2276     {
    2277     if( lstrncmpi32A(lpEnv, entry, l) ) continue;
    2278 
    2279     if( !*(lpEnv+l) )
    2280         return (lpEnv + l);         /* empty entry */
    2281     else if ( *(lpEnv+l)== '=' )
    2282         return (lpEnv + l + 1);
    2283     }
    2284     return NULL;
    2285 }
    2286 
    2287 SEGPTR WIN32API FindEnvironmentString(LPSTR str)
    2288 {
    2289     SEGPTR  spEnv = GetDOSEnvironment();
    2290     LPSTR  lpEnv = (LPSTR)PTR_SEG_TO_LIN(spEnv);
    2291 
    2292     LPSTR  lpString = (spEnv)?SHELL_FindString(lpEnv, str):NULL;
    2293 
    2294     if( lpString )      /*  offset should be small enough */
    2295     return spEnv + (lpString - lpEnv);
    2296 
    2297     return (SEGPTR)NULL;
    2298 }
    2299 
    2300 /*************************************************************************
    2301  *                      DoEnvironmentSubst      [SHELL.37]
    2302  *
    2303  * Replace %KEYWORD% in the str with the value of variable KEYWORD
    2304  * from "DOS" environment.
    2305  */
    2306 DWORD WIN32API DoEnvironmentSubst(LPSTR str,WORD length)
    2307 {
    2308   LPSTR   lpEnv = (LPSTR)PTR_SEG_TO_LIN(GetDOSEnvironment());
    2309   LPSTR   lpBuffer = (LPSTR)HeapAlloc( GetProcessHeap(), 0, length);
    2310   LPSTR   lpstr = str;
    2311   LPSTR   lpbstr = lpBuffer;
    2312 
    2313   CharToOem32A(str,str);
    2314 
    2315   TRACE(reg,"accept %s\n", str);
    2316 
    2317   while( *lpstr && lpbstr - lpBuffer < length )
    2318    {
    2319      LPSTR lpend = lpstr;
    2320 
    2321      if( *lpstr == '%' )
    2322        {
    2323       do { lpend++; } while( *lpend && *lpend != '%' );
    2324       if( *lpend == '%' && lpend - lpstr > 1 )  /* found key */
    2325         {
    2326            LPSTR lpKey;
    2327           *lpend = '\0';
    2328            lpKey = SHELL_FindString(lpEnv, lpstr+1);
    2329            if( lpKey )              /* found key value */
    2330          {
    2331            int l = strlen(lpKey);
    2332 
    2333            if( l > length - (lpbstr - lpBuffer) - 1 )
    2334              {
    2335                WARN(reg,"Env subst aborted - string too short\n");
    2336               *lpend = '%';
    2337                break;
    2338              }
    2339            strcpy(lpbstr, lpKey);
    2340            lpbstr += l;
    2341          }
    2342            else break;
    2343           *lpend = '%';
    2344            lpstr = lpend + 1;
    2345         }
    2346       else break;                   /* back off and whine */
    2347 
    2348       continue;
    2349        }
    2350 
    2351      *lpbstr++ = *lpstr++;
    2352    }
    2353 
    2354  *lpbstr = '\0';
    2355   if( lpstr - str == strlen(str) )
    2356     {
    2357       strncpy(str, lpBuffer, length);
    2358       length = 1;
    2359     }
    2360   else
    2361       length = 0;
    2362 
    2363   TRACE(reg,"    return %s\n", str);
    2364 
    2365   OemToChar32A(str,str);
    2366   HeapFree( GetProcessHeap(), 0, lpBuffer);
    2367 
    2368   /*  Return str length in the LOWORD
    2369    *  and 1 in HIWORD if subst was successful.
    2370    */
    2371  return (DWORD)MAKELONG(strlen(str), length);
    2372 }
    2373 
    2374 /*************************************************************************
    2375  *              ShellHookProc       [SHELL.103]
    2376  * System-wide WH_SHELL hook.
    2377  */
    2378 LRESULT WIN32API ShellHookProc(INT16 code, WPARAM16 wParam, LPARAM lParam)
    2379 {
    2380     TRACE(reg,"%i, %04x, %08x\n", code, wParam,
    2381                               (unsigned)lParam );
    2382     if( SHELL_hHook && SHELL_hWnd )
    2383     {
    2384     USHORT  uMsg = 0;
    2385         switch( code )
    2386         {
    2387         case HSHELL_WINDOWCREATED:      uMsg = uMsgWndCreated;   break;
    2388         case HSHELL_WINDOWDESTROYED:    uMsg = uMsgWndDestroyed; break;
    2389         case HSHELL_ACTIVATESHELLWINDOW:    uMsg = uMsgShellActivate;
    2390         }
    2391     PostMessage16( SHELL_hWnd, uMsg, wParam, 0 );
    2392     }
    2393     return CallNextHookEx16( WH_SHELL, code, wParam, lParam );
    2394 }
    2395 
    2396 /*************************************************************************
    2397  *              RegisterShellHook   [SHELL.102]
    2398  */
    2399 BOOL WIN32API RegisterShellHook(HWND16 hWnd, USHORT uAction)
    2400 {
    2401     TRACE(reg,"%04x [%u]\n", hWnd, uAction );
    2402 
    2403     switch( uAction )
    2404     {
    2405     case 2: /* register hWnd as a shell window */
    2406 
    2407          if( !SHELL_hHook )
    2408          {
    2409         HMODULE16 hShell = GetModuleHandle16( "SHELL" );
    2410 
    2411         SHELL_hHook = SetWindowsHookEx16( WH_SHELL, ShellHookProc,
    2412                                                   hShell, 0 );
    2413         if( SHELL_hHook )
    2414         {
    2415             uMsgWndCreated = RegisterWindowMessage32A( lpstrMsgWndCreated );
    2416             uMsgWndDestroyed = RegisterWindowMessage32A( lpstrMsgWndDestroyed );
    2417             uMsgShellActivate = RegisterWindowMessage32A( lpstrMsgShellActivate );
    2418         }
    2419         else WARN(reg, "unable to install ShellHookProc()!\n");
    2420          }
    2421 
    2422          if( SHELL_hHook ) return ((SHELL_hWnd = hWnd) != 0);
    2423          break;
    2424 
    2425     default:
    2426 
    2427          WARN(reg, "unknown code %i\n", uAction );
    2428 
    2429          /* just in case */
    2430 
    2431          SHELL_hWnd = 0;
    2432     }
    2433     return FALSE;
    2434 }
    2435 
    2436 
    2437 /*************************************************************************
    2438  *              SHAppBarMessage32   [SHELL32.207]
    2439  */
    2440 UINT32 WIN32API SHAppBarMessage32(DWORD msg, PAPPBARDATA data)
    2441 {
    2442     FIXME(shell,"(0x%08lx,%p): stub\n", msg, data);
    2443 #if 0
    2444     switch (msg) {
    2445         case ABM_ACTIVATE:
    2446         case ABM_GETAUTOHIDEBAR:
    2447         case ABM_GETSTATE:
    2448         case ABM_GETTASKBARPOS:
    2449         case ABM_NEW:
    2450         case ABM_QUERYPOS:
    2451         case ABM_REMOVE:
    2452         case ABM_SETAUTOHIDEBAR:
    2453         case ABM_SETPOS:
    2454         case ABM_WINDOWPOSCHANGED:
    2455         ;
    2456     }
    2457 #endif
    2458     return 0;
    2459 }
    2460 
    2461 
    2462 /*************************************************************************
    2463  *              Control_RunDLL      [SHELL32.12]
    2464  *
    2465  * Wild speculation in the following!
    2466  *
    2467  * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
    2468  */
    2469 
    2470 void WIN32API Control_RunDLL (HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4)
    2471 {
    2472   TRACE(exec, "(%08x, %p, \"%s\", %08lx)\n",
    2473     hwnd, code ? code : "(null)", cmd ? cmd : "(null)", arg4);
    2474 }
    2475 
    2476 /*************************************************************************
    2477  */
    2478 
    2479 void WIN32API FreeIconList( DWORD dw )
    2480 {
    2481     FIXME(reg, "empty stub\n" );
    2482 }
    2483 
    2484 /*************************************************************************
    2485  *           SHELL32_DllGetClassObject   [SHELL32.14]
    2486  *
    2487  * http://premium.microsoft.com/msdn/library/sdkdoc/api2_48fo.htm
    2488  */
    2489 DWORD WIN32API SHELL32_DllGetClassObject(REFCLSID rclsid,REFIID iid,LPVOID *ppv)
    2490 {
    2491     char    xclsid[50],xiid[50];
    2492     HRESULT hres = E_OUTOFMEMORY;
    2493 
    2494 
    2495     WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
    2496     WINE_StringFromCLSID((LPCLSID)iid,xiid);
    2497     TRACE(shell,"(%s,%s,%p)\n",xclsid,xiid,ppv);
    2498 
    2499     *ppv = NULL;
    2500 /* SDK example code looks like this:
    2501  *
    2502     HRESULT hres = E_OUTOFMEMORY;
    2503 
    2504     *ppv = NULL;
    2505     CClassFactory *pClassFactory = new CClassFactory(rclsid);
    2506 
    2507     if (pClassFactory) {
    2508         hRes = pClassFactory->QueryInterface(riid,ppv);
    2509     pClassFactory->Release();
    2510     }
    2511     return hRes;
    2512  *
    2513  * The magic of the whole stuff is still unclear to me, so just hack together
    2514  * something.
    2515  */
    2516 
    2517     if (!memcmp(rclsid,&CLSID_ShellDesktop,sizeof(CLSID_ShellDesktop))) {
    2518         TRACE(shell,"   requested CLSID_ShellDesktop, creating it.\n");
    2519     *ppv = IShellFolder_Constructor();
    2520     FIXME(shell,"Initialize this folder to be the shell desktop folder\n");
    2521     return 0;
    2522     }
    2523 
    2524     FIXME(shell, "   -> clsid not found. returning E_OUTOFMEMORY.\n");
    2525     return hres;
    2526 }
    2527 
    2528 #endif
    2529 
    2530 
    2531 
    2532 
    2533 #if 0
    2534 
    2535 WINSHELLAPI HICON     APIENTRY DuplicateIcon(HINSTANCE hInst, HICON hIcon);
    2536 WINSHELLAPI HICON     APIENTRY ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon);
    2537 WINSHELLAPI HICON     APIENTRY ExtractAssociatedIconW(HINSTANCE hInst, LPWSTR lpIconPath, LPWORD lpiIcon);
    2538 WINSHELLAPI UINT APIENTRY SHAppBarMessage(DWORD dwMessage, PAPPBARDATA pData);
    2539 WINSHELLAPI DWORD   APIENTRY DoEnvironmentSubstA(LPSTR szString, UINT cbString);
    2540 WINSHELLAPI DWORD   APIENTRY DoEnvironmentSubstW(LPWSTR szString, UINT cbString);
    2541 WINSHELLAPI LPSTR APIENTRY FindEnvironmentStringA(LPSTR szEnvVar);
    2542 WINSHELLAPI LPWSTR APIENTRY FindEnvironmentStringW(LPWSTR szEnvVar);
    2543 WINSHELLAPI void WINAPI SHFreeNameMappings(HANDLE hNameMappings);
    2544 WINSHELLAPI void WINAPI WinExecErrorA(HWND hwnd, int error, LPCSTR lpstrFileName, LPCSTR lpstrTitle);
    2545 WINSHELLAPI void WINAPI WinExecErrorW(HWND hwnd, int error, LPCWSTR lpstrFileName, LPCWSTR lpstrTitle);
    2546 WINSHELLAPI BOOL WINAPI SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName,
    2547                              BOOL FAR * pfMustCopy, UINT uFlags);
    2548 WINSHELLAPI BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
    2549                              BOOL FAR * pfMustCopy, UINT uFlags);
    2550 
    2551 #endif
    2552 
  • TabularUnified trunk/src/shell32/shell32.def

    r63 r77  
    121121;   SheFullPathA               = _SheFullPathA@?                    @229
    122122;   SheFullPathW               = _SheFullPathW@?                    @230
    123 ;   SheSetCurDrive             = _SheSetCurDrive@?                  @231
     123;   SheSetCurDrive             = _SheSetCurDrive@4                  @231
    124124;   SheGetDirA                 = _SheGetDirA@?                      @232
    125125;   SheGetDirExW               = _SheGetDirExW@?                    @233
Note: See TracChangeset for help on using the changeset viewer.