diff --git a/dll/win32/shell32/wine/control.c b/dll/win32/shell32/wine/control.c index 7485efcf261..f77f46ad5d4 100644 --- a/dll/win32/shell32/wine/control.c +++ b/dll/win32/shell32/wine/control.c @@ -67,8 +67,16 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) CPlApplet* applet; DWORD len; unsigned i; +#ifdef __REACTOS__ + CPLINFO info = { 0 }; + union { + NEWCPLINFOA NewCplInfoA; + NEWCPLINFOW NewCplInfoW; + } Newcpl; +#else CPLINFO info; NEWCPLINFOW newinfo; +#endif if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) return applet; @@ -123,8 +131,12 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) FIELD_OFFSET( CPlApplet, info[applet->count] )); for (i = 0; i < applet->count; i++) { +#ifdef __REACTOS__ + ZeroMemory(&Newcpl, sizeof(Newcpl)); +#else ZeroMemory(&newinfo, sizeof(newinfo)); newinfo.dwSize = sizeof(NEWCPLINFOA); +#endif applet->info[i].helpfile[0] = 0; /* proc is supposed to return a null value upon success for * CPL_INQUIRE and CPL_NEWINQUIRE @@ -162,30 +174,74 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) if ((info.idIcon == CPL_DYNAMIC_RES) || (info.idName == CPL_DYNAMIC_RES) || (info.idInfo == CPL_DYNAMIC_RES)) { +#ifdef __REACTOS__ + applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&Newcpl); + applet->info[i].data = Newcpl.NewCplInfoA.lData; +#else applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&newinfo); applet->info[i].data = newinfo.lData; +#endif + if (info.idIcon == CPL_DYNAMIC_RES) { +#ifdef __REACTOS__ + if (!Newcpl.NewCplInfoA.hIcon) WARN("couldn't get icon for applet %u\n", i); + /* This is CPL_NEWINQUIRE, so use the HICON value as idIcon */ + applet->info[i].idIcon = (INT)Newcpl.NewCplInfoA.hIcon; +#else if (!newinfo.hIcon) WARN("couldn't get icon for applet %u\n", i); applet->info[i].icon = newinfo.hIcon; +#endif } +#ifdef __REACTOS__ + if (Newcpl.NewCplInfoA.dwSize == sizeof(NEWCPLINFOW)) { +#else if (newinfo.dwSize == sizeof(NEWCPLINFOW)) { +#endif if (info.idName == CPL_DYNAMIC_RES) +#ifdef __REACTOS__ + memcpy(applet->info[i].name, Newcpl.NewCplInfoW.szName, + sizeof(Newcpl.NewCplInfoW.szName)); +#else memcpy(applet->info[i].name, newinfo.szName, sizeof(newinfo.szName)); +#endif if (info.idInfo == CPL_DYNAMIC_RES) +#ifdef __REACTOS__ + memcpy(applet->info[i].info, Newcpl.NewCplInfoW.szInfo, + sizeof(Newcpl.NewCplInfoW.szInfo)); + memcpy(applet->info[i].helpfile, Newcpl.NewCplInfoW.szHelpFile, + sizeof(Newcpl.NewCplInfoW.szHelpFile)); +#else memcpy(applet->info[i].info, newinfo.szInfo, sizeof(newinfo.szInfo)); memcpy(applet->info[i].helpfile, newinfo.szHelpFile, sizeof(newinfo.szHelpFile)); +#endif + } else { if (info.idName == CPL_DYNAMIC_RES) +#ifdef __REACTOS__ + MultiByteToWideChar(CP_ACP, 0, Newcpl.NewCplInfoA.szName, + sizeof(Newcpl.NewCplInfoA.szName) / sizeof(CHAR), +#else MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szName, sizeof(((LPNEWCPLINFOA)&newinfo)->szName) / sizeof(CHAR), +#endif applet->info[i].name, sizeof(applet->info[i].name) / sizeof(WCHAR)); if (info.idInfo == CPL_DYNAMIC_RES) +#ifdef __REACTOS__ + MultiByteToWideChar(CP_ACP, 0, Newcpl.NewCplInfoA.szInfo, + sizeof(Newcpl.NewCplInfoA.szInfo) / sizeof(CHAR), +#else MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szInfo, sizeof(((LPNEWCPLINFOA)&newinfo)->szInfo) / sizeof(CHAR), +#endif applet->info[i].info, sizeof(applet->info[i].info) / sizeof(WCHAR)); +#ifdef __REACTOS__ + MultiByteToWideChar(CP_ACP, 0, Newcpl.NewCplInfoA.szHelpFile, + sizeof(Newcpl.NewCplInfoA.szHelpFile) / sizeof(CHAR), +#else MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szHelpFile, sizeof(((LPNEWCPLINFOA)&newinfo)->szHelpFile) / sizeof(CHAR), +#endif applet->info[i].helpfile, sizeof(applet->info[i].helpfile) / sizeof(WCHAR)); } 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,