Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendeviceinterface.c
Go to the documentation of this file.
00001 #include "priv.h" 00002 00003 NTSTATUS 00004 KspSetDeviceInterfacesState( 00005 IN PLIST_ENTRY ListHead, 00006 IN BOOL Enable) 00007 { 00008 NTSTATUS Status = STATUS_SUCCESS; 00009 PLIST_ENTRY Entry; 00010 PSYMBOLIC_LINK_ENTRY SymEntry; 00011 00012 00013 Entry = ListHead->Flink; 00014 while(Entry != ListHead) 00015 { 00016 /* fetch symbolic link entry */ 00017 SymEntry = (PSYMBOLIC_LINK_ENTRY)CONTAINING_RECORD(Entry, SYMBOLIC_LINK_ENTRY, Entry); 00018 /* set device interface state */ 00019 Status = IoSetDeviceInterfaceState(&SymEntry->SymbolicLink, Enable); 00020 00021 DPRINT("KspSetDeviceInterfacesState SymbolicLink '%S' Status %lx\n", SymEntry->SymbolicLink.Buffer, Status, Enable); 00022 00023 /* check for success */ 00024 if (!NT_SUCCESS(Status)) 00025 return Status; 00026 /* get next entry */ 00027 Entry = Entry->Flink; 00028 } 00029 /* return result */ 00030 return Status; 00031 } 00032 00033 NTSTATUS 00034 KspFreeDeviceInterfaces( 00035 IN PLIST_ENTRY ListHead) 00036 { 00037 PLIST_ENTRY Entry; 00038 PSYMBOLIC_LINK_ENTRY SymEntry; 00039 00040 while(!IsListEmpty(ListHead)) 00041 { 00042 /* remove first entry */ 00043 Entry = RemoveHeadList(ListHead); 00044 00045 /* fetch symbolic link entry */ 00046 SymEntry = (PSYMBOLIC_LINK_ENTRY)CONTAINING_RECORD(Entry, SYMBOLIC_LINK_ENTRY, Entry); 00047 00048 /* free device interface string */ 00049 RtlFreeUnicodeString(&SymEntry->SymbolicLink); 00050 /* free entry item */ 00051 FreeItem(Entry); 00052 } 00053 00054 return STATUS_SUCCESS; 00055 } 00056 00057 NTSTATUS 00058 KspRegisterDeviceInterfaces( 00059 IN PDEVICE_OBJECT PhysicalDeviceObject, 00060 IN ULONG CategoriesCount, 00061 IN GUID const*Categories, 00062 IN PUNICODE_STRING ReferenceString, 00063 OUT PLIST_ENTRY SymbolicLinkList) 00064 { 00065 ULONG Index; 00066 NTSTATUS Status = STATUS_SUCCESS; 00067 PSYMBOLIC_LINK_ENTRY SymEntry; 00068 00069 for(Index = 0; Index < CategoriesCount; Index++) 00070 { 00071 /* allocate a symbolic link entry */ 00072 SymEntry = AllocateItem(NonPagedPool, sizeof(SYMBOLIC_LINK_ENTRY)); 00073 /* check for success */ 00074 if (!SymEntry) 00075 return STATUS_INSUFFICIENT_RESOURCES; 00076 00077 /* now register device interface */ 00078 Status = IoRegisterDeviceInterface(PhysicalDeviceObject, 00079 &Categories[Index], 00080 ReferenceString, 00081 &SymEntry->SymbolicLink); 00082 00083 if (!NT_SUCCESS(Status)) 00084 { 00085 DPRINT1("Failed to register device interface %x\n", Status); 00086 00087 /* free entry */ 00088 FreeItem(SymEntry); 00089 00090 /* return result */ 00091 return Status; 00092 } 00093 00094 /* copy device class */ 00095 RtlMoveMemory(&SymEntry->DeviceInterfaceClass, &Categories[Index], sizeof(CLSID)); 00096 00097 /* insert symbolic link entry */ 00098 InsertTailList(SymbolicLinkList, &SymEntry->Entry); 00099 } 00100 00101 /* return result */ 00102 return Status; 00103 } 00104 00105 NTSTATUS 00106 KspSetFilterFactoriesState( 00107 IN PKSIDEVICE_HEADER DeviceHeader, 00108 IN BOOLEAN NewState) 00109 { 00110 PCREATE_ITEM_ENTRY CreateEntry; 00111 PLIST_ENTRY Entry; 00112 NTSTATUS Status = STATUS_SUCCESS; 00113 00114 /* grab first device interface */ 00115 Entry = DeviceHeader->ItemList.Flink; 00116 while(Entry != &DeviceHeader->ItemList && Status == STATUS_SUCCESS) 00117 { 00118 /* grab create entry */ 00119 CreateEntry = CONTAINING_RECORD(Entry, CREATE_ITEM_ENTRY, Entry); 00120 00121 /* sanity check */ 00122 ASSERT(CreateEntry->CreateItem); 00123 00124 if (CreateEntry->CreateItem->Create == IKsFilterFactory_Create) 00125 { 00126 /* found our own filterfactory */ 00127 Status = KsFilterFactorySetDeviceClassesState((PKSFILTERFACTORY)CreateEntry->CreateItem->Context, NewState); 00128 } 00129 00130 Entry = Entry->Flink; 00131 } 00132 00133 /* store result */ 00134 return Status; 00135 } Generated on Sun May 27 2012 04:27:51 for ReactOS by
1.7.6.1
|