This commit is contained in:
Whindmar Saksit 2025-03-29 13:28:45 -04:00 committed by GitHub
commit 2be4f4526c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 65 additions and 13 deletions

View file

@ -48,12 +48,8 @@ static BOOL IL_AddImagesForTest(HIMAGELIST himl)
HINSTANCE hInst = LoadLibraryW(L"USER32");
if (!hInst)
return FALSE;
HICON hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(100), /* Windows */
HICON hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(100),
IMAGE_ICON, IL_IMGSIZE, IL_IMGSIZE, 0);
if (!hIco)
hIco = (HICON)LoadImage(hInst, MAKEINTRESOURCE(32512), /* ReactOS */
IMAGE_ICON, IL_IMGSIZE, IL_IMGSIZE, 0);
if (hIco)
{
idx = ImageList_AddIcon(himl, hIco);

View file

@ -45,6 +45,42 @@ static void test_LoadImage_DataFile(void)
}
}
static void test_LoadIcon_SystemIds(void)
{
static const WORD icomap[][2] = {
{ 100, (WORD)(SIZE_T)IDI_APPLICATION },
{ 101, (WORD)(SIZE_T)IDI_WARNING },
{ 102, (WORD)(SIZE_T)IDI_QUESTION },
{ 103, (WORD)(SIZE_T)IDI_ERROR },
{ 104, (WORD)(SIZE_T)IDI_INFORMATION },
{ 105, (WORD)(SIZE_T)IDI_WINLOGO }
};
HINSTANCE hInst = GetModuleHandleW(L"USER32");
typedef BOOL (WINAPI*SHAIE)(HICON, HICON);
SHAIE pfnSHAreIconsEqual;
HMODULE hSHLWAPI = LoadLibraryA("SHLWAPI");
if (!hSHLWAPI)
{
skip("Could not initialize\n");
return;
}
pfnSHAreIconsEqual = (SHAIE)GetProcAddress(hSHLWAPI, MAKEINTRESOURCEA(548));
if (!pfnSHAreIconsEqual)
{
FreeLibrary(hSHLWAPI);
skip("Could not initialize\n");
return;
}
for (UINT i = 0; i < _countof(icomap); i++)
{
HICON hIcoRes = LoadIconW(hInst, MAKEINTRESOURCEW(icomap[i][0]));
HICON hIcoSys = LoadIconW(NULL, MAKEINTRESOURCEW(icomap[i][1]));
ok(hIcoRes && pfnSHAreIconsEqual(hIcoRes, hIcoSys), "SysIcon %d must be resource %d\n", icomap[i][1], icomap[i][0]);
}
FreeLibrary(hSHLWAPI);
}
START_TEST(LoadImage)
{
char path[MAX_PATH];
@ -133,4 +169,6 @@ START_TEST(LoadImage)
si.cb = sizeof(si);
CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi );
WaitForSingleObject (pi.hProcess, INFINITE);
test_LoadIcon_SystemIds();
}

View file

@ -1144,7 +1144,7 @@ co_IntSetWndIcons(VOID)
IntLoadSystenIcons(Common->hIconBang, OIC_BANG);
IntLoadSystenIcons(Common->hIconNote, OIC_NOTE);
IntLoadSystenIcons(gpsi->hIconWindows, OIC_WINLOGO);
IntLoadSystenIcons(gpsi->hIconSmWindows, OIC_WINLOGO+1);
IntLoadSystenIcons(gpsi->hIconSmWindows, OIC_INTERNAL_WINSMALL);
ERR("hIconSmWindows %p hIconWindows %p \n",gpsi->hIconSmWindows,gpsi->hIconWindows);

View file

@ -155,7 +155,7 @@ IntLoadSystenIcons(HICON hcur, DWORD id)
return;
// Set Small Window Icon and do not link.
if ( id == OIC_WINLOGO+1 )
if ( id == OIC_INTERNAL_WINSMALL )
{
pcur->CURSORF_flags |= CURSORF_GLOBAL;
UserReferenceObject(pcur);

View file

@ -108,6 +108,8 @@ extern SYSTEMCURICO gasyscur[];
#define ROIC_BANG 3
#define ROIC_NOTE 4
#define ROIC_WINLOGO 5
#define ROIC_SHIELD 6
#define OIC_INTERNAL_WINSMALL 6 /* Note: This needs to change if SHIELD becomes special */
#define ROCR_ARROW 0
#define ROCR_IBEAM 1

View file

@ -55,12 +55,13 @@ OCR_HAND CURSOR "resources/ocr_hand.cur"
/* Icons */
OIC_SAMPLE ICON "resources/oic_sample.ico"
OIC_HAND ICON "resources/oic_hand.ico"
OIC_QUES ICON "resources/oic_ques.ico"
OIC_BANG ICON "resources/oic_bang.ico"
OIC_NOTE ICON "resources/oic_note.ico"
OIC_WINLOGO ICON "resources/oic_reactos.ico"
100 ICON "resources/oic_sample.ico" /* IDI_APPLICATION */
101 ICON "resources/oic_bang.ico" /* IDI_WARNING */
102 ICON "resources/oic_ques.ico" /* IDI_QUESTION */
103 ICON "resources/oic_hand.ico" /* IDI_ERROR */
104 ICON "resources/oic_note.ico" /* IDI_INFORMATION */
105 ICON "resources/oic_reactos.ico" /* IDI_WINLOGO */
/* 106 ICON "resources/oic_shield.ico" IDI_SHIELD */
/* Bitmaps */

View file

@ -1487,8 +1487,23 @@ CURSORICON_LoadImageW(
/* Check if caller wants OEM icons */
if(!hinst)
{
#ifndef IDI_SHIELD
#define IDI_SHIELD MAKEINTRESOURCE(32518)
#endif
hinst = User32Instance;
/* Map IDI to resource id */
if (bIcon && lpszName >= IDI_APPLICATION && lpszName <= IDI_SHIELD)
{
SIZE_T id = 100 + (SIZE_T)lpszName - (SIZE_T)IDI_APPLICATION;
if ((id | 2) == 103)
id ^= 2; /* Must swap IDI_ERROR and IDI_WARNING */
lpszName = MAKEINTRESOURCEW(id);
}
}
if(lpszName)
{
/* Prepare the resource name string */