[HOTPLUG]

- start on safely remove hardware applet
- resources are not yet commited

svn path=/trunk/; revision=58337
This commit is contained in:
Johannes Anderwald
2013-02-17 15:51:07 +00:00
parent 2b6431ea3e
commit 5503d02bba
8 changed files with 212 additions and 0 deletions
+26
View File
@@ -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)
+7
View File
@@ -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 ([email protected])
*/
+87
View File
@@ -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 ([email protected])
*/
#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;
}
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#define WIN32_NO_STATUS
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <wincon.h>
#include <commctrl.h>
#include <cpl.h>
#include <tchar.h>
#include <limits.h>
#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);
+20
View File
@@ -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 ([email protected])
*/
#include <windef.h>
#include <winuser.h>
#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 <reactos/version.rc>
#include "rsrc.rc"
+12
View File
@@ -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
+11
View File
@@ -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
+8
View File
@@ -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