added an initial mmsys.cpl. not added to the build system because w32api lacks a...
authorThomas Bluemel <thomas@reactsoft.com>
Wed, 23 Nov 2005 23:02:35 +0000 (23:02 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Wed, 23 Nov 2005 23:02:35 +0000 (23:02 +0000)
svn path=/trunk/; revision=19508

reactos/baseaddress.xml
reactos/lib/cpl/mmsys/En.rc [new file with mode: 0644]
reactos/lib/cpl/mmsys/mmsys.c [new file with mode: 0644]
reactos/lib/cpl/mmsys/mmsys.def [new file with mode: 0644]
reactos/lib/cpl/mmsys/mmsys.h [new file with mode: 0644]
reactos/lib/cpl/mmsys/mmsys.rc [new file with mode: 0644]
reactos/lib/cpl/mmsys/mmsys.xml [new file with mode: 0644]
reactos/lib/cpl/mmsys/resource.h [new file with mode: 0644]
reactos/lib/cpl/mmsys/resources/mmsys.ico [new file with mode: 0644]

index 723035a..058dfb6 100644 (file)
@@ -4,6 +4,7 @@
 <property name="BASEADDRESS_REGTESTS" value="0x07000000" />
 <property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
 <property name="BASEADDRESS_DEVENUM" value="0x35680000" />
+<property name="BASEADDRESS_MMSYS" value="0x588A0000" />
 <property name="BASEADDRESS_UXTHEME" value="0x5AD70000" />
 <property name="BASEADDRESS_VDMDBG" value="0x5B0D0000" />
 <property name="BASEADDRESS_OBJSEL" value="0x5B400000" />
diff --git a/reactos/lib/cpl/mmsys/En.rc b/reactos/lib/cpl/mmsys/En.rc
new file mode 100644 (file)
index 0000000..39989fa
--- /dev/null
@@ -0,0 +1,14 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+IDD_HARDWARE DIALOGEX 0, 0, 246, 228
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Hardware"
+FONT 8, "MS Shell Dlg"
+BEGIN
+END
+
+STRINGTABLE 
+BEGIN
+    IDS_CPLNAME "Sound and Audio Devices"
+    IDS_CPLDESCRIPTION "Changes the sound scheme for your computer, or configure the settings for your speakers and recording devices."
+END
\ No newline at end of file
diff --git a/reactos/lib/cpl/mmsys/mmsys.c b/reactos/lib/cpl/mmsys/mmsys.c
new file mode 100644 (file)
index 0000000..d9c8367
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ *  ReactOS
+ *  Copyright (C) 2005 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id: main.c 12852 2005-01-06 13:58:04Z mf $
+ *
+ * PROJECT:         ReactOS Multimedia Control Panel
+ * FILE:            lib/cpl/mmsys/mmsys.c
+ * PURPOSE:         ReactOS Multimedia Control Panel
+ * PROGRAMMER:      Thoams Weidenmueller <w3seek@reactos.com>
+ * UPDATE HISTORY:
+ *      2005/11/23  Created
+ */
+#include <windows.h>
+#include <commctrl.h>
+#include <initguid.h>
+#include <cfgmgr32.h>
+#include <setupapi.h>
+#include <devguid.h>
+#include <cpl.h>
+
+#include "mmsys.h"
+#include "resource.h"
+
+HWND WINAPI
+DeviceCreateHardwarePageEx(HWND hWndParent,
+                           LPGUID lpGuids,
+                           UINT uNumberOfGuids,
+                           UINT Unknown);
+
+#define NUM_APPLETS    (1)
+
+
+HINSTANCE hApplet = 0;
+
+/* Applets */
+const APPLET Applets[NUM_APPLETS] = 
+{
+  {IDI_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, MmSysApplet},
+};
+
+/* Hardware property page dialog callback */
+static INT_PTR CALLBACK
+HardwareDlgProc(HWND hwndDlg,
+               UINT uMsg,
+               WPARAM wParam,
+               LPARAM lParam)
+{
+    switch(uMsg)
+    {
+        case WM_INITDIALOG:
+        {
+            GUID Guids[] = {
+                GUID_DEVCLASS_CDROM,
+                GUID_DEVCLASS_MEDIA,
+            };
+
+            /* create the hardware page */
+            DeviceCreateHardwarePageEx(hwndDlg,
+                                       Guids,
+                                       sizeof(Guids) / sizeof(Guids[0]),
+                                       1);
+            break;
+        }
+    }
+
+    return FALSE;
+}
+
+LONG APIENTRY
+MmSysApplet(HWND hwnd,
+            UINT uMsg,
+            LONG wParam,
+            LONG lParam)
+{
+    PROPSHEETPAGE psp[1];
+    PROPSHEETHEADER psh = {0};
+    TCHAR Caption[256];
+
+    LoadString(hApplet,
+               IDS_CPLNAME,
+               Caption,
+               sizeof(Caption) / sizeof(TCHAR));
+
+    psh.dwSize = sizeof(PROPSHEETHEADER);
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE;
+    psh.hwndParent = NULL;
+    psh.hInstance = hApplet;
+    psh.hIcon = LoadIcon(hApplet,
+                         MAKEINTRESOURCE(IDI_CPLICON));
+    psh.pszCaption = Caption;
+    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+    psh.nStartPage = 0;
+    psh.ppsp = psp;
+
+    InitPropSheetPage(&psp[0],
+                      IDD_HARDWARE,
+                      HardwareDlgProc);
+
+    return (LONG)(PropertySheet(&psh) != -1);
+}
+
+VOID
+InitPropSheetPage(PROPSHEETPAGE *psp,
+                  WORD idDlg,
+                  DLGPROC DlgProc)
+{
+    ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+    psp->dwSize = sizeof(PROPSHEETPAGE);
+    psp->dwFlags = PSP_DEFAULT;
+    psp->hInstance = hApplet;
+    psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+    psp->pfnDlgProc = DlgProc;
+}
+
+
+/* Control Panel Callback */
+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;
+            UINT uAppIndex = (UINT)lParam1;
+
+            CPlInfo->lData = 0;
+            CPlInfo->idIcon = Applets[uAppIndex].idIcon;
+            CPlInfo->idName = Applets[uAppIndex].idName;
+            CPlInfo->idInfo = Applets[uAppIndex].idDescription;
+            break;
+        }
+
+        case CPL_DBLCLK:
+        {
+            UINT uAppIndex = (UINT)lParam1;
+            Applets[uAppIndex].AppletProc(hwndCpl,
+                                          uMsg,
+                                          lParam1,
+                                          lParam2);
+            break;
+        }
+    }
+
+    return FALSE;
+}
+
+
+BOOL STDCALL
+DllMain(HINSTANCE hinstDLL,
+       DWORD dwReason,
+       LPVOID lpReserved)
+{
+    switch(dwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            hApplet = hinstDLL;
+            DisableThreadLibraryCalls(hinstDLL);
+            break;
+    }
+
+    return TRUE;
+}
diff --git a/reactos/lib/cpl/mmsys/mmsys.def b/reactos/lib/cpl/mmsys/mmsys.def
new file mode 100644 (file)
index 0000000..3e5b9c9
--- /dev/null
@@ -0,0 +1,6 @@
+LIBRARY mmsys.cpl
+
+EXPORTS
+CPlApplet@16
+
+; EOF
diff --git a/reactos/lib/cpl/mmsys/mmsys.h b/reactos/lib/cpl/mmsys/mmsys.h
new file mode 100644 (file)
index 0000000..0cc249d
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __CPL_MMSYS_H
+#define __CPL_MMSYS_H
+
+//typedef LONG (CALLBACK *APPLET_PROC)(VOID);
+
+typedef struct _APPLET
+{
+  UINT idIcon;
+  UINT idName;
+  UINT idDescription;
+  APPLET_PROC AppletProc;
+} APPLET, *PAPPLET;
+
+extern HINSTANCE hApplet;
+
+
+/* main.c */
+
+VOID
+InitPropSheetPage(PROPSHEETPAGE *psp,
+                 WORD idDlg,
+                 DLGPROC DlgProc);
+
+LONG APIENTRY
+MmSysApplet(HWND hwnd,
+            UINT uMsg,
+            LONG wParam,
+            LONG lParam);
+
+#endif /* __CPL_MMSYS_H */
+
+/* EOF */
diff --git a/reactos/lib/cpl/mmsys/mmsys.rc b/reactos/lib/cpl/mmsys/mmsys.rc
new file mode 100644 (file)
index 0000000..209c669
--- /dev/null
@@ -0,0 +1,13 @@
+#include <windows.h>
+#include "resource.h"
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS Multimedia Control Panel\0"
+#define REACTOS_STR_INTERNAL_NAME      "mmsys\0"
+#define REACTOS_STR_ORIGINAL_FILENAME  "mmsys.cpl\0"
+#include <reactos/version.rc>
+
+
+IDI_CPLICON ICON "resources/mmsys.ico"
+
+#include "En.rc"
diff --git a/reactos/lib/cpl/mmsys/mmsys.xml b/reactos/lib/cpl/mmsys/mmsys.xml
new file mode 100644 (file)
index 0000000..e6a7b36
--- /dev/null
@@ -0,0 +1,16 @@
+<module name="mmsys" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_MMSYS}" installbase="system32" installname="mmsys.cpl">
+       <importlibrary definition="mmsys.def" />
+       <include base="mmsys">.</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>kernel32</library>
+       <library>user32</library>
+       <library>comctl32</library>
+       <library>devmgr</library>
+       <file>mmsys.c</file>
+       <file>mmsys.rc</file>
+</module>
diff --git a/reactos/lib/cpl/mmsys/resource.h b/reactos/lib/cpl/mmsys/resource.h
new file mode 100644 (file)
index 0000000..994457e
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __CPL_RESOURCE_H
+#define __CPL_RESOURCE_H
+
+
+#define IDI_CPLICON    1
+
+#define IDD_HARDWARE   100
+
+#define IDS_CPLNAME    1000
+#define IDS_CPLDESCRIPTION     1001
+
+
+#endif /* __CPL_RESOURCE_H */
+
+/* EOF */
diff --git a/reactos/lib/cpl/mmsys/resources/mmsys.ico b/reactos/lib/cpl/mmsys/resources/mmsys.ico
new file mode 100644 (file)
index 0000000..3eae16d
Binary files /dev/null and b/reactos/lib/cpl/mmsys/resources/mmsys.ico differ