00065 :
00066
00067 This routine build an registry key to report eisa resources to arbiters.
00068
00069 Arguments:
00070
00071 None.
00072
00073 Return Value:
00074
00075
NTSTATUS code.
00076
00077 --*/
00078
00079 {
00080
NTSTATUS status;
00081 ULONG disposition, tmpValue;
00082 WCHAR buffer[
BUFFER_LENGTH];
00083
00084 UNICODE_STRING unicodeString;
00085 HANDLE rootHandle, deviceHandle, instanceHandle, logConfHandle;
00086
00087 PCM_RESOURCE_LIST resourceList;
00088 ULONG resourceLength;
00089
00090 status =
EisaGetEisaDevicesResources(&resourceList, &resourceLength);
00091
if (!
NT_SUCCESS(status) || resourceList ==
NULL) {
00092
return STATUS_UNSUCCESSFUL;
00093 }
00094
00095
RtlInitUnicodeString(&unicodeString, L
"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\Root");
00096 status =
IopOpenRegistryKeyEx( &rootHandle,
00097 NULL,
00098 &unicodeString,
00099 KEY_ALL_ACCESS
00100 );
00101
00102
if (!
NT_SUCCESS(status)) {
00103
if (resourceList) {
00104
ExFreePool (resourceList);
00105 }
00106
return status;
00107 }
00108
00109
RtlInitUnicodeString(&unicodeString, EISA_DEVICE_NODE_NAME);
00110 status =
IopCreateRegistryKeyEx( &deviceHandle,
00111 rootHandle,
00112 &unicodeString,
00113 KEY_ALL_ACCESS,
00114 REG_OPTION_NON_VOLATILE,
00115 NULL
00116 );
00117
00118 ZwClose(rootHandle);
00119
if (!
NT_SUCCESS(status)) {
00120
if (resourceList) {
00121
ExFreePool (resourceList);
00122 }
00123
return status;
00124 }
00125
00126
RtlInitUnicodeString( &unicodeString, L
"0000" );
00127 status =
IopCreateRegistryKeyEx( &instanceHandle,
00128 deviceHandle,
00129 &unicodeString,
00130 KEY_ALL_ACCESS,
00131 REG_OPTION_NON_VOLATILE,
00132 &disposition );
00133 ZwClose(deviceHandle);
00134
if (
NT_SUCCESS(status)) {
00135
if (disposition == REG_CREATED_NEW_KEY) {
00136
00137
RtlInitUnicodeString( &unicodeString, L
"DeviceDesc" );
00138 swprintf(buffer, L
"%s", L
"Device to report Eisa Slot Resources");
00139
00140 ZwSetValueKey(instanceHandle,
00141 &unicodeString,
00142 0,
00143 REG_SZ,
00144 buffer,
00145 (wcslen(buffer) + 1) *
sizeof(WCHAR)
00146 );
00147
00148
RtlInitUnicodeString( &unicodeString, L
"HardwareID" );
00149 RtlZeroMemory(buffer, BUFFER_LENGTH *
sizeof(WCHAR));
00150 swprintf(buffer, L
"%s", L
"*Eisa_Resource_Device");
00151
00152 ZwSetValueKey(instanceHandle,
00153 &unicodeString,
00154 0,
00155 REG_MULTI_SZ,
00156 buffer,
00157 (wcslen(buffer) + 2) *
sizeof(WCHAR)
00158 );
00159
00160 PiWstrToUnicodeString(&unicodeString, REGSTR_VALUE_CONFIG_FLAGS);
00161 tmpValue = 0;
00162 ZwSetValueKey(instanceHandle,
00163 &unicodeString,
00164 TITLE_INDEX_VALUE,
00165 REG_DWORD,
00166 &tmpValue,
00167
sizeof(tmpValue)
00168 );
00169
00170 }
00171
00172
RtlInitUnicodeString( &unicodeString, REGSTR_KEY_LOGCONF );
00173 status =
IopCreateRegistryKeyEx( &logConfHandle,
00174 instanceHandle,
00175 &unicodeString,
00176 KEY_ALL_ACCESS,
00177 REG_OPTION_NON_VOLATILE,
00178 NULL
00179 );
00180 ZwClose(instanceHandle);
00181
if (
NT_SUCCESS(status)) {
00182
RtlInitUnicodeString( &unicodeString, REGSTR_VAL_BOOTCONFIG );
00183
00184 status = ZwSetValueKey(logConfHandle,
00185 &unicodeString,
00186 0,
00187 REG_RESOURCE_LIST,
00188 resourceList,
00189 resourceLength
00190 );
00191 ZwClose(logConfHandle);
00192 }
00193 }
00194
if (resourceList) {
00195
ExFreePool (resourceList);
00196 }
00197
return status;
00198 }