2013-02-17 15:51:07 +00:00
|
|
|
/*
|
2023-11-05 00:02:22 +00:00
|
|
|
* PROJECT: Safely Remove Hardware Applet
|
|
|
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
|
|
|
* PURPOSE: Applet initialization
|
|
|
|
* COPYRIGHT: Copyright 2013 Johannes Anderwald <johannes.anderwald@reactos.org>
|
|
|
|
* Copyright 2020 Eric Kohl <eric.kohl@reactos.org>
|
|
|
|
*/
|
2013-02-17 15:51:07 +00:00
|
|
|
|
|
|
|
#include "hotplug.h"
|
|
|
|
|
2020-03-29 22:37:45 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
// globals
|
|
|
|
HINSTANCE hApplet = 0;
|
|
|
|
|
|
|
|
/* Applets */
|
|
|
|
APPLET Applets[NUM_APPLETS] =
|
|
|
|
{
|
2020-03-29 22:37:45 +00:00
|
|
|
{IDI_HOTPLUG, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet}
|
2013-02-17 15:51:07 +00:00
|
|
|
};
|
|
|
|
|
2020-04-04 16:13:03 +00:00
|
|
|
static
|
|
|
|
DWORD
|
|
|
|
GetHotPlugFlags(VOID)
|
|
|
|
{
|
|
|
|
HKEY hKey = NULL;
|
|
|
|
DWORD dwFlags = 0;
|
|
|
|
DWORD dwSize, dwError;
|
|
|
|
|
|
|
|
dwError = RegOpenKeyExW(HKEY_CURRENT_USER,
|
|
|
|
REGSTR_PATH_SYSTRAY,
|
|
|
|
0,
|
|
|
|
KEY_READ,
|
|
|
|
&hKey);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
dwSize = sizeof(dwFlags);
|
|
|
|
dwError = RegQueryValueExW(hKey,
|
|
|
|
L"HotPlugFlags",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(LPBYTE)&dwFlags,
|
|
|
|
&dwSize);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
dwFlags = 0;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (hKey != NULL)
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
return dwFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
DWORD
|
|
|
|
SetHotPlugFlags(
|
|
|
|
_In_ DWORD dwFlags)
|
|
|
|
{
|
|
|
|
HKEY hKey = NULL;
|
|
|
|
DWORD dwError;
|
|
|
|
|
|
|
|
dwError = RegCreateKeyExW(HKEY_CURRENT_USER,
|
|
|
|
REGSTR_PATH_SYSTRAY,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE,
|
|
|
|
KEY_WRITE,
|
|
|
|
NULL,
|
|
|
|
&hKey,
|
|
|
|
NULL);
|
|
|
|
if (dwError != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
dwError = RegSetValueExW(hKey,
|
|
|
|
L"HotPlugFlags",
|
|
|
|
0,
|
|
|
|
REG_DWORD,
|
|
|
|
(LPBYTE)&dwFlags,
|
|
|
|
sizeof(dwFlags));
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (hKey != NULL)
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
return dwError;
|
|
|
|
}
|
|
|
|
|
2020-03-30 21:11:44 +00:00
|
|
|
static
|
|
|
|
VOID
|
2023-11-04 12:31:26 +00:00
|
|
|
UpdateDialog(
|
|
|
|
_In_ HWND hwndDlg)
|
2020-03-30 21:11:44 +00:00
|
|
|
{
|
2023-11-04 12:31:26 +00:00
|
|
|
HWND hwndDeviceTree;
|
|
|
|
BOOL bHasItem;
|
2020-04-04 16:13:03 +00:00
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE);
|
2020-03-30 21:11:44 +00:00
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
bHasItem = (TreeView_GetCount(hwndDeviceTree) != 0);
|
|
|
|
if (bHasItem)
|
|
|
|
TreeView_SelectItem(hwndDeviceTree, TreeView_GetFirstVisible(hwndDeviceTree));
|
2020-03-30 21:11:44 +00:00
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_PROPERTIES), bHasItem);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_STOP), bHasItem);
|
2020-04-05 07:48:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
ShowContextMenu(
|
|
|
|
HWND hwndDlg,
|
|
|
|
HWND hwndTreeView,
|
|
|
|
PHOTPLUG_DATA pHotplugData)
|
|
|
|
{
|
|
|
|
HTREEITEM hTreeItem;
|
|
|
|
RECT rc;
|
|
|
|
POINT pt;
|
|
|
|
|
|
|
|
hTreeItem = TreeView_GetSelection(hwndTreeView);
|
|
|
|
if (hTreeItem == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
TreeView_GetItemRect(hwndTreeView, hTreeItem, &rc, TRUE);
|
|
|
|
|
|
|
|
pt.x = (rc.left + rc.right) / 2;
|
|
|
|
pt.y = (rc.top + rc.bottom) / 2;
|
|
|
|
ClientToScreen(hwndTreeView, &pt);
|
|
|
|
TrackPopupMenu(GetSubMenu(pHotplugData->hPopupMenu, 0),
|
|
|
|
TPM_LEFTALIGN | TPM_TOPALIGN,
|
|
|
|
pt.x,
|
|
|
|
pt.y,
|
|
|
|
0,
|
|
|
|
hwndDlg,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2023-10-23 11:53:08 +00:00
|
|
|
static
|
|
|
|
DEVINST
|
|
|
|
GetSelectedDeviceInst(
|
2023-11-04 12:31:26 +00:00
|
|
|
_In_ PHOTPLUG_DATA pHotplugData)
|
2023-10-23 11:53:08 +00:00
|
|
|
{
|
|
|
|
HTREEITEM hTreeItem;
|
|
|
|
TVITEMW item;
|
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
hTreeItem = TreeView_GetSelection(pHotplugData->hwndDeviceTree);
|
2023-10-23 11:53:08 +00:00
|
|
|
if (hTreeItem == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ZeroMemory(&item, sizeof(item));
|
|
|
|
item.mask = TVIF_PARAM;
|
|
|
|
item.hItem = hTreeItem;
|
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
TreeView_GetItem(pHotplugData->hwndDeviceTree, &item);
|
2023-10-23 11:53:08 +00:00
|
|
|
|
|
|
|
return item.lParam;
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
ShowDeviceProperties(
|
|
|
|
_In_ HWND hwndParent,
|
|
|
|
_In_ DEVINST DevInst)
|
|
|
|
{
|
|
|
|
ULONG ulSize;
|
|
|
|
CONFIGRET cr;
|
|
|
|
LPWSTR pszDevId;
|
|
|
|
|
|
|
|
cr = CM_Get_Device_ID_Size(&ulSize, DevInst, 0);
|
|
|
|
if (cr != CR_SUCCESS || ulSize == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Take the terminating NULL into account */
|
|
|
|
ulSize++;
|
|
|
|
|
|
|
|
pszDevId = HeapAlloc(GetProcessHeap(), 0, ulSize * sizeof(WCHAR));
|
|
|
|
if (pszDevId == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cr = CM_Get_Device_IDW(DevInst, pszDevId, ulSize, 0);
|
|
|
|
if (cr == CR_SUCCESS)
|
|
|
|
{
|
|
|
|
typedef int (WINAPI *PFDEVICEPROPERTIESW)(HWND, LPCWSTR, LPCWSTR, BOOL);
|
|
|
|
HMODULE hDevMgrDll;
|
|
|
|
PFDEVICEPROPERTIESW pDevicePropertiesW;
|
|
|
|
|
|
|
|
hDevMgrDll = LoadLibraryW(L"devmgr.dll");
|
|
|
|
if (hDevMgrDll != NULL)
|
|
|
|
{
|
|
|
|
pDevicePropertiesW = (PFDEVICEPROPERTIESW)GetProcAddress(hDevMgrDll, "DevicePropertiesW");
|
|
|
|
if (pDevicePropertiesW != NULL)
|
|
|
|
pDevicePropertiesW(hwndParent, NULL, pszDevId, FALSE);
|
|
|
|
|
|
|
|
FreeLibrary(hDevMgrDll);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, pszDevId);
|
|
|
|
}
|
|
|
|
|
2020-03-29 22:37:45 +00:00
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
|
|
|
SafeRemovalDlgProc(
|
|
|
|
HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2020-03-31 20:43:42 +00:00
|
|
|
PHOTPLUG_DATA pHotplugData;
|
|
|
|
|
|
|
|
pHotplugData = (PHOTPLUG_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
2020-03-29 22:37:45 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2020-04-05 07:48:14 +00:00
|
|
|
pHotplugData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HOTPLUG_DATA));
|
2020-03-31 20:43:42 +00:00
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
2022-09-14 20:12:50 +00:00
|
|
|
WCHAR szWindowTitle[MAX_PATH];
|
|
|
|
|
2020-03-31 20:43:42 +00:00
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pHotplugData);
|
|
|
|
|
2022-09-14 20:12:50 +00:00
|
|
|
if (LoadStringW(hApplet,
|
|
|
|
IDS_CPLNAME,
|
|
|
|
szWindowTitle,
|
|
|
|
ARRAYSIZE(szWindowTitle)))
|
|
|
|
{
|
|
|
|
SetWindowTextW(hwndDlg, szWindowTitle);
|
|
|
|
}
|
|
|
|
|
2022-09-15 14:54:10 +00:00
|
|
|
pHotplugData->hIcon = (HICON)LoadImageW(hApplet,
|
|
|
|
MAKEINTRESOURCEW(IDI_HOTPLUG),
|
|
|
|
IMAGE_ICON,
|
|
|
|
GetSystemMetrics(SM_CXICON),
|
|
|
|
GetSystemMetrics(SM_CYICON),
|
|
|
|
LR_DEFAULTCOLOR);
|
|
|
|
pHotplugData->hIconSm = (HICON)LoadImageW(hApplet,
|
|
|
|
MAKEINTRESOURCEW(IDI_HOTPLUG),
|
|
|
|
IMAGE_ICON,
|
|
|
|
GetSystemMetrics(SM_CXSMICON),
|
|
|
|
GetSystemMetrics(SM_CYSMICON),
|
|
|
|
LR_DEFAULTCOLOR);
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)pHotplugData->hIcon);
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)pHotplugData->hIconSm);
|
|
|
|
|
2020-03-31 20:43:42 +00:00
|
|
|
pHotplugData->ImageListData.cbSize = sizeof(pHotplugData->ImageListData);
|
|
|
|
SetupDiGetClassImageList(&pHotplugData->ImageListData);
|
|
|
|
|
2020-04-05 07:48:14 +00:00
|
|
|
pHotplugData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_DEVICE_TREE));
|
2023-11-04 12:31:26 +00:00
|
|
|
pHotplugData->hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE);
|
2020-04-04 16:13:03 +00:00
|
|
|
pHotplugData->dwFlags = GetHotPlugFlags();
|
|
|
|
|
|
|
|
if (pHotplugData->dwFlags & HOTPLUG_DISPLAY_DEVICE_COMPONENTS)
|
|
|
|
Button_SetCheck(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DISPLAY_COMPONENTS), BST_CHECKED);
|
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
TreeView_SetImageList(pHotplugData->hwndDeviceTree,
|
2020-03-31 20:43:42 +00:00
|
|
|
pHotplugData->ImageListData.ImageList,
|
|
|
|
TVSIL_NORMAL);
|
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
EnumHotpluggedDevices(pHotplugData);
|
|
|
|
UpdateDialog(hwndDlg);
|
2020-03-31 20:43:42 +00:00
|
|
|
}
|
2020-03-29 22:37:45 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDCLOSE:
|
2020-03-30 21:11:44 +00:00
|
|
|
KillTimer(hwndDlg, 1);
|
2020-03-29 22:37:45 +00:00
|
|
|
EndDialog(hwndDlg, TRUE);
|
|
|
|
break;
|
|
|
|
|
2020-04-04 16:13:03 +00:00
|
|
|
case IDC_SAFE_REMOVE_DISPLAY_COMPONENTS:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
{
|
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
|
|
|
if (Button_GetCheck(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DISPLAY_COMPONENTS)) == BST_CHECKED)
|
|
|
|
pHotplugData->dwFlags |= HOTPLUG_DISPLAY_DEVICE_COMPONENTS;
|
|
|
|
else
|
|
|
|
pHotplugData->dwFlags &= ~HOTPLUG_DISPLAY_DEVICE_COMPONENTS;
|
|
|
|
|
|
|
|
SetHotPlugFlags(pHotplugData->dwFlags);
|
|
|
|
|
2023-11-04 12:31:26 +00:00
|
|
|
EnumHotpluggedDevices(pHotplugData);
|
|
|
|
UpdateDialog(hwndDlg);
|
2020-04-04 16:13:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2023-10-23 11:53:08 +00:00
|
|
|
|
|
|
|
case IDC_SAFE_REMOVE_PROPERTIES:
|
|
|
|
case IDM_PROPERTIES:
|
2023-11-04 12:31:26 +00:00
|
|
|
ShowDeviceProperties(hwndDlg, GetSelectedDeviceInst(pHotplugData));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_SAFE_REMOVE_STOP:
|
|
|
|
case IDM_STOP:
|
2023-10-23 11:53:08 +00:00
|
|
|
{
|
2023-11-04 12:31:26 +00:00
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
|
|
|
DialogBoxParamW(hApplet,
|
|
|
|
MAKEINTRESOURCEW(IDD_CONFIRM_STOP_HARDWARE_DIALOG),
|
|
|
|
hwndDlg,
|
|
|
|
ConfirmRemovalDlgProc,
|
|
|
|
(LPARAM)pHotplugData);
|
|
|
|
}
|
|
|
|
|
2023-10-23 11:53:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-03-29 22:37:45 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-03-30 21:11:44 +00:00
|
|
|
|
|
|
|
case WM_DEVICECHANGE:
|
|
|
|
switch (wParam)
|
|
|
|
{
|
|
|
|
case DBT_DEVNODES_CHANGED:
|
|
|
|
SetTimer(hwndDlg, 1, 500, NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_TIMER:
|
|
|
|
if (wParam == 1)
|
|
|
|
{
|
|
|
|
KillTimer(hwndDlg, 1);
|
2020-03-31 20:43:42 +00:00
|
|
|
|
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
2023-11-04 12:31:26 +00:00
|
|
|
EnumHotpluggedDevices(pHotplugData);
|
|
|
|
UpdateDialog(hwndDlg);
|
2020-04-05 07:48:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
if (((LPNMHDR)lParam)->idFrom == IDC_SAFE_REMOVE_DEVICE_TREE)
|
|
|
|
{
|
|
|
|
if (((LPNMHDR)lParam)->code == NM_RCLICK)
|
|
|
|
{
|
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
|
|
|
ShowContextMenu(hwndDlg,
|
|
|
|
((LPNMHDR)lParam)->hwndFrom,
|
|
|
|
pHotplugData);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-03-31 20:43:42 +00:00
|
|
|
}
|
2020-03-30 21:11:44 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_CLOSE:
|
|
|
|
KillTimer(hwndDlg, 1);
|
|
|
|
EndDialog(hwndDlg, TRUE);
|
|
|
|
break;
|
2020-03-31 20:43:42 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
if (pHotplugData != NULL)
|
|
|
|
{
|
2020-04-05 07:48:14 +00:00
|
|
|
if (pHotplugData->hPopupMenu != NULL)
|
|
|
|
DestroyMenu(pHotplugData->hPopupMenu);
|
|
|
|
|
2020-03-31 20:43:42 +00:00
|
|
|
SetupDiDestroyClassImageList(&pHotplugData->ImageListData);
|
|
|
|
|
2022-09-15 14:54:10 +00:00
|
|
|
if (pHotplugData->hIconSm)
|
|
|
|
DestroyIcon(pHotplugData->hIconSm);
|
|
|
|
|
|
|
|
if (pHotplugData->hIcon)
|
|
|
|
DestroyIcon(pHotplugData->hIcon);
|
|
|
|
|
2020-03-31 20:43:42 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, pHotplugData);
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)NULL);
|
|
|
|
}
|
|
|
|
break;
|
2020-03-29 22:37:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
LONG
|
|
|
|
APIENTRY
|
|
|
|
InitApplet(
|
2020-03-29 22:37:45 +00:00
|
|
|
HWND hwnd,
|
2013-02-17 15:51:07 +00:00
|
|
|
UINT uMsg,
|
|
|
|
LPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2020-04-04 16:13:03 +00:00
|
|
|
DPRINT("InitApplet()\n");
|
2020-03-29 22:37:45 +00:00
|
|
|
|
|
|
|
DialogBox(hApplet,
|
|
|
|
MAKEINTRESOURCE(IDD_SAFE_REMOVE_HARDWARE_DIALOG),
|
|
|
|
hwnd,
|
|
|
|
SafeRemovalDlgProc);
|
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
// TODO
|
2020-03-29 22:37:45 +00:00
|
|
|
return TRUE;
|
2013-02-17 15:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LONG
|
|
|
|
CALLBACK
|
|
|
|
CPlApplet(
|
|
|
|
HWND hwndCPl,
|
|
|
|
UINT uMsg,
|
|
|
|
LPARAM lParam1,
|
|
|
|
LPARAM lParam2)
|
|
|
|
{
|
2020-03-29 22:37:45 +00:00
|
|
|
UINT i = (UINT)lParam1;
|
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case CPL_INIT:
|
|
|
|
return TRUE;
|
2020-03-29 22:37:45 +00:00
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
case CPL_GETCOUNT:
|
|
|
|
return NUM_APPLETS;
|
2020-03-29 22:37:45 +00:00
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
case CPL_INQUIRE:
|
2022-09-17 04:59:51 +00:00
|
|
|
if (i < NUM_APPLETS)
|
2020-03-29 22:37:45 +00:00
|
|
|
{
|
|
|
|
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
|
|
|
|
CPlInfo->lData = 0;
|
|
|
|
CPlInfo->idIcon = Applets[i].idIcon;
|
|
|
|
CPlInfo->idName = Applets[i].idName;
|
|
|
|
CPlInfo->idInfo = Applets[i].idDescription;
|
|
|
|
}
|
2022-09-17 04:59:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2013-02-17 15:51:07 +00:00
|
|
|
break;
|
2020-03-29 22:37:45 +00:00
|
|
|
|
2013-02-17 15:51:07 +00:00
|
|
|
case CPL_DBLCLK:
|
2022-09-17 04:59:51 +00:00
|
|
|
if (i < NUM_APPLETS)
|
|
|
|
Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
|
|
|
else
|
|
|
|
return TRUE;
|
2013-02-17 15:51:07 +00:00
|
|
|
break;
|
2020-03-29 22:37:45 +00:00
|
|
|
|
|
|
|
case CPL_STARTWPARMSW:
|
2022-09-17 04:59:51 +00:00
|
|
|
if (i < NUM_APPLETS)
|
|
|
|
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
|
|
|
|
break;
|
2013-02-17 15:51:07 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
INT
|
|
|
|
WINAPI
|
|
|
|
DllMain(
|
|
|
|
HINSTANCE hinstDLL,
|
|
|
|
DWORD dwReason,
|
|
|
|
LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(lpvReserved);
|
|
|
|
|
2020-03-29 22:37:45 +00:00
|
|
|
switch (dwReason)
|
2013-02-17 15:51:07 +00:00
|
|
|
{
|
2020-03-29 22:37:45 +00:00
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
case DLL_THREAD_ATTACH:
|
|
|
|
hApplet = hinstDLL;
|
|
|
|
break;
|
2013-02-17 15:51:07 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|