Guest User

IoAssignResources Source code

a guest
Mar 9th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. NTSTATUS __stdcall IoAssignResources(PUNICODE_STRING RegistryPath, PUNICODE_STRING DriverClassName, PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT DeviceObject, PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, PCM_RESOURCE_LIST *AllocatedResources)
  2. {
  3. __int16 v6; // bx@1
  4. PDEVICE_NODE DeviceNode; // eax@2
  5. char *DriverName; // eax@9
  6. PDEVICE_NODE v9; // eax@11
  7. PUNICODE_STRING InstancePath; // eax@12
  8. PUNICODE_STRING ServiceName; // eax@14
  9. PDEVICE_NODE ParentDeviceNode; // eax@16
  10. USHORT *Length; // eax@17
  11.  
  12. v6 = 0;
  13. if ( DeviceObject )
  14. {
  15. DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode;
  16. if ( DeviceNode )
  17. {
  18. if ( !(BYTE2(DeviceNode->Flags) & 2) )
  19. {
  20. if ( DriverObject )
  21. {
  22. IoAddTriageDumpDataBlock(DriverObject, DriverObject->Size);
  23. if ( DriverObject->DriverName.Length )
  24. {
  25. IoAddTriageDumpDataBlock(&DriverObject->DriverName, 2);
  26. IoAddTriageDumpDataBlock(DriverObject->DriverName.Buffer, DriverObject->DriverName.Length);
  27. }
  28. v6 = 0;
  29. }
  30. IoAddTriageDumpDataBlock(DeviceObject, DeviceObject->Size);
  31. if ( DeviceObject->DriverObject )
  32. {
  33. IoAddTriageDumpDataBlock(DeviceObject->DriverObject, DeviceObject->DriverObject->Size);
  34. DriverName = &DeviceObject->DriverObject->DriverName;
  35. if ( *DriverName != v6 )
  36. {
  37. IoAddTriageDumpDataBlock(DriverName, 2);
  38. IoAddTriageDumpDataBlock(
  39. DeviceObject->DriverObject->DriverName.Buffer,
  40. DeviceObject->DriverObject->DriverName.Length);
  41. }
  42. }
  43. v9 = DeviceObject->DeviceObjectExtension->DeviceNode;
  44. if ( v9 )
  45. {
  46. IoAddTriageDumpDataBlock(v9, 292);
  47. InstancePath = &DeviceObject->DeviceObjectExtension->DeviceNode->InstancePath;
  48. if ( InstancePath->Length )
  49. {
  50. IoAddTriageDumpDataBlock(InstancePath, 2);
  51. IoAddTriageDumpDataBlock(
  52. DeviceObject->DeviceObjectExtension->DeviceNode->InstancePath.Buffer,
  53. DeviceObject->DeviceObjectExtension->DeviceNode->InstancePath.Length);
  54. }
  55. ServiceName = &DeviceObject->DeviceObjectExtension->DeviceNode->ServiceName;
  56. if ( ServiceName->Length )
  57. {
  58. IoAddTriageDumpDataBlock(ServiceName, 2);
  59. IoAddTriageDumpDataBlock(
  60. DeviceObject->DeviceObjectExtension->DeviceNode->ServiceName.Buffer,
  61. DeviceObject->DeviceObjectExtension->DeviceNode->ServiceName.Length);
  62. }
  63. ParentDeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode->Parent;
  64. if ( ParentDeviceNode )
  65. {
  66. Length = &ParentDeviceNode->ServiceName.Length;
  67. if ( *Length )
  68. {
  69. IoAddTriageDumpDataBlock(Length, 2);
  70. IoAddTriageDumpDataBlock(
  71. DeviceObject->DeviceObjectExtension->DeviceNode->Parent->ServiceName.Buffer,
  72. DeviceObject->DeviceObjectExtension->DeviceNode->Parent->ServiceName.Length);
  73. }
  74. }
  75. }
  76. KeBugCheckEx(202u, 2u, DeviceObject, 0, 0);
  77. }
  78. }
  79. }
  80. if ( RequestedResources && (!RequestedResources->AlternativeLists || !RequestedResources->List[0].Count) )
  81. RequestedResources = 0;
  82. if ( AllocatedResources )
  83. *AllocatedResources = 0;
  84. return IopLegacyResourceAllocation(2, DriverObject, DeviceObject, RequestedResources, AllocatedResources);
  85. }
Advertisement
Add Comment
Please, Sign In to add comment