From 5503d02bba261135d62259a112e3418446b4b45d Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 17 Feb 2013 15:51:07 +0000 Subject: [PATCH] [HOTPLUG] - start on safely remove hardware applet - resources are not yet commited svn path=/trunk/; revision=58337 --- reactos/dll/cpl/hotplug/CMakeLists.txt | 26 ++++++++ reactos/dll/cpl/hotplug/enum.c | 7 +++ reactos/dll/cpl/hotplug/hotplug.c | 87 ++++++++++++++++++++++++++ reactos/dll/cpl/hotplug/hotplug.h | 41 ++++++++++++ reactos/dll/cpl/hotplug/hotplug.rc | 20 ++++++ reactos/dll/cpl/hotplug/hotplug.spec | 12 ++++ reactos/dll/cpl/hotplug/resource.h | 11 ++++ reactos/dll/cpl/hotplug/rsrc.rc | 8 +++ 8 files changed, 212 insertions(+) create mode 100644 reactos/dll/cpl/hotplug/CMakeLists.txt create mode 100644 reactos/dll/cpl/hotplug/enum.c create mode 100644 reactos/dll/cpl/hotplug/hotplug.c create mode 100644 reactos/dll/cpl/hotplug/hotplug.h create mode 100644 reactos/dll/cpl/hotplug/hotplug.rc create mode 100644 reactos/dll/cpl/hotplug/hotplug.spec create mode 100644 reactos/dll/cpl/hotplug/resource.h create mode 100644 reactos/dll/cpl/hotplug/rsrc.rc diff --git a/reactos/dll/cpl/hotplug/CMakeLists.txt b/reactos/dll/cpl/hotplug/CMakeLists.txt new file mode 100644 index 00000000000..c117ef72802 --- /dev/null +++ b/reactos/dll/cpl/hotplug/CMakeLists.txt @@ -0,0 +1,26 @@ + + +spec2def(hotplug.dll hotplug.spec) + +list(APPEND SOURCE + hotplug.c + enum.c + hotplug.rc + ${CMAKE_CURRENT_BINARY_DIR}/hotplug.def) + +add_library(hotplug SHARED ${SOURCE}) + +set_module_type(hotplug win32dll UNICODE) + +add_importlibs(hotplug + msvcrt + user32 + gdi32 + advapi32 + ntdll + setupapi + comctl32 + kernel32) + +add_pch(hotplug hotplug.h) +add_cd_file(TARGET hotplug DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/cpl/hotplug/enum.c b/reactos/dll/cpl/hotplug/enum.c new file mode 100644 index 00000000000..f63d8746b7b --- /dev/null +++ b/reactos/dll/cpl/hotplug/enum.c @@ -0,0 +1,7 @@ +/* + * PROJECT: Safely Remove Hardware Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/hotplug/hotplug.c + * PURPOSE: device enumeration + * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) + */ diff --git a/reactos/dll/cpl/hotplug/hotplug.c b/reactos/dll/cpl/hotplug/hotplug.c new file mode 100644 index 00000000000..733e16c0de6 --- /dev/null +++ b/reactos/dll/cpl/hotplug/hotplug.c @@ -0,0 +1,87 @@ +/* +* PROJECT: Safely Remove Hardware Applet +* LICENSE: GPL - See COPYING in the top level directory +* FILE: dll/cpl/hotplug/hotplug.c +* PURPOSE: applet initialization +* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) +*/ + +#include "hotplug.h" + +// globals +HINSTANCE hApplet = 0; + +/* Applets */ +APPLET Applets[NUM_APPLETS] = +{ + {IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, InitApplet} +}; + + +LONG +APIENTRY +InitApplet( + HWND hwnd, + UINT uMsg, + LPARAM wParam, + LPARAM lParam) +{ + // TODO + return FALSE; +} + + +LONG +CALLBACK +CPlApplet( + HWND hwndCPl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + switch(uMsg) + { + case CPL_INIT: + { + return TRUE; + } + case CPL_GETCOUNT: + { + return NUM_APPLETS; + } + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->idIcon = Applets[0].idIcon; + CPlInfo->idName = Applets[0].idName; + CPlInfo->idInfo = Applets[0].idDescription; + break; + } + case CPL_DBLCLK: + { + InitApplet(hwndCPl, uMsg, lParam1, lParam2); + break; + } + } + return FALSE; +} + + +INT +WINAPI +DllMain( + HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpvReserved) +{ + UNREFERENCED_PARAMETER(lpvReserved); + + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + hApplet = hinstDLL; + break; + } + return TRUE; +} diff --git a/reactos/dll/cpl/hotplug/hotplug.h b/reactos/dll/cpl/hotplug/hotplug.h new file mode 100644 index 00000000000..b21d59a0235 --- /dev/null +++ b/reactos/dll/cpl/hotplug/hotplug.h @@ -0,0 +1,41 @@ +#pragma once + +#define WIN32_NO_STATUS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +// Globals +extern HINSTANCE hApplet; + +// defines +#define NUM_APPLETS (1) + +// global structures +typedef struct +{ + int idIcon; + int idName; + int idDescription; + APPLET_PROC AppletProc; +}APPLET, *PAPPLET; + + + +// hotplug.c +LONG +APIENTRY +InitApplet( + HWND hwnd, + UINT uMsg, + LPARAM wParam, + LPARAM lParam); diff --git a/reactos/dll/cpl/hotplug/hotplug.rc b/reactos/dll/cpl/hotplug/hotplug.rc new file mode 100644 index 00000000000..bdbe51a06fb --- /dev/null +++ b/reactos/dll/cpl/hotplug/hotplug.rc @@ -0,0 +1,20 @@ +/* + * PROJECT: ReactOS Safely Remove Hardware Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/hotplug/hotplug.rc + * PURPOSE: main resource file + * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) + */ + +#include +#include + +#include "resource.h" + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Hardware Safe Removal Support\0" +#define REACTOS_STR_INTERNAL_NAME "hotplug\0" +#define REACTOS_STR_ORIGINAL_FILENAME "hotplug.dll\0" +#include + +#include "rsrc.rc" diff --git a/reactos/dll/cpl/hotplug/hotplug.spec b/reactos/dll/cpl/hotplug/hotplug.spec new file mode 100644 index 00000000000..8ec310bac27 --- /dev/null +++ b/reactos/dll/cpl/hotplug/hotplug.spec @@ -0,0 +1,12 @@ +@ stdcall CPlApplet(ptr long ptr ptr) +;@ stub HotPlugChildWithInvalidIdW +;@ stub HotPlugDriverBlockedW +;@ stub HotPlugEjectDevice +;@ stub HotPlugEjectDeviceEx +;@ stub HotPlugEjectVetoedW +;@ stub HotPlugHibernateVetoedW +;@ stub HotPlugRemovealVetoedW +;@ stub HotPlugSafeRemovalDriveNotificationW +;@ stub HotPlugSafeRemovalNotificationW +;@ stub HotPlugStandyVetoedW +;@ stub HotPlugWarmEjectVetoedW diff --git a/reactos/dll/cpl/hotplug/resource.h b/reactos/dll/cpl/hotplug/resource.h new file mode 100644 index 00000000000..1480b134cce --- /dev/null +++ b/reactos/dll/cpl/hotplug/resource.h @@ -0,0 +1,11 @@ + +// dialog ids +#define IDD_SAFE_REMOVE_HARDWARE_DIALOG 100 +#define IDD_CONFIRM_STOP_HARDWARE_DIALOG 101 + +// resource strings ids +#define IDS_CPLNAME 1000 +#define IDS_CPLDESCRIPTION 1001 + +// control ids +#define IDC_CPLICON 10000 diff --git a/reactos/dll/cpl/hotplug/rsrc.rc b/reactos/dll/cpl/hotplug/rsrc.rc new file mode 100644 index 00000000000..14b2a29a79f --- /dev/null +++ b/reactos/dll/cpl/hotplug/rsrc.rc @@ -0,0 +1,8 @@ +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#ifdef LANGUAGE_DE_DE + #include "lang/de-DE.rc" +#endif +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif