Leaked source code of windows server 2003
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.

827 lines
20 KiB

  1. #ifndef __GckShell_h__
  2. #define __GckShell_h__
  3. // @doc
  4. /**********************************************************************
  5. *
  6. * @module GckShell.h |
  7. *
  8. * Header file for GcKernel.sys WDM shell structure
  9. *
  10. * History
  11. * ----------------------------------------------------------------------
  12. * Mitchell S. Dernis Original (Adopted from Hid2Gdp by Michael Hooning)
  13. *
  14. * (c) 1986-1998 Microsoft Corporation. All right reserved.
  15. *
  16. * @topic GckShell |
  17. * Declaration of all structures, and functions in GcKernel that make up
  18. * the shell of the driver. This excludes the Filter Module (and in the future)
  19. * any mixer modules.
  20. **********************************************************************/
  21. #include "GckExtrn.h" // Pull in any stuff that also needs to be available externally.
  22. #include "RemLock.h" // Pull in header for RemoveLock utility functions
  23. // We use some structures from hidclass.h
  24. #include <hidclass.h>
  25. #include <hidsdi.h>
  26. #include <hidpi.h>
  27. #include <hidusage.h>
  28. // A little more rigorous than our normal build
  29. #pragma warning(error:4100) // Unreferenced formal parameter
  30. #pragma warning(error:4705) // Statement has no effect
  31. //-----------------------------------------------------------------------------
  32. // The below constants distinguish between the three types of Device Objects
  33. // used throughout GcKernel. 0xABCD in the high word is used as a signature
  34. // in DEBUG builds just to verify that the type was initialized.
  35. //-----------------------------------------------------------------------------
  36. #define GCK_DO_TYPE_CONTROL 0xABCD0001
  37. #define GCK_DO_TYPE_FILTER 0xABCD0002
  38. #define GCK_DO_TYPE_SWVB 0xABCD0003
  39. //------------------------------------------------------------------------------
  40. // Enumeration to keep track of device state, rather than fStarted and fRemoved
  41. // flags
  42. //------------------------------------------------------------------------------
  43. typedef enum _tagGCK_DEVICE_STATE
  44. {
  45. GCK_STATE_STARTED=0,
  46. //GCK_STATE_SURPRISE_REMOVED, //Currently not used, same as GCK_STATE_STOPPED
  47. GCK_STATE_STOP_PENDING,
  48. GCK_STATE_STOPPED,
  49. //GCK_STATE_REMOVE_PENDING, //Currently not used, same as GCK_STATE_STOPPED
  50. GCK_STATE_REMOVED
  51. } GCK_DEVICE_STATE;
  52. //------------------------------------------------------------------------------
  53. // Microsoft's vendor ID is fixed for all products. The following constant
  54. // is defined for use in GcKernel
  55. //------------------------------------------------------------------------------
  56. #define MICROSOFT_VENDOR_ID 0x045E
  57. //------------------------------------------------------------------------------
  58. // Declaration of Various structures
  59. //------------------------------------------------------------------------------
  60. //
  61. // @struct GCK_CONTROL_EXT | Device Extension for our control device
  62. //
  63. typedef struct _tagGCK_CONTROL_EXT
  64. {
  65. ULONG ulGckDevObjType; // @field Type of GcKernel device object.
  66. LONG lOutstandingIO; // @field 1 biased count of reasons why we shouldn't unload
  67. } GCK_CONTROL_EXT, *PGCK_CONTROL_EXT;
  68. //
  69. // @struct GCK_HID_Device_INFO | sub-structure that holds HID info about device
  70. //
  71. typedef struct _tagGCK_HID_DEVICE_INFO
  72. {
  73. HID_COLLECTION_INFORMATION HidCollectionInfo; // @field HID_COLLECTION_INFO reported by device
  74. PHIDP_PREPARSED_DATA pHIDPPreparsedData; // @field pointer to HID_PREPARSED_DATA reported by device
  75. HIDP_CAPS HidPCaps; // @field HID_CAPS structure for device
  76. } GCK_HID_DEVICE_INFO, *PGCK_HID_DEVICE_INFO;
  77. //
  78. // @struct GCK_FILE_OPEN_ITEM | Status of open file handles.
  79. //
  80. typedef struct tagGCK_FILE_OPEN_ITEM
  81. {
  82. BOOLEAN fReadPending; // @field TRUE if read is pending to driver
  83. BOOLEAN fConfirmed; // @field TRUE means that the lower driver has already completed the open
  84. ULONG ulAccess; // @field represents permissions this was opened with
  85. USHORT usSharing; // @field represents sharing under which this was opened
  86. FILE_OBJECT *pFileObject; // @field Pointer to file object which this status describes
  87. struct tagGCK_FILE_OPEN_ITEM *pNextOpenItem; // @field Next structure in Linked List
  88. } GCK_FILE_OPEN_ITEM, *PGCK_FILE_OPEN_ITEM;
  89. typedef struct _SHARE_STATUS {
  90. ULONG OpenCount;
  91. ULONG Readers;
  92. ULONG Writers;
  93. //ULONG Deleters; //We are driver without delete symantics
  94. ULONG SharedRead;
  95. ULONG SharedWrite;
  96. //ULONG SharedDelete; //We are driver without delete symantics
  97. } SHARE_STATUS, *PSHARE_STATUS;
  98. //
  99. // @struct GCK_INTERNAL_POLL | Information needed for the iternal polling routines
  100. //
  101. typedef struct tagGCK_INTERNAL_POLL
  102. {
  103. KSPIN_LOCK InternalPollLock; // @field SpinLock to serialize access to this structue (not all items require it)
  104. FILE_OBJECT *pInternalFileObject; // @field Pointer to File Object that was created for internal polls
  105. PGCK_FILE_OPEN_ITEM pFirstOpenItem; // @field Head of linked list of GCK_FILE_OPEN_ITEMs for open files
  106. SHARE_STATUS ShareStatus; // @field Keeps track of file sharing.
  107. // BOOLEAN fReadPending; // @field TRUE if Read IRP to lower driver is pending
  108. LONG fReadPending; // @field TRUE if Read IRP to lower driver is pending
  109. PIRP pPrivateIrp; // @field IRP we reuse to send Read IRPs to lower driver
  110. PUCHAR pucReportBuffer; // @field Buffer for getting Report with pPrivateIrp
  111. ULONG ulInternalPollRef; // @field Reference to internal polls
  112. PKTHREAD InternalCreateThread; // @field Used to figure out if a create is for the internal file object
  113. BOOLEAN fReady;
  114. } GCK_INTERNAL_POLL, *PGCK_INTERNAL_POLL;
  115. typedef struct _tagGCK_INTERLOCKED_QUEUE
  116. {
  117. KSPIN_LOCK SpinLock;
  118. LIST_ENTRY ListHead;
  119. } GCK_INTERLOCKED_QUEUE, *PGCK_INTERLOCKED_QUEUE;
  120. // Declare structure for filterhooks stuff
  121. struct GCK_FILTER_HOOKS_DATA;
  122. //
  123. // @struct GCK_FILTER_EXT | Device Extension for device objects which act as filters
  124. //
  125. typedef struct _tagGCK_FILTER_EXT
  126. {
  127. ULONG ulGckDevObjType; // @field Type of GcKernel device object.
  128. GCK_DEVICE_STATE eDeviceState; // @field Keeps track of device state
  129. PDEVICE_OBJECT pPDO; // @field PDO to which this filter is attached
  130. PDEVICE_OBJECT pTopOfStack; // @field Top of the device stack just
  131. // beneath this filter device object
  132. KEVENT StartEvent; // @field Event to notify when lower driver completed start IRP.
  133. GCK_REMOVE_LOCK RemoveLock; // @field Custom Remove Lock
  134. PUCHAR pucLastReport; // @field Last report read
  135. IO_STATUS_BLOCK ioLastReportStatus; // @field Status block for Last report read
  136. struct GCK_FILTER_HOOKS_DATA *pFilterHooks;// @field pointer to all the thinks needed in filter hooks
  137. PDEVICE_OBJECT pNextFilterObject; // @field point to next filter device object in global list
  138. GCK_HID_DEVICE_INFO HidInfo; // @field sub-structure with pertinent HID info
  139. PVOID pvFilterObject; // @field pointer to CDeviceFilter, but this is C module so use PVOID
  140. PVOID pvSecondaryFilter; // @field pointer to CDeviceFilter, but this is C module so use PVOID
  141. PVOID pvForceIoctlQueue; // @field pointer to CGuardedIrpQueue for waiting IOCTL_GCK_NOTIFY_FF_SCHEME_CHANGE (use PVOID since C)
  142. PVOID pvTriggerIoctlQueue;// @field pointer to CGuardedIrpQueue for waiting IOCTL_GCK_TRIGGER (use PVOID since C)
  143. GCK_INTERNAL_POLL InternalPoll; // @field Structure for Internal Polling module.
  144. } GCK_FILTER_EXT, *PGCK_FILTER_EXT;
  145. //
  146. // @struct GCK_GLOBALS | Hold a few global variables for the driver
  147. //
  148. typedef struct _tagGCK_GLOBALS
  149. {
  150. PDEVICE_OBJECT pControlObject; //@field pointer to the one and only control object
  151. ULONG ulFilteredDeviceCount; //@field count of device objects for filtering devices
  152. PDEVICE_OBJECT pFilterObjectList; //@field head of linked list for all the devices we are filtering
  153. FAST_MUTEX FilterObjectListFMutex; //@field fast mutex for synchronizing access to filter object list
  154. PGCK_FILTER_EXT pSWVB_FilterExt; //@field Device Extension of Filter Device which acts as SideWinder Virtual Bus
  155. PDEVICE_OBJECT pVirtualKeyboardPdo; //@field PDO for virtual Keyboard
  156. ULONG ulVirtualKeyboardRefCount; //@field RefCount of virual Keyboard users
  157. } GCK_GLOBALS;
  158. //
  159. // @devnote One instance of GCK_GLOBALS exists(in GckShell.c) and is called "Globals"
  160. //
  161. extern GCK_GLOBALS Globals;
  162. /*****************************************************************************
  163. ** Declaration of Driver Entry Points
  164. ******************************************************************************/
  165. //
  166. // General Entry Points - In GckShell.c
  167. //
  168. NTSTATUS
  169. DriverEntry(
  170. IN PDRIVER_OBJECT pDriverObject,
  171. IN PUNICODE_STRING pRegistryPath
  172. );
  173. VOID
  174. GCK_Unload(
  175. IN PDRIVER_OBJECT pDriverObject
  176. );
  177. NTSTATUS
  178. GCK_Create (
  179. IN PDEVICE_OBJECT pDeviceObject,
  180. IN PIRP pIrp
  181. );
  182. NTSTATUS
  183. GCK_Close (
  184. IN PDEVICE_OBJECT pDeviceObject,
  185. IN PIRP pIrp
  186. );
  187. NTSTATUS
  188. GCK_Read (
  189. IN PDEVICE_OBJECT pDeviceObject,
  190. IN PIRP pIrp
  191. );
  192. NTSTATUS
  193. GCK_Power (
  194. IN PDEVICE_OBJECT pDeviceObject,
  195. IN PIRP pIrp
  196. );
  197. NTSTATUS
  198. GCK_PnP (
  199. IN PDEVICE_OBJECT pDeviceObject,
  200. IN PIRP pIrp
  201. );
  202. NTSTATUS
  203. GCK_Ioctl (
  204. IN PDEVICE_OBJECT pDeviceObject,
  205. IN PIRP pIrp
  206. );
  207. NTSTATUS
  208. GCK_Pass (
  209. IN PDEVICE_OBJECT pDeviceObject,
  210. IN PIRP pIrp
  211. );
  212. //
  213. // For Control Devices - In CTRL.c
  214. //
  215. NTSTATUS
  216. GCK_CTRL_DriverEntry(
  217. IN PDRIVER_OBJECT pDriverObject,
  218. IN PUNICODE_STRING pRegistryPath
  219. );
  220. VOID
  221. GCK_CTRL_Unload(
  222. IN PDRIVER_OBJECT pDriverObject
  223. );
  224. NTSTATUS
  225. GCK_CTRL_AddDevice
  226. (
  227. IN PDRIVER_OBJECT pDriverObject
  228. );
  229. VOID
  230. GCK_CTRL_Remove();
  231. NTSTATUS
  232. GCK_CTRL_Create (
  233. IN PDEVICE_OBJECT pDeviceObject,
  234. IN PIRP pIrp
  235. );
  236. NTSTATUS
  237. GCK_CTRL_Close (
  238. IN PDEVICE_OBJECT pDeviceObject,
  239. IN PIRP pIrp
  240. );
  241. //
  242. // For Control Devices - In CTRL_Ioctl.c
  243. //
  244. NTSTATUS
  245. GCK_CTRL_Ioctl (
  246. IN PDEVICE_OBJECT pDeviceObject,
  247. IN PIRP pIrp
  248. );
  249. //
  250. // For Filter Devices - In FLTR.c
  251. //
  252. NTSTATUS
  253. GCK_FLTR_DriverEntry(
  254. IN PDRIVER_OBJECT pDriverObject,
  255. IN PUNICODE_STRING pRegistryPath
  256. );
  257. VOID
  258. GCK_FLTR_Unload(
  259. IN PDRIVER_OBJECT pDriverObject
  260. );
  261. NTSTATUS
  262. GCK_FLTR_Create (
  263. IN PDEVICE_OBJECT pDeviceObject,
  264. IN PIRP pIrp
  265. );
  266. NTSTATUS
  267. GCK_FLTR_Close (
  268. IN PDEVICE_OBJECT pDeviceObject,
  269. IN PIRP pIrp
  270. );
  271. NTSTATUS
  272. GCK_FLTR_Read
  273. (
  274. IN PDEVICE_OBJECT pPdo,
  275. IN PIRP pIrp
  276. );
  277. NTSTATUS
  278. GCK_FLTR_Ioctl (
  279. IN PDEVICE_OBJECT pDeviceObject,
  280. IN PIRP pIrp
  281. );
  282. //
  283. // In FLTR_PnP.c
  284. //
  285. NTSTATUS
  286. GCK_FLTR_Power (
  287. IN PDEVICE_OBJECT pDeviceObject,
  288. IN PIRP pIrp
  289. );
  290. NTSTATUS
  291. GCK_FLTR_PnP (
  292. IN PDEVICE_OBJECT pDeviceObject,
  293. IN PIRP pIrp
  294. );
  295. NTSTATUS
  296. GCK_FLTR_AddDevice(
  297. IN PDRIVER_OBJECT pDriverObject,
  298. IN PDEVICE_OBJECT pPhysicalDeviceObject
  299. );
  300. //
  301. // In SWVBENUM.c
  302. //
  303. NTSTATUS
  304. GCK_SWVB_DriverEntry(
  305. IN PDRIVER_OBJECT pDriverObject,
  306. IN PUNICODE_STRING pRegistryPath
  307. );
  308. VOID
  309. GCK_SWVB_UnLoad();
  310. NTSTATUS
  311. GCK_SWVB_PnP
  312. (
  313. IN PDEVICE_OBJECT pPdo,
  314. IN PIRP pIrp
  315. );
  316. NTSTATUS
  317. GCK_SWVB_Power
  318. (
  319. IN PDEVICE_OBJECT pPdo,
  320. IN PIRP pIrp
  321. );
  322. NTSTATUS
  323. GCK_SWVB_Create
  324. (
  325. IN PDEVICE_OBJECT pPdo,
  326. IN PIRP pIrp
  327. );
  328. NTSTATUS
  329. GCK_SWVB_Close
  330. (
  331. IN PDEVICE_OBJECT pPdo,
  332. IN PIRP pIrp
  333. );
  334. NTSTATUS
  335. GCK_SWVB_Read
  336. (
  337. IN PDEVICE_OBJECT pPdo,
  338. IN PIRP pIrp
  339. );
  340. NTSTATUS
  341. GCK_SWVB_Ioctl
  342. (
  343. IN PDEVICE_OBJECT pPdo,
  344. IN PIRP pIrp
  345. );
  346. //
  347. // In SWVKBD.c
  348. //
  349. NTSTATUS
  350. GCK_VKBD_DriverEntry(
  351. IN PDRIVER_OBJECT pDriverObject,
  352. IN PUNICODE_STRING pRegistryPath
  353. );
  354. /*****************************************************************************
  355. ** End of declaration of Driver Entry Points
  356. ******************************************************************************/
  357. /*****************************************************************************
  358. ** Declaration of Non-Entry Driver routines
  359. ******************************************************************************/
  360. //
  361. // In FLTR.c
  362. //
  363. NTSTATUS
  364. GCK_FLTR_CreateComplete
  365. (
  366. IN PDEVICE_OBJECT pDeviceObject,
  367. IN PIRP pIrp,
  368. IN PVOID pContext
  369. );
  370. //
  371. // In PnP.c
  372. //
  373. NTSTATUS
  374. GCK_FLTR_PnPComplete (
  375. IN PDEVICE_OBJECT pDeviceObject,
  376. IN PIRP pIrp,
  377. IN PVOID pContext
  378. );
  379. NTSTATUS
  380. GCK_FLTR_StartDevice (
  381. IN PDEVICE_OBJECT pDeviceObject,
  382. IN PIRP pIrp
  383. );
  384. VOID
  385. GCK_FLTR_StopDevice (
  386. IN PGCK_FILTER_EXT pFilterExt,
  387. IN BOOLEAN fTouchTheHardware
  388. );
  389. NTSTATUS
  390. GCK_GetHidInformation
  391. (
  392. IN PGCK_FILTER_EXT pFilterExt
  393. );
  394. VOID
  395. GCK_CleanHidInformation(
  396. IN PGCK_FILTER_EXT pFilterExt
  397. );
  398. //
  399. // In IoCtl.c
  400. //
  401. NTSTATUS
  402. GCK_CTRL_Ioctl (
  403. IN PDEVICE_OBJECT pDeviceObject,
  404. IN PIRP pIrp
  405. );
  406. NTSTATUS
  407. GCK_FLTR_Ioctl (
  408. IN PDEVICE_OBJECT pDeviceObject,
  409. IN PIRP pIrp
  410. );
  411. PDEVICE_OBJECT
  412. GCK_FindDeviceObject(
  413. IN PWSTR pwszInterfaceReq,
  414. IN ULONG uInLength
  415. );
  416. BOOLEAN GCK_MatchReqPathtoInterfaces
  417. (
  418. IN PWSTR pwszPath,
  419. IN ULONG uStringLen,
  420. IN PWSTR pmwszInterfaces
  421. );
  422. //
  423. // In FilterHooks.cpp
  424. //
  425. NTSTATUS _stdcall
  426. GCKF_InitFilterHooks(
  427. IN PGCK_FILTER_EXT pFilterExt
  428. );
  429. void _stdcall
  430. GCKF_DestroyFilterHooks(
  431. IN PGCK_FILTER_EXT pFilterExt
  432. );
  433. NTSTATUS _stdcall
  434. GCKF_ProcessCommands(
  435. IN PGCK_FILTER_EXT pFilterExt,
  436. IN PCHAR pCommandBuffer,
  437. IN ULONG ulBufferSize,
  438. IN BOOLEAN fPrimaryFilter
  439. );
  440. void _stdcall
  441. GCKF_SetInitialMapping(
  442. IN PGCK_FILTER_EXT pFilterExt
  443. );
  444. NTSTATUS _stdcall
  445. GCKF_IncomingReadRequests(
  446. IN PGCK_FILTER_EXT pFilterExt,
  447. IN PIRP pIrp
  448. );
  449. VOID __stdcall
  450. GCKF_KickDeviceForData(
  451. IN PGCK_FILTER_EXT pFilterExt
  452. );
  453. VOID _stdcall
  454. GCKF_CancelPendingRead(
  455. IN PDEVICE_OBJECT pDeviceObject,
  456. IN PIRP pIrp
  457. );
  458. NTSTATUS _stdcall
  459. GCKF_IncomingInputReports(
  460. IN PGCK_FILTER_EXT pFilterExt,
  461. IN PCHAR pcReport,
  462. IN IO_STATUS_BLOCK IoStatus
  463. );
  464. NTSTATUS _stdcall
  465. GCKF_CompleteReadRequests(
  466. IN PGCK_FILTER_EXT pFilterExt,
  467. IN PCHAR pcReport,
  468. IN IO_STATUS_BLOCK IoStatus
  469. );
  470. void _stdcall
  471. GCKF_CompleteReadRequestsForFileObject(
  472. IN PGCK_FILTER_EXT pFilterExt,
  473. IN PFILE_OBJECT pFileObject
  474. );
  475. NTSTATUS _stdcall
  476. GCKF_IncomingForceFeedbackChangeNotificationRequest(
  477. IN PGCK_FILTER_EXT pFilterExt,
  478. IN PIRP pIrp
  479. );
  480. NTSTATUS _stdcall
  481. GCKF_ProcessForceFeedbackChangeNotificationRequests(
  482. IN PGCK_FILTER_EXT pFilterExt
  483. );
  484. void _stdcall
  485. GCKF_OnForceFeedbackChangeNotification(
  486. IN PGCK_FILTER_EXT pFilterExt,
  487. const IN /*FORCE_BLOCK*/void* pForceBlock
  488. );
  489. NTSTATUS _stdcall
  490. GCKF_GetForceFeedbackData(
  491. IN PIRP pIrp,
  492. IN PGCK_FILTER_EXT pFilterExt
  493. );
  494. NTSTATUS _stdcall
  495. GCKF_SetWorkingSet(
  496. IN PGCK_FILTER_EXT pFilterExt,
  497. UCHAR ucWorkingSet
  498. );
  499. NTSTATUS _stdcall
  500. GCKF_QueryProfileSet(
  501. IN PIRP pIrp,
  502. IN PGCK_FILTER_EXT pFilterExt
  503. );
  504. NTSTATUS _stdcall
  505. GCKF_SetLEDBehaviour(
  506. IN PIRP pIrp,
  507. IN PGCK_FILTER_EXT pFilterExt
  508. );
  509. NTSTATUS _stdcall
  510. GCKF_TriggerRequest(
  511. IN PIRP pIrp,
  512. IN PGCK_FILTER_EXT pFilterExt
  513. );
  514. void _stdcall
  515. GCKF_SetNextJog(
  516. IN PVOID pvFilterContext,
  517. IN ULONG ulJogDelay
  518. );
  519. ULONG _stdcall
  520. GCKF_GetTimeStampMs();
  521. VOID _stdcall
  522. GCKF_TimerDPCHandler(
  523. IN PKDPC Dpc,
  524. IN PVOID DeferredContext,
  525. IN PVOID SystemArgument1,
  526. IN PVOID SystemArgument2
  527. );
  528. NTSTATUS _stdcall
  529. GCKF_EnableTestKeyboard(
  530. IN PGCK_FILTER_EXT pFilterExt,
  531. IN BOOLEAN fEnable,
  532. IN PFILE_OBJECT pFileObject
  533. );
  534. NTSTATUS _stdcall
  535. GCKF_BeginTestScheme(
  536. IN PGCK_FILTER_EXT pFilterExt,
  537. IN PCHAR pCommandBuffer,
  538. IN ULONG ulBufferSize,
  539. IN FILE_OBJECT *pFileObject
  540. );
  541. NTSTATUS _stdcall
  542. GCKF_UpdateTestScheme(
  543. IN PGCK_FILTER_EXT pFilterExt,
  544. IN PCHAR pCommandBuffer,
  545. IN ULONG ulBufferSize,
  546. IN FILE_OBJECT *pFileObject
  547. );
  548. NTSTATUS _stdcall
  549. GCKF_EndTestScheme(
  550. IN PGCK_FILTER_EXT pFilterExt,
  551. IN FILE_OBJECT *pFileObject
  552. );
  553. NTSTATUS _stdcall
  554. GCKF_BackdoorPoll(
  555. IN PGCK_FILTER_EXT pFilterExt,
  556. IN PIRP pIrp,
  557. IN GCK_POLLING_MODES ePollingMode
  558. );
  559. void _stdcall
  560. GCKF_ResetKeyboardQueue(
  561. DEVICE_OBJECT* pFilterHandle
  562. );
  563. //
  564. // In InternalPoll.c
  565. //
  566. NTSTATUS
  567. GCK_IP_AddFileObject
  568. (
  569. IN PGCK_FILTER_EXT pFilterExt,
  570. IN PFILE_OBJECT pFileObject,
  571. IN USHORT usDesiredShareAccess,
  572. IN ULONG ulDesiredAccess
  573. );
  574. NTSTATUS
  575. GCK_IP_RemoveFileObject
  576. (
  577. IN PGCK_FILTER_EXT pFilterExt,
  578. IN PFILE_OBJECT pFileObject
  579. );
  580. NTSTATUS
  581. GCK_IP_ConfirmFileObject
  582. (
  583. IN PGCK_FILTER_EXT pFilterExt,
  584. IN PFILE_OBJECT pFileObject,
  585. IN BOOLEAN fConfirm
  586. );
  587. BOOLEAN
  588. GCK_IP_CheckSharing
  589. (
  590. IN SHARE_STATUS ShareStatus,
  591. IN USHORT usDesireShareAccess,
  592. IN ULONG ulDesiredAccess
  593. );
  594. BOOLEAN
  595. GCK_IP_AddSharing
  596. (
  597. IN OUT SHARE_STATUS *pShareStatus,
  598. IN USHORT usDesiredShareAccess,
  599. IN ULONG ulDesiredAccess
  600. );
  601. BOOLEAN
  602. GCK_IP_RemoveSharing
  603. (
  604. IN OUT SHARE_STATUS *pShareStatus,
  605. IN USHORT usDesiredShareAccess,
  606. IN ULONG ulDesiredAccess
  607. );
  608. NTSTATUS
  609. GCK_IP_OneTimePoll
  610. (
  611. IN PGCK_FILTER_EXT pFilterExt
  612. );
  613. NTSTATUS
  614. GCK_IP_FullTimePoll
  615. (
  616. IN PGCK_FILTER_EXT pFilterExt,
  617. IN BOOLEAN fStart
  618. );
  619. NTSTATUS
  620. GCK_IP_ReadComplete
  621. (
  622. IN PDEVICE_OBJECT pDeviceObject,
  623. IN PIRP pIrp,
  624. IN PVOID pContext
  625. );
  626. void
  627. GCK_IP_AddDevice(PGCK_FILTER_EXT pFilterExt);
  628. NTSTATUS
  629. GCK_IP_Init
  630. (
  631. IN PGCK_FILTER_EXT pFilterExt
  632. );
  633. NTSTATUS
  634. GCK_IP_Cleanup
  635. (
  636. IN OUT PGCK_FILTER_EXT pFilterExt
  637. );
  638. NTSTATUS
  639. GCK_IP_CreateFileObject
  640. (
  641. OUT PFILE_OBJECT *ppFileObject,
  642. IN PDEVICE_OBJECT pPDO
  643. );
  644. NTSTATUS
  645. GCK_IP_CloseFileObject
  646. (
  647. IN OUT PGCK_FILTER_EXT pFilterExt
  648. );
  649. /*****************************************************************************
  650. ** End of declaration of Non-Entry Driver routines
  651. ******************************************************************************/
  652. /*****************************************************************************
  653. ** Macros used internally - to access filed from the device extension
  654. ** directly from the pDeviceObject
  655. ******************************************************************************/
  656. #define NEXT_FILTER_DEVICE_OBJECT(__pDO__)\
  657. ( ((PGCK_FILTER_EXT)__pDO__->DeviceExtension)->pNextFilterObject )
  658. #define PTR_NEXT_FILTER_DEVICE_OBJECT(__pDO__)\
  659. ( &((PGCK_FILTER_EXT)__pDO__->DeviceExtension)->pNextFilterObject )
  660. #define FILTER_DEVICE_OBJECT_PDO(__pDO__)\
  661. ( ((PGCK_FILTER_EXT)__pDO__->DeviceExtension)->pPDO )
  662. #define THREAD_SAFE_DEC_REF(__pFoo__, __TYPE__)\
  663. __TYPE__ *__pTempPointer__ = __pFoo__;\
  664. __pFoo__ = NULL;\
  665. __pTempPointer__->DecRef();
  666. /*****************************************************************************
  667. ** End of macros used internally
  668. ******************************************************************************/
  669. /*****************************************************************************
  670. ** Macro for allocating memory - debug version uses ExAllocatePoolTag
  671. ******************************************************************************/
  672. #if (DBG==1)
  673. // For serious debugging
  674. /*
  675. #define EX_ALLOCATE_POOL(__PoolType__,__Size__) MyAllocation(__PoolType__,__Size__, '_KCG', __FILE__, __LINE__)
  676. PVOID MyAllocation(
  677. IN POOL_TYPE PoolType,
  678. IN ULONG NumberOfBytes,
  679. IN ULONG Tag,
  680. IN LPSTR File,
  681. IN ULONG Line
  682. )
  683. {
  684. DbgPrint("GcKernel: ");
  685. DbgPrint("Memory allocation in %s, line %d\n", File, Line);
  686. return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
  687. }
  688. */
  689. //For lighter weight debugging
  690. #define EX_ALLOCATE_POOL(__PoolType__,__Size__) ExAllocatePoolWithTag(__PoolType__,__Size__,'_KCG')
  691. #else
  692. #define EX_ALLOCATE_POOL(__PoolType__,__Size__) ExAllocatePool(__PoolType__,__Size__)
  693. #endif
  694. #endif // __GckShell_h__