Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1449 lines
34 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. protos.h
  5. Abstract:
  6. NDIS wrapper function prototypes
  7. Author:
  8. Environment:
  9. Kernel mode, FSD
  10. Revision History:
  11. Jun-95 Jameel Hyder Split up from a monolithic file
  12. --*/
  13. NTSTATUS
  14. DriverEntry(
  15. IN PDRIVER_OBJECT DriverObject,
  16. IN PUNICODE_STRING RegistryPath
  17. );
  18. #if NDIS_UNLOAD
  19. VOID
  20. ndisUnload(
  21. IN PDRIVER_OBJECT DriverObject
  22. );
  23. #endif
  24. NTSTATUS
  25. ndisBuildDeviceAcl(
  26. OUT PACL *DeviceAcl,
  27. IN BOOLEAN AddNetConfigOps
  28. );
  29. NTSTATUS
  30. ndisCreateSecurityDescriptor(
  31. IN PDEVICE_OBJECT DeviceObject,
  32. OUT PSECURITY_DESCRIPTOR * pSecurityDescriptor,
  33. BOOLEAN AddNetConfigOps
  34. );
  35. BOOLEAN
  36. ndisCheckAccess (
  37. PIRP Irp,
  38. PIO_STACK_LOCATION IrpSp,
  39. PNTSTATUS Status,
  40. PSECURITY_DESCRIPTOR SecurityDescriptor
  41. );
  42. VOID
  43. ndisReadRegistry(
  44. VOID
  45. );
  46. VOID
  47. ndisWorkerThread(
  48. IN PVOID Context
  49. );
  50. NTSTATUS
  51. ndisReadRegParameters(
  52. IN PWSTR ValueName,
  53. IN ULONG ValueType,
  54. IN PVOID ValueData,
  55. IN ULONG ValueLength,
  56. IN PVOID Context,
  57. IN PVOID EntryContext
  58. );
  59. NTSTATUS
  60. ndisReadProcessorAffinityMask(
  61. IN PWSTR ValueName,
  62. IN ULONG ValueType,
  63. IN PVOID ValueData,
  64. IN ULONG ValueLength,
  65. IN PVOID Context,
  66. IN PVOID EntryContext
  67. );
  68. NTSTATUS
  69. ndisAddMediaTypeToArray(
  70. IN PWSTR ValueName,
  71. IN ULONG ValueType,
  72. IN PVOID ValueData,
  73. IN ULONG ValueLength,
  74. IN PVOID Context,
  75. IN PVOID EntryContext
  76. );
  77. NDIS_STATUS
  78. ndisCloseAllBindingsOnProtocol(
  79. PNDIS_PROTOCOL_BLOCK Protocol
  80. );
  81. BOOLEAN
  82. ndisIMCheckDeviceInstance(
  83. IN PNDIS_M_DRIVER_BLOCK MiniBlock,
  84. IN PUNICODE_STRING DeviceInstance,
  85. OUT PNDIS_HANDLE DeviceContext OPTIONAL
  86. );
  87. NDIS_STATUS
  88. ndisIMInitializeDeviceInstance(
  89. IN PNDIS_MINIPORT_BLOCK Miniport,
  90. IN NDIS_HANDLE DeviceContext,
  91. IN BOOLEAN fStartIrp
  92. );
  93. NDIS_STATUS
  94. ndisIMQueueDeviceInstance(
  95. IN PNDIS_M_DRIVER_BLOCK MiniBlock,
  96. IN PNDIS_STRING DeviceInstance,
  97. IN NDIS_HANDLE DeviceContext
  98. );
  99. NTSTATUS
  100. FASTCALL
  101. ndisPnPQueryRemoveDevice(
  102. IN PDEVICE_OBJECT DeviceObject,
  103. IN PIRP Irp
  104. );
  105. NTSTATUS
  106. FASTCALL
  107. ndisPnPCancelRemoveDevice(
  108. IN PDEVICE_OBJECT DeviceObject,
  109. IN PIRP Irp
  110. );
  111. NTSTATUS
  112. FASTCALL
  113. ndisPnPRemoveDevice(
  114. IN PDEVICE_OBJECT DeviceObject,
  115. IN PIRP Irp OPTIONAL
  116. );
  117. VOID
  118. ndisSetDeviceNames(
  119. IN PNDIS_STRING ExportName,
  120. OUT PNDIS_STRING DeviceName,
  121. OUT PNDIS_STRING BaseName,
  122. IN PUCHAR Buffer
  123. );
  124. NTSTATUS
  125. FASTCALL
  126. ndisPnPQueryStopDevice(
  127. IN PDEVICE_OBJECT DeviceObject,
  128. IN PIRP Irp
  129. );
  130. NTSTATUS
  131. FASTCALL
  132. ndisPnPCancelStopDevice(
  133. IN PDEVICE_OBJECT DeviceObject,
  134. IN PIRP Irp
  135. );
  136. NTSTATUS
  137. FASTCALL
  138. ndisPnPStopDevice(
  139. IN PDEVICE_OBJECT DeviceObject,
  140. IN PIRP Irp
  141. );
  142. NDIS_STATUS
  143. ndisTranslateResources(
  144. IN PNDIS_MINIPORT_BLOCK Miniport,
  145. IN CM_RESOURCE_TYPE ResourceType,
  146. IN PHYSICAL_ADDRESS Resource,
  147. OUT PPHYSICAL_ADDRESS pTranslatedResource,
  148. OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR *pResourceDescriptor OPTIONAL
  149. );
  150. NTSTATUS
  151. FASTCALL
  152. ndisQueryBusInterface(
  153. IN PNDIS_MINIPORT_BLOCK Miniport
  154. );
  155. ULONG
  156. ndisGetSetBusConfigSpace(
  157. IN PNDIS_MINIPORT_BLOCK Miniport,
  158. IN ULONG Offset,
  159. IN PVOID Buffer,
  160. IN ULONG Length,
  161. IN ULONG WhichSpace,
  162. IN BOOLEAN Read
  163. );
  164. VOID
  165. FASTCALL
  166. ndisReinitializeMiniportBlock(
  167. IN PNDIS_MINIPORT_BLOCK Miniport
  168. );
  169. VOID
  170. FASTCALL
  171. ndisCheckAdapterBindings(
  172. IN PNDIS_MINIPORT_BLOCK Miniport,
  173. IN PNDIS_PROTOCOL_BLOCK Protocol OPTIONAL
  174. );
  175. NDIS_STATUS
  176. FASTCALL
  177. ndisPnPStartDevice(
  178. IN PDEVICE_OBJECT DeviceObject,
  179. IN PIRP Irp
  180. );
  181. NTSTATUS
  182. ndisQueryReferenceBusInterface(
  183. IN PDEVICE_OBJECT PnpDeviceObject,
  184. OUT PBUS_INTERFACE_REFERENCE * BusInterface
  185. );
  186. NTSTATUS
  187. ndisPnPAddDevice(
  188. IN PDRIVER_OBJECT DriverObject,
  189. IN PDEVICE_OBJECT PhysicalDeviceObject
  190. );
  191. NTSTATUS
  192. ndisAddDevice(
  193. IN PDRIVER_OBJECT DriverObject,
  194. IN PUNICODE_STRING pExportName,
  195. IN PDEVICE_OBJECT PhysicalDeviceObject,
  196. IN ULONG Characteristics
  197. );
  198. NTSTATUS
  199. ndisWritePnPCapabilities(
  200. IN PNDIS_MINIPORT_BLOCK Miniport,
  201. IN ULONG PnPCapabilities
  202. );
  203. NDIS_STATUS
  204. ndisRegisterMiniportDriver(
  205. IN NDIS_HANDLE NdisWrapperHandle,
  206. IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
  207. IN UINT CharacteristicsLength,
  208. OUT PNDIS_HANDLE DriverHandle
  209. );
  210. NTSTATUS
  211. ndisDispatchRequest(
  212. IN PDEVICE_OBJECT pDeviceObject,
  213. IN PIRP pIrp
  214. );
  215. NTSTATUS
  216. FASTCALL
  217. ndisHandlePnPRequest(
  218. IN PIRP pIrp
  219. );
  220. NTSTATUS
  221. FASTCALL
  222. ndisHandleLegacyTransport(
  223. IN PUNICODE_STRING pDevice
  224. );
  225. NTSTATUS
  226. FASTCALL
  227. ndisHandleProtocolBindNotification(
  228. IN PUNICODE_STRING pDevice,
  229. IN PUNICODE_STRING Protocol
  230. );
  231. NTSTATUS
  232. FASTCALL
  233. ndisHandleProtocolUnbindNotification(
  234. IN PUNICODE_STRING pDevice,
  235. IN PUNICODE_STRING Protocol
  236. );
  237. NTSTATUS
  238. ndisHandleProtocolReconfigNotification(
  239. IN PUNICODE_STRING pDevice,
  240. IN PUNICODE_STRING Protocol,
  241. IN PVOID ReConfigBuffer,
  242. IN UINT ReConfigBufferSize,
  243. IN UINT Operation
  244. );
  245. NTSTATUS
  246. FASTCALL
  247. ndisHandleProtocolUnloadNotification(
  248. IN PUNICODE_STRING Protocol
  249. );
  250. NTSTATUS
  251. FASTCALL
  252. ndisHandleOrphanDevice(
  253. IN PUNICODE_STRING pDevice
  254. );
  255. NTSTATUS
  256. FASTCALL
  257. ndisHandleUModePnPOp(
  258. IN PNDIS_PNP_OPERATION PnPOp
  259. );
  260. NTSTATUS
  261. FASTCALL
  262. ndisEnumerateInterfaces(
  263. IN PNDIS_ENUM_INTF EnumIntf,
  264. IN UINT BufferLength
  265. );
  266. #if defined(_WIN64)
  267. NTSTATUS
  268. FASTCALL
  269. ndisEnumerateInterfaces32(
  270. IN PNDIS_ENUM_INTF32 EnumIntf,
  271. IN UINT BufferLength
  272. );
  273. #endif // _WIN64
  274. VOID
  275. ndisFindRootDevice(
  276. IN PNDIS_STRING DeviceName,
  277. IN BOOLEAN fTester,
  278. OUT PNDIS_STRING * pBindDeviceName,
  279. OUT PNDIS_STRING * pRootDeviceName,
  280. OUT PNDIS_MINIPORT_BLOCK * pMiniport
  281. );
  282. PNDIS_MINIPORT_BLOCK
  283. ndisFindMiniportOnGlobalList(
  284. IN PNDIS_STRING DeviceName
  285. );
  286. NTSTATUS
  287. ndisUnbindProtocol(
  288. IN PNDIS_OPEN_BLOCK Open,
  289. IN BOOLEAN Notify
  290. );
  291. VOID
  292. ndisReferenceMiniportByName(
  293. IN PUNICODE_STRING DeviceName,
  294. OUT PNDIS_MINIPORT_BLOCK * pMiniport
  295. );
  296. PNDIS_OPEN_BLOCK
  297. FASTCALL
  298. ndisMapOpenByName(
  299. IN PUNICODE_STRING DeviceName,
  300. IN PNDIS_PROTOCOL_BLOCK Protocol,
  301. IN BOOLEAN Reference,
  302. IN BOOLEAN fUnbinding
  303. );
  304. VOID
  305. NdisMCancelTimer(
  306. IN PNDIS_MINIPORT_TIMER Timer,
  307. OUT PBOOLEAN TimerCancelled
  308. );
  309. //
  310. // general reference/dereference functions
  311. //
  312. BOOLEAN
  313. FASTCALL
  314. ndisReferenceRef(
  315. IN PREFERENCE RefP
  316. );
  317. BOOLEAN
  318. FASTCALL
  319. ndisDereferenceRef(
  320. IN PREFERENCE RefP
  321. );
  322. VOID
  323. FASTCALL
  324. ndisInitializeRef(
  325. IN PREFERENCE RefP
  326. );
  327. BOOLEAN
  328. FASTCALL
  329. ndisCloseRef(
  330. IN PREFERENCE RefP
  331. );
  332. BOOLEAN
  333. FASTCALL
  334. ndisReferenceULongRef(
  335. IN PULONG_REFERENCE RefP
  336. );
  337. VOID
  338. FASTCALL
  339. ndisReferenceULongRefNoCheck(
  340. IN PULONG_REFERENCE RefP
  341. );
  342. BOOLEAN
  343. FASTCALL
  344. ndisDereferenceULongRef(
  345. IN PULONG_REFERENCE RefP
  346. );
  347. VOID
  348. FASTCALL
  349. ndisInitializeULongRef(
  350. IN PULONG_REFERENCE RefP
  351. );
  352. BOOLEAN
  353. FASTCALL
  354. ndisCloseULongRef(
  355. IN PULONG_REFERENCE RefP
  356. );
  357. #if DBG
  358. BOOLEAN
  359. FASTCALL
  360. ndisReferenceProtocol(
  361. IN PNDIS_PROTOCOL_BLOCK Protocol
  362. );
  363. #else
  364. #define ndisReferenceProtocol(ProtP) ndisReferenceRef(&(ProtP)->Ref)
  365. #endif
  366. NTSTATUS
  367. FASTCALL
  368. ndisReferenceProtocolByName(
  369. IN PUNICODE_STRING ProtocolName,
  370. IN OUT PNDIS_PROTOCOL_BLOCK * Protocol,
  371. IN BOOLEAN fPartialMatch
  372. );
  373. VOID
  374. FASTCALL
  375. ndisDereferenceProtocol(
  376. IN PNDIS_PROTOCOL_BLOCK Protocol
  377. );
  378. VOID
  379. FASTCALL
  380. ndisDeQueueOpenOnProtocol(
  381. IN PNDIS_OPEN_BLOCK Open,
  382. IN PNDIS_PROTOCOL_BLOCK Protocol
  383. );
  384. BOOLEAN
  385. ndisCheckPortUsage(
  386. IN ULONG PortNumber,
  387. IN PNDIS_MINIPORT_BLOCK Miniport,
  388. OUT PULONG pTranslatedPort,
  389. OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR *pResourceDescriptor
  390. );
  391. VOID
  392. ndisImmediateReadWritePort(
  393. IN NDIS_HANDLE WrapperConfigurationContext,
  394. IN ULONG Port,
  395. IN OUT PVOID Data,
  396. IN ULONG Size,
  397. IN BOOLEAN Read
  398. );
  399. BOOLEAN
  400. ndisCheckMemoryUsage(
  401. IN ULONG Address,
  402. IN PNDIS_MINIPORT_BLOCK Miniport,
  403. OUT PULONG pTranslatedAddress,
  404. OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR *pResourceDescriptor
  405. );
  406. VOID
  407. ndisImmediateReadWriteSharedMemory(
  408. IN NDIS_HANDLE WrapperConfigurationContext,
  409. IN ULONG SharedMemoryAddress,
  410. OUT PUCHAR Buffer,
  411. IN ULONG Length,
  412. IN BOOLEAN Read
  413. );
  414. NTSTATUS
  415. ndisStartMapping(
  416. IN INTERFACE_TYPE InterfaceType,
  417. IN ULONG BusNumber,
  418. IN ULONG InitialAddress,
  419. IN ULONG Length,
  420. IN ULONG AddressSpace,
  421. OUT PVOID * InitialMapping,
  422. OUT PBOOLEAN Mapped
  423. );
  424. NTSTATUS
  425. ndisEndMapping(
  426. IN PVOID InitialMapping,
  427. IN ULONG Length,
  428. IN BOOLEAN Mapped
  429. );
  430. NDIS_STATUS
  431. ndisInitializeAdapter(
  432. IN PNDIS_M_DRIVER_BLOCK pMiniBlock,
  433. IN PDEVICE_OBJECT DeviceObject,
  434. IN PUNICODE_STRING RegServiceName,
  435. IN NDIS_HANDLE DeviceContext OPTIONAL
  436. );
  437. BOOLEAN
  438. ndisWmiGuidIsAdapterSpecific(
  439. IN LPGUID guid
  440. );
  441. NTSTATUS
  442. ndisCreateAdapterInstanceName(
  443. OUT PUNICODE_STRING * pAdapterInstanceName,
  444. IN PDEVICE_OBJECT PhysicalDeviceObject
  445. );
  446. NDIS_STATUS
  447. ndisInitializeConfiguration(
  448. OUT PNDIS_WRAPPER_CONFIGURATION_HANDLE pConfigurationHandle,
  449. IN PNDIS_MINIPORT_BLOCK Miniport,
  450. IN PUNICODE_STRING pExportName
  451. );
  452. NTSTATUS
  453. ndisReadBindPaths(
  454. IN PNDIS_MINIPORT_BLOCK Miniport,
  455. IN PRTL_QUERY_REGISTRY_TABLE LQueryTable
  456. );
  457. NDIS_STATUS
  458. ndisMInitializeAdapter(
  459. IN PNDIS_M_DRIVER_BLOCK pMiniDriver,
  460. IN PNDIS_WRAPPER_CONFIGURATION_HANDLE pConfigurationHandle,
  461. IN PUNICODE_STRING pExportName,
  462. IN NDIS_HANDLE DeviceContext OPTIONAL
  463. );
  464. VOID
  465. FASTCALL
  466. ndisInitializeBinding(
  467. IN PNDIS_MINIPORT_BLOCK Miniport,
  468. IN PNDIS_PROTOCOL_BLOCK Protocol
  469. );
  470. BOOLEAN
  471. FASTCALL
  472. ndisProtocolAlreadyBound(
  473. IN PNDIS_PROTOCOL_BLOCK Protocol,
  474. IN PNDIS_MINIPORT_BLOCK Miniport
  475. );
  476. NTSTATUS
  477. FASTCALL
  478. ndisMShutdownMiniport(
  479. IN PNDIS_MINIPORT_BLOCK Miniport
  480. );
  481. NDIS_STATUS
  482. FASTCALL
  483. ndisCloseMiniportBindings(
  484. IN PNDIS_MINIPORT_BLOCK Miniport
  485. );
  486. VOID
  487. ndisCheckProtocolBindings(
  488. IN PNDIS_PROTOCOL_BLOCK Protocol
  489. );
  490. VOID
  491. ndisMQueuedAllocateSharedHandler(
  492. IN PASYNC_WORKITEM pWorkItem
  493. );
  494. VOID
  495. ndisMQueuedFreeSharedHandler(
  496. IN PASYNC_WORKITEM pWorkItem
  497. );
  498. /*++
  499. BOOLEAN
  500. ndisReferenceDriver(
  501. IN PNDIS_M_DRIVER_BLOCK DriverP
  502. );
  503. --*/
  504. #define ndisReferenceDriver(DriverP) ndisReferenceRef(&(DriverP)->Ref)
  505. VOID
  506. FASTCALL
  507. ndisDereferenceDriver(
  508. IN PNDIS_M_DRIVER_BLOCK DriverP,
  509. IN BOOLEAN fGlobalLockHeld
  510. );
  511. BOOLEAN
  512. FASTCALL
  513. ndisQueueMiniportOnDriver(
  514. IN PNDIS_MINIPORT_BLOCK Miniport,
  515. IN PNDIS_M_DRIVER_BLOCK Driver
  516. );
  517. VOID
  518. FASTCALL
  519. ndisDeQueueMiniportOnDriver(
  520. IN PNDIS_MINIPORT_BLOCK Miniport,
  521. IN PNDIS_M_DRIVER_BLOCK Driver
  522. );
  523. /*++
  524. BOOLEAN
  525. FASTCALL
  526. ndisReferenceMiniport(
  527. IN PNDIS_MINIPORT_BLOCK Miniport
  528. );
  529. --*/
  530. #if DBG
  531. BOOLEAN
  532. FASTCALL
  533. ndisReferenceMiniport(
  534. IN PNDIS_MINIPORT_BLOCK Miniport
  535. );
  536. #else
  537. #define ndisReferenceMiniport(Miniport) ndisReferenceULongRef(&(Miniport)->Ref)
  538. #endif
  539. #ifdef TRACK_MINIPORT_REFCOUNTS
  540. BOOLEAN
  541. ndisReferenceMiniportAndLog(
  542. IN PNDIS_MINIPORT_BLOCK Miniport,
  543. IN UINT Line,
  544. IN UINT Module
  545. );
  546. BOOLEAN
  547. ndisReferenceMiniportAndLogCreate(
  548. IN PNDIS_MINIPORT_BLOCK Miniport,
  549. IN UINT Line,
  550. IN UINT Module,
  551. IN PIRP Irp
  552. );
  553. #endif
  554. VOID
  555. FASTCALL
  556. ndisDereferenceMiniport(
  557. IN PNDIS_MINIPORT_BLOCK Miniport
  558. );
  559. VOID
  560. FASTCALL
  561. ndisDeQueueOpenOnMiniport(
  562. IN PNDIS_OPEN_BLOCK MiniportOpen,
  563. IN PNDIS_MINIPORT_BLOCK Miniport
  564. );
  565. VOID
  566. FASTCALL
  567. ndisInitializePackage(
  568. IN PPKG_REF pPkg
  569. );
  570. VOID
  571. FASTCALL
  572. ndisReferencePackage(
  573. IN PPKG_REF pPkg
  574. );
  575. VOID
  576. FASTCALL
  577. ndisDereferencePackage(
  578. IN PPKG_REF pPkg
  579. );
  580. #define ProtocolReferencePackage() ndisReferencePackage(&ndisPkgs[NDSP_PKG])
  581. #define MiniportReferencePackage() ndisReferencePackage(&ndisPkgs[NDSM_PKG])
  582. #define PnPReferencePackage() ndisReferencePackage(&ndisPkgs[NPNP_PKG])
  583. #define CoReferencePackage() ndisReferencePackage(&ndisPkgs[NDCO_PKG])
  584. #define EthReferencePackage() ndisReferencePackage(&ndisPkgs[NDSE_PKG])
  585. #define FddiReferencePackage() ndisReferencePackage(&ndisPkgs[NDSF_PKG])
  586. #define TrReferencePackage() ndisReferencePackage(&ndisPkgs[NDST_PKG])
  587. #define ArcReferencePackage() ndisReferencePackage(&ndisPkgs[NDSA_PKG])
  588. #define ProtocolDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDSP_PKG])
  589. #define MiniportDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDSM_PKG])
  590. #define PnPDereferencePackage() ndisDereferencePackage(&ndisPkgs[NPNP_PKG])
  591. #define CoDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDCO_PKG])
  592. #define EthDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDSE_PKG])
  593. #define FddiDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDSF_PKG])
  594. #define TrDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDST_PKG])
  595. #define ArcDereferencePackage() ndisDereferencePackage(&ndisPkgs[NDSA_PKG])
  596. //
  597. // IRP handlers established on behalf of NDIS devices by the wrapper.
  598. //
  599. NTSTATUS
  600. ndisCreateIrpHandler(
  601. IN PDEVICE_OBJECT DeviceObject,
  602. IN PIRP Irp
  603. );
  604. NTSTATUS
  605. ndisDeviceControlIrpHandler(
  606. IN PDEVICE_OBJECT DeviceObject,
  607. IN PIRP Irp
  608. );
  609. NTSTATUS
  610. ndisCloseIrpHandler(
  611. IN PDEVICE_OBJECT DeviceObject,
  612. IN PIRP Irp
  613. );
  614. NTSTATUS
  615. ndisDummyIrpHandler(
  616. IN PDEVICE_OBJECT DeviceObject,
  617. IN PIRP Irp
  618. );
  619. VOID
  620. ndisCancelLogIrp(
  621. IN PDEVICE_OBJECT DeviceObject,
  622. IN PIRP Irp
  623. );
  624. NDIS_STATUS
  625. FASTCALL
  626. ndisMGetLogData(
  627. IN PNDIS_MINIPORT_BLOCK Miniport,
  628. IN PIRP Irp
  629. );
  630. BOOLEAN
  631. FASTCALL
  632. ndisQueueOpenOnProtocol(
  633. IN PNDIS_OPEN_BLOCK Open,
  634. IN PNDIS_PROTOCOL_BLOCK Protocol
  635. );
  636. VOID
  637. NdisCancelTimer(
  638. IN PNDIS_TIMER Timer,
  639. OUT PBOOLEAN TimerCancelled
  640. );
  641. //
  642. // Dma operations
  643. //
  644. extern
  645. IO_ALLOCATION_ACTION
  646. ndisDmaExecutionRoutine(
  647. IN PDEVICE_OBJECT DeviceObject,
  648. IN PIRP Irp,
  649. IN PVOID MapRegisterBase,
  650. IN PVOID Context
  651. );
  652. //
  653. // Map Registers
  654. //
  655. extern
  656. IO_ALLOCATION_ACTION
  657. ndisAllocationExecutionRoutine(
  658. IN PDEVICE_OBJECT DeviceObject,
  659. IN PIRP Irp,
  660. IN PVOID MapRegisterBase,
  661. IN PVOID Context
  662. );
  663. #undef NdisMSendResourcesAvailable
  664. VOID
  665. NdisMSendResourcesAvailable(
  666. IN NDIS_HANDLE MiniportAdapterHandle
  667. );
  668. #undef NdisMResetComplete
  669. VOID
  670. NdisMResetComplete(
  671. IN NDIS_HANDLE MiniportAdapterHandle,
  672. IN NDIS_STATUS Status,
  673. IN BOOLEAN AddressingReset
  674. );
  675. NTSTATUS
  676. ndisSaveParameters(
  677. IN PWSTR ValueName,
  678. IN ULONG ValueType,
  679. IN PVOID ValueData,
  680. IN ULONG ValueLength,
  681. IN PVOID Context,
  682. IN PVOID EntryContext
  683. );
  684. NTSTATUS
  685. ndisReadParameter(
  686. IN PWSTR ValueName,
  687. IN ULONG ValueType,
  688. IN PVOID ValueData,
  689. IN ULONG ValueLength,
  690. IN PVOID Context,
  691. IN PVOID EntryContext
  692. );
  693. VOID
  694. FASTCALL
  695. ndisMCommonHaltMiniport(
  696. IN PNDIS_MINIPORT_BLOCK Miniport
  697. );
  698. VOID
  699. FASTCALL
  700. ndisMHaltMiniport(
  701. IN PNDIS_MINIPORT_BLOCK Miniport
  702. );
  703. VOID
  704. ndisMUnload(
  705. IN PDRIVER_OBJECT DriverObject
  706. );
  707. NDIS_STATUS
  708. FASTCALL
  709. ndisQueryDeviceOid(
  710. IN PNDIS_USER_OPEN_CONTEXT OpenContext,
  711. IN PNDIS_REQUEST QueryRequest,
  712. IN NDIS_OID Oid,
  713. IN PVOID Buffer,
  714. IN UINT BufferLength
  715. );
  716. BOOLEAN
  717. FASTCALL
  718. ndisValidOid(
  719. IN PNDIS_USER_OPEN_CONTEXT OpenContext,
  720. IN NDIS_OID Oid
  721. );
  722. NDIS_STATUS
  723. FASTCALL
  724. ndisSplitStatisticsOids(
  725. IN PNDIS_USER_OPEN_CONTEXT OpenContext,
  726. IN PNDIS_OID OidList,
  727. IN ULONG NumOids
  728. );
  729. VOID
  730. FASTCALL
  731. ndisMFinishClose(
  732. IN PNDIS_OPEN_BLOCK Open
  733. );
  734. VOID
  735. ndisMQueuedFinishClose(
  736. IN PNDIS_OPEN_BLOCK Open
  737. );
  738. BOOLEAN
  739. FASTCALL
  740. ndisMKillOpen(
  741. IN PNDIS_OPEN_BLOCK Open
  742. );
  743. NDIS_STATUS
  744. FASTCALL
  745. ndisQueryOidList(
  746. IN PNDIS_USER_OPEN_CONTEXT OpenContext
  747. );
  748. VOID
  749. ndisBugcheckHandler(
  750. IN PNDIS_WRAPPER_CONTEXT WrapperContext,
  751. IN ULONG Size
  752. );
  753. VOID
  754. ndisMFinishQueuedPendingOpen(
  755. IN PNDIS_POST_OPEN_PROCESSING PostOpen
  756. );
  757. VOID
  758. NdisAllocatePacketPool(
  759. OUT PNDIS_STATUS Status,
  760. OUT PNDIS_HANDLE PoolHandle,
  761. IN UINT NumberOfDescriptors,
  762. IN UINT ProtocolReservedLength
  763. );
  764. #undef NdisIMInitializeDeviceInstance
  765. NDIS_STATUS
  766. NdisIMInitializeDeviceInstance(
  767. IN NDIS_HANDLE DriverHandle,
  768. IN PNDIS_STRING DriverInstance
  769. );
  770. #undef NdisSend
  771. VOID
  772. NdisSend(
  773. OUT PNDIS_STATUS Status,
  774. IN NDIS_HANDLE NdisBindingHandle,
  775. IN PNDIS_PACKET Packet
  776. );
  777. #undef NdisSendPackets
  778. VOID
  779. NdisSendPackets(
  780. IN NDIS_HANDLE NdisBindingHandle,
  781. IN PPNDIS_PACKET PacketArray,
  782. IN UINT NumberOfPackets
  783. );
  784. VOID
  785. NdisMStartBufferPhysicalMapping(
  786. IN NDIS_HANDLE MiniportAdapterHandle,
  787. IN PNDIS_BUFFER Buffer,
  788. IN ULONG PhysicalMapRegister,
  789. IN BOOLEAN WriteToDevice,
  790. OUT PNDIS_PHYSICAL_ADDRESS_UNIT PhysicalAddressArray,
  791. OUT PUINT ArraySize
  792. );
  793. VOID
  794. NdisMCompleteBufferPhysicalMapping(
  795. IN NDIS_HANDLE MiniportAdapterHandle,
  796. IN PNDIS_BUFFER Buffer,
  797. IN ULONG PhysicalMapRegister
  798. );
  799. VOID
  800. FASTCALL
  801. ndisMAllocSGList(
  802. IN PNDIS_MINIPORT_BLOCK Miniport,
  803. IN PNDIS_PACKET Packet
  804. );
  805. VOID
  806. FASTCALL
  807. ndisMFreeSGList(
  808. IN PNDIS_MINIPORT_BLOCK Miniport,
  809. IN PNDIS_PACKET Packet
  810. );
  811. VOID
  812. ndisMProcessSGList(
  813. IN PDEVICE_OBJECT pDO,
  814. IN PIRP pIrp,
  815. IN PSCATTER_GATHER_LIST pSGL,
  816. IN PVOID Context
  817. );
  818. VOID
  819. ndisWorkItemHandler(
  820. IN PNDIS_WORK_ITEM WorkItem
  821. );
  822. //
  823. // MISC
  824. //
  825. #undef NDIS_BUFFER_TO_SPAN_PAGES
  826. ULONG
  827. NDIS_BUFFER_TO_SPAN_PAGES(
  828. IN PNDIS_BUFFER Buffer
  829. );
  830. #undef NdisGetFirstBufferFromPacket
  831. VOID
  832. NdisGetFirstBufferFromPacket(
  833. IN PNDIS_PACKET Packet,
  834. OUT PNDIS_BUFFER * FirstBuffer,
  835. OUT PVOID * FirstBufferVA,
  836. OUT PUINT FirstBufferLength,
  837. OUT PUINT TotalBufferLength
  838. );
  839. #undef NdisGetFirstBufferFromPacketSafe
  840. VOID
  841. NdisGetFirstBufferFromPacketSafe(
  842. IN PNDIS_PACKET Packet,
  843. OUT PNDIS_BUFFER * FirstBuffer,
  844. OUT PVOID * FirstBufferVA,
  845. OUT PUINT FirstBufferLength,
  846. OUT PUINT TotalBufferLength,
  847. IN MM_PAGE_PRIORITY Priority
  848. );
  849. #undef NdisBufferLength
  850. ULONG
  851. NdisBufferLength(
  852. IN PNDIS_BUFFER Buffer
  853. );
  854. #undef NdisBufferVirtualAddress
  855. PVOID
  856. NdisBufferVirtualAddress(
  857. IN PNDIS_BUFFER Buffer
  858. );
  859. #undef NdisGetBufferPhysicalArraySize
  860. VOID
  861. NdisGetBufferPhysicalArraySize(
  862. IN PNDIS_BUFFER Buffer,
  863. OUT PUINT ArraySize
  864. );
  865. #undef NdisAllocateSpinLock
  866. VOID
  867. NdisAllocateSpinLock(
  868. IN PNDIS_SPIN_LOCK SpinLock
  869. );
  870. #undef NdisFreeSpinLock
  871. VOID
  872. NdisFreeSpinLock(
  873. IN PNDIS_SPIN_LOCK SpinLock
  874. );
  875. #undef NdisAcquireSpinLock
  876. VOID
  877. NdisAcquireSpinLock(
  878. IN PNDIS_SPIN_LOCK SpinLock
  879. );
  880. #undef NdisReleaseSpinLock
  881. VOID
  882. NdisReleaseSpinLock(
  883. IN PNDIS_SPIN_LOCK SpinLock
  884. );
  885. #undef NdisDprAcquireSpinLock
  886. VOID
  887. NdisDprAcquireSpinLock(
  888. IN PNDIS_SPIN_LOCK SpinLock
  889. );
  890. #undef NdisDprReleaseSpinLock
  891. VOID
  892. NdisDprReleaseSpinLock(
  893. IN PNDIS_SPIN_LOCK SpinLock
  894. );
  895. #undef NdisGetCurrentSystemTime
  896. VOID
  897. NdisGetCurrentSystemTime(
  898. IN PLARGE_INTEGER pCurrentTime
  899. );
  900. #undef NdisQueryBufferSafe
  901. VOID
  902. NdisQueryBufferSafe(
  903. IN PNDIS_BUFFER Buffer,
  904. OUT PVOID * VirtualAddress OPTIONAL,
  905. OUT PUINT Length,
  906. IN MM_PAGE_PRIORITY Priority
  907. );
  908. #undef NdisQueryBufferOffset
  909. VOID
  910. NdisQueryBufferOffset(
  911. IN PNDIS_BUFFER Buffer,
  912. OUT PUINT Offset,
  913. OUT PUINT Length
  914. );
  915. #undef NdisAdjustBufferLength
  916. VOID
  917. NdisAdjustBufferLength(
  918. IN PNDIS_BUFFER Buffer,
  919. IN UINT Length
  920. );
  921. #undef NdisUpdateSharedMemory
  922. VOID
  923. NdisUpdateSharedMemory(
  924. IN NDIS_HANDLE NdisAdapterHandle,
  925. IN ULONG Length,
  926. IN PVOID VirtualAddress,
  927. IN NDIS_PHYSICAL_ADDRESS PhysicalAddress
  928. );
  929. #undef NdisFreePacketPool
  930. VOID
  931. NdisFreePacketPool(
  932. IN NDIS_HANDLE PoolHandle
  933. );
  934. #undef NdisFreePacket
  935. VOID
  936. NdisFreePacket(
  937. IN PNDIS_PACKET Packet
  938. );
  939. #undef NdisDprFreePacketNonInterlocked
  940. VOID
  941. NdisDprFreePacketNonInterlocked(
  942. IN PNDIS_PACKET Packet
  943. );
  944. #undef NdisDprFreePacket
  945. VOID
  946. NdisDprFreePacket(
  947. IN PNDIS_PACKET Packet
  948. );
  949. VOID
  950. FASTCALL
  951. ndisFreePacket(
  952. IN PNDIS_PACKET Packet,
  953. IN PNDIS_PKT_POOL Pool
  954. );
  955. #undef NdisAnsiStringToUnicodeString
  956. NDIS_STATUS
  957. NdisAnsiStringToUnicodeString(
  958. IN OUT PUNICODE_STRING DestinationString,
  959. IN PANSI_STRING SourceString
  960. );
  961. #undef NdisUnicodeStringToAnsiString
  962. NDIS_STATUS
  963. NdisUnicodeStringToAnsiString(
  964. IN OUT PANSI_STRING DestinationString,
  965. IN PUNICODE_STRING SourceString
  966. );
  967. #undef NdisCompareAnsiString
  968. BOOLEAN
  969. NdisCompareAnsiString(
  970. IN PANSI_STRING String1,
  971. IN PANSI_STRING String2,
  972. IN BOOLEAN CaseInSensitive
  973. );
  974. #undef NdisCompareUnicodeString
  975. BOOLEAN
  976. NdisCompareUnicodeString(
  977. IN PUNICODE_STRING String1,
  978. IN PUNICODE_STRING String2,
  979. IN BOOLEAN CaseInSensitive
  980. );
  981. #undef NdisUpcaseUnicodeString
  982. NDIS_STATUS
  983. NdisUpcaseUnicodeString(
  984. OUT PUNICODE_STRING DestinationString,
  985. IN PUNICODE_STRING SourceString
  986. );
  987. #undef NdisReset
  988. VOID
  989. NdisReset(
  990. OUT PNDIS_STATUS Status,
  991. IN NDIS_HANDLE NdisBindingHandle
  992. );
  993. #undef NdisRequest
  994. VOID
  995. NdisRequest(
  996. OUT PNDIS_STATUS Status,
  997. IN NDIS_HANDLE NdisBindingHandle,
  998. IN PNDIS_REQUEST NdisRequest
  999. );
  1000. #undef NdisTransferData
  1001. VOID
  1002. NdisTransferData(
  1003. OUT PNDIS_STATUS Status,
  1004. IN NDIS_HANDLE NdisBindingHandle,
  1005. IN NDIS_HANDLE MacReceiveContext,
  1006. IN UINT ByteOffset,
  1007. IN UINT BytesToTransfer,
  1008. IN OUT PNDIS_PACKET Packet,
  1009. OUT PUINT BytesTransferred
  1010. );
  1011. BOOLEAN
  1012. ndisVerifierInitialization(
  1013. VOID
  1014. );
  1015. BOOLEAN
  1016. ndisVerifierInjectResourceFailure (
  1017. IN BOOLEAN fDelayFailure
  1018. );
  1019. EXPORT
  1020. NDIS_STATUS
  1021. ndisVerifierAllocateMemory(
  1022. OUT PVOID * VirtualAddress,
  1023. IN UINT Length,
  1024. IN UINT MemoryFlags,
  1025. IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
  1026. );
  1027. EXPORT
  1028. NDIS_STATUS
  1029. ndisVerifierAllocateMemoryWithTag(
  1030. OUT PVOID * VirtualAddress,
  1031. IN UINT Length,
  1032. IN ULONG Tag
  1033. );
  1034. EXPORT
  1035. VOID
  1036. ndisVerifierAllocatePacketPool(
  1037. OUT PNDIS_STATUS Status,
  1038. OUT PNDIS_HANDLE PoolHandle,
  1039. IN UINT NumberOfDescriptors,
  1040. IN UINT ProtocolReservedLength
  1041. );
  1042. EXPORT
  1043. VOID
  1044. ndisVerifierAllocatePacketPoolEx(
  1045. OUT PNDIS_STATUS Status,
  1046. OUT PNDIS_HANDLE PoolHandle,
  1047. IN UINT NumberOfDescriptors,
  1048. IN UINT NumberOfOverflowDescriptors,
  1049. IN UINT ProtocolReservedLength
  1050. );
  1051. EXPORT
  1052. VOID
  1053. ndisVerifierFreePacketPool(
  1054. IN NDIS_HANDLE PoolHandle
  1055. );
  1056. NDIS_STATUS
  1057. ndisVerifierQueryMapRegisterCount(
  1058. IN NDIS_INTERFACE_TYPE BusType,
  1059. OUT PUINT MapRegisterCount
  1060. );
  1061. VOID
  1062. ndisFreePacketPool(
  1063. IN NDIS_HANDLE PoolHandle,
  1064. IN BOOLEAN Verify
  1065. );
  1066. #if TRACK_MEMORY
  1067. extern
  1068. PVOID
  1069. AllocateM(
  1070. IN UINT Size,
  1071. IN ULONG ModLine,
  1072. IN ULONG Tag
  1073. );
  1074. extern
  1075. VOID
  1076. FreeM(
  1077. IN PVOID MemPtr
  1078. );
  1079. #endif
  1080. VOID
  1081. ndisMNotifyMachineName(
  1082. IN PNDIS_MINIPORT_BLOCK Miniport,
  1083. IN PNDIS_STRING MachineName OPTIONAL
  1084. );
  1085. VOID
  1086. ndisPowerStateCallback(
  1087. IN PVOID CallBackContext,
  1088. IN PVOID Argument1,
  1089. IN PVOID Argument2
  1090. );
  1091. VOID
  1092. ndisNotifyMiniports(
  1093. IN PNDIS_MINIPORT_BLOCK Miniport OPTIONAL,
  1094. IN NDIS_DEVICE_PNP_EVENT DevicePnPEvent,
  1095. IN PVOID Buffer,
  1096. IN ULONG Length
  1097. );
  1098. PNDIS_MINIPORT_BLOCK
  1099. ndisReferenceNextUnprocessedMiniport(
  1100. IN PNDIS_M_DRIVER_BLOCK MiniBlock
  1101. );
  1102. VOID
  1103. ndisUnprocessAllMiniports(
  1104. IN PNDIS_M_DRIVER_BLOCK MiniBlock
  1105. );
  1106. #undef NdisSetPacketCancelId
  1107. VOID
  1108. NdisSetPacketCancelId(
  1109. IN PNDIS_PACKET Packet,
  1110. IN PVOID CancelId
  1111. );
  1112. #undef NdisGetPacketCancelId
  1113. PVOID
  1114. NdisGetPacketCancelId(
  1115. IN PNDIS_PACKET Packet
  1116. );
  1117. VOID
  1118. ndisSetupWmiNode(
  1119. IN PNDIS_MINIPORT_BLOCK Miniport,
  1120. IN PUNICODE_STRING InstanceName,
  1121. IN ULONG DataBlockSize,
  1122. IN PVOID pGuid,
  1123. IN OUT PWNODE_SINGLE_INSTANCE * pwnode
  1124. );
  1125. BOOLEAN
  1126. FASTCALL
  1127. ndisMStartSendPacketsSG(
  1128. IN PNDIS_MINIPORT_BLOCK Miniport
  1129. );
  1130. NDIS_STATUS
  1131. ndisMSendSG(
  1132. IN NDIS_HANDLE NdisBindingHandle,
  1133. IN PNDIS_PACKET Packet
  1134. );
  1135. BOOLEAN
  1136. FASTCALL
  1137. ndisMStartSendsSG(
  1138. IN PNDIS_MINIPORT_BLOCK Miniport
  1139. );
  1140. VOID
  1141. ndisMSendPacketsSG(
  1142. IN NDIS_HANDLE NdisBindingHandle,
  1143. IN PPNDIS_PACKET PacketArray,
  1144. IN UINT NumberOfPackets
  1145. );
  1146. VOID
  1147. ndisMSendCompleteSG(
  1148. IN NDIS_HANDLE MiniportAdapterHandle,
  1149. IN PNDIS_PACKET Packet,
  1150. IN NDIS_STATUS Status
  1151. );
  1152. VOID
  1153. FASTCALL
  1154. ndisMAllocSGListS(
  1155. IN PNDIS_MINIPORT_BLOCK Miniport,
  1156. IN PNDIS_PACKET Packet
  1157. );
  1158. VOID
  1159. ndisMProcessSGListS(
  1160. IN PDEVICE_OBJECT pDO,
  1161. IN PIRP pIrp,
  1162. IN PSCATTER_GATHER_LIST pSGL,
  1163. IN PVOID Context
  1164. );
  1165. VOID
  1166. ndisDereferenceDmaAdapter(
  1167. IN PNDIS_MINIPORT_BLOCK Miniport
  1168. );
  1169. VOID
  1170. ndisDereferenceAfNotification(
  1171. IN PNDIS_OPEN_BLOCK Open
  1172. );
  1173. VOID
  1174. ndisMSetIndicatePacketHandler(
  1175. IN PNDIS_MINIPORT_BLOCK Miniport
  1176. );
  1177. VOID
  1178. ndisVerifierFreeMemory(
  1179. IN PVOID VirtualAddress,
  1180. IN UINT Length,
  1181. IN UINT MemoryFlags
  1182. );
  1183. VOID
  1184. ndisUpdateCheckForLoopbackFlag(
  1185. IN PNDIS_MINIPORT_BLOCK Miniport
  1186. );
  1187. BOOLEAN
  1188. ndisReferenceOpenByHandle(
  1189. IN PNDIS_OPEN_BLOCK Open,
  1190. IN BOOLEAN fRef
  1191. );
  1192. BOOLEAN
  1193. ndisRemoveOpenFromGlobalList(
  1194. IN PNDIS_OPEN_BLOCK Open
  1195. );
  1196. NDIS_STATUS
  1197. ndisMRegisterInterruptCommon(
  1198. OUT PNDIS_MINIPORT_INTERRUPT Interrupt,
  1199. IN NDIS_HANDLE MiniportAdapterHandle,
  1200. IN UINT InterruptVector,
  1201. IN UINT InterruptLevel,
  1202. IN BOOLEAN RequestIsr,
  1203. IN BOOLEAN SharedInterrupt,
  1204. IN NDIS_INTERRUPT_MODE InterruptMode
  1205. );
  1206. VOID
  1207. ndisMDeregisterInterruptCommon(
  1208. IN PNDIS_MINIPORT_INTERRUPT MiniportInterrupt
  1209. );
  1210. NTSTATUS
  1211. CreateDeviceDriverSecurityDescriptor(
  1212. PVOID DeviceOrDriverObject
  1213. );