From 3e56dbc9a4b9914b1780581e7f8f01f67c7466c9 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Fri, 16 Jun 2000 21:50:59 +0000 Subject: [PATCH] - fixed null-pidl from _ILCreateControl - some more no-name functions in shlwapi --- dlls/shell32/pidl.c | 55 +++++++++++++---------- dlls/shell32/shell32_main.c | 40 ++++++++++++++--- dlls/shell32/shell32_main.h | 6 +++ dlls/shell32/shellord.c | 88 +++++++++++++++++++++++++++++++++++-- dlls/shell32/shlwapi.spec | 19 ++++---- 5 files changed, 164 insertions(+), 44 deletions(-) diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 96ec11851b6..4e31ec1e60c 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -799,40 +799,33 @@ HRESULT WINAPI SHGetSpecialFolderLocation( TRACE_(shell)("(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl); - *ppidl = NULL; - if (ppidl) { + *ppidl = NULL; switch (nFolder) { case CSIDL_DESKTOP: *ppidl = _ILCreateDesktop(); - hr = NOERROR; break; case CSIDL_DRIVES: *ppidl = _ILCreateMyComputer(); - hr = NOERROR; break; case CSIDL_NETWORK: *ppidl = _ILCreateNetwork (); - hr = NOERROR; break; case CSIDL_CONTROLS: *ppidl = _ILCreateControl (); - hr = NOERROR; break; case CSIDL_PRINTERS: *ppidl = _ILCreatePrinter (); - hr = NOERROR; break; case CSIDL_BITBUCKET: *ppidl = _ILCreateBitBucket (); - hr = NOERROR; break; default: @@ -843,6 +836,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation( hr = SHILCreateFromPathA(szPath, ppidl, &attributes); } } + if(*ppidl) hr = NOERROR; } TRACE_(shell)("-- (new pidl %p)\n",*ppidl); @@ -1229,7 +1223,8 @@ LPITEMIDLIST _ILCreateSpecial(LPCSTR szGUID) */ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize) -{ LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL; +{ + LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL; LPPIDLDATA pData; UINT16 uSize = 0; LPSTR pszDest; @@ -1237,18 +1232,38 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize) TRACE("(0x%02x %p %i)\n",type,pIn,uInSize); switch (type) - { case PT_DESKTOP: + { + case PT_DESKTOP: uSize = 0; - pidlOut = SHAlloc(uSize + 2); - pidlOut->mkid.cb = uSize; + break; + case PT_SPECIAL: + case PT_MYCOMP: + uSize = 2 + 2 + sizeof(GUID); + break; + case PT_DRIVE: + uSize = 2 + 23; + break; + case PT_FOLDER: + case PT_VALUE: + uSize = 2 + 12 + uInSize; + break; + default: + FIXME("can't create type: 0x%08x\n",type); + return NULL; + } + + if(!(pidlOut = SHAlloc(uSize + 2))) return NULL; + ZeroMemory(pidlOut, uSize + 2); + pidlOut->mkid.cb = uSize; + + switch (type) + { + case PT_DESKTOP: TRACE("- create Desktop\n"); break; + case PT_SPECIAL: case PT_MYCOMP: - uSize = 2 + 2 + sizeof(GUID); - pidlOut = SHAlloc(uSize + 2); - ZeroMemory(pidlOut, uSize + 2); - pidlOut->mkid.cb = uSize; pData =_ILGetDataPointer(pidlOut); pData->type = type; memcpy(&(pData->u.mycomp.guid), pIn, uInSize); @@ -1256,10 +1271,6 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize) break; case PT_DRIVE: - uSize = 2 + 23; - pidlOut = SHAlloc(uSize + 2); - ZeroMemory(pidlOut, uSize + 2); - pidlOut->mkid.cb = uSize; pData =_ILGetDataPointer(pidlOut); pData->type = type; pszDest = _ILGetTextPointer(pidlOut); @@ -1269,10 +1280,6 @@ LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT16 uInSize) case PT_FOLDER: case PT_VALUE: - uSize = 2 + 12 + uInSize; - pidlOut = SHAlloc(uSize + 2); - ZeroMemory(pidlOut, uSize + 2); - pidlOut->mkid.cb = uSize; pData =_ILGetDataPointer(pidlOut); pData->type = type; pszDest = _ILGetTextPointer(pidlOut); diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 87ea7d6785a..61e8fdbd11d 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -818,10 +818,38 @@ static HINSTANCE hComctl32; static INT shell32_RefCount = 0; LONG shell32_ObjCount = 0; -HINSTANCE shell32_hInstance; +HINSTANCE shell32_hInstance = 0; +HINSTANCE shlwapi_hInstance = 0; +HMODULE huser32 = 0; HIMAGELIST ShellSmallIconList = 0; HIMAGELIST ShellBigIconList = 0; +/************************************************************************* + * SHELL32 LibMain + * + * NOTES + * calling oleinitialize here breaks sone apps. + */ + +BOOL WINAPI ShlwapiLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) +{ + TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad); + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + shlwapi_hInstance = hinstDLL; + if(!huser32) huser32 = GetModuleHandleA("USER32.DLL"); + + if (!huser32) + { + ERR("hModule of USER32 is 0\n"); + return FALSE; + } + break; + } + return TRUE; +} + /************************************************************************* * SHELL32 LibMain * @@ -831,8 +859,6 @@ HIMAGELIST ShellBigIconList = 0; BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) { - HMODULE hUser32; - TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad); switch (fdwReason) @@ -843,10 +869,10 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) shell32_hInstance = hinstDLL; hComctl32 = GetModuleHandleA("COMCTL32.DLL"); - hUser32 = GetModuleHandleA("USER32"); + if(!huser32) huser32 = GetModuleHandleA("USER32.DLL"); DisableThreadLibraryCalls(shell32_hInstance); - if (!hComctl32 || !hUser32) + if (!hComctl32 || !huser32) { ERR("P A N I C SHELL32 loading failed\n"); return FALSE; @@ -871,8 +897,8 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L); pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L); /* user32 */ - pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(hUser32,"LookupIconIdFromDirectoryEx"); - pCreateIconFromResourceEx=(void*)GetProcAddress(hUser32,"CreateIconFromResourceEx"); + pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(huser32,"LookupIconIdFromDirectoryEx"); + pCreateIconFromResourceEx=(void*)GetProcAddress(huser32,"CreateIconFromResourceEx"); /* initialize the common controls */ if (pDLLInitComctl) diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 8e71f17bae5..51698ffea65 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -20,12 +20,18 @@ /******************************************* * global SHELL32.DLL variables */ +extern HMODULE huser32; extern HINSTANCE shell32_hInstance; extern LONG shell32_ObjCount; extern HIMAGELIST ShellSmallIconList; extern HIMAGELIST ShellBigIconList; extern HDPA sic_hdpa; +/******************************************* +* global SHLWAPI.DLL variables +*/ +extern HINSTANCE shlwapi_hInstance; + /******************************************* * pointer to functions dynamically loaded */ diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 9d01b92c564..23ae8c9f062 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -988,6 +988,19 @@ DWORD WINAPI SHLWAPI_1 ( return 0; } +/************************************************************************* + * SHLWAPI_16 [SHLWAPI] + */ +HRESULT WINAPI SHLWAPI_16 ( + LPVOID w, + LPVOID x, + LPVOID y, + LPWSTR z) +{ + FIXME("(%p %p %p %p)stub\n",w,x,y,z); + return 0xabba1252; +} + /************************************************************************* * SHLWAPI_23 [SHLWAPI.23] * @@ -1083,6 +1096,21 @@ HRESULT WINAPI SHLWAPI_219 ( return 0xabba1252; } +/************************************************************************* + * SHLWAPI_215 [SHLWAPI] + * + * NOTES + * check me! + */ +LPWSTR WINAPI SHLWAPI_215 ( + LPSTR lpStrSrc, + LPVOID lpwStrDest, + int len) +{ + WARN("(%s %p %u)\n",lpStrSrc,lpwStrDest,len); + return CRTDLL_wcsncpy(lpwStrDest, lpStrSrc, len); +} + /************************************************************************* * SHLWAPI_222 [SHLWAPI] * @@ -1194,13 +1222,44 @@ DWORD WINAPI SHLWAPI_276 () } /************************************************************************* - * SHLWAPI_309 [SHLWAPI] + * SHLWAPI_278 [SHLWAPI] * */ -DWORD WINAPI SHLWAPI_309 (LPVOID x) +DWORD WINAPI SHLWAPI_278 ( + LONG wndProc, + HWND hWndParent, + DWORD dwExStyle, + DWORD dwStyle, + HMENU hMenu, + LONG z) { - FIXME("(%p)stub\n",x); - return 0xabba1245; + WNDCLASSA wndclass; + HWND hwnd; + HCURSOR hCursor; + char * clsname = "WorkerA"; + + FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n", + wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z); + + hCursor = LoadCursorA(0x00000000,IDC_ARROWA); + + if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass)) + { + RtlZeroMemory(&wndclass, sizeof(WNDCLASSA)); + wndclass.lpfnWndProc = GetProcAddress(huser32, "DefWindowProcW"); + wndclass.cbWndExtra = 4; + wndclass.hInstance = shlwapi_hInstance; + wndclass.hCursor = hCursor; + wndclass.hbrBackground = COLOR_BTNSHADOW; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = clsname; + RegisterClassA (&wndclass); + } + hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent, + hMenu,shlwapi_hInstance,0); + SetWindowLongA(hwnd, 0, z); + SetWindowLongA(hwnd, GWL_WNDPROC, wndProc); + return hwnd; } /************************************************************************* @@ -1240,6 +1299,27 @@ DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z) return 0xabba1246; } +/************************************************************************* + * SHLWAPI_378 [SHLWAPI] + */ +DWORD WINAPI SHLWAPI_378 ( + LPSTR x, + LPVOID y, /* 0x50000000 */ + LPVOID z) /* 4 */ +{ + FIXME("(%s %p %p)stub\n", x,y,z); + return LoadLibraryA(x); +} + +/************************************************************************* + * SHLWAPI_431 [SHLWAPI] + */ +DWORD WINAPI SHLWAPI_431 (DWORD x) +{ + FIXME("(0x%08lx)stub\n", x); + return 0xabba1247; +} + /************************************************************************* * SHLWAPI_437 [SHLWAPI] * diff --git a/dlls/shell32/shlwapi.spec b/dlls/shell32/shlwapi.spec index d72316e5055..ce23d6d0052 100644 --- a/dlls/shell32/shlwapi.spec +++ b/dlls/shell32/shlwapi.spec @@ -1,5 +1,6 @@ name shlwapi type win32 +init ShlwapiLibMain 1 stdcall SHLWAPI_1(ptr ptr)SHLWAPI_1 2 stub @ @@ -16,7 +17,7 @@ type win32 13 stub @ 14 stub @ 15 stub @ -16 stub @ +16 stdcall SHLWAPI_16(long long long long)SHLWAPI_16 17 stub @ 18 stub @ 19 stub @ @@ -56,7 +57,7 @@ type win32 53 stub @ 54 stub @ 55 stub @ -56 stub @ +56 forward SHLWAPI_56 user32.DefWindowProcW 57 stub @ 58 stub @ 59 stub @ @@ -94,7 +95,7 @@ type win32 91 stub @ 92 stub @ 93 stub @ -94 stub @ +94 forward SHLWAPI_94 user32.GetWindowLongW 95 stub @ 96 stub @ 97 stub @ @@ -107,7 +108,7 @@ type win32 104 stub @ 105 stub @ 106 stub @ -107 stub @ +107 forward SHLWAPI_107 user32.LoadStringW 108 stub @ 109 stub @ 110 stub @ @@ -215,7 +216,7 @@ type win32 212 stub @ 213 stub @ 214 stub @ -215 stub @ +215 stdcall SHLWAPI_215(long long long)SHLWAPI_215 216 stub @ 217 stub @ 218 stub @ @@ -278,7 +279,7 @@ type win32 275 stub @ 276 stdcall SHLWAPI_276()SHLWAPI_276 277 stub @ -278 stub @ +278 stdcall SHLWAPI_278(long long long long long long)SHLWAPI_278 279 stub @ 280 stub @ 281 stub @ @@ -309,7 +310,7 @@ type win32 306 stub @ 307 stub @ 308 stub @ -309 stdcall SHLWAPI_309(ptr)SHLWAPI_309 +309 forward SHLWAPI_309 kernel32.LoadLibraryW 310 stub @ 311 stub @ 312 stub @ @@ -378,7 +379,7 @@ type win32 375 stub @ 376 stub @ 377 stdcall SHLWAPI_377(long long long)SHLWAPI_377 -378 stub @ +378 stdcall SHLWAPI_378(long long long)SHLWAPI_378 379 stub @ 380 stub @ 381 stub AssocQueryStringA @@ -431,7 +432,7 @@ type win32 428 stub @ 429 stub @ 430 stub @ -431 stub @ +431 stdcall SHLWAPI_431(long)SHLWAPI_431 432 stub @ 433 stub @ 434 stub @