diff --git a/dll/win32/shell32/wine/control.c b/dll/win32/shell32/wine/control.c index 7485efcf261..b0be94f4a4d 100644 --- a/dll/win32/shell32/wine/control.c +++ b/dll/win32/shell32/wine/control.c @@ -67,7 +67,11 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) CPlApplet* applet; DWORD len; unsigned i; +#ifdef __REACTOS__ + CPLINFO info = { 0 }; +#else CPLINFO info; +#endif NEWCPLINFOW newinfo; if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) @@ -167,7 +171,12 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) applet->info[i].data = newinfo.lData; if (info.idIcon == CPL_DYNAMIC_RES) { if (!newinfo.hIcon) WARN("couldn't get icon for applet %u\n", i); +#ifdef __REACTOS__ + /* This is CPL_NEWINQUIRE, so use the HICON value as idIcon */ + applet->info[i].idIcon = (INT)newinfo.hIcon; +#else applet->info[i].icon = newinfo.hIcon; +#endif } if (newinfo.dwSize == sizeof(NEWCPLINFOW)) { if (info.idName == CPL_DYNAMIC_RES) diff --git a/win32ss/user/user32/windows/cursoricon.c b/win32ss/user/user32/windows/cursoricon.c index 1f6b71714aa..1d3afa1b7b6 100644 --- a/win32ss/user/user32/windows/cursoricon.c +++ b/win32ss/user/user32/windows/cursoricon.c @@ -2031,6 +2031,37 @@ HICON WINAPI LoadIconA( _In_ LPCSTR lpIconName ) { +#ifdef __REACTOS__ + /* We want to see if this call is for a Control Panel applet. + * These have extensions of '.cpl' and if this is true, then it + * is likely that this is a response to a CPL_NEWINQUIRE message. + * If so, we want to use the HICON value to return the idIcon + * resource number which is what ReactOS can handle for now. */ + DWORD ret, size = MAX_PATH, len; + UNICODE_STRING ustrModule = {0, 0, NULL}; + WCHAR ext[5] = { 0 }; + + ustrModule.Buffer = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); + if (!ustrModule.Buffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + ret = GetModuleFileNameW(hInstance, ustrModule.Buffer, size); + if(ret == 0) + { + HeapFree(GetProcessHeap(), 0, ustrModule.Buffer); + return NULL; + } + len = wcslen(ustrModule.Buffer); + if (len > 4) + memcpy(ext, (VOID*)((LONG_PTR)ustrModule.Buffer + (len * 2) - 8), 8); + + if (wcsicmp(ext, L".cpl") == 0) + return (HICON)MAKEINTRESOURCEW(lpIconName); + /* End of CPL_NEWINQUIRE special handling */ + +#endif TRACE("%p, %s\n", hInstance, debugstr_a(lpIconName)); return LoadImageA(hInstance,