Add "Add hardware" control panel applet.

Not added to the build, as InstallNewDevice in newdev.dll is not implemented

svn path=/trunk/; revision=18239
This commit is contained in:
Hervé Poussineau 2005-10-03 07:48:59 +00:00
parent 88f8bc8a25
commit 7a6054e30a
10 changed files with 229 additions and 0 deletions

View file

@ -5,6 +5,7 @@
<property name="BASEADDRESS_UXTHEME" value="0x5AD70000" />
<property name="BASEADDRESS_OBJSEL" value="0x5B400000" />
<property name="BASEADDRESS_DINPUT" value="0x5F580000" />
<property name="BASEADDRESS_HDWWIZ" value="0x64D40000" />
<property name="BASEADDRESS_TIMEDATE" value="0x64DA0000" />
<property name="BASEADDRESS_SYSDM" value="0x64DD0000" />
<property name="BASEADDRESS_MAIN" value="0x64F40000" />

View file

@ -0,0 +1,7 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE
BEGIN
IDS_CPLNAME "Add hardware"
IDS_CPLDESCRIPTION "Add hardware to your computer."
END

View file

@ -0,0 +1,7 @@
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_CPLNAME "Ajout de matériel"
IDS_CPLDESCRIPTION "Ajoute un nouveau matériel à votre ordinateur."
END

View file

@ -0,0 +1,146 @@
/*
* ReactOS New devices installation
* Copyright (C) 2005 ReactOS Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* PROJECT: ReactOS Add hardware control panel
* FILE: lib/cpl/hdwwiz/hdwwiz.c
* PURPOSE: ReactOS Add hardware control panel
* PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
*/
#include <windows.h>
#include <commctrl.h>
#include <setupapi.h>
#include <cpl.h>
#include <tchar.h>
#include <stdio.h>
#include "resource.h"
#include "hdwwiz.h"
LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
HINSTANCE hApplet = 0;
/* Applets */
APPLET Applets[] =
{
{IDI_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
};
typedef BOOL (*PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
LONG APIENTRY
Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
{
HMODULE hNewDev = NULL;
PINSTALL_NEW_DEVICE InstallNewDevice;
DWORD Reboot;
BOOL ret;
LONG rc;
hNewDev = LoadLibrary(_T("newdev.dll"));
if (!hNewDev)
{
rc = 1;
goto cleanup;
}
InstallNewDevice = (PINSTALL_NEW_DEVICE)GetProcAddress(hNewDev, (LPCSTR)"InstallNewDevice");
if (!InstallNewDevice)
{
rc = 2;
goto cleanup;
}
ret = InstallNewDevice(hwnd, NULL, &Reboot);
if (!ret)
{
rc = 3;
goto cleanup;
}
if (Reboot != DI_NEEDRESTART && Reboot != DI_NEEDREBOOT)
{
/* We're done with installation */
rc = 0;
goto cleanup;
}
/* We need to reboot */
if (SetupPromptReboot(NULL, hwnd, FALSE) == -1)
{
/* User doesn't want to reboot, or an error occurred */
rc = 5;
goto cleanup;
}
rc = 0;
cleanup:
if (hNewDev != NULL)
FreeLibrary(hNewDev);
return rc;
}
/* Control Panel Callback */
LONG CALLBACK
CPlApplet(HWND hwndCpl,
UINT uMsg,
LPARAM lParam1,
LPARAM lParam2)
{
int i = (int)lParam1;
switch (uMsg)
{
case CPL_INIT:
return TRUE;
case CPL_GETCOUNT:
return sizeof(Applets)/sizeof(Applets[0]);
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;
}
case CPL_DBLCLK:
{
Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
break;
}
}
return FALSE;
}
BOOL WINAPI
DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
hApplet = hinstDLL;
break;
}
return TRUE;
}

View file

@ -0,0 +1,6 @@
LIBRARY hdwwiz.cpl
EXPORTS
CPlApplet@16
; EOF

View file

@ -0,0 +1,16 @@
#ifndef __CPL_HDWWIZ_H
#define __CPL_HDWWIZ_H
typedef struct
{
int idIcon;
int idName;
int idDescription;
APPLET_PROC AppletProc;
} APPLET, *PAPPLET;
extern HINSTANCE hApplet;
#endif /* __CPL_HDWWIZ_H */
/* EOF */

View file

@ -0,0 +1,21 @@
#include <windows.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Software Control Panel\0"
#define REACTOS_STR_INTERNAL_NAME "hdwwiz\0"
#define REACTOS_STR_ORIGINAL_FILENAME "hdwwiz.cpl\0"
#ifdef _MSC_VER
#include <../../../reactos/version.rc>
#else
#include <reactos/version.rc>
#endif
IDI_CPLICON ICON "resources/applet.ico"
#include "En.rc"
#include "Fr.rc"

View file

@ -0,0 +1,13 @@
<module name="hdwwiz" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_HDWWIZ}" installbase="system32" installname="hdwwiz.cpl">
<importlibrary definition="hdwwiz.def" />
<include base="hdwwiz">.</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<library>setupapi</library>
<file>hdwwiz.c</file>
<file>hdwwiz.rc</file>
</module>

View file

@ -0,0 +1,12 @@
#ifndef __CPL_RESOURCE_H
#define __CPL_RESOURCE_H
/* ids */
#define IDI_CPLICON 1
#define IDS_CPLNAME 2
#define IDS_CPLDESCRIPTION 3
#endif /* __CPL_RESOURCE_H */
/* EOF */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB