Author: silverblade
Date: Wed Sep 19 08:13:24 2007
New Revision: 29100
URL:
http://svn.reactos.org/svn/reactos?rev=29100&view=rev
Log:
ReactOS Audio Service. Has not been tested within ReactOS but on Windows
(XP) it now detects when new devices have been attached. This
information is shared via a mapped file. I have also written a utility
to read the contents of the mapped file (this is not included - further
work is required).
Added a few missing #defines to dbt.h and also reformatted some of the
WinMM code so it was clearer to read.
Added:
trunk/reactos/base/services/audiosrv/pnp_list_lock.c
trunk/reactos/base/services/audiosrv/pnp_list_manager.c
trunk/reactos/base/services/audiosrv/pnp_list_manager.h
trunk/reactos/include/reactos/libs/audiosrv/
trunk/reactos/include/reactos/libs/audiosrv/audiosrv.h
Modified:
trunk/reactos/base/services/audiosrv/audiosrv.rbuild
trunk/reactos/base/services/audiosrv/main.c
trunk/reactos/dll/win32/winmm/driver.c
trunk/reactos/dll/win32/winmm/lolvldrv.c
trunk/reactos/include/psdk/dbt.h
Modified: trunk/reactos/base/services/audiosrv/audiosrv.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/audiosrv/aud…
==============================================================================
--- trunk/reactos/base/services/audiosrv/audiosrv.rbuild (original)
+++ trunk/reactos/base/services/audiosrv/audiosrv.rbuild Wed Sep 19 08:13:24 2007
@@ -1,10 +1,16 @@
-<module name="audiosrv" type="win32cui"
installbase="system32" installname="audiosrv.exe"
allowwarnings="true">
+<module name="audiosrv" type="win32cui"
installbase="system32"
+installname="audiosrv.exe" allowwarnings="true">
<include base="audiosrv">.</include>
+ <define name="UNICODE" />
<define name="__USE_W32API" />
<define name="__REACTOS__" />
<define name="_WIN32_WINNT">0x0501</define>
+ <define name="WINVER">0x0501</define>
<library>kernel32</library>
<library>advapi32</library>
+ <library>user32</library>
<file>main.c</file>
+ <file>pnp_list_manager.c</file>
+ <file>pnp_list_lock.c</file>
<file>audiosrv.rc</file>
</module>
Modified: trunk/reactos/base/services/audiosrv/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/audiosrv/mai…
==============================================================================
--- trunk/reactos/base/services/audiosrv/main.c (original)
+++ trunk/reactos/base/services/audiosrv/main.c Wed Sep 19 08:13:24 2007
@@ -7,16 +7,12 @@
*/
#include <windows.h>
+#include <winuser.h>
+#include <dbt.h>
+#include <audiosrv/audiosrv.h>
+#include <pnp_list_manager.h>
-/* This is currently set to avoid conflicting service names in Windows! */
-#define SERVICE_NAME "RosAudioSrv"
-
-/* A named mutex is used for synchronizing access to the device list.
- If this mutex doesn't exist, it means the audio service isn't running. */
-#define DEVICE_LIST_MUTEX_NAME "Global\\AudioDeviceListSync"
-
-/* ...and this is where the device list will be available */
-#define DEVICE_LIST_MAPPED_FILENAME "Global\\AudioDeviceList"
+#include <ksmedia.h>
@@ -25,19 +21,23 @@
VOID CALLBACK
ServiceMain(DWORD argc, char** argv);
-VOID WINAPI
-ServiceControlHandler(DWORD request);
-
+DWORD WINAPI
+ServiceControlHandler(
+ DWORD dwControl,
+ DWORD dwEventType,
+ LPVOID lpEventData,
+ LPVOID lpContext);
/* Service table */
SERVICE_TABLE_ENTRY service_table[2] =
{
- { "AudioSrv", (LPSERVICE_MAIN_FUNCTION) ServiceMain },
+ { L"AudioSrv", (LPSERVICE_MAIN_FUNCTION) ServiceMain },
{ NULL, NULL }
};
SERVICE_STATUS_HANDLE service_status_handle;
SERVICE_STATUS service_status;
+HDEVNOTIFY device_notification_handle = NULL;
/* Synchronization of access to the event list */
HANDLE device_list_mutex = INVALID_HANDLE_VALUE;
@@ -45,40 +45,109 @@
/* Implementation */
-VOID WINAPI
-ServiceControlHandler(DWORD request)
+DWORD
+ProcessDeviceArrival(DEV_BROADCAST_DEVICEINTERFACE* device)
{
- switch ( request )
+ PnP_AudioDevice* list_node;
+ list_node = CreateDeviceDescriptor(device->dbcc_name, TRUE);
+ AppendAudioDeviceToList(list_node);
+ DestroyDeviceDescriptor(list_node);
+
+ return NO_ERROR;
+}
+
+DWORD WINAPI
+ServiceControlHandler(
+ DWORD dwControl,
+ DWORD dwEventType,
+ LPVOID lpEventData,
+ LPVOID lpContext)
+{
+ switch ( dwControl )
{
+ case SERVICE_CONTROL_INTERROGATE :
+ {
+ return NO_ERROR;
+ }
+
case SERVICE_CONTROL_STOP :
case SERVICE_CONTROL_SHUTDOWN :
{
+ /* FIXME: This function doesn't exist?! */
+/*
+ UnregisterDeviceNotification(device_notification_handle);
+ device_notification_handle = NULL;
+*/
+
+ DestroyAudioDeviceList();
+
service_status.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(service_status_handle, &service_status);
-
- CloseHandle(device_list_mutex);
service_status.dwWin32ExitCode = 0;
service_status.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(service_status_handle, &service_status);
- return;
+ return NO_ERROR;
}
+ case SERVICE_CONTROL_DEVICEEVENT :
+ {
+ switch ( dwEventType )
+ {
+ case DBT_DEVICEARRIVAL :
+ {
+ DEV_BROADCAST_DEVICEINTERFACE* incoming_device =
+ (DEV_BROADCAST_DEVICEINTERFACE*) lpEventData;
+
+ return ProcessDeviceArrival(incoming_device);
+ }
+
+ default :
+ {
+ break;
+ }
+ }
+
+ return NO_ERROR;
+ }
default :
- break;
+ return ERROR_CALL_NOT_IMPLEMENTED;
};
- SetServiceStatus(service_status_handle, &service_status);
+ /*SetServiceStatus(service_status_handle, &service_status);*/
+}
+
+BOOL
+RegisterForDeviceNotifications()
+{
+ DEV_BROADCAST_DEVICEINTERFACE notification_filter;
+
+ const GUID wdmaud_guid = {STATIC_KSCATEGORY_WDMAUD};
+
+ /* FIXME: This currently lists ALL device interfaces... */
+ ZeroMemory(¬ification_filter, sizeof(notification_filter));
+ notification_filter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
+ notification_filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ notification_filter.dbcc_classguid = wdmaud_guid;
+
+ device_notification_handle =
+ RegisterDeviceNotification((HANDLE) service_status_handle,
+ ¬ification_filter,
+ DEVICE_NOTIFY_SERVICE_HANDLE |
+ DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
+
+ return ( device_notification_handle != NULL );
}
VOID CALLBACK
ServiceMain(DWORD argc, char** argv)
{
- service_status_handle = RegisterServiceCtrlHandler(SERVICE_NAME,
- ServiceControlHandler);
+ service_status_handle = RegisterServiceCtrlHandlerEx(SERVICE_NAME,
+ ServiceControlHandler,
+ NULL);
/* Set these to defaults */
service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
@@ -92,15 +161,22 @@
service_status.dwCurrentState = SERVICE_START_PENDING;
SetServiceStatus(service_status_handle, &service_status);
- /* We should create the mapped section here along with the mutex to
- sync access to the device list... */
-
- device_list_mutex = CreateMutex(NULL, FALSE, DEVICE_LIST_MUTEX_NAME);
-
- if ( ! device_list_mutex)
+ /* This creates the audio device list and mutex */
+ if ( ! CreateAudioDeviceList(AUDIO_LIST_MAX_SIZE) )
{
service_status.dwCurrentState = SERVICE_STOPPED;
- service_status.dwWin32ExitCode = -1; // ok?
+ service_status.dwWin32ExitCode = -1;
+ SetServiceStatus(service_status_handle, &service_status);
+ return;
+ }
+
+ /* We want to know when devices are added/removed */
+ if ( ! RegisterForDeviceNotifications() )
+ {
+ DestroyAudioDeviceList();
+
+ service_status.dwCurrentState = SERVICE_STOPPED;
+ service_status.dwWin32ExitCode = -1;
SetServiceStatus(service_status_handle, &service_status);
return;
}
@@ -114,4 +190,5 @@
int main()
{
StartServiceCtrlDispatcher(service_table);
+ return 0;
}
Added: trunk/reactos/base/services/audiosrv/pnp_list_lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/audiosrv/pnp…
==============================================================================
--- trunk/reactos/base/services/audiosrv/pnp_list_lock.c (added)
+++ trunk/reactos/base/services/audiosrv/pnp_list_lock.c Wed Sep 19 08:13:24 2007
@@ -1,0 +1,58 @@
+/*
+ * PROJECT: ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/services/audiosrv/list_lock.c
+ * PURPOSE: Audio Service Plug and Play list locking mechanism
+ * COPYRIGHT: Copyright 2007 Andrew Greenwood
+ */
+
+#include <windows.h>
+#include <assert.h>
+#include <audiosrv/audiosrv.h>
+
+static HANDLE audio_device_list_lock = NULL;
+
+BOOL
+InitializeAudioDeviceListLock()
+{
+ /* The security stuff is to make sure the mutex can be grabbed by
+ other processes - is this the best idea though ??? */
+
+ SECURITY_DESCRIPTOR security_descriptor;
+ SECURITY_ATTRIBUTES security;
+
+ InitializeSecurityDescriptor(&security_descriptor,
SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl(&security_descriptor, TRUE, 0, FALSE);
+
+ security.nLength = sizeof(SECURITY_ATTRIBUTES);
+ security.lpSecurityDescriptor = &security_descriptor;
+ security.bInheritHandle = FALSE;
+
+ audio_device_list_lock = CreateMutex(&security,
+ FALSE,
+ AUDIO_LIST_LOCK_NAME);
+
+ return ( audio_device_list_lock != NULL );
+}
+
+VOID
+KillAudioDeviceListLock()
+{
+ CloseHandle(audio_device_list_lock);
+ audio_device_list_lock = NULL;
+}
+
+VOID
+LockAudioDeviceList()
+{
+ assert( audio_device_list_lock != NULL );
+ WaitForSingleObject(audio_device_list_lock, INFINITE);
+}
+
+VOID
+UnlockAudioDeviceList()
+{
+ assert( audio_device_list_lock != NULL );
+ ReleaseMutex(audio_device_list_lock);
+}
+
Added: trunk/reactos/base/services/audiosrv/pnp_list_manager.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/audiosrv/pnp…
==============================================================================
--- trunk/reactos/base/services/audiosrv/pnp_list_manager.c (added)
+++ trunk/reactos/base/services/audiosrv/pnp_list_manager.c Wed Sep 19 08:13:24 2007
@@ -1,0 +1,173 @@
+/*
+ * PROJECT: ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/services/audiosrv/pnp_list_manager.c
+ * PURPOSE: Audio Service List Manager
+ * COPYRIGHT: Copyright 2007 Andrew Greenwood
+ */
+
+#include <assert.h>
+#include <audiosrv/audiosrv.h>
+
+
+/*
+ Device descriptor
+*/
+
+VOID*
+CreateDeviceDescriptor(WCHAR* path, BOOL is_enabled)
+{
+ PnP_AudioDevice* device;
+
+ int path_length = WideStringSize(path);
+ int size = sizeof(PnP_AudioDevice) + path_length;
+
+/* printf("path_length %d, total %d\n", path_length, size);*/
+
+ device = malloc(size);
+
+ if ( ! device )
+ return NULL;
+
+ device->enabled = is_enabled;
+ memcpy(device->path, path, path_length);
+
+ return device;
+}
+
+
+/*
+ Device list (manager-side)
+
+ The device list is stored in some shared-memory, with a named, global
+ mutex to provide a locking mechanism (to avoid it from being updated
+ whilst being read).
+*/
+
+static HANDLE device_list_file = NULL;
+static PnP_AudioHeader* audio_device_list = NULL;
+
+BOOL
+AppendAudioDeviceToList(PnP_AudioDevice* device)
+{
+ int device_info_size;
+
+ /* Figure out the actual structure size */
+ device_info_size = sizeof(PnP_AudioDevice);
+ device_info_size += WideStringSize(device->path);
+
+ LockAudioDeviceList();
+
+/*
+ printf("list size is %d\n", audio_device_list->size);
+ printf("device info size is %d bytes\n", device_info_size);
+*/
+
+ /* We DON'T want to overshoot the end of the buffer! */
+ if ( audio_device_list->size + device_info_size >
audio_device_list->max_size )
+ {
+/*
+ printf("max_size would be exceeded! failing\n");
+*/
+ return FALSE;
+ }
+
+ /* Commit the device descriptor to the list */
+ memcpy((char*)audio_device_list + audio_device_list->size,
+ device,
+ device_info_size);
+
+ /* Update the header */
+ audio_device_list->device_count ++;
+ audio_device_list->size += device_info_size;
+
+ UnlockAudioDeviceList();
+
+ return TRUE;
+}
+
+BOOL
+CreateAudioDeviceList(DWORD max_size)
+{
+/* printf("Initializing memory device list lock\n");*/
+
+ if ( ! InitializeAudioDeviceListLock() )
+ {
+ /*printf("Failed!\n");*/
+ return FALSE;
+ }
+
+ /* Preliminary locking - the list memory will likely be a big
+ buffer of gibberish at this point so we don't want anyone
+ turning up before we're ready... */
+ LockAudioDeviceList();
+
+ /* Expose our device list to the world */
+ device_list_file = CreateFileMapping(INVALID_HANDLE_VALUE,
+ NULL,
+ PAGE_READWRITE,
+ 0,
+ max_size,
+ AUDIO_LIST_NAME);
+
+ if ( ! device_list_file )
+ {
+ /*printf("Creation of audio device list FAILED!\n");*/
+
+ UnlockAudioDeviceList();
+ KillAudioDeviceListLock();
+
+ return FALSE;
+ }
+
+ /* Of course, we'll need to access the list ourselves */
+ audio_device_list = MapViewOfFile(device_list_file,
+ FILE_MAP_WRITE,
+ 0,
+ 0,
+ max_size);
+
+ if ( ! audio_device_list )
+ {
+ /*printf("MapViewOfFile FAILED\n");*/
+
+ CloseHandle(device_list_file);
+ device_list_file = NULL;
+
+ UnlockAudioDeviceList();
+ KillAudioDeviceListLock();
+
+ return FALSE;
+ }
+
+ /* Clear the mem to avoid any random stray data */
+ memset(audio_device_list, 0, max_size);
+
+ /* Don't want devices to overwrite the list! */
+ audio_device_list->size = sizeof(PnP_AudioHeader);
+ audio_device_list->max_size = max_size;
+ audio_device_list->device_count = 0;
+
+ UnlockAudioDeviceList();
+
+ return TRUE;
+}
+
+VOID
+DestroyAudioDeviceList()
+{
+ LockAudioDeviceList();
+
+ /*printf("Unmapping view\n");*/
+ UnmapViewOfFile(audio_device_list);
+ audio_device_list = NULL;
+
+ /*printf("Closing memory mapped file\n");*/
+ CloseHandle(device_list_file);
+ device_list_file = NULL;
+
+ UnlockAudioDeviceList();
+
+ /*printf("Killing devlist lock\n");*/
+ KillAudioDeviceListLock();
+}
Added: trunk/reactos/base/services/audiosrv/pnp_list_manager.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/audiosrv/pnp…
==============================================================================
--- trunk/reactos/base/services/audiosrv/pnp_list_manager.h (added)
+++ trunk/reactos/base/services/audiosrv/pnp_list_manager.h Wed Sep 19 08:13:24 2007
@@ -1,0 +1,29 @@
+/*
+ * PROJECT: ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/services/audiosrv/pnp_list_manager.h
+ * PURPOSE: Audio Service List Manager
+ * COPYRIGHT: Copyright 2007 Andrew Greenwood
+ */
+
+#include <assert.h>
+#include <audiosrv/audiosrv.h>
+
+#ifndef PNP_LIST_MANAGER_H
+#define PNP_LIST_MANAGER_H
+
+VOID*
+CreateDeviceDescriptor(WCHAR* path, BOOL is_enabled);
+
+#define DestroyDeviceDescriptor(descriptor) free(descriptor)
+
+BOOL
+AppendAudioDeviceToList(PnP_AudioDevice* device);
+
+BOOL
+CreateAudioDeviceList(DWORD max_size);
+
+VOID
+DestroyAudioDeviceList();
+
+#endif
Modified: trunk/reactos/dll/win32/winmm/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winmm/driver.c?r…
==============================================================================
--- trunk/reactos/dll/win32/winmm/driver.c (original)
+++ trunk/reactos/dll/win32/winmm/driver.c Wed Sep 19 08:13:24 2007
@@ -4,6 +4,8 @@
* Copyright 1994 Martin Ayotte
* Copyright 1998 Marcus Meissner
* Copyright 1999 Eric Pouech
+ *
+ * Reformatting and additional comments added by Andrew Greenwood.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -213,17 +215,29 @@
static const WCHAR wszSystemIni[] =
{'S','Y','S','T','E','M','.','I','N','I',0};
WCHAR wsznull = '\0';
+ /* This takes us as far as Windows NT\CurrentVersion */
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, HKLM_BASE, 0, KEY_QUERY_VALUE, &hKey);
- if (lRet == ERROR_SUCCESS) {
- lRet = RegOpenKeyExW(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
- if (lRet == ERROR_SUCCESS) {
+
+ if (lRet == ERROR_SUCCESS)
+ {
+ /* Now we descend into the section name that we were given */
+ lRet = RegOpenKeyExW(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
+
+ if (lRet == ERROR_SUCCESS)
+ {
+ /* Retrieve the desired value - this is the filename of the lib */
bufLen = sz;
- lRet = RegQueryValueExW(hSecKey, keyName, 0, 0, (void*)buf, &bufLen);
- RegCloseKey( hSecKey );
- }
+ lRet = RegQueryValueExW(hSecKey, keyName, 0, 0, (void*)buf, &bufLen);
+ RegCloseKey( hSecKey );
+ }
+
RegCloseKey( hKey );
}
- if (lRet == ERROR_SUCCESS) return TRUE;
+
+ /* Finish up if we've got what we want from the registry */
+ if (lRet == ERROR_SUCCESS)
+ return TRUE;
+
/* default to system.ini if we can't find it in the registry,
* to support native installations where system.ini is still used */
return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz /
sizeof(WCHAR), wszSystemIni);
@@ -243,19 +257,38 @@
TRACE("(%s, %08lX);\n", debugstr_w(fn), lParam2);
- if ((ptr = strchrW(fn, ' ')) != NULL) {
- *ptr++ = '\0';
- while (*ptr == ' ') ptr++;
- if (*ptr == '\0') ptr = NULL;
+ if ((ptr = strchrW(fn, ' ')) != NULL)
+ {
+ *ptr++ = '\0';
+
+ while (*ptr == ' ')
+ ptr++;
+
+ if (*ptr == '\0')
+ ptr = NULL;
}
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
- if (lpDrv == NULL) {cause = "OOM"; goto exit;}
-
- if ((hModule = LoadLibraryW(fn)) == 0) {cause = "Not a 32 bit lib"; goto
exit;}
+
+ if (lpDrv == NULL)
+ {
+ cause = "OOM";
+ goto exit;
+ }
+
+ if ((hModule = LoadLibraryW(fn)) == 0)
+ {
+ cause = "Not a 32 bit lib";
+ goto exit;
+ }
lpDrv->d.d32.lpDrvProc = (DRIVERPROC)GetProcAddress(hModule,
"DriverProc");
- if (lpDrv->d.d32.lpDrvProc == NULL) {cause = "no DriverProc"; goto
exit;}
+
+ if (lpDrv->d.d32.lpDrvProc == NULL)
+ {
+ cause = "no DriverProc";
+ goto exit;
+ }
lpDrv->dwFlags = 0;
lpDrv->d.d32.hModule = hModule;
@@ -285,10 +318,14 @@
}
if (!DRIVER_AddToList(lpDrv, (LPARAM)ptr, lParam2))
- {cause = "load failed"; goto exit;}
+ {
+ cause = "load failed";
+ goto exit;
+ }
TRACE("=> %p\n", lpDrv);
return lpDrv;
+
exit:
FreeLibrary(hModule);
HeapFree(GetProcessHeap(), 0, lpDrv);
@@ -347,17 +384,32 @@
TRACE("(%s, %s, 0x%08lx);\n",
debugstr_w(lpDriverName), debugstr_w(lpSectionName), lParam);
- if (lsn == NULL) {
+ /* If no section name is specified, either the caller is intending on
+ opening a driver by filename, or wants to open a user-installable
+ driver that has an entry in the Drivers32 key in the registry */
+ if (lsn == NULL)
+ {
+ /* Default registry key */
static const WCHAR wszDrivers32[] =
{'D','r','i','v','e','r','s','3','2',0};
- lstrcpynW(libName, lpDriverName, sizeof(libName) / sizeof(WCHAR));
-
- if ((lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
- goto the_end;
- lsn = wszDrivers32;
- }
- if (DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) &&
- (lpDrv = DRIVER_TryOpenDriver32(libName, lParam)))
- goto the_end;
+
+ lstrcpynW(libName, lpDriverName, sizeof(libName) / sizeof(WCHAR));
+
+ /* Try and open the driver by filename */
+ if ( lpDrv = DRIVER_TryOpenDriver32(libName, lParam) )
+ goto the_end;
+
+ /* If we got here, the file wasn't found. So we assume the caller
+ wanted a driver specified under the Drivers32 registry key */
+ lsn = wszDrivers32;
+ }
+
+ /* Attempt to locate the driver filename in the registry */
+ if ( DRIVER_GetLibName(lpDriverName, lsn, libName, sizeof(libName)) )
+ {
+ /* Now we have the filename, we can try and load it */
+ if ( lpDrv = DRIVER_TryOpenDriver32(libName, lParam) )
+ goto the_end;
+ }
/* now we will try a 16 bit driver (and add all the glue to make it work... which
* is located in our mmsystem implementation)
Modified: trunk/reactos/dll/win32/winmm/lolvldrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winmm/lolvldrv.c…
==============================================================================
--- trunk/reactos/dll/win32/winmm/lolvldrv.c (original)
+++ trunk/reactos/dll/win32/winmm/lolvldrv.c Wed Sep 19 08:13:24 2007
@@ -4,6 +4,7 @@
* MMSYTEM low level drivers handling functions
*
* Copyright 1999 Eric Pouech
+ * Modified for use with ReactOS by Andrew Greenwood, 2007
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Modified: trunk/reactos/include/psdk/dbt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/dbt.h?rev=291…
==============================================================================
--- trunk/reactos/include/psdk/dbt.h (original)
+++ trunk/reactos/include/psdk/dbt.h Wed Sep 19 08:13:24 2007
@@ -20,6 +20,7 @@
#define DBT_DEVTYP_VOLUME 2
#define DBT_DEVTYP_PORT 3
#define DBT_DEVTYP_NET 4
+#define DBT_DEVTYP_DEVICEINTERFACE 5
#define DBT_APPYBEGIN 0
#define DBT_APPYEND 1
#define DBT_DEVNODES_CHANGED 7
@@ -101,6 +102,13 @@
DWORD dbcv_unitmask;
WORD dbcv_flags;
} DEV_BROADCAST_VOLUME,*PDEV_BROADCAST_VOLUME;
+typedef struct _DEV_BROADCAST_DEVICEINTERFACE {
+ DWORD dbcc_size;
+ DWORD dbcc_devicetype;
+ DWORD dbcc_reserved;
+ GUID dbcc_classguid;
+ TCHAR dbcc_name[1];
+} DEV_BROADCAST_DEVICEINTERFACE, *PDEV_BROADCAST_DEVICEINTERFACE;
#ifdef UNICODE
typedef DEV_BROADCAST_PORT_W DEV_BROADCAST_PORT, *PDEV_BROADCAST_PORT;
Added: trunk/reactos/include/reactos/libs/audiosrv/audiosrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/audio…
==============================================================================
--- trunk/reactos/include/reactos/libs/audiosrv/audiosrv.h (added)
+++ trunk/reactos/include/reactos/libs/audiosrv/audiosrv.h Wed Sep 19 08:13:24 2007
@@ -1,0 +1,60 @@
+/*
+ * PROJECT: ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: include/reactos/libs/audiosrv/audiosrv.h
+ * PURPOSE: Audio Service Plug and Play list
+ * COPYRIGHT: Copyright 2007 Andrew Greenwood
+ */
+
+#include <windows.h>
+
+#ifndef AUDIOSRV_H
+#define AUDIOSRV_H
+
+/* This is currently set to avoid conflicting service names in Windows! */
+#define SERVICE_NAME L"RosAudioSrv"
+
+/* A named mutex is used for synchronizing access to the device list.
+ If this mutex doesn't exist, it means the audio service isn't running. */
+#define AUDIO_LIST_LOCK_NAME L"Global\\AudioDeviceListLock"
+
+/* ...and this is where the device list will be available */
+#define AUDIO_LIST_NAME L"Global\\AudioDeviceList"
+
+/* Amount of shared memory to allocate */
+#define AUDIO_LIST_MAX_SIZE 65536
+
+typedef struct
+{
+ DWORD enabled;
+ WCHAR path[]; /* The device object path (excluded from sizeof) */
+} PnP_AudioDevice;
+
+typedef struct
+{
+ DWORD size; /* Size of the shared mem */
+ DWORD max_size; /* Amount of mem available */
+ DWORD device_count; /* Number of devices */
+ PnP_AudioDevice first_device[];
+} PnP_AudioHeader;
+
+
+/* Calculate amount of memory consumed by a wide string - this includes the
+ terminating NULL. */
+
+#define WideStringSize(str) \
+ ( (lstrlenW(str) + 1) * sizeof(WCHAR) )
+
+BOOL
+InitializeAudioDeviceListLock();
+
+VOID
+KillAudioDeviceListLock();
+
+VOID
+LockAudioDeviceList();
+
+VOID
+UnlockAudioDeviceList();
+
+#endif