ReactOS 0.4.16-dev-197-g92996da
registry.c File Reference
#include "precomp.h"
#include <mmebuddy_debug.h>
Include dependency graph for registry.c:

Go to the source code of this file.

Functions

MMRESULT OpenSoundDriverParametersRegKey (IN LPWSTR ServiceName, OUT PHKEY KeyHandle)
 
MMRESULT OpenSoundDeviceRegKey (IN LPWSTR ServiceName, IN DWORD DeviceIndex, OUT PHKEY KeyHandle)
 

Function Documentation

◆ OpenSoundDeviceRegKey()

MMRESULT OpenSoundDeviceRegKey ( IN LPWSTR  ServiceName,
IN DWORD  DeviceIndex,
OUT PHKEY  KeyHandle 
)

Definition at line 73 of file registry.c.

77{
79 PWCHAR RegPath;
80
83
84 /*
85 Work out the space required to hold the path:
86
87 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
88 sndblst\
89 Parameters\
90 Device123\
91 */
93 + wcslen(ServiceName) + 1
96 + GetDigitCount(DeviceIndex);
97
98 /* Allocate storage for the string */
100
101 if ( ! RegPath )
102 {
103 return MMSYSERR_NOMEM;
104 }
105
106 /* Write the path */
107 wsprintf(RegPath,
108 L"%ls\\%ls\\%ls\\%ls%d",
113 DeviceIndex);
114
115 SND_TRACE(L"Opening reg key: %wS\n", RegPath);
116
117 /* Perform the open */
119 RegPath,
120 0,
121 KEY_READ,
123 {
124 /* Couldn't open the key */
125 SND_ERR(L"Failed to open reg key: %wS\n", RegPath);
126 FreeMemory(RegPath);
127 return MMSYSERR_ERROR;
128 }
129
130 FreeMemory(RegPath);
131
132 return MMSYSERR_NOERROR;
133}
static USHORT PathLength
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
static WCHAR ServiceName[]
Definition: browser.c:19
#define ERROR_SUCCESS
Definition: deptool.c:10
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
UINT GetDigitCount(IN UINT Number)
Definition: utility.c:68
#define SND_TRACE(...)
#define SND_ERR(...)
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
#define REG_DEVICE_KEY_NAME_U
Definition: sndnames.h:77
#define REG_PARAMETERS_KEY_NAME_U
Definition: sndnames.h:76
#define REG_SERVICES_KEY_NAME_U
Definition: sndnames.h:75
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegOpenKeyEx
Definition: winreg.h:520
#define wsprintf
Definition: winuser.h:5877

Referenced by EnumerateNt4ServiceSoundDevices().

◆ OpenSoundDriverParametersRegKey()

MMRESULT OpenSoundDriverParametersRegKey ( IN LPWSTR  ServiceName,
OUT PHKEY  KeyHandle 
)

Definition at line 20 of file registry.c.

23{
24 SIZE_T KeyLength;
25 PWCHAR ParametersKeyName;
26
29
30 /* Work out how long the string will be */
31 KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1
32 + wcslen(ServiceName) + 1
34
35 /* Allocate memory for the string */
36 ParametersKeyName = AllocateWideString(KeyLength);
37
38 if ( ! ParametersKeyName )
39 return MMSYSERR_NOMEM;
40
41 /* Construct the registry path */
42 wsprintf(ParametersKeyName,
43 L"%s\\%s\\%s",
47
48 SND_TRACE(L"Opening reg key: %wS\n", ParametersKeyName);
49
50 /* Perform the open */
52 ParametersKeyName,
53 0,
56 {
57 /* Couldn't open the key */
58 SND_ERR(L"Failed to open reg key: %wS\n", ParametersKeyName);
59 FreeMemory(ParametersKeyName);
60 return MMSYSERR_ERROR;
61 }
62
63 FreeMemory(ParametersKeyName);
64
65 return MMSYSERR_NOERROR;
66}