Add a display class installer (useful when installing display drivers)
Use a common header for desk.cpl files
Modified: trunk/reactos/bootdata/packages/reactos.dff
Modified: trunk/reactos/lib/cpl/desk/appearance.c
Modified: trunk/reactos/lib/cpl/desk/background.c
Added: trunk/reactos/lib/cpl/desk/classinst.c
Modified: trunk/reactos/lib/cpl/desk/desk.c
Modified: trunk/reactos/lib/cpl/desk/desk.def
Modified: trunk/reactos/lib/cpl/desk/desk.h
Modified: trunk/reactos/lib/cpl/desk/desk.xml
Modified: trunk/reactos/lib/cpl/desk/dibitmap.c
Deleted: trunk/reactos/lib/cpl/desk/dibitmap.h
Modified: trunk/reactos/lib/cpl/desk/screensaver.c
Modified: trunk/reactos/lib/cpl/desk/settings.c
Added: trunk/reactos/media/inf/display.inf
Modified: trunk/reactos/media/inf/inf.xml
Modified: trunk/reactos/media/inf/syssetup.inf
_____
Modified: trunk/reactos/bootdata/packages/reactos.dff
--- trunk/reactos/bootdata/packages/reactos.dff 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/bootdata/packages/reactos.dff 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -293,6 +293,7 @@
media\drivers\etc\services 5
media\inf\acpi.inf 6
media\inf\cdrom.inf 6
+media\inf\display.inf 6
media\inf\hdc.inf 6
media\inf\layout.inf 6
media\inf\machine.inf 6
_____
Modified: trunk/reactos/lib/cpl/desk/appearance.c
--- trunk/reactos/lib/cpl/desk/appearance.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/appearance.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -8,11 +8,8 @@
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
*/
-#include <windows.h>
-#include <commctrl.h>
+#include "desk.h"
-#include "resource.h"
-
INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
_____
Modified: trunk/reactos/lib/cpl/desk/background.c
--- trunk/reactos/lib/cpl/desk/background.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/background.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -8,16 +8,7 @@
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
*/
-#include <windows.h>
-#include <commctrl.h>
-#include <commdlg.h>
-#include <cpl.h>
-#include <tchar.h>
-
-#include "resource.h"
-
#include "desk.h"
-#include "dibitmap.h"
#define MAX_BACKGROUNDS 100
_____
Added: trunk/reactos/lib/cpl/desk/classinst.c
--- trunk/reactos/lib/cpl/desk/classinst.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/classinst.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -0,0 +1,177 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Plug & Play
+ * FILE: lib/cpl/desk/classinst.c
+ * PURPOSE: Display class installer
+ *
+ * PROGRAMMERS: HervÚ Poussineau (hpoussin(a)reactos.org)
+ */
+
+//#define NDEBUG
+#include <debug.h>
+
+#include "desk.h"
+
+DWORD WINAPI
+DisplayClassInstaller(
+ IN DI_FUNCTION InstallFunction,
+ IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
+{
+ SP_DEVINSTALL_PARAMS InstallParams;
+ SP_DRVINFO_DATA DriverInfoData;
+ HINF hInf = INVALID_HANDLE_VALUE;
+ TCHAR SectionName[MAX_PATH];
+ TCHAR ServiceName[MAX_SERVICE_NAME_LEN];
+ SP_DRVINFO_DETAIL_DATA DriverInfoDetailData;
+ HKEY hServicesKey = INVALID_HANDLE_VALUE;
+ HKEY hServiceKey = INVALID_HANDLE_VALUE;
+ HKEY hDeviceSubKey = INVALID_HANDLE_VALUE;
+ DWORD disposition;
+ BOOL result;
+ LONG rc;
+
+ if (InstallFunction != DIF_INSTALLDEVICE)
+ return ERROR_DI_DO_DEFAULT;
+
+ InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
+ result = SetupDiGetDeviceInstallParams(DeviceInfoSet,
DeviceInfoData, &InstallParams);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetDeviceInstallParams() failed with
error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ InstallParams.Flags |= DI_NEEDRESTART;
+
+ result = SetupDiSetDeviceInstallParams(DeviceInfoSet,
DeviceInfoData, &InstallParams);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiSetDeviceInstallParams() failed with
error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA);
+ result = SetupDiGetSelectedDriver(DeviceInfoSet, DeviceInfoData,
&DriverInfoData);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetSelectedDriver() failed with error
0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA);
+ result = SetupDiGetDriverInfoDetail(
+ DeviceInfoSet, DeviceInfoData,
+ &DriverInfoData, &DriverInfoDetailData,
+ sizeof(SP_DRVINFO_DETAIL_DATA), NULL);
+ if (!result && GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetDriverInfoDetail() failed with error
0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL,
INF_STYLE_WIN4, NULL);
+ if (hInf == INVALID_HANDLE_VALUE)
+ {
+ rc = GetLastError();
+ DPRINT("SetupOpenInfFile() failed with error 0x%lx\n",
rc);
+ goto cleanup;
+ }
+
+ result = SetupDiGetActualSectionToInstall(
+ hInf, DriverInfoDetailData.SectionName,
+ SectionName, MAX_PATH -
_tcslen(_T(".SoftwareSettings")), NULL, NULL);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetActualSectionToInstall() failed with
error 0x%lx\n", rc);
+ goto cleanup;
+ }
+ _tcscat(SectionName, _T(".SoftwareSettings"));
+
+ result = SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetDeviceRegistryProperty() failed with
error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ result = SetupDiGetDeviceRegistryProperty(
+ DeviceInfoSet, DeviceInfoData,
+ SPDRP_SERVICE, NULL,
+ (PBYTE)ServiceName, MAX_SERVICE_NAME_LEN *
sizeof(TCHAR), NULL);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupDiGetDeviceRegistryProperty() failed with
error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ rc = RegOpenKeyEx(
+ HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Services"),
+ 0, KEY_ENUMERATE_SUB_KEYS, &hServicesKey);
+ if (rc != ERROR_SUCCESS)
+ {
+ DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
+ goto cleanup;
+ }
+ rc = RegOpenKeyEx(
+ hServicesKey, ServiceName,
+ 0, KEY_CREATE_SUB_KEY, &hServiceKey);
+ if (rc != ERROR_SUCCESS)
+ {
+ DPRINT("RegOpenKeyEx() failed with error 0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ /* Create a Device0 subkey (FIXME: do a loop to find a free
number?) */
+ rc = RegCreateKeyEx(
+ hServiceKey, _T("Device0"), 0, NULL,
+ REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
+ &hDeviceSubKey, &disposition);
+ if (rc != ERROR_SUCCESS)
+ {
+ DPRINT("RegCreateKeyEx() failed with error 0x%lx\n",
rc);
+ goto cleanup;
+ }
+ if (disposition != REG_CREATED_NEW_KEY)
+ {
+ rc = ERROR_GEN_FAILURE;
+ DPRINT("RegCreateKeyEx() failed\n");
+ goto cleanup;
+ }
+
+ /* Install SoftwareSettings section */
+ result = SetupInstallFromInfSection(
+ InstallParams.hwndParent, hInf, SectionName,
+ SPINST_REGISTRY, hDeviceSubKey,
+ NULL, 0, NULL, NULL,
+ NULL, NULL);
+ if (!result)
+ {
+ rc = GetLastError();
+ DPRINT("SetupInstallFromInfSection() failed with error
0x%lx\n", rc);
+ goto cleanup;
+ }
+
+ /* FIXME: install OpenGLSoftwareSettings section */
+
+ rc = ERROR_SUCCESS;
+
+cleanup:
+ if (hInf != INVALID_HANDLE_VALUE)
+ SetupCloseInfFile(hInf);
+ if (hServicesKey != INVALID_HANDLE_VALUE)
+ RegCloseKey(hServicesKey);
+ if (hServiceKey != INVALID_HANDLE_VALUE)
+ RegCloseKey(hServiceKey);
+ if (hDeviceSubKey != INVALID_HANDLE_VALUE)
+ RegCloseKey(hDeviceSubKey);
+
+ return rc;
+}
Property changes on: trunk/reactos/lib/cpl/desk/classinst.c
___________________________________________________________________
Name: svn:eol-style
+ native
_____
Modified: trunk/reactos/lib/cpl/desk/desk.c
--- trunk/reactos/lib/cpl/desk/desk.c 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/lib/cpl/desk/desk.c 2005-10-22 17:18:33 UTC (rev
18683)
@@ -8,11 +8,6 @@
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
*/
-#include <windows.h>
-#include <commctrl.h>
-#include <cpl.h>
-
-#include "resource.h"
#include "desk.h"
#define NUM_APPLETS (1)
_____
Modified: trunk/reactos/lib/cpl/desk/desk.def
--- trunk/reactos/lib/cpl/desk/desk.def 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/lib/cpl/desk/desk.def 2005-10-22 17:18:33 UTC (rev
18683)
@@ -2,5 +2,6 @@
EXPORTS
CPlApplet@16
+DisplayClassInstaller@12
; EOF
_____
Modified: trunk/reactos/lib/cpl/desk/desk.h
--- trunk/reactos/lib/cpl/desk/desk.h 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/lib/cpl/desk/desk.h 2005-10-22 17:18:33 UTC (rev
18683)
@@ -1,6 +1,16 @@
#ifndef __CPL_DESK_H__
#define __CPL_DESK_H__
+#include <windows.h>
+#include <commctrl.h>
+#include <commdlg.h>
+#include <cpl.h>
+#include <tchar.h>
+#include <setupapi.h>
+#include <stdio.h>
+
+#include "resource.h"
+
typedef struct
{
int idIcon;
@@ -13,5 +23,21 @@
extern HINSTANCE hApplet;
+typedef struct
+{
+ BITMAPFILEHEADER *header;
+ BITMAPINFO *info;
+ BYTE *bits;
+
+ int width;
+ int height;
+
+} DIBitmap;
+
+extern DIBitmap *DibLoadImage(TCHAR *filename);
+extern void DibFreeImage(DIBitmap *bitmap);
+
+DWORD DbgPrint(PCH Format,...);
+
#endif /* __CPL_DESK_H__ */
_____
Modified: trunk/reactos/lib/cpl/desk/desk.xml
--- trunk/reactos/lib/cpl/desk/desk.xml 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/lib/cpl/desk/desk.xml 2005-10-22 17:18:33 UTC (rev
18683)
@@ -14,13 +14,15 @@
<library>gdi32</library>
<library>comctl32</library>
<library>comdlg32</library>
+ <library>setupapi</library>
<library>shell32</library>
- <file>desk.c</file>
+ <library>ntdll</library>
+ <file>classinst.c</file>
+ <file>desk.c</file>
<file>background.c</file>
<file>screensaver.c</file>
<file>appearance.c</file>
<file>settings.c</file>
- <file>dibitmap.c</file>
- <file>desk.rc</file>
-
+ <file>dibitmap.c</file>
+ <file>desk.rc</file>
</module>
_____
Modified: trunk/reactos/lib/cpl/desk/dibitmap.c
--- trunk/reactos/lib/cpl/desk/dibitmap.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/dibitmap.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -8,7 +8,7 @@
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
*/
-#include "dibitmap.h"
+#include "desk.h"
DIBitmap *DibLoadImage(TCHAR *filename)
{
_____
Deleted: trunk/reactos/lib/cpl/desk/dibitmap.h
--- trunk/reactos/lib/cpl/desk/dibitmap.h 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/dibitmap.h 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -1,22 +0,0 @@
-
-#ifndef __DIBITMAP_H__
-#define __DIBITMAP_H__
-
-#include <windows.h>
-
-typedef struct
-{
- BITMAPFILEHEADER *header;
- BITMAPINFO *info;
- BYTE *bits;
-
- int width;
- int height;
-
-} DIBitmap;
-
-extern DIBitmap *DibLoadImage(TCHAR *filename);
-extern void DibFreeImage(DIBitmap *bitmap);
-
-#endif /* __DIBITMAP_H__ */
-
_____
Modified: trunk/reactos/lib/cpl/desk/screensaver.c
--- trunk/reactos/lib/cpl/desk/screensaver.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/screensaver.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -8,12 +8,6 @@
* PROGRAMMERS: Trevor McCort (lycan359(a)gmail.com)
*/
-#include <windows.h>
-#include <commctrl.h>
-
-#include "resource.h"
-#include <cpl.h>
-#include <tchar.h>
#include "desk.h"
#define MAX_SCREENSAVERS 100
_____
Modified: trunk/reactos/lib/cpl/desk/settings.c
--- trunk/reactos/lib/cpl/desk/settings.c 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/lib/cpl/desk/settings.c 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -9,13 +9,6 @@
* HervÚ Poussineau (poussine(a)freesurf.fr)
*/
-#include <windows.h>
-#include <commctrl.h>
-#include <stdio.h>
-#include <tchar.h>
-#include <cpl.h>
-
-#include "resource.h"
#include "desk.h"
/* As slider control can't contain user data, we have to keep an
_____
Added: trunk/reactos/media/inf/display.inf
--- trunk/reactos/media/inf/display.inf 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/media/inf/display.inf 2005-10-22 17:18:33 UTC (rev
18683)
@@ -0,0 +1,25 @@
+; Display.INF
+;
+; Installation file for the Display class
+;
+[Version]
+Signature = "$Windows NT$"
+;Signature = "$ReactOS$"
+LayoutFile = layout.inf
+
+Class = Display
+ClassGUID = {4d36e968-e325-11ce-bfc1-08002be10318}
+Provider = %ReactOS%
+DriverVer = 10/18/2005,1.00
+
+[ClassInstall32.NT]
+AddReg = DisplayClass.NT.AddReg
+
+[DisplayClass.NT.AddReg]
+HKR, , , 0, %DisplayClassName%
+HKR, , Icon, 0, "-1"
+HKR, , Installer32, 0, "desk.cpl,DisplayClassInstaller"
+
+[Strings]
+ReactOS = "ReactOS Team"
+DisplayClassName = "Display Adapters"
_____
Modified: trunk/reactos/media/inf/inf.xml
--- trunk/reactos/media/inf/inf.xml 2005-10-22 17:13:49 UTC (rev
18682)
+++ trunk/reactos/media/inf/inf.xml 2005-10-22 17:18:33 UTC (rev
18683)
@@ -1,6 +1,7 @@
<group>
<installfile base="inf">acpi.inf</installfile>
<installfile base="inf">cdrom.inf</installfile>
+<installfile base="inf">display.inf</installfile>
<installfile base="inf">hdc.inf</installfile>
<installfile base="inf">layout.inf</installfile>
<installfile base="inf">machine.inf</installfile>
_____
Modified: trunk/reactos/media/inf/syssetup.inf
--- trunk/reactos/media/inf/syssetup.inf 2005-10-22 17:13:49 UTC
(rev 18682)
+++ trunk/reactos/media/inf/syssetup.inf 2005-10-22 17:18:33 UTC
(rev 18683)
@@ -15,6 +15,7 @@
; MS uses netnovel.inf as class-installer INF for NICs
; we use a separate one to keep things clean
cdrom.inf
+display.inf
hdc.inf
machine.inf
mouse.inf