[ros-kernel] pnp mgr update
ismarc at austin.rr.com
ismarc at austin.rr.com
Mon Feb 23 17:28:15 CET 2004
I have another patch, still goes into deviface.c, took me longer than expected with work and all. Filip, if you could take a good look at what I've got, especially commented out, I'd appreciate it.
-Matt
-------------- next part --------------
? lib/freetype/temp.exp
Index: ntoskrnl/io/deviface.c
===================================================================
RCS file: /CVS/ReactOS/reactos/ntoskrnl/io/deviface.c,v
retrieving revision 1.3
diff -u -r1.3 deviface.c
--- ntoskrnl/io/deviface.c 23 Jan 2004 18:00:53 -0000 1.3
+++ ntoskrnl/io/deviface.c 23 Feb 2004 23:11:39 -0000
@@ -94,8 +94,8 @@
ULONG Size;
ULONG i = 0;
- PWCHAR BaseKeyString = L"\\HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Class\\";
- PWCHAR BaseInterfaceString = L"\\HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\";
+ PWCHAR BaseKeyString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\";
+ PWCHAR BaseInterfaceString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\";
status = RtlStringFromGUID( AliasInterfaceClassGuid, GuidString );
@@ -195,7 +195,9 @@
}
/*
- * @unimplemented
+ * @implemented
+ * Returns a list of interfaces with a null terminator after each one and an extra
+ * at the end of the list.
*/
NTSTATUS
STDCALL
@@ -205,8 +207,178 @@
IN ULONG Flags,
OUT PWSTR *SymbolicLinkList)
{
- DPRINT("IoGetDeviceInterfaces called (UNIMPLEMENTED)\n");
- return STATUS_NOT_IMPLEMENTED;
+ PUNICODE_STRING GuidString;
+ PUNICODE_STRING PdoGuidString;
+ PUNICODE_STRING BaseKeyName;
+ PUNICODE_STRING AliasKeyName;
+ PWSTR bipName;
+
+// PDEVICE_OBJECT NextPdo;
+
+ PHANDLE InterfaceKey;
+ PHANDLE PdoDriverKey;
+ BOOLEAN CaseInsensitive = TRUE;
+
+ PKEY_FULL_INFORMATION fip;
+ PKEY_BASIC_INFORMATION bip;
+
+// PWCHAR DriverKeyName;
+
+ LONG status;
+ NTSTATUS Status;
+
+ ULONG BufferSize;
+ ULONG Size;
+ ULONG i = 0;
+
+// BOOLEAN PdoTest = TRUE;
+
+ PWCHAR BaseKeyString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\";
+ PWCHAR BaseInterfaceString = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\";
+
+ status = RtlStringFromGUID( InterfaceClassGuid, GuidString );
+ if( !status )
+ {
+ DPRINT( "RtlStringFromGUID() Failed.\n" );
+ return STATUS_INVALID_HANDLE;
+ }
+ RtlInitUnicodeString( BaseKeyName, BaseKeyString );
+ RtlInitUnicodeString( AliasKeyName, BaseInterfaceString );
+
+ BaseKeyName->MaximumLength += sizeof( GuidString );
+ RtlAppendUnicodeStringToString( BaseKeyName, GuidString );
+
+ if( PhysicalDeviceObject )
+ {
+ IoGetDeviceProperty( PhysicalDeviceObject,
+ DevicePropertyClassGuid,
+ sizeof(GuidString),
+ PdoGuidString,
+ &BufferSize );
+
+ if( RtlCompareUnicodeString( GuidString, PdoGuidString, CaseInsensitive ) )
+ {
+ DPRINT( "Inconsistent Guid's asked for in IoGetDeviceInterfaces()\n" );
+ return STATUS_INVALID_HANDLE;
+ }
+
+ Status = IoOpenDeviceRegistryKey( PhysicalDeviceObject,
+ PLUGPLAY_REGKEY_DRIVER,
+ GENERIC_READ,
+ PdoDriverKey );
+ if( !NT_SUCCESS(Status) )
+ {
+ DPRINT( "IoOpenDeviceRegistryKey() failed.\n" );
+ return Status;
+ }
+
+ DPRINT("IoGetDeviceInterfaces() called with PDO, not implemented\n");
+ return STATUS_NOT_IMPLEMENTED;
+/*
+ wcscat( *SymbolicLinkList, DriverKeyName );
+
+ while( PdoTest )
+ {
+ if( PhysicalDeviceObject->NextDevice == NULL )
+ {
+ PdoTest = FALSE;
+ break;
+ }
+
+ NextPdo = PhysicalDeviceObject->NextDevice;
+
+ IoGetDeviceProperty( PhysicalDeviceObject,
+ DevicePropertyDriverKeyName,
+ sizeof(DriverKeyName),
+ DriverKeyName,
+ &BufferSize );
+ DriverKeyName = (PWCHAR) ExAllocatePool(PagedPool, BufferSize);
+
+ Status = IoGetDeviceProperty( PhysicalDeviceObject,
+ DevicePropertyDriverKeyName,
+ sizeof(DriverKeyName),
+ DriverKeyName,
+ &BufferSize );
+
+ if( !NT_SUCCESS(Status) )
+ {
+ DPRINT( "IoGetDeviceProperty() failed.\n" );
+ return Status;
+ }
+ wcscat( *SymbolicLinkList, DriverKeyName );
+ }
+
+ wcscat( *SymbolicLinkList, L"\0" );
+
+ ExFreePool(DriverKeyName);
+
+ return STATUS_SUCCESS;
+*/
+ }
+ else
+ {
+ Status = IoOpenDeviceInterfaceRegistryKey( BaseKeyName,
+ GENERIC_READ,
+ InterfaceKey );
+
+ if( !NT_SUCCESS( Status ) )
+ {
+ DPRINT( "IoOpenDeviceInterfaceRegistryKey() failed.\n" );
+ return Status;
+ }
+
+
+ Status = ZwQueryKey( InterfaceKey,
+ KeyFullInformation,
+ NULL,
+ 0,
+ &Size );
+
+ if( !NT_SUCCESS( Status) )
+ {
+ DPRINT( "ZwQueryKey() failed.\n" );
+ return Status;
+ }
+
+ fip = (PKEY_FULL_INFORMATION) ExAllocatePool(PagedPool, Size);
+
+ ZwQueryKey( InterfaceKey,
+ KeyFullInformation,
+ fip,
+ Size,
+ &Size );
+
+ while( i < fip->SubKeys )
+ {
+ i++;
+ ZwEnumerateKey( InterfaceKey,
+ i,
+ KeyBasicInformation,
+ NULL,
+ 0,
+ &Size );
+ bip = (PKEY_BASIC_INFORMATION) ExAllocatePool(PagedPool, Size);
+
+ ZwEnumerateKey( InterfaceKey,
+ i,
+ KeyBasicInformation,
+ bip,
+ Size,
+ &Size );
+
+ //Put the name in the string here
+ wcscat( bipName, BaseInterfaceString );
+ wcscat( bipName, bip->Name );
+ wcscat( *SymbolicLinkList, bipName );
+ wcscat( *SymbolicLinkList, L"\0" );
+ ExFreePool(bip);
+ }
+ wcscat( *SymbolicLinkList, L"\0" );
+
+ ExFreePool(fip);
+ }
+
+ return STATUS_SUCCESS;
}
/*
@@ -233,7 +405,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
STDCALL
@@ -241,12 +413,48 @@
IN PUNICODE_STRING SymbolicLinkName,
IN BOOLEAN Enable)
{
- DPRINT("IoSetDeviceInterfaceState called (UNIMPLEMENTED)\n");
+ POBJECT_ATTRIBUTES ObjectAttributes;
+ PHANDLE Key;
+
+ NTSTATUS Status;
+
+ InitializeObjectAttributes( ObjectAttributes,
+ SymbolicLinkName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL );
+
+ if( Enable )
+ {
+ Status = NtCreateSymbolicLinkObject( Key,
+ SYMBOLIC_LINK_ALL_ACCESS,
+ ObjectAttributes,
+ SymbolicLinkName );
+ if( !NT_SUCCESS( Status ) )
+ {
+ DPRINT("NtCreateSymbolicLinkObject() Failed (%x status)\n", Status);
+ return Status;
+ }
+
+ return STATUS_SUCCESS;
+ }
+ else if( !Enable )
+ {
+ NtOpenSymbolicLinkObject( Key,
+ SYMBOLIC_LINK_ALL_ACCESS,
+ ObjectAttributes );
+ NtMakeTemporaryObject( Key );
+ NtClose( Key );
+
+//Should we check to see if it's still valid? or do we trust it will happen
+//because all the handles have to be closed?
+
+ return STATUS_SUCCESS;
+ }
+
+ DPRINT("IoSetDeviceInterfaceState() called, missed the checks.\n");
return STATUS_SUCCESS;
-// return STATUS_OBJECT_NAME_EXISTS;
-// return STATUS_OBJECT_NAME_NOT_FOUND;
-// return STATUS_NOT_IMPLEMENTED;
}
/* EOF */
More information about the Ros-kernel
mailing list