shlwapi: Match shlwapi wrappers to MSDN descriptions.

oldstable
Dmitry Timoshkov 2007-03-28 20:13:54 +09:00 committed by Alexandre Julliard
parent 7358913545
commit 03e9e5b60d
7 changed files with 67 additions and 357 deletions

View File

@ -5,8 +5,8 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = shlwapi.dll
IMPORTLIB = libshlwapi.$(IMPLIBEXT)
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = oleaut32
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = oleaut32 ole32 comctl32 comdlg32 mpr mlang urlmon shell32 winmm version
EXTRALIBS = -luuid
C_SRCS = \

View File

@ -33,99 +33,30 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "objbase.h"
#include "docobj.h"
#include "exdisp.h"
#include "shlguid.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "winver.h"
#include "winnetwk.h"
#include "mmsystem.h"
#include "objbase.h"
#include "exdisp.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "shellapi.h"
#include "commdlg.h"
#include "wine/unicode.h"
#include "winreg.h"
#include "wine/debug.h"
#include "shlwapi.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* Get a function pointer from a DLL handle */
#define GET_FUNC(func, module, name, fail) \
do { \
if (!func) { \
if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
func = (fn##func)GetProcAddress(SHLWAPI_h##module, name); \
if (!func) return fail; \
} \
} while (0)
/* DLL handles for late bound calls */
extern HINSTANCE shlwapi_hInstance;
extern HMODULE SHLWAPI_hshell32;
extern HMODULE SHLWAPI_hwinmm;
extern HMODULE SHLWAPI_hcomdlg32;
extern HMODULE SHLWAPI_hcomctl32;
extern HMODULE SHLWAPI_hmpr;
extern HMODULE SHLWAPI_hurlmon;
extern HMODULE SHLWAPI_hversion;
extern DWORD SHLWAPI_ThreadRef_index;
/* Function pointers for GET_FUNC macro; these need to be global because of gcc bug */
typedef LPITEMIDLIST (WINAPI *fnpSHBrowseForFolderW)(LPBROWSEINFOW);
static fnpSHBrowseForFolderW pSHBrowseForFolderW;
typedef BOOL (WINAPI *fnpPlaySoundW)(LPCWSTR, HMODULE, DWORD);
static fnpPlaySoundW pPlaySoundW;
typedef DWORD (WINAPI *fnpSHGetFileInfoW)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT);
static fnpSHGetFileInfoW pSHGetFileInfoW;
typedef UINT (WINAPI *fnpDragQueryFileW)(HDROP, UINT, LPWSTR, UINT);
static fnpDragQueryFileW pDragQueryFileW;
typedef BOOL (WINAPI *fnpSHGetPathFromIDListW)(LPCITEMIDLIST, LPWSTR);
static fnpSHGetPathFromIDListW pSHGetPathFromIDListW;
typedef BOOL (WINAPI *fnpShellExecuteExW)(LPSHELLEXECUTEINFOW);
static fnpShellExecuteExW pShellExecuteExW;
typedef HICON (WINAPI *fnpSHFileOperationW)(LPSHFILEOPSTRUCTW);
static fnpSHFileOperationW pSHFileOperationW;
typedef UINT (WINAPI *fnpExtractIconExW)(LPCWSTR, INT,HICON *,HICON *, UINT);
static fnpExtractIconExW pExtractIconExW;
typedef BOOL (WINAPI *fnpSHGetNewLinkInfoW)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT);
static fnpSHGetNewLinkInfoW pSHGetNewLinkInfoW;
typedef HRESULT (WINAPI *fnpSHDefExtractIconW)(LPCWSTR, int, UINT, HICON*, HICON*, UINT);
static fnpSHDefExtractIconW pSHDefExtractIconW;
typedef HICON (WINAPI *fnpExtractIconW)(HINSTANCE, LPCWSTR, UINT);
static fnpExtractIconW pExtractIconW;
typedef BOOL (WINAPI *fnpGetSaveFileNameW)(LPOPENFILENAMEW);
static fnpGetSaveFileNameW pGetSaveFileNameW;
typedef DWORD (WINAPI *fnpWNetRestoreConnectionW)(HWND, LPWSTR);
static fnpWNetRestoreConnectionW pWNetRestoreConnectionW;
typedef DWORD (WINAPI *fnpWNetGetLastErrorW)(LPDWORD, LPWSTR, DWORD, LPWSTR, DWORD);
static fnpWNetGetLastErrorW pWNetGetLastErrorW;
typedef BOOL (WINAPI *fnpPageSetupDlgW)(LPPAGESETUPDLGW);
static fnpPageSetupDlgW pPageSetupDlgW;
typedef BOOL (WINAPI *fnpPrintDlgW)(LPPRINTDLGW);
static fnpPrintDlgW pPrintDlgW;
typedef BOOL (WINAPI *fnpGetOpenFileNameW)(LPOPENFILENAMEW);
static fnpGetOpenFileNameW pGetOpenFileNameW;
typedef DWORD (WINAPI *fnpGetFileVersionInfoSizeW)(LPCWSTR,LPDWORD);
static fnpGetFileVersionInfoSizeW pGetFileVersionInfoSizeW;
typedef BOOL (WINAPI *fnpGetFileVersionInfoW)(LPCWSTR,DWORD,DWORD,LPVOID);
static fnpGetFileVersionInfoW pGetFileVersionInfoW;
typedef WORD (WINAPI *fnpVerQueryValueW)(LPVOID,LPCWSTR,LPVOID*,UINT*);
static fnpVerQueryValueW pVerQueryValueW;
typedef BOOL (WINAPI *fnpCOMCTL32_417)(HDC,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
static fnpCOMCTL32_417 pCOMCTL32_417;
typedef HRESULT (WINAPI *fnpDllGetVersion)(DLLVERSIONINFO*);
static fnpDllGetVersion pDllGetVersion;
typedef HRESULT (WINAPI *fnpCreateFormatEnumerator)(UINT,FORMATETC*,IEnumFORMATETC**);
static fnpCreateFormatEnumerator pCreateFormatEnumerator;
typedef HRESULT (WINAPI *fnpRegisterFormatEnumerator)(LPBC,IEnumFORMATETC*,DWORD);
static fnpRegisterFormatEnumerator pRegisterFormatEnumerator;
HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*);
HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,BOOL);
HRESULT WINAPI CLSIDFromStringWrap(LPCWSTR,CLSID*);
BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD);
/*
@ -460,8 +391,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
format->tymed = -1;
/* Create a clipboard enumerator */
GET_FUNC(pCreateFormatEnumerator, urlmon, "CreateFormatEnumerator", E_FAIL);
hRet = pCreateFormatEnumerator(dwNumValues, formatList, &pIEnumFormatEtc);
hRet = CreateFormatEnumerator(dwNumValues, formatList, &pIEnumFormatEtc);
if (FAILED(hRet) || !pIEnumFormatEtc)
return hRet;
@ -496,8 +426,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
hRet = IEnumFORMATETC_Clone(pIEnumFormatEtc, &pClone);
if (!hRet && pClone)
{
GET_FUNC(pRegisterFormatEnumerator, urlmon, "RegisterFormatEnumerator", E_FAIL);
pRegisterFormatEnumerator(lpBC, pClone, 0);
RegisterFormatEnumerator(lpBC, pClone, 0);
IEnumFORMATETC_Release(pClone);
}
@ -823,32 +752,6 @@ BOOL WINAPI AppendMenuWrapW(HMENU hMenu, UINT flags, UINT id, LPCWSTR str)
return InsertMenuW(hMenu, -1, flags | MF_BITMAP, id, str);
}
/*************************************************************************
* @ [SHLWAPI.74]
*
* Get the text from a given dialog item.
*
* PARAMS
* hWnd [I] Handle of dialog
* nItem [I] Index of item
* lpsDest [O] Buffer for receiving window text
* nDestLen [I] Length of buffer.
*
* RETURNS
* Success: The length of the returned text.
* Failure: 0.
*/
INT WINAPI GetDlgItemTextWrapW(HWND hWnd, INT nItem, LPWSTR lpsDest,INT nDestLen)
{
HWND hItem = GetDlgItem(hWnd, nItem);
if (hItem)
return GetWindowTextW(hItem, lpsDest, nDestLen);
if (nDestLen)
*lpsDest = (WCHAR)'\0';
return 0;
}
/*************************************************************************
* @ [SHLWAPI.138]
*
@ -2784,7 +2687,7 @@ BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id)
{
WCHAR wClsid[40];
MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, sizeof(wClsid)/sizeof(WCHAR));
return SUCCEEDED(CLSIDFromStringWrap(wClsid, id));
return SUCCEEDED(CLSIDFromString(wClsid, id));
}
/*************************************************************************
@ -2794,7 +2697,7 @@ BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id)
*/
BOOL WINAPI GUIDFromStringW(LPCWSTR idstr, CLSID *id)
{
return SUCCEEDED(CLSIDFromStringWrap(idstr, id));
return SUCCEEDED(CLSIDFromString((LPOLESTR)idstr, id));
}
/*************************************************************************
@ -2821,13 +2724,21 @@ DWORD WINAPI WhichPlatform(void)
static DWORD dwState = 0;
HKEY hKey;
DWORD dwRet, dwData, dwSize;
HMODULE hshell32;
if (dwState)
return dwState;
/* If shell32 exports DllGetVersion(), the browser is integrated */
GET_FUNC(pDllGetVersion, shell32, "DllGetVersion", 1);
dwState = pDllGetVersion ? 2 : 1;
dwState = 1;
hshell32 = LoadLibraryA("shell32.dll");
if (hshell32)
{
FARPROC pDllGetVersion;
pDllGetVersion = GetProcAddress(hshell32, "DllGetVersion");
dwState = pDllGetVersion ? 2 : 1;
FreeLibrary(hshell32);
}
/* Set or delete the key accordingly */
dwRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
@ -3050,8 +2961,7 @@ HRESULT WINAPI IUnknown_CPContainerOnChanged(IUnknown *lpUnknown, DISPID dispID)
*/
BOOL WINAPI PlaySoundWrapW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
{
GET_FUNC(pPlaySoundW, winmm, "PlaySoundW", FALSE);
return pPlaySoundW(pszSound, hmod, fdwSound);
return PlaySoundW(pszSound, hmod, fdwSound);
}
/*************************************************************************
@ -3095,18 +3005,6 @@ BOOL WINAPI SHSetIniStringW(LPWSTR str1, LPVOID x, LPWSTR str2, LPWSTR str3)
return TRUE;
}
/*************************************************************************
* @ [SHLWAPI.299]
*
* See COMCTL32_417.
*/
BOOL WINAPI ExtTextOutWrapW(HDC hdc, INT x, INT y, UINT flags, const RECT *lprect,
LPCWSTR str, UINT count, const INT *lpDx)
{
GET_FUNC(pCOMCTL32_417, comctl32, (LPCSTR)417, FALSE);
return pCOMCTL32_417(hdc, x, y, flags, lprect, str, count, lpDx);
}
/*************************************************************************
* @ [SHLWAPI.313]
*
@ -3115,8 +3013,7 @@ BOOL WINAPI ExtTextOutWrapW(HDC hdc, INT x, INT y, UINT flags, const RECT *lprec
DWORD WINAPI SHGetFileInfoWrapW(LPCWSTR path, DWORD dwFileAttributes,
SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
{
GET_FUNC(pSHGetFileInfoW, shell32, "SHGetFileInfoW", 0);
return pSHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags);
return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags);
}
/*************************************************************************
@ -3126,8 +3023,7 @@ DWORD WINAPI SHGetFileInfoWrapW(LPCWSTR path, DWORD dwFileAttributes,
*/
UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
{
GET_FUNC(pDragQueryFileW, shell32, "DragQueryFileW", 0);
return pDragQueryFileW(hDrop, lFile, lpszFile, lLength);
return DragQueryFileW(hDrop, lFile, lpszFile, lLength);
}
/*************************************************************************
@ -3137,8 +3033,7 @@ UINT WINAPI DragQueryFileWrapW(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lL
*/
LPITEMIDLIST WINAPI SHBrowseForFolderWrapW(LPBROWSEINFOW lpBi)
{
GET_FUNC(pSHBrowseForFolderW, shell32, "SHBrowseForFolderW", NULL);
return pSHBrowseForFolderW(lpBi);
return SHBrowseForFolderW(lpBi);
}
/*************************************************************************
@ -3148,8 +3043,7 @@ LPITEMIDLIST WINAPI SHBrowseForFolderWrapW(LPBROWSEINFOW lpBi)
*/
BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl,LPWSTR pszPath)
{
GET_FUNC(pSHGetPathFromIDListW, shell32, "SHGetPathFromIDListW", 0);
return pSHGetPathFromIDListW(pidl, pszPath);
return SHGetPathFromIDListW(pidl, pszPath);
}
/*************************************************************************
@ -3159,8 +3053,7 @@ BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl,LPWSTR pszPath)
*/
BOOL WINAPI ShellExecuteExWrapW(LPSHELLEXECUTEINFOW lpExecInfo)
{
GET_FUNC(pShellExecuteExW, shell32, "ShellExecuteExW", FALSE);
return pShellExecuteExW(lpExecInfo);
return ShellExecuteExW(lpExecInfo);
}
/*************************************************************************
@ -3168,31 +3061,18 @@ BOOL WINAPI ShellExecuteExWrapW(LPSHELLEXECUTEINFOW lpExecInfo)
*
* See SHFileOperationW.
*/
HICON WINAPI SHFileOperationWrapW(LPSHFILEOPSTRUCTW lpFileOp)
INT WINAPI SHFileOperationWrapW(LPSHFILEOPSTRUCTW lpFileOp)
{
GET_FUNC(pSHFileOperationW, shell32, "SHFileOperationW", 0);
return pSHFileOperationW(lpFileOp);
}
/*************************************************************************
* @ [SHLWAPI.337]
*
* See ExtractIconExW.
*/
UINT WINAPI ExtractIconExWrapW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge,
HICON *phiconSmall, UINT nIcons)
{
GET_FUNC(pExtractIconExW, shell32, "ExtractIconExW", 0);
return pExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
return SHFileOperationW(lpFileOp);
}
/*************************************************************************
* @ [SHLWAPI.342]
*
*/
LONG WINAPI SHInterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare)
PVOID WINAPI SHInterlockedCompareExchange( PVOID *dest, PVOID xchg, PVOID compare )
{
return InterlockedCompareExchange(dest, xchg, compare);
return InterlockedCompareExchangePointer( dest, xchg, compare );
}
/*************************************************************************
@ -3200,15 +3080,9 @@ LONG WINAPI SHInterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare)
*
* See GetFileVersionInfoSizeW.
*/
DWORD WINAPI GetFileVersionInfoSizeWrapW(
LPWSTR x,
LPVOID y)
DWORD WINAPI GetFileVersionInfoSizeWrapW( LPCWSTR filename, LPDWORD handle )
{
DWORD ret;
GET_FUNC(pGetFileVersionInfoSizeW, version, "GetFileVersionInfoSizeW", 0);
ret = pGetFileVersionInfoSizeW(x, y);
return 0x208 + ret;
return GetFileVersionInfoSizeW( filename, handle );
}
/*************************************************************************
@ -3216,14 +3090,10 @@ DWORD WINAPI GetFileVersionInfoSizeWrapW(
*
* See GetFileVersionInfoW.
*/
BOOL WINAPI GetFileVersionInfoWrapW(
LPWSTR w, /* [in] path to dll */
DWORD x, /* [in] parm 2 to GetFileVersionInfoA */
DWORD y, /* [in] return value from SHLWAPI_350() - assume length */
LPVOID z) /* [in/out] buffer (+0x208 sent to GetFileVersionInfoA()) */
BOOL WINAPI GetFileVersionInfoWrapW( LPCWSTR filename, DWORD handle,
DWORD datasize, LPVOID data )
{
GET_FUNC(pGetFileVersionInfoW, version, "GetFileVersionInfoW", 0);
return pGetFileVersionInfoW(w, x, y-0x208, (char*)z+0x208);
return GetFileVersionInfoW( filename, handle, datasize, data );
}
/*************************************************************************
@ -3231,14 +3101,10 @@ BOOL WINAPI GetFileVersionInfoWrapW(
*
* See VerQueryValueW.
*/
WORD WINAPI VerQueryValueWrapW(
LPVOID w, /* [in] Buffer from SHLWAPI_351() */
LPWSTR x, /* [in] Value to retrieve - converted and passed to VerQueryValueA() as #2 */
LPVOID y, /* [out] Ver buffer - passed to VerQueryValueA as #3 */
UINT* z) /* [in] Ver length - passed to VerQueryValueA as #4 */
WORD WINAPI VerQueryValueWrapW( LPVOID pBlock, LPCWSTR lpSubBlock,
LPVOID *lplpBuffer, UINT *puLen )
{
GET_FUNC(pVerQueryValueW, version, "VerQueryValueW", 0);
return pVerQueryValueW((char*)w+0x208, x, y, z);
return VerQueryValueW( pBlock, lpSubBlock, lplpBuffer, puLen );
}
#define IsIface(type) SUCCEEDED((hRet = IUnknown_QueryInterface(lpUnknown, &IID_##type, (void**)&lpObj)))
@ -3302,8 +3168,7 @@ HRESULT WINAPI IUnknown_EnableModeless(IUnknown *lpUnknown, BOOL bModeless)
BOOL WINAPI SHGetNewLinkInfoWrapW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
BOOL *pfMustCopy, UINT uFlags)
{
GET_FUNC(pSHGetNewLinkInfoW, shell32, "SHGetNewLinkInfoW", FALSE);
return pSHGetNewLinkInfoW(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
return SHGetNewLinkInfoW(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
}
/*************************************************************************
@ -3314,8 +3179,7 @@ BOOL WINAPI SHGetNewLinkInfoWrapW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszN
UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON* phiconLarge,
HICON* phiconSmall, UINT nIconSize)
{
GET_FUNC(pSHDefExtractIconW, shell32, "SHDefExtractIconW", 0);
return pSHDefExtractIconW(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
return SHDefExtractIconW(pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
}
/*************************************************************************
@ -3391,8 +3255,7 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST
HICON WINAPI ExtractIconWrapW(HINSTANCE hInstance, LPCWSTR lpszExeFileName,
UINT nIconIndex)
{
GET_FUNC(pExtractIconW, shell32, "ExtractIconW", NULL);
return pExtractIconW(hInstance, lpszExeFileName, nIconIndex);
return ExtractIconW(hInstance, lpszExeFileName, nIconIndex);
}
/*************************************************************************
@ -3509,8 +3372,7 @@ COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown)
*/
BOOL WINAPI GetSaveFileNameWrapW(LPOPENFILENAMEW ofn)
{
GET_FUNC(pGetSaveFileNameW, comdlg32, "GetSaveFileNameW", FALSE);
return pGetSaveFileNameW(ofn);
return GetSaveFileNameW(ofn);
}
/*************************************************************************
@ -3520,8 +3382,7 @@ BOOL WINAPI GetSaveFileNameWrapW(LPOPENFILENAMEW ofn)
*/
DWORD WINAPI WNetRestoreConnectionWrapW(HWND hwndOwner, LPWSTR lpszDevice)
{
GET_FUNC(pWNetRestoreConnectionW, mpr, "WNetRestoreConnectionW", 0);
return pWNetRestoreConnectionW(hwndOwner, lpszDevice);
return WNetRestoreConnectionW(hwndOwner, lpszDevice);
}
/*************************************************************************
@ -3532,8 +3393,7 @@ DWORD WINAPI WNetRestoreConnectionWrapW(HWND hwndOwner, LPWSTR lpszDevice)
DWORD WINAPI WNetGetLastErrorWrapW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize,
LPWSTR lpNameBuf, DWORD nNameBufSize)
{
GET_FUNC(pWNetGetLastErrorW, mpr, "WNetGetLastErrorW", 0);
return pWNetGetLastErrorW(lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize);
return WNetGetLastErrorW(lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize);
}
/*************************************************************************
@ -3543,8 +3403,7 @@ DWORD WINAPI WNetGetLastErrorWrapW(LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nEr
*/
BOOL WINAPI PageSetupDlgWrapW(LPPAGESETUPDLGW pagedlg)
{
GET_FUNC(pPageSetupDlgW, comdlg32, "PageSetupDlgW", FALSE);
return pPageSetupDlgW(pagedlg);
return PageSetupDlgW(pagedlg);
}
/*************************************************************************
@ -3554,8 +3413,7 @@ BOOL WINAPI PageSetupDlgWrapW(LPPAGESETUPDLGW pagedlg)
*/
BOOL WINAPI PrintDlgWrapW(LPPRINTDLGW printdlg)
{
GET_FUNC(pPrintDlgW, comdlg32, "PrintDlgW", FALSE);
return pPrintDlgW(printdlg);
return PrintDlgW(printdlg);
}
/*************************************************************************
@ -3565,8 +3423,7 @@ BOOL WINAPI PrintDlgWrapW(LPPRINTDLGW printdlg)
*/
BOOL WINAPI GetOpenFileNameWrapW(LPOPENFILENAMEW ofn)
{
GET_FUNC(pGetOpenFileNameW, comdlg32, "GetOpenFileNameW", FALSE);
return pGetOpenFileNameW(ofn);
return GetOpenFileNameW(ofn);
}
/*************************************************************************
@ -3761,99 +3618,10 @@ DWORD WINAPI MLClearMLHInstance(DWORD x)
*
* RETURNS
* S_OK on success or E_INVALIDARG on failure
*
* NOTES
* This is really CLSIDFromString() which is exported by ole32.dll,
* however the native shlwapi.dll does *not* import ole32. Nor does
* ole32.dll import this ordinal from shlwapi. Therefore we must conclude
* that MS duplicated the code for CLSIDFromString(), and yes they did, only
* it returns an E_INVALIDARG error code on failure.
* This is a duplicate (with changes for Unicode) of CLSIDFromString16()
* in "dlls/ole32/compobj.c".
*/
HRESULT WINAPI CLSIDFromStringWrap(LPCWSTR idstr, CLSID *id)
{
LPCWSTR s = idstr;
BYTE *p;
INT i;
WCHAR table[256];
if (!s) {
memset(id, 0, sizeof(CLSID));
return S_OK;
}
else { /* validate the CLSID string */
if (strlenW(s) != 38)
return E_INVALIDARG;
if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
return E_INVALIDARG;
for (i=1; i<37; i++)
{
if ((i == 9)||(i == 14)||(i == 19)||(i == 24))
continue;
if (!(((s[i] >= L'0') && (s[i] <= L'9')) ||
((s[i] >= L'a') && (s[i] <= L'f')) ||
((s[i] >= L'A') && (s[i] <= L'F')))
)
return E_INVALIDARG;
}
}
TRACE("%s -> %p\n", debugstr_w(s), id);
/* quick lookup table */
memset(table, 0, 256*sizeof(WCHAR));
for (i = 0; i < 10; i++) {
table['0' + i] = i;
}
for (i = 0; i < 6; i++) {
table['A' + i] = i+10;
table['a' + i] = i+10;
}
/* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
p = (BYTE *) id;
s++; /* skip leading brace */
for (i = 0; i < 4; i++) {
p[3 - i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 4;
s++; /* skip - */
for (i = 0; i < 2; i++) {
p[1-i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 2;
s++; /* skip - */
for (i = 0; i < 2; i++) {
p[1-i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 2;
s++; /* skip - */
/* these are just sequential bytes */
for (i = 0; i < 2; i++) {
*p++ = table[*s]<<4 | table[*(s+1)];
s += 2;
}
s++; /* skip - */
for (i = 0; i < 6; i++) {
*p++ = table[*s]<<4 | table[*(s+1)];
s += 2;
}
return S_OK;
return CLSIDFromString((LPOLESTR)idstr, id);
}
/*************************************************************************
@ -4441,20 +4209,9 @@ UINT WINAPI ZoneComputePaneSize(HWND hwnd)
return 0x95;
}
typedef void (WINAPI *fnSHChangeNotify)(LONG, UINT, LPCVOID, LPCVOID);
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
{
static fnSHChangeNotify fn;
HMODULE hshell32;
if (!fn)
{
hshell32 = LoadLibraryA("shell32");
if (hshell32)
fn = (fnSHChangeNotify) GetProcAddress(hshell32, "SHChangeNotify");
}
fn(wEventId, uFlags, dwItem1, dwItem2);
SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2);
}
typedef struct SHELL_USER_SID { /* according to MSDN this should be in shlobj.h... */

View File

@ -50,7 +50,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
} while (0)
/* DLL handles for late bound calls */
extern HMODULE SHLWAPI_hshell32;
static HMODULE SHLWAPI_hshell32;
/* Function pointers for GET_FUNC macro; these need to be global because of gcc bug */
typedef BOOL (WINAPI *fnpIsNetDrive)(int);

View File

@ -71,7 +71,7 @@
71 stdcall @(long ptr long) user32.GetClassNameW
72 stdcall @(long ptr long) user32.GetClipboardFormatNameW
73 stdcall @(long ptr) kernel32.GetCurrentDirectoryW
74 stdcall -noname GetDlgItemTextWrapW(long long wstr long)
74 stdcall @(long long wstr long) user32.GetDlgItemTextW
75 stdcall @(wstr) kernel32.GetFileAttributesW
76 stdcall @(wstr long ptr ptr) kernel32.GetFullPathNameW
77 stdcall @(long long ptr long) kernel32.GetLocaleInfoW
@ -296,7 +296,7 @@
296 stub -noname CreateURLFileContentsW
297 stub -noname CreateURLFileContentsA
298 stdcall @(wstr wstr wstr wstr) kernel32.WritePrivateProfileStringW
299 stdcall -noname ExtTextOutWrapW(long long long long ptr wstr long ptr)
299 stdcall @(long long long long ptr wstr long ptr) gdi32.ExtTextOutW
300 stdcall @(long long long long long long long long long long long long long wstr) gdi32.CreateFontW
301 stdcall @(long wstr long ptr long ptr) user32.DrawTextExW
302 stdcall @(long long long ptr) user32.GetMenuItemInfoW
@ -334,12 +334,12 @@
334 stdcall -noname SHGetPathFromIDListWrapW(ptr ptr)
335 stdcall -noname ShellExecuteExWrapW(ptr)
336 stdcall -noname SHFileOperationWrapW(ptr)
337 stdcall -noname ExtractIconExWrapW(wstr long ptr ptr long)
337 stdcall @(wstr long ptr ptr long) user32.ExtractIconExW
338 stdcall @(wstr long) kernel32.SetFileAttributesW
339 stdcall @(long long wstr ptr ptr long) kernel32.GetNumberFormatW
340 stdcall @(long wstr wstr long) user32.MessageBoxW
341 stdcall @(long ptr) kernel32.FindNextFileW
342 stdcall -noname SHInterlockedCompareExchange(ptr long long)
342 stdcall -noname SHInterlockedCompareExchange(ptr ptr ptr)
343 stdcall -noname SHRegGetCLSIDKeyA(ptr str long long ptr)
344 stdcall -noname SHRegGetCLSIDKeyW(ptr wstr long long ptr)
345 stdcall -noname SHAnsiToAnsi(str ptr long)
@ -348,7 +348,7 @@
348 stub -noname SHGetFileDescriptionW
349 stub -noname SHGetFileDescriptionA
350 stdcall -noname GetFileVersionInfoSizeWrapW(wstr ptr)
351 stdcall -noname GetFileVersionInfoWrapW(wstr ptr long ptr)
351 stdcall -noname GetFileVersionInfoWrapW(wstr long long ptr)
352 stdcall -noname VerQueryValueWrapW(ptr wstr ptr ptr)
353 stub -noname SHFormatDateTimeA
354 stub -noname SHFormatDateTimeW

View File

@ -23,24 +23,14 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#define NO_SHLWAPI_REG
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
HINSTANCE shlwapi_hInstance = 0;
HMODULE SHLWAPI_hshell32 = 0;
HMODULE SHLWAPI_hwinmm = 0;
HMODULE SHLWAPI_hcomdlg32 = 0;
HMODULE SHLWAPI_hcomctl32 = 0;
HMODULE SHLWAPI_hmpr = 0;
HMODULE SHLWAPI_hmlang = 0;
HMODULE SHLWAPI_hurlmon = 0;
HMODULE SHLWAPI_hversion = 0;
DWORD SHLWAPI_ThreadRef_index = TLS_OUT_OF_INDEXES;
/*************************************************************************
@ -74,14 +64,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
SHLWAPI_ThreadRef_index = TlsAlloc();
break;
case DLL_PROCESS_DETACH:
if (SHLWAPI_hshell32) FreeLibrary(SHLWAPI_hshell32);
if (SHLWAPI_hwinmm) FreeLibrary(SHLWAPI_hwinmm);
if (SHLWAPI_hcomdlg32) FreeLibrary(SHLWAPI_hcomdlg32);
if (SHLWAPI_hcomctl32) FreeLibrary(SHLWAPI_hcomctl32);
if (SHLWAPI_hmpr) FreeLibrary(SHLWAPI_hmpr);
if (SHLWAPI_hmlang) FreeLibrary(SHLWAPI_hmlang);
if (SHLWAPI_hurlmon) FreeLibrary(SHLWAPI_hurlmon);
if (SHLWAPI_hversion) FreeLibrary(SHLWAPI_hversion);
if (SHLWAPI_ThreadRef_index != TLS_OUT_OF_INDEXES) TlsFree(SHLWAPI_ThreadRef_index);
break;
}

View File

@ -37,6 +37,7 @@
#include "wingdi.h"
#include "winuser.h"
#include "shlobj.h"
#include "mlang.h"
#include "ddeml.h"
#include "wine/unicode.h"
#include "wine/debug.h"
@ -45,22 +46,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* Get a function pointer from a DLL handle */
#define GET_FUNC(func, module, name, fail) \
do { \
if (!func) { \
if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
func = (fn##func)GetProcAddress(SHLWAPI_h##module, name); \
if (!func) return fail; \
} \
} while (0)
extern HMODULE SHLWAPI_hmlang;
extern HINSTANCE shlwapi_hInstance;
typedef HRESULT (WINAPI *fnpConvertINetUnicodeToMultiByte)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
static fnpConvertINetUnicodeToMultiByte pConvertINetUnicodeToMultiByte;
static HRESULT WINAPI _SHStrDupAA(LPCSTR,LPSTR*);
static HRESULT WINAPI _SHStrDupAW(LPCWSTR,LPSTR*);
@ -2609,8 +2596,7 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
DWORD dwMode = 0;
INT nWideCharCount = len - 1;
GET_FUNC(pConvertINetUnicodeToMultiByte, mlang, "ConvertINetUnicodeToMultiByte", 0);
if (!pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
if (!ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
lpiLen))
return 0;
@ -2622,7 +2608,7 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
*lpiLen = 0;
if (pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpiLen))
if (ConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpiLen))
{
SHTruncateString(mem, *lpiLen);
lstrcpynA(lpDstStr, mem, *lpiLen + 1);

View File

@ -26,31 +26,18 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/debug.h"
#include "winuser.h"
#define NO_SHLWAPI_REG
#define NO_SHLWAPI_PATH
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#define NO_SHLWAPI_USER
#include "shlwapi.h"
#include "shlobj.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* Get a function pointer from a DLL handle */
#define GET_FUNC(func, module, name, fail) \
do { \
if (!func) { \
if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
if (!(func = (void*)GetProcAddress(SHLWAPI_h##module, name))) return fail; \
} \
} while (0)
/* DLL handles for late bound calls */
extern HMODULE SHLWAPI_hshell32;
/* Function pointers for GET_FUNC macro; these need to be global because of gcc bug */
static HRESULT (WINAPI *pSHGetInstanceExplorer)(IUnknown**);
extern DWORD SHLWAPI_ThreadRef_index; /* Initialised in shlwapi_main.c */
DWORD WINAPI SHStringFromGUIDA(REFGUID,LPSTR,INT);
@ -118,9 +105,7 @@ HRESULT WINAPI _SHGetInstanceExplorer(IUnknown **lppUnknown)
{
/* This function is used within SHLWAPI only to hold the IE reference
* for threads created with the CTF_PROCESS_REF flag set. */
GET_FUNC(pSHGetInstanceExplorer, shell32, "SHGetInstanceExplorer", E_FAIL);
return pSHGetInstanceExplorer(lppUnknown);
return SHGetInstanceExplorer(lppUnknown);
}
/* Internal thread information structure */