mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[CPL] Boundary check of Control Panel applets (#4706)
- Check the boundary (i < NUM_APPLETS) of the variable i in CPlApplet functions. - Use UINT type for the variable i.
This commit is contained in:
parent
37ccb9e594
commit
e5ebbc8afa
12 changed files with 194 additions and 98 deletions
|
@ -240,7 +240,7 @@ CPlApplet(HWND hwndCPl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
INT i = (INT)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -251,6 +251,7 @@ CPlApplet(HWND hwndCPl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
|
@ -258,14 +259,23 @@ CPlApplet(HWND hwndCPl,
|
|||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -252,7 +252,7 @@ cleanup:
|
|||
LONG CALLBACK
|
||||
CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
int i = (int)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -263,6 +263,7 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
|
@ -270,14 +271,23 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -548,6 +548,7 @@ CPlApplet(
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
|
@ -555,14 +556,23 @@ CPlApplet(
|
|||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -87,9 +87,7 @@ LONG CALLBACK
|
|||
CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
CPLINFO *CPlInfo;
|
||||
int i;
|
||||
|
||||
i = (int)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -100,15 +98,25 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -232,6 +232,8 @@ CPlApplet(HWND hwndCpl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case CPL_INIT:
|
||||
|
@ -241,23 +243,31 @@ CPlApplet(HWND hwndCpl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
UINT uAppIndex = (UINT)lParam1;
|
||||
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[uAppIndex].idIcon;
|
||||
CPlInfo->idName = Applets[uAppIndex].idName;
|
||||
CPlInfo->idInfo = Applets[uAppIndex].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -319,11 +319,9 @@ LONG CALLBACK
|
|||
CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
CPLINFO *CPlInfo;
|
||||
DWORD i;
|
||||
|
||||
UINT i = (UINT)lParam1;
|
||||
UNREFERENCED_PARAMETER(hwndCPl);
|
||||
|
||||
i = (DWORD)lParam1;
|
||||
switch (uMsg)
|
||||
{
|
||||
case CPL_INIT:
|
||||
|
@ -333,15 +331,25 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ CPlApplet(HWND hwndCpl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case CPL_INIT:
|
||||
|
@ -96,26 +98,31 @@ CPlApplet(HWND hwndCpl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
UINT uAppIndex = (UINT)lParam1;
|
||||
|
||||
CPlInfo->lData = lParam1;
|
||||
CPlInfo->idIcon = Applets[uAppIndex].idIcon;
|
||||
CPlInfo->idName = Applets[uAppIndex].idName;
|
||||
CPlInfo->idInfo = Applets[uAppIndex].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = lParam1;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_DBLCLK:
|
||||
{
|
||||
UINT uAppIndex = (UINT)lParam1;
|
||||
Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -745,6 +745,8 @@ CPlApplet(HWND hwndCpl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case CPL_INIT:
|
||||
|
@ -754,29 +756,31 @@ CPlApplet(HWND hwndCpl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
UINT uAppIndex = (UINT)lParam1;
|
||||
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[uAppIndex].idIcon;
|
||||
CPlInfo->idName = Applets[uAppIndex].idName;
|
||||
CPlInfo->idInfo = Applets[uAppIndex].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_DBLCLK:
|
||||
{
|
||||
UINT uAppIndex = (UINT)lParam1;
|
||||
Applets[uAppIndex].AppletProc(hwndCpl,
|
||||
uMsg,
|
||||
lParam1,
|
||||
lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -155,7 +155,7 @@ CPlApplet(HWND hwndCPl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
int i = (int)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -170,20 +170,26 @@ CPlApplet(HWND hwndCPl,
|
|||
}
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CPL_DBLCLK:
|
||||
{
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -203,7 +203,7 @@ CPlApplet(HWND hwndCPl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
INT i = (INT)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
UNREFERENCED_PARAMETER(hwndCPl);
|
||||
|
||||
|
@ -216,6 +216,7 @@ CPlApplet(HWND hwndCPl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
|
@ -223,15 +224,23 @@ CPlApplet(HWND hwndCPl,
|
|||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case CPL_STARTWPARMSW:
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
|
||||
if (i < NUM_APPLETS)
|
||||
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -131,7 +131,7 @@ CPlApplet(HWND hwndCpl,
|
|||
LPARAM lParam1,
|
||||
LPARAM lParam2)
|
||||
{
|
||||
INT i = (INT)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -142,20 +142,26 @@ CPlApplet(HWND hwndCpl,
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
break;
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
CPlInfo->idIcon = Applets[i].idIcon;
|
||||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
{
|
||||
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
}
|
||||
break;
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
|
|||
LONG CALLBACK
|
||||
CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
int i = (int)lParam1;
|
||||
UINT i = (UINT)lParam1;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -101,6 +101,7 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
return NUM_APPLETS;
|
||||
|
||||
case CPL_INQUIRE:
|
||||
if (i < NUM_APPLETS)
|
||||
{
|
||||
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
||||
CPlInfo->lData = 0;
|
||||
|
@ -108,10 +109,17 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|||
CPlInfo->idName = Applets[i].idName;
|
||||
CPlInfo->idInfo = Applets[i].idDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPL_DBLCLK:
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
if (i < NUM_APPLETS)
|
||||
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue