[HOTPLUG] Enable the hotplug.cpl and add the 'Safely Remove Hardware' dialog

This commit is contained in:
Eric Kohl 2020-03-30 00:37:45 +02:00
parent 177ae91bf6
commit 2125fec23a
8 changed files with 136 additions and 26 deletions

View file

@ -4,6 +4,7 @@ add_subdirectory(appwiz)
add_subdirectory(console) add_subdirectory(console)
add_subdirectory(desk) add_subdirectory(desk)
add_subdirectory(hdwwiz) add_subdirectory(hdwwiz)
add_subdirectory(hotplug)
add_subdirectory(inetcpl) add_subdirectory(inetcpl)
add_subdirectory(input) add_subdirectory(input)
add_subdirectory(intl) add_subdirectory(intl)

View file

@ -5,6 +5,9 @@ list(APPEND SOURCE
hotplug.c hotplug.c
enum.c) enum.c)
file(GLOB hotplug_rc_deps resources/*.*)
add_rc_deps(hotplug.rc ${hotplug_rc_deps})
add_library(hotplug MODULE add_library(hotplug MODULE
${SOURCE} ${SOURCE}
hotplug.rc hotplug.rc

View file

@ -8,26 +8,66 @@
#include "hotplug.h" #include "hotplug.h"
#define NDEBUG
#include <debug.h>
// globals // globals
HINSTANCE hApplet = 0; HINSTANCE hApplet = 0;
/* Applets */ /* Applets */
APPLET Applets[NUM_APPLETS] = APPLET Applets[NUM_APPLETS] =
{ {
{IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet} {IDI_HOTPLUG, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet}
}; };
INT_PTR
CALLBACK
SafeRemovalDlgProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCLOSE:
EndDialog(hwndDlg, TRUE);
break;
}
break;
}
return FALSE;
}
LONG LONG
APIENTRY APIENTRY
InitApplet( InitApplet(
HWND hwnd, HWND hwnd,
UINT uMsg, UINT uMsg,
LPARAM wParam, LPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
DPRINT1("InitApplet()\n");
DialogBox(hApplet,
MAKEINTRESOURCE(IDD_SAFE_REMOVE_HARDWARE_DIALOG),
hwnd,
SafeRemovalDlgProc);
// TODO // TODO
return FALSE; return TRUE;
} }
@ -39,29 +79,32 @@ CPlApplet(
LPARAM lParam1, LPARAM lParam1,
LPARAM lParam2) LPARAM lParam2)
{ {
UINT i = (UINT)lParam1;
switch(uMsg) switch(uMsg)
{ {
case CPL_INIT: case CPL_INIT:
{
return TRUE; return TRUE;
}
case CPL_GETCOUNT: case CPL_GETCOUNT:
{
return NUM_APPLETS; return NUM_APPLETS;
}
case CPL_INQUIRE: case CPL_INQUIRE:
{ {
CPLINFO *CPlInfo = (CPLINFO*)lParam2; CPLINFO *CPlInfo = (CPLINFO*)lParam2;
CPlInfo->idIcon = Applets[0].idIcon; CPlInfo->lData = 0;
CPlInfo->idName = Applets[0].idName; CPlInfo->idIcon = Applets[i].idIcon;
CPlInfo->idInfo = Applets[0].idDescription; CPlInfo->idName = Applets[i].idName;
CPlInfo->idInfo = Applets[i].idDescription;
}
break; break;
}
case CPL_DBLCLK: case CPL_DBLCLK:
{ Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
InitApplet(hwndCPl, uMsg, lParam1, lParam2);
break; break;
}
case CPL_STARTWPARMSW:
return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
} }
return FALSE; return FALSE;
} }
@ -76,12 +119,12 @@ DllMain(
{ {
UNREFERENCED_PARAMETER(lpvReserved); UNREFERENCED_PARAMETER(lpvReserved);
switch(dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
hApplet = hinstDLL; hApplet = hinstDLL;
break; break;
} }
return TRUE; return TRUE;
} }

View file

@ -7,11 +7,29 @@
*/ */
#include <windef.h> #include <windef.h>
#include <winuser.h>
#include <commctrl.h>
#include "resource.h" #include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_VERSION_DLL #define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Hardware Safe Removal Support" #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Hardware Safe Removal Support"
#define REACTOS_STR_INTERNAL_NAME "hotplug" #define REACTOS_STR_INTERNAL_NAME "hotplug"
#define REACTOS_STR_ORIGINAL_FILENAME "hotplug.dll" #define REACTOS_STR_ORIGINAL_FILENAME "hotplug.dll"
#include <reactos/version.rc> #include <reactos/version.rc>
IDI_HOTPLUG ICON "resources/1.ico"
#include <reactos/manifest_hosted.rc>
/* UTF-8 */
#pragma code_page(65001)
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif

View file

@ -0,0 +1,18 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
IDD_SAFE_REMOVE_HARDWARE_DIALOG DIALOGEX 0, 0, 278, 245
CAPTION "Hardware sicher entfernen"
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDI_HOTPLUG, IDC_SAFE_REMOVE_ICON, 7, 10, 20, 20
LTEXT "Wählen Sie das Gerät aus, das Sie entfernen möchten, und klicken Sie auf ""Beenden"". Sie erhalten eine Benachrichtigung, wenn Sie das Gerät sicher entfernen können.", IDC_STATIC, 36, 12, 234, 24, WS_CHILD | WS_VISIBLE | WS_GROUP
LTEXT "&Hardwarekomponenten:", IDC_STATIC, 7, 42, 248, 8, WS_CHILD | WS_VISIBLE | WS_GROUP
CONTROL "", IDC_SAFE_REMOVE_DEVICE_TREE, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 7, 52, 264, 102
LTEXT "", IDC_SAFE_REMOVE_TEXT, 7, 156, 264, 16, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "E&igenschaften", IDC_SAFE_REMOVE_PROPERTIES, 158, 178, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "B&eenden", IDC_SAFE_REMOVE_STOP, 216, 178, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
CONTROL "", IDC_STATIC, "static", SS_CENTER | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 7, 200, 264, 1
AUTOCHECKBOX "&Gerätekomponenten anzeigen", IDC_SAFE_REMOVE_DISPLAY_COMPONENTS, 7, 208, 112, 10, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Schließen", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END

View file

@ -0,0 +1,18 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_SAFE_REMOVE_HARDWARE_DIALOG DIALOGEX 0, 0, 278, 245
CAPTION "Safely Remove Hardware"
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDI_HOTPLUG, IDC_SAFE_REMOVE_ICON, 7, 10, 20, 20
LTEXT "Select the device you want to unplug or eject, and then click Stop. When ReactOS notifies you that it is safe to do so unplug the device from your computer.", IDC_STATIC, 36, 12, 234, 24, WS_CHILD | WS_VISIBLE | WS_GROUP
LTEXT "&Hardware devices:", IDC_STATIC, 7, 42, 248, 8, WS_CHILD | WS_VISIBLE | WS_GROUP
CONTROL "", IDC_SAFE_REMOVE_DEVICE_TREE, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 7, 52, 264, 102
LTEXT "", IDC_SAFE_REMOVE_TEXT, 7, 156, 264, 16, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "&Properties", IDC_SAFE_REMOVE_PROPERTIES, 158, 178, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Stop", IDC_SAFE_REMOVE_STOP, 216, 178, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
CONTROL "", IDC_STATIC, "static", SS_CENTER | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 7, 200, 264, 1
AUTOCHECKBOX "&Display device components", IDC_SAFE_REMOVE_DISPLAY_COMPONENTS, 7, 208, 112, 10, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Close", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END

View file

@ -1,12 +1,21 @@
#pragma once #pragma once
/* Icon ids */
#define IDI_HOTPLUG 100
/* Dialog ids */ /* Dialog ids */
#define IDD_SAFE_REMOVE_HARDWARE_DIALOG 100 #define IDC_STATIC -1
#define IDD_CONFIRM_STOP_HARDWARE_DIALOG 101
#define IDD_SAFE_REMOVE_HARDWARE_DIALOG 300
#define IDC_SAFE_REMOVE_ICON 301
#define IDC_SAFE_REMOVE_DEVICE_TREE 302
#define IDC_SAFE_REMOVE_TEXT 303
#define IDC_SAFE_REMOVE_PROPERTIES 304
#define IDC_SAFE_REMOVE_STOP 305
#define IDC_SAFE_REMOVE_DISPLAY_COMPONENTS 306
#define IDD_CONFIRM_STOP_HARDWARE_DIALOG 310
/* Resource strings ids */ /* Resource strings ids */
#define IDS_CPLNAME 1000 #define IDS_CPLNAME 1000
#define IDS_CPLDESCRIPTION 1001 #define IDS_CPLDESCRIPTION 1001
/* Control ids */
#define IDC_CPLICON 10000

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB