ReactOS  0.4.15-dev-3337-gf4ccc51
i8042prt.h File Reference
#include <ntifs.h>
#include <kbdmou.h>
#include <ntdd8042.h>
Include dependency graph for i8042prt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _I8042_SETTINGS
 
struct  _INTERRUPT_DATA
 
struct  _PORT_DEVICE_EXTENSION
 
struct  _I8042_DRIVER_EXTENSION
 
struct  _FDO_DEVICE_EXTENSION
 
struct  _I8042_KEYBOARD_EXTENSION
 
struct  _I8042_MOUSE_EXTENSION
 
struct  _I8042_HOOK_WORKITEM
 

Macros

#define I8042PRT_TAG   '2408'
 
#define WHEEL_DELTA   120
 
#define KEYBOARD_PRESENT   0x01 /* A keyboard is attached */
 
#define KEYBOARD_CONNECTED   0x02 /* Keyboard received IOCTL_INTERNAL_KEYBOARD_CONNECT */
 
#define KEYBOARD_STARTED   0x04 /* Keyboard FDO received IRP_MN_START_DEVICE */
 
#define KEYBOARD_INITIALIZED   0x08 /* Keyboard interrupt is connected */
 
#define MOUSE_PRESENT   0x10 /* A mouse is attached */
 
#define MOUSE_CONNECTED   0x20 /* Mouse received IOCTL_INTERNAL_MOUSE_CONNECT */
 
#define MOUSE_STARTED   0x40 /* Mouse FDO received IRP_MN_START_DEVICE */
 
#define MOUSE_INITIALIZED   0x80 /* Mouse interrupt is connected */
 
#define MAX(a, b)   ((a) >= (b) ? (a) : (b))
 
#define KEYBOARD_POWER_CODE   0x5E
 
#define KEYBOARD_SLEEP_CODE   0x5F
 
#define KEYBOARD_WAKE_CODE   0x63
 
#define KBD_READ_MODE   0x20
 
#define KBD_WRITE_MODE   0x60
 
#define MOUSE_ENAB   0xA8
 
#define MOUSE_LINE_TEST   0xA9
 
#define CTRL_SELF_TEST   0xAA
 
#define KBD_CLK_DISABLE   0xAD
 
#define KBD_CLK_ENABLE   0xAE
 
#define CTRL_WRITE_MOUSE   0xD4
 
#define KBD_CMD_SET_LEDS   0xED
 
#define KBD_CMD_GET_ID   0xF2
 
#define KBD_SELF_TEST_OK   0x55
 
#define KBD_ACK   0xFA
 
#define KBD_NACK   0xFC
 
#define KBD_RESEND   0xFE
 
#define KBD_OBF   0x01
 
#define KBD_IBF   0x02
 
#define MOU_OBF   0x20
 
#define KBD_PERR   0x80
 
#define CCB_KBD_INT_ENAB   0x01
 
#define CCB_MOUSE_INT_ENAB   0x02
 
#define CCB_SYSTEM_FLAG   0x04
 
#define CCB_KBD_DISAB   0x10
 
#define CCB_MOUSE_DISAB   0x20
 
#define CCB_TRANSLATE   0x40
 
#define KBD_LED_SCROLL   0x01
 
#define KBD_LED_NUM   0x02
 
#define KBD_LED_CAPS   0x04
 
#define MOU_ENAB   0xF4
 
#define MOU_CMD_RESET   0xFF
 
#define MOUSE_ACK   0xFA
 
#define MOUSE_ERROR   0xFC
 
#define MOUSE_NACK   0xFE
 
#define i8042ReadKeyboardData(DeviceExtension, Data)   i8042ReadData(DeviceExtension, KBD_OBF, Data)
 
#define i8042ReadMouseData(DeviceExtension, Data)   i8042ReadData(DeviceExtension, MOU_OBF, Data)
 

Typedefs

typedef struct _I8042_SETTINGS I8042_SETTINGS
 
typedef struct _I8042_SETTINGSPI8042_SETTINGS
 
typedef enum _MOUSE_TIMEOUT_STATE MOUSE_TIMEOUT_STATE
 
typedef enum _MOUSE_TIMEOUT_STATEPMOUSE_TIMEOUT_STATE
 
typedef struct _INTERRUPT_DATA INTERRUPT_DATA
 
typedef struct _INTERRUPT_DATAPINTERRUPT_DATA
 
typedef struct _I8042_KEYBOARD_EXTENSIONPI8042_KEYBOARD_EXTENSION
 
typedef struct _I8042_MOUSE_EXTENSIONPI8042_MOUSE_EXTENSION
 
typedef struct _PORT_DEVICE_EXTENSION PORT_DEVICE_EXTENSION
 
typedef struct _PORT_DEVICE_EXTENSIONPPORT_DEVICE_EXTENSION
 
typedef struct _I8042_DRIVER_EXTENSION I8042_DRIVER_EXTENSION
 
typedef struct _I8042_DRIVER_EXTENSIONPI8042_DRIVER_EXTENSION
 
typedef enum _I8042_DEVICE_TYPE I8042_DEVICE_TYPE
 
typedef enum _I8042_DEVICE_TYPEPI8042_DEVICE_TYPE
 
typedef struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
 
typedef struct _FDO_DEVICE_EXTENSIONPFDO_DEVICE_EXTENSION
 
typedef struct _I8042_KEYBOARD_EXTENSION I8042_KEYBOARD_EXTENSION
 
typedef enum _I8042_MOUSE_TYPE I8042_MOUSE_TYPE
 
typedef enum _I8042_MOUSE_TYPEPI8042_MOUSE_TYPE
 
typedef struct _I8042_MOUSE_EXTENSION I8042_MOUSE_EXTENSION
 
typedef struct _I8042_HOOK_WORKITEM I8042_HOOK_WORKITEM
 
typedef struct _I8042_HOOK_WORKITEMPI8042_HOOK_WORKITEM
 

Enumerations

enum  DEVICE_STATE {
  dsStopped, dsStarted, dsPaused, dsRemoved,
  dsSurpriseRemoved, NotStarted = 0, Started, StopPending,
  Stopped, RemovePending, SurpriseRemovePending, Deleted,
  dsStopped, dsStarted, dsPaused, dsRemoved,
  dsSurpriseRemoved, dsStopped, dsStarted, dsPaused,
  dsRemoved, dsSurpriseRemoved
}
 
enum  _MOUSE_TIMEOUT_STATE { NoChange, TimeoutStart, TimeoutCancel }
 
enum  _I8042_DEVICE_TYPE { Unknown, Keyboard, Mouse, PhysicalDeviceObject }
 
enum  _I8042_MOUSE_TYPE { GenericPS2, Intellimouse, IntellimouseExplorer, Ps2pp }
 
enum  _FLAGS { FL_NOLOOP = 0x01, FL_INITHACK = 0x02 }
 

Functions

 _Dispatch_type_ (IRP_MJ_CREATE) DRIVER_DISPATCH i8042Create
 
 _Dispatch_type_ (IRP_MJ_CLEANUP) DRIVER_DISPATCH i8042Cleanup
 
 _Dispatch_type_ (IRP_MJ_CLOSE) DRIVER_DISPATCH i8042Close
 
NTSTATUS NTAPI i8042SynchWritePortKbd (IN PVOID Context, IN UCHAR Value, IN BOOLEAN WaitForAck)
 
BOOLEAN i8042PacketIsr (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Output)
 
NTSTATUS i8042StartPacket (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PFDO_DEVICE_EXTENSION FdoDeviceExtension, IN PUCHAR Bytes, IN ULONG ByteCount, IN PIRP Irp)
 
NTSTATUS DuplicateUnicodeString (IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
 
VOID i8042MouHandle (IN PI8042_MOUSE_EXTENSION DeviceExtension, IN UCHAR Output)
 
VOID i8042MouHandleButtons (IN PI8042_MOUSE_EXTENSION DeviceExtension, IN USHORT Mask)
 
NTSTATUS i8042MouInitialize (IN PI8042_MOUSE_EXTENSION DeviceExtension)
 
BOOLEAN i8042ChangeMode (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable)
 
 _Dispatch_type_ (IRP_MJ_PNP) DRIVER_DISPATCH i8042Pnp
 
VOID i8042MouHandlePs2pp (IN PI8042_MOUSE_EXTENSION DeviceExtension, IN UCHAR Input)
 
VOID i8042Flush (IN PPORT_DEVICE_EXTENSION DeviceExtension)
 
BOOLEAN i8042IsrWritePort (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Value, IN UCHAR SelectCmd OPTIONAL)
 
NTSTATUS i8042ReadData (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR StatusFlags, OUT PUCHAR Data)
 
NTSTATUS i8042ReadDataWait (IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
 
NTSTATUS i8042ReadStatus (IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Status)
 
NTSTATUS NTAPI i8042SynchReadPort (IN PVOID Context, OUT PUCHAR Value, IN BOOLEAN WaitForAck)
 
NTSTATUS NTAPI i8042SynchWritePort (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Port, IN UCHAR Value, IN BOOLEAN WaitForAck)
 
BOOLEAN i8042Write (IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
 
NTSTATUS ReadRegistryEntries (IN PUNICODE_STRING RegistryPath, OUT PI8042_SETTINGS Settings)
 
VOID NTAPI i8042InitializeHwHacks (VOID)
 

Variables

IO_WORKITEM_ROUTINE i8042SendHookWorkItem
 
DRIVER_STARTIO i8042KbdStartIo
 
DRIVER_DISPATCH i8042KbdDeviceControl
 
DRIVER_DISPATCH i8042KbdInternalDeviceControl
 
KSERVICE_ROUTINE i8042KbdInterruptService
 
DRIVER_ADD_DEVICE i8042AddDevice
 
DRIVER_DISPATCH ForwardIrpAndForget
 
DRIVER_DISPATCH ForwardIrpAndWait
 
DRIVER_DISPATCH i8042MouInternalDeviceControl
 
KSERVICE_ROUTINE i8042MouInterruptService
 
ULONG i8042HwFlags
 

Macro Definition Documentation

◆ CCB_KBD_DISAB

#define CCB_KBD_DISAB   0x10

Definition at line 262 of file i8042prt.h.

◆ CCB_KBD_INT_ENAB

#define CCB_KBD_INT_ENAB   0x01

Definition at line 259 of file i8042prt.h.

◆ CCB_MOUSE_DISAB

#define CCB_MOUSE_DISAB   0x20

Definition at line 263 of file i8042prt.h.

◆ CCB_MOUSE_INT_ENAB

#define CCB_MOUSE_INT_ENAB   0x02

Definition at line 260 of file i8042prt.h.

◆ CCB_SYSTEM_FLAG

#define CCB_SYSTEM_FLAG   0x04

Definition at line 261 of file i8042prt.h.

◆ CCB_TRANSLATE

#define CCB_TRANSLATE   0x40

Definition at line 264 of file i8042prt.h.

◆ CTRL_SELF_TEST

#define CTRL_SELF_TEST   0xAA

Definition at line 225 of file i8042prt.h.

◆ CTRL_WRITE_MOUSE

#define CTRL_WRITE_MOUSE   0xD4

Definition at line 228 of file i8042prt.h.

◆ I8042PRT_TAG

#define I8042PRT_TAG   '2408'

Definition at line 12 of file i8042prt.h.

◆ i8042ReadKeyboardData

#define i8042ReadKeyboardData (   DeviceExtension,
  Data 
)    i8042ReadData(DeviceExtension, KBD_OBF, Data)

Definition at line 405 of file i8042prt.h.

◆ i8042ReadMouseData

#define i8042ReadMouseData (   DeviceExtension,
  Data 
)    i8042ReadData(DeviceExtension, MOU_OBF, Data)

Definition at line 407 of file i8042prt.h.

◆ KBD_ACK

#define KBD_ACK   0xFA

Definition at line 242 of file i8042prt.h.

◆ KBD_CLK_DISABLE

#define KBD_CLK_DISABLE   0xAD

Definition at line 226 of file i8042prt.h.

◆ KBD_CLK_ENABLE

#define KBD_CLK_ENABLE   0xAE

Definition at line 227 of file i8042prt.h.

◆ KBD_CMD_GET_ID

#define KBD_CMD_GET_ID   0xF2

Definition at line 235 of file i8042prt.h.

◆ KBD_CMD_SET_LEDS

#define KBD_CMD_SET_LEDS   0xED

Definition at line 234 of file i8042prt.h.

◆ KBD_IBF

#define KBD_IBF   0x02

Definition at line 251 of file i8042prt.h.

◆ KBD_LED_CAPS

#define KBD_LED_CAPS   0x04

Definition at line 272 of file i8042prt.h.

◆ KBD_LED_NUM

#define KBD_LED_NUM   0x02

Definition at line 271 of file i8042prt.h.

◆ KBD_LED_SCROLL

#define KBD_LED_SCROLL   0x01

Definition at line 270 of file i8042prt.h.

◆ KBD_NACK

#define KBD_NACK   0xFC

Definition at line 243 of file i8042prt.h.

◆ KBD_OBF

#define KBD_OBF   0x01

Definition at line 250 of file i8042prt.h.

◆ KBD_PERR

#define KBD_PERR   0x80

Definition at line 253 of file i8042prt.h.

◆ KBD_READ_MODE

#define KBD_READ_MODE   0x20

Definition at line 221 of file i8042prt.h.

◆ KBD_RESEND

#define KBD_RESEND   0xFE

Definition at line 244 of file i8042prt.h.

◆ KBD_SELF_TEST_OK

#define KBD_SELF_TEST_OK   0x55

Definition at line 241 of file i8042prt.h.

◆ KBD_WRITE_MODE

#define KBD_WRITE_MODE   0x60

Definition at line 222 of file i8042prt.h.

◆ KEYBOARD_CONNECTED

#define KEYBOARD_CONNECTED   0x02 /* Keyboard received IOCTL_INTERNAL_KEYBOARD_CONNECT */

Definition at line 69 of file i8042prt.h.

◆ KEYBOARD_INITIALIZED

#define KEYBOARD_INITIALIZED   0x08 /* Keyboard interrupt is connected */

Definition at line 71 of file i8042prt.h.

◆ KEYBOARD_POWER_CODE

#define KEYBOARD_POWER_CODE   0x5E

Definition at line 213 of file i8042prt.h.

◆ KEYBOARD_PRESENT

#define KEYBOARD_PRESENT   0x01 /* A keyboard is attached */

Definition at line 68 of file i8042prt.h.

◆ KEYBOARD_SLEEP_CODE

#define KEYBOARD_SLEEP_CODE   0x5F

Definition at line 214 of file i8042prt.h.

◆ KEYBOARD_STARTED

#define KEYBOARD_STARTED   0x04 /* Keyboard FDO received IRP_MN_START_DEVICE */

Definition at line 70 of file i8042prt.h.

◆ KEYBOARD_WAKE_CODE

#define KEYBOARD_WAKE_CODE   0x63

Definition at line 215 of file i8042prt.h.

◆ MAX

#define MAX (   a,
  b 
)    ((a) >= (b) ? (a) : (b))

Definition at line 211 of file i8042prt.h.

◆ MOU_CMD_RESET

#define MOU_CMD_RESET   0xFF

Definition at line 279 of file i8042prt.h.

◆ MOU_ENAB

#define MOU_ENAB   0xF4

Definition at line 278 of file i8042prt.h.

◆ MOU_OBF

#define MOU_OBF   0x20

Definition at line 252 of file i8042prt.h.

◆ MOUSE_ACK

#define MOUSE_ACK   0xFA

Definition at line 285 of file i8042prt.h.

◆ MOUSE_CONNECTED

#define MOUSE_CONNECTED   0x20 /* Mouse received IOCTL_INTERNAL_MOUSE_CONNECT */

Definition at line 73 of file i8042prt.h.

◆ MOUSE_ENAB

#define MOUSE_ENAB   0xA8

Definition at line 223 of file i8042prt.h.

◆ MOUSE_ERROR

#define MOUSE_ERROR   0xFC

Definition at line 286 of file i8042prt.h.

◆ MOUSE_INITIALIZED

#define MOUSE_INITIALIZED   0x80 /* Mouse interrupt is connected */

Definition at line 75 of file i8042prt.h.

◆ MOUSE_LINE_TEST

#define MOUSE_LINE_TEST   0xA9

Definition at line 224 of file i8042prt.h.

◆ MOUSE_NACK

#define MOUSE_NACK   0xFE

Definition at line 287 of file i8042prt.h.

◆ MOUSE_PRESENT

#define MOUSE_PRESENT   0x10 /* A mouse is attached */

Definition at line 72 of file i8042prt.h.

◆ MOUSE_STARTED

#define MOUSE_STARTED   0x40 /* Mouse FDO received IRP_MN_START_DEVICE */

Definition at line 74 of file i8042prt.h.

◆ WHEEL_DELTA

#define WHEEL_DELTA   120

Definition at line 60 of file i8042prt.h.

Typedef Documentation

◆ FDO_DEVICE_EXTENSION

◆ I8042_DEVICE_TYPE

◆ I8042_DRIVER_EXTENSION

◆ I8042_HOOK_WORKITEM

◆ I8042_KEYBOARD_EXTENSION

◆ I8042_MOUSE_EXTENSION

◆ I8042_MOUSE_TYPE

◆ I8042_SETTINGS

◆ INTERRUPT_DATA

◆ MOUSE_TIMEOUT_STATE

◆ PFDO_DEVICE_EXTENSION

◆ PI8042_DEVICE_TYPE

◆ PI8042_DRIVER_EXTENSION

◆ PI8042_HOOK_WORKITEM

◆ PI8042_KEYBOARD_EXTENSION

◆ PI8042_MOUSE_EXTENSION

Definition at line 65 of file i8042prt.h.

◆ PI8042_MOUSE_TYPE

◆ PI8042_SETTINGS

◆ PINTERRUPT_DATA

◆ PMOUSE_TIMEOUT_STATE

◆ PORT_DEVICE_EXTENSION

◆ PPORT_DEVICE_EXTENSION

Enumeration Type Documentation

◆ _FLAGS

Enumerator
FL_NOLOOP 
FL_INITHACK 

Definition at line 453 of file i8042prt.h.

454 {
455  FL_NOLOOP = 0x01,
456  FL_INITHACK = 0x02,
457 };

◆ _I8042_DEVICE_TYPE

Enumerator
Unknown 
Keyboard 
Mouse 
PhysicalDeviceObject 

Definition at line 112 of file i8042prt.h.

113 {
114  Unknown,
115  Keyboard,
116  Mouse,
enum _I8042_DEVICE_TYPE * PI8042_DEVICE_TYPE
enum _I8042_DEVICE_TYPE I8042_DEVICE_TYPE

◆ _I8042_MOUSE_TYPE

Enumerator
GenericPS2 
Intellimouse 
IntellimouseExplorer 
Ps2pp 

Definition at line 167 of file i8042prt.h.

168 {
169  GenericPS2,
170  Intellimouse,
172  Ps2pp
enum _I8042_MOUSE_TYPE * PI8042_MOUSE_TYPE
enum _I8042_MOUSE_TYPE I8042_MOUSE_TYPE

◆ _MOUSE_TIMEOUT_STATE

Enumerator
NoChange 
TimeoutStart 
TimeoutCancel 

Definition at line 43 of file i8042prt.h.

44 {
45  NoChange,
enum _MOUSE_TIMEOUT_STATE MOUSE_TIMEOUT_STATE
enum _MOUSE_TIMEOUT_STATE * PMOUSE_TIMEOUT_STATE

◆ DEVICE_STATE

Enumerator
dsStopped 
dsStarted 
dsPaused 
dsRemoved 
dsSurpriseRemoved 
NotStarted 
Started 
StopPending 
Stopped 
RemovePending 
SurpriseRemovePending 
Deleted 
dsStopped 
dsStarted 
dsPaused 
dsRemoved 
dsSurpriseRemoved 
dsStopped 
dsStarted 
dsPaused 
dsRemoved 
dsSurpriseRemoved 

Definition at line 14 of file i8042prt.h.

15 {
16  dsStopped,
17  dsStarted,
18  dsPaused,
19  dsRemoved,
21 } DEVICE_STATE;
DEVICE_STATE
Definition: i8042prt.h:14

Function Documentation

◆ _Dispatch_type_() [1/4]

_Dispatch_type_ ( IRP_MJ_CREATE  )

Definition at line 984 of file isapnp.c.

995 {
996  PAGED_CODE();
997 
998  Irp->IoStatus.Status = STATUS_SUCCESS;
999 
1000  DPRINT("%s(%p, %p)\n", __FUNCTION__, DeviceObject, Irp);
1001 
1003 
1004  return STATUS_SUCCESS;
1005 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define __FUNCTION__
Definition: types.h:112
#define PAGED_CODE()

◆ _Dispatch_type_() [2/4]

_Dispatch_type_ ( IRP_MJ_CLEANUP  )

Definition at line 2374 of file btrfs.c.

2376  {
2377  NTSTATUS Status;
2380  device_extension* Vcb = DeviceObject->DeviceExtension;
2381  fcb* fcb = FileObject->FsContext;
2382  bool top_level;
2383 
2385 
2386  TRACE("cleanup\n");
2387 
2388  top_level = is_top_level(Irp);
2389 
2390  if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
2392  goto exit;
2393  } else if (DeviceObject == master_devobj) {
2394  TRACE("closing file system\n");
2396  goto exit;
2397  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
2399  goto exit;
2400  }
2401 
2402  if (FileObject->Flags & FO_CLEANUP_COMPLETE) {
2403  TRACE("FileObject %p already cleaned up\n", FileObject);
2405  goto exit;
2406  }
2407 
2408  if (!fcb) {
2409  ERR("fcb was NULL\n");
2411  goto exit;
2412  }
2413 
2415 
2416  // We have to use the pointer to Vcb stored in the fcb, as we can receive cleanup
2417  // messages belonging to other devices.
2418 
2419  if (FileObject && FileObject->FsContext) {
2420  LONG oc;
2421  ccb* ccb;
2422  file_ref* fileref;
2423  bool locked = true;
2424 
2425  ccb = FileObject->FsContext2;
2426  fileref = ccb ? ccb->fileref : NULL;
2427 
2428  TRACE("cleanup called for FileObject %p\n", FileObject);
2429  TRACE("fileref %p, refcount = %li, open_count = %li\n", fileref, fileref ? fileref->refcount : 0, fileref ? fileref->open_count : 0);
2430 
2431  ExAcquireResourceSharedLite(&fcb->Vcb->tree_lock, true);
2432 
2433  ExAcquireResourceExclusiveLite(fcb->Header.Resource, true);
2434 
2436 
2438 
2439  if (ccb)
2440  FsRtlNotifyCleanup(fcb->Vcb->NotifySync, &fcb->Vcb->DirNotifyList, ccb);
2441 
2442  if (fileref) {
2443  oc = InterlockedDecrement(&fileref->open_count);
2444 #ifdef DEBUG_FCB_REFCOUNTS
2445  ERR("fileref %p: open_count now %i\n", fileref, oc);
2446 #endif
2447  }
2448 
2449  if (ccb && ccb->options & FILE_DELETE_ON_CLOSE && fileref)
2450  fileref->delete_on_close = true;
2451 
2452  if (fileref && fileref->delete_on_close && fcb->type == BTRFS_TYPE_DIRECTORY && fcb->inode_item.st_size > 0 && fcb != fcb->Vcb->dummy_fcb)
2453  fileref->delete_on_close = false;
2454 
2455  if (fcb->Vcb->locked && fcb->Vcb->locked_fileobj == FileObject) {
2456  TRACE("unlocking volume\n");
2459  }
2460 
2461  if (ccb && ccb->reserving) {
2462  fcb->subvol->reserved = NULL;
2463  ccb->reserving = false;
2464  // FIXME - flush all of subvol's fcbs
2465  }
2466 
2467  if (fileref && (oc == 0 || (fileref->delete_on_close && fileref->posix_delete))) {
2468  if (!fcb->Vcb->removing) {
2469  if (oc == 0 && fileref->fcb->inode_item.st_nlink == 0 && fileref != fcb->Vcb->root_fileref &&
2470  fcb != fcb->Vcb->volume_fcb && !fcb->ads) { // last handle closed on POSIX-deleted file
2472 
2474 
2476  if (!NT_SUCCESS(Status)) {
2477  ERR("delete_fileref_fcb returned %08lx\n", Status);
2479  ExReleaseResourceLite(fileref->fcb->Header.Resource);
2480  ExReleaseResourceLite(&fcb->Vcb->tree_lock);
2481  goto exit;
2482  }
2483 
2485 
2486  mark_fcb_dirty(fileref->fcb);
2487  } else if (fileref->delete_on_close && fileref != fcb->Vcb->root_fileref && fcb != fcb->Vcb->volume_fcb) {
2489 
2491 
2492  if (!fileref->fcb->ads || fileref->dc) {
2493  if (fileref->fcb->ads) {
2495  FILE_ACTION_REMOVED, &fileref->dc->name);
2496  } else
2498  }
2499 
2500  ExReleaseResourceLite(fcb->Header.Resource);
2501  locked = false;
2502 
2503  // fileref_lock needs to be acquired before fcb->Header.Resource
2504  ExAcquireResourceExclusiveLite(&fcb->Vcb->fileref_lock, true);
2505 
2506  Status = delete_fileref(fileref, FileObject, oc > 0 && fileref->posix_delete, Irp, &rollback);
2507  if (!NT_SUCCESS(Status)) {
2508  ERR("delete_fileref returned %08lx\n", Status);
2510  ExReleaseResourceLite(&fcb->Vcb->fileref_lock);
2511  ExReleaseResourceLite(&fcb->Vcb->tree_lock);
2512  goto exit;
2513  }
2514 
2515  ExReleaseResourceLite(&fcb->Vcb->fileref_lock);
2516 
2518  } else if (FileObject->Flags & FO_CACHE_SUPPORTED && FileObject->SectionObjectPointer->DataSectionObject) {
2520 
2521  if (locked) {
2522  ExReleaseResourceLite(fcb->Header.Resource);
2523  locked = false;
2524  }
2525 
2526  CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, &iosb);
2527 
2528  if (!NT_SUCCESS(iosb.Status))
2529  ERR("CcFlushCache returned %08lx\n", iosb.Status);
2530 
2531  if (!ExIsResourceAcquiredSharedLite(fcb->Header.PagingIoResource)) {
2532  ExAcquireResourceExclusiveLite(fcb->Header.PagingIoResource, true);
2533  ExReleaseResourceLite(fcb->Header.PagingIoResource);
2534  }
2535 
2536  CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, false);
2537 
2538  TRACE("flushed cache on close (FileObject = %p, fcb = %p, AllocationSize = %I64x, FileSize = %I64x, ValidDataLength = %I64x)\n",
2539  FileObject, fcb, fcb->Header.AllocationSize.QuadPart, fcb->Header.FileSize.QuadPart, fcb->Header.ValidDataLength.QuadPart);
2540  }
2541  }
2542 
2543  if (fcb->Vcb && fcb != fcb->Vcb->volume_fcb)
2545  }
2546 
2547  if (locked)
2548  ExReleaseResourceLite(fcb->Header.Resource);
2549 
2550  ExReleaseResourceLite(&fcb->Vcb->tree_lock);
2551 
2552  FileObject->Flags |= FO_CLEANUP_COMPLETE;
2553  }
2554 
2556 
2557 exit:
2558  TRACE("returning %08lx\n", Status);
2559 
2560  Irp->IoStatus.Status = Status;
2561  Irp->IoStatus.Information = 0;
2562 
2564 
2565  if (top_level)
2567 
2569 
2570  return Status;
2571 }
struct _file_ref * parent
Definition: btrfs_drv.h:368
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
Definition: irp.c:1782
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
Definition: treefuncs.c:1050
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:386
void clear_rollback(LIST_ENTRY *rollback)
Definition: treefuncs.c:1029
#define FsRtlEnterFileSystem
ULONG options
Definition: btrfs_drv.h:390
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
#define FsRtlExitFileSystem
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define FSRTL_VOLUME_UNLOCK
Definition: ntifs_ex.h:443
Status
Definition: btrfs.c:4232
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
#define FILE_NOTIFY_CHANGE_FILE_NAME
LONG open_count
Definition: btrfs_drv.h:367
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
#define FILE_NOTIFY_CHANGE_DIR_NAME
void send_notification_fileref(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
Definition: btrfs.c:1449
VOID NTAPI IoRemoveShareAccess(IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess)
Definition: file.c:3477
bool posix_delete
Definition: btrfs_drv.h:361
VOID NTAPI FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext)
Definition: notify.c:635
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
long LONG
Definition: pedump.c:60
uint32_t st_nlink
Definition: btrfs.h:285
PDEVICE_OBJECT master_devobj
Definition: btrfs.c:69
#define BTRFS_TYPE_DIRECTORY
Definition: shellext.h:86
#define FILE_ACTION_REMOVED
void mark_fcb_dirty(_In_ fcb *fcb)
Definition: btrfs.c:1625
#define IoCompleteRequest
Definition: irp.c:1240
uint8_t type
Definition: btrfs_drv.h:302
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
LONG refcount
Definition: btrfs_drv.h:366
FILE_LOCK lock
Definition: btrfs_drv.h:305
InsertTailList & Vcb
Definition: btrfs.c:2978
FSRTL_ADVANCED_FCB_HEADER Header
Definition: btrfs_drv.h:294
Status
Definition: gdiplustypes.h:24
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
uint64_t st_size
Definition: btrfs.h:282
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS NTAPI FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, IN ULONG EventCode)
Definition: pnp.c:38
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1998
#define FO_CACHE_SUPPORTED
Definition: iotypes.h:1781
dir_child * dc
Definition: btrfs_drv.h:369
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define InterlockedDecrement
Definition: armddk.h:52
NTSTATUS vol_cleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:348
fcb * fcb
Definition: btrfs_drv.h:357
Definition: typedefs.h:119
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
Definition: filelock.c:1029
INODE_ITEM inode_item
Definition: btrfs_drv.h:303
#define ERR(fmt,...)
Definition: debug.h:110
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1790
static NTSTATUS delete_fileref_fcb(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
Definition: btrfs.c:2150
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
struct _root * subvol
Definition: btrfs_drv.h:299
#define NULL
Definition: types.h:112
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
Definition: btrfs_drv.h:1357
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
bool ads
Definition: btrfs_drv.h:341
static __inline POPLOCK fcb_oplock(fcb *fcb)
Definition: btrfs_drv.h:1683
NTSTATUS delete_fileref(_In_ file_ref *fileref, _In_opt_ PFILE_OBJECT FileObject, _In_ bool make_orphan, _In_opt_ PIRP Irp, _In_ LIST_ENTRY *rollback)
Definition: btrfs.c:2206
#define IO_NO_INCREMENT
Definition: iotypes.h:598
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
Definition: resource.c:1658
bool reserving
Definition: btrfs_drv.h:397
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
Definition: oplock.c:1172
SHARE_ACCESS share_access
Definition: btrfs_drv.h:309
void exit(int exitcode)
Definition: _exit.c:33
struct _ccb ccb
file_ref * fileref
Definition: btrfs_drv.h:399
return STATUS_SUCCESS
Definition: btrfs.c:3014
void do_unlock_volume(device_extension *Vcb)
Definition: fsctl.c:2320
struct _device_extension * Vcb
Definition: btrfs_drv.h:298
UNICODE_STRING name
Definition: btrfs_drv.h:267
bool delete_on_close
Definition: btrfs_drv.h:360

◆ _Dispatch_type_() [3/4]

_Dispatch_type_ ( IRP_MJ_CLOSE  )

Definition at line 461 of file btrfs.c.

463  {
466  device_extension* Vcb = DeviceObject->DeviceExtension;
467  bool top_level;
468 
470 
471  TRACE("close\n");
472 
473  top_level = is_top_level(Irp);
474 
475  if (DeviceObject == master_devobj) {
476  TRACE("Closing file system\n");
478  goto end;
479  } else if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
481  goto end;
482  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
484  goto end;
485  }
486 
488 
489  // FIXME - call FsRtlNotifyUninitializeSync(&Vcb->NotifySync) if unmounting
490 
492 
493 end:
494  Irp->IoStatus.Status = Status;
495  Irp->IoStatus.Information = 0;
496 
498 
499  if (top_level)
501 
502  TRACE("returning %08lx\n", Status);
503 
505 
506  return Status;
507 }
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: btrfs.c:4232
#define VCB_TYPE_FS
Definition: btrfs_drv.h:695
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:279
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_DISK_INCREMENT
Definition: iotypes.h:600
_In_ PIRP Irp
Definition: csq.h:116
PDEVICE_OBJECT master_devobj
Definition: btrfs.c:69
#define IoCompleteRequest
Definition: irp.c:1240
InsertTailList & Vcb
Definition: btrfs.c:2978
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:697
GLuint GLuint end
Definition: gl.h:1545
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define NULL
Definition: types.h:112
static NTSTATUS close_file(_In_ PFILE_OBJECT FileObject, _In_ PIRP Irp)
Definition: btrfs.c:1860
NTSTATUS vol_close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: volume.c:95
return STATUS_SUCCESS
Definition: btrfs.c:3014

◆ _Dispatch_type_() [4/4]

_Dispatch_type_ ( IRP_MJ_PNP  )

Definition at line 1581 of file isapnp.c.

1591 {
1593  PISAPNP_COMMON_EXTENSION DevExt = DeviceObject->DeviceExtension;
1594 
1595  PAGED_CODE();
1596 
1597  if (DevExt->Signature == IsaPnpBus)
1598  return IsaFdoPnp((PISAPNP_FDO_EXTENSION)DevExt, Irp, IrpSp);
1599  else
1600  return IsaPdoPnp((PISAPNP_PDO_EXTENSION)DevExt, Irp, IrpSp);
1601 }
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS IsaFdoPnp(_In_ PISAPNP_FDO_EXTENSION FdoExt, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:123
ISAPNP_SIGNATURE Signature
Definition: isapnp.h:150
NTSTATUS IsaPdoPnp(_In_ PISAPNP_PDO_EXTENSION PdoDeviceExtension, _Inout_ PIRP Irp, _In_ PIO_STACK_LOCATION IrpSp)
Definition: pdo.c:864
#define PAGED_CODE()

◆ DuplicateUnicodeString()

NTSTATUS DuplicateUnicodeString ( IN ULONG  Flags,
IN PCUNICODE_STRING  SourceString,
OUT PUNICODE_STRING  DestinationString 
)

Definition at line 72 of file misc.c.

76 {
81  {
83  }
84 
85 
86  if ((SourceString->Length == 0)
89  {
93  }
94  else
95  {
96  USHORT DestMaxLength = SourceString->Length;
97 
99  DestMaxLength += sizeof(UNICODE_NULL);
100 
102  if (DestinationString->Buffer == NULL)
103  return STATUS_NO_MEMORY;
104 
107  DestinationString->MaximumLength = DestMaxLength;
108 
111  }
112 
113  return STATUS_SUCCESS;
114 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING
Definition: green.h:16
unsigned short Length
Definition: sprintf.c:451
#define I8042PRT_TAG
Definition: i8042prt.h:12
void * Buffer
Definition: sprintf.c:453
#define UNICODE_NULL
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned short MaximumLength
Definition: sprintf.c:452

Referenced by DriverEntry(), FdcPdoQueryId(), PciCreateCompatibleIDsString(), PciCreateHardwareIDsString(), PciIdeXPdoQueryId(), ReportDetectedDevice(), SearchForLegacyDrivers(), and SerenumPdoQueryId().

◆ i8042ChangeMode()

BOOLEAN i8042ChangeMode ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN UCHAR  FlagsToDisable,
IN UCHAR  FlagsToEnable 
)

Definition at line 37 of file pnp.c.

41 {
42  UCHAR Value;
44 
45  if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_READ_MODE))
46  {
47  WARN_(I8042PRT, "Can't read i8042 mode\n");
48  return FALSE;
49  }
50 
51  Status = i8042ReadDataWait(DeviceExtension, &Value);
52  if (!NT_SUCCESS(Status))
53  {
54  WARN_(I8042PRT, "No response after read i8042 mode\n");
55  return FALSE;
56  }
57 
58  Value &= ~FlagsToDisable;
59  Value |= FlagsToEnable;
60 
61  if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_WRITE_MODE))
62  {
63  WARN_(I8042PRT, "Can't set i8042 mode\n");
64  return FALSE;
65  }
66 
67  if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Value))
68  {
69  WARN_(I8042PRT, "Can't send i8042 mode\n");
70  return FALSE;
71  }
72 
73  return TRUE;
74 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
#define FALSE
Definition: types.h:117
#define KBD_WRITE_MODE
Definition: i8042prt.h:222
#define KBD_READ_MODE
Definition: i8042prt.h:221
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
Definition: readwrite.c:95
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by EnableInterrupts(), i8042BasicDetect(), and i8042DetectKeyboard().

◆ i8042Flush()

VOID i8042Flush ( IN PPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 21 of file readwrite.c.

23 {
24  UCHAR Ignore;
25 
26  /* Flush output buffer */
27  while (NT_SUCCESS(i8042ReadData(DeviceExtension, KBD_OBF /* | MOU_OBF*/, &Ignore))) {
29  TRACE_(I8042PRT, "Output data flushed\n");
30  }
31 
32  /* Flush input buffer */
33  while (NT_SUCCESS(i8042ReadData(DeviceExtension, KBD_IBF, &Ignore))) {
35  TRACE_(I8042PRT, "Input data flushed\n");
36  }
37 }
#define KBD_OBF
Definition: i8042prt.h:250
#define KBD_IBF
Definition: i8042prt.h:251
#define TRACE_(x)
Definition: compat.h:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS i8042ReadData(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR StatusFlags, OUT PUCHAR Data)
Definition: readwrite.c:56
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:96

Referenced by EnableInterrupts(), i8042BasicDetect(), and i8042DetectMouse().

◆ i8042InitializeHwHacks()

VOID NTAPI i8042InitializeHwHacks ( VOID  )

Definition at line 183 of file hwhacks.c.

185 {
187  PVOID DataBlockObject;
188  PWNODE_ALL_DATA AllData;
190 
191  /* Open the data block object for the SMBIOS table */
194  &DataBlockObject);
195  if (!NT_SUCCESS(Status))
196  {
197  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
198  return;
199  }
200 
201  /* Query the required buffer size */
202  BufferSize = 0;
203  Status = IoWMIQueryAllData(DataBlockObject, &BufferSize, NULL);
204  if (!NT_SUCCESS(Status))
205  {
206  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
207  return;
208  }
209 
210  AllData = ExAllocatePoolWithTag(PagedPool, BufferSize, 'BTMS');
211  if (AllData == NULL)
212  {
213  DPRINT1("Failed to allocate %lu bytes for SMBIOS tables\n", BufferSize);
214  return;
215  }
216 
217  /* Query the buffer data */
218  Status = IoWMIQueryAllData(DataBlockObject, &BufferSize, AllData);
219  if (!NT_SUCCESS(Status))
220  {
221  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
222  ExFreePoolWithTag(AllData, 'BTMS');
223  return;
224  }
225 
226  /* FIXME: This function should be removed once the mssmbios driver is implemented */
227  /* Store SMBios data in registry */
228  i8042StoreSMBiosTables(AllData + 1,
229  AllData->FixedInstanceSize);
230  DPRINT1("SMBiosTables HACK, see CORE-14867\n");
231 
232  /* Parse the table */
233  i8042ParseSMBiosTables(AllData + 1,
234  AllData->WnodeHeader.BufferSize);
235 
236  /* Free the buffer */
237  ExFreePoolWithTag(AllData, 'BTMS');
238 }
static VOID i8042StoreSMBiosTables(_In_reads_bytes_(TableSize) PVOID SMBiosTables, _In_ ULONG TableSize)
Definition: hwhacks.c:119
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI IoWMIQueryAllData(IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer)
Definition: wmi.c:169
Status
Definition: gdiplustypes.h:24
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
static VOID i8042ParseSMBiosTables(_In_reads_bytes_(TableSize) PVOID SMBiosTables, _In_ ULONG TableSize)
Definition: hwhacks.c:62
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS NTAPI IoWMIOpenBlock(_In_ LPCGUID DataBlockGuid, _In_ ULONG DesiredAccess, _Out_ PVOID *DataBlockObject)
Definition: wmi.c:140
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define WMIGUID_QUERY
Definition: wmistr.h:159
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
struct _WNODE_HEADER WnodeHeader
Definition: wmistr.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by DriverEntry().

◆ i8042IsrWritePort()

BOOLEAN i8042IsrWritePort ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN UCHAR  Value,
IN UCHAR SelectCmd  OPTIONAL 
)

Definition at line 40 of file readwrite.c.

44 {
45  if (SelectCmd)
46  if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, SelectCmd))
47  return FALSE;
48 
49  return i8042Write(DeviceExtension, DeviceExtension->DataPort, Value);
50 }
#define FALSE
Definition: types.h:117
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406

Referenced by i8042DetectMouse(), i8042MouInitialize(), i8042MouIsrWritePort(), and StartProcedure().

◆ i8042MouHandle()

VOID i8042MouHandle ( IN PI8042_MOUSE_EXTENSION  DeviceExtension,
IN UCHAR  Output 
)

Definition at line 68 of file mouse.c.

71 {
72  PMOUSE_INPUT_DATA MouseInput;
73  CHAR Scroll;
74 
75  MouseInput = DeviceExtension->MouseBuffer + DeviceExtension->MouseInBuffer;
76 
77  switch (DeviceExtension->MouseState)
78  {
79  case MouseIdle:
80  /* This bit should be 1, if not drop the packet, we
81  * might be lucky and get in sync again
82  */
83  if (!(Output & 8)) {
84  WARN_(I8042PRT, "Bad input, dropping..\n");
85  return;
86  }
87 
88  MouseInput->Buttons = 0;
89  MouseInput->RawButtons = 0;
90  MouseInput->Flags = MOUSE_MOVE_RELATIVE;
91 
92  /* Note how we ignore the overflow bits, like Windows
93  * is said to do. There's no reasonable thing to do
94  * anyway.
95  */
96 
97  if (Output & 16)
98  MouseInput->LastX = 1;
99  else
100  MouseInput->LastX = 0;
101  if (Output & 32)
102  MouseInput->LastY = 1;
103  else
104  MouseInput->LastY = 0;
105 
106  if (Output & 1)
107  MouseInput->RawButtons |= MOUSE_LEFT_BUTTON_DOWN;
108  if (Output & 2)
109  MouseInput->RawButtons |= MOUSE_RIGHT_BUTTON_DOWN;
110  if (Output & 4)
111  MouseInput->RawButtons |= MOUSE_MIDDLE_BUTTON_DOWN;
112 
113  DeviceExtension->MouseState = XMovement;
114  break;
115 
116  case XMovement:
117  if (MouseInput->LastX)
118  MouseInput->LastX = (LONG) Output - 256;
119  else
120  MouseInput->LastX = Output;
121 
122  DeviceExtension->MouseState = YMovement;
123  break;
124 
125  case YMovement:
126  if (MouseInput->LastY)
127  MouseInput->LastY = (LONG)Output - 256;
128  else
129  MouseInput->LastY = (LONG)Output;
130 
131  /* Windows wants it the other way around */
132  MouseInput->LastY = -MouseInput->LastY;
133 
134  if (DeviceExtension->MouseType == GenericPS2 ||
135  DeviceExtension->MouseType == Ps2pp)
136  {
138  DeviceExtension,
142  DeviceExtension->MouseHook.QueueMousePacket(DeviceExtension->MouseHook.CallContext);
143  DeviceExtension->MouseState = MouseIdle;
144  }
145  else
146  {
147  DeviceExtension->MouseState = ZMovement;
148  }
149  break;
150 
151  case ZMovement:
152  Scroll = Output & 0x0f;
153  if (Scroll & 8)
154  Scroll |= 0xf0;
155 
156  if (Scroll)
157  {
158  MouseInput->RawButtons |= MOUSE_WHEEL;
159  MouseInput->ButtonData = (USHORT)(Scroll * -WHEEL_DELTA);
160  }
161 
162  if (DeviceExtension->MouseType == IntellimouseExplorer)
163  {
164  if (Output & 16)
165  MouseInput->RawButtons |= MOUSE_BUTTON_4_DOWN;
166  if (Output & 32)
167  MouseInput->RawButtons |= MOUSE_BUTTON_5_DOWN;
168  }
170  DeviceExtension,
176  DeviceExtension->MouseHook.QueueMousePacket(DeviceExtension->MouseHook.CallContext);
177  DeviceExtension->MouseState = MouseIdle;
178  break;
179 
180  default:
181  ERR_(I8042PRT, "Unexpected state 0x%lx!\n", DeviceExtension->MouseState);
182  ASSERT(FALSE);
183  }
184 }
#define MOUSE_MIDDLE_BUTTON_DOWN
Definition: ntddmou.h:50
#define MOUSE_LEFT_BUTTON_DOWN
Definition: ntddmou.h:46
#define MOUSE_WHEEL
Definition: ntddmou.h:56
char CHAR
Definition: xmlstorage.h:175
#define ERR_(ch,...)
Definition: debug.h:156
USHORT Flags
Definition: ntddmou.h:78
#define WHEEL_DELTA
Definition: treelist.c:99
#define FALSE
Definition: types.h:117
ULONG RawButtons
Definition: ntddmou.h:86
long LONG
Definition: pedump.c:60
#define MOUSE_BUTTON_4_DOWN
Definition: ntddmou.h:52
#define ASSERT(a)
Definition: mode.c:44
#define MOUSE_MOVE_RELATIVE
Definition: ntddmou.h:67
#define MOUSE_RIGHT_BUTTON_DOWN
Definition: ntddmou.h:48
USHORT ButtonData
Definition: ntddmou.h:83
Definition: arc.h:85
unsigned short USHORT
Definition: pedump.c:61
#define MOUSE_BUTTON_5_DOWN
Definition: ntddmou.h:54
#define WARN_(ch,...)
Definition: debug.h:157
VOID i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension, IN USHORT Mask)
Definition: mouse.c:191

Referenced by i8042MouHandlePs2pp(), and i8042MouInterruptService().

◆ i8042MouHandleButtons()

VOID i8042MouHandleButtons ( IN PI8042_MOUSE_EXTENSION  DeviceExtension,
IN USHORT  Mask 
)

Definition at line 191 of file mouse.c.

194 {
195  PMOUSE_INPUT_DATA MouseInput;
196  USHORT NewButtonData;
197  USHORT ButtonDiff;
198 
199  MouseInput = DeviceExtension->MouseBuffer + DeviceExtension->MouseInBuffer;
200  NewButtonData = (USHORT)(MouseInput->RawButtons & Mask);
201  ButtonDiff = (NewButtonData ^ DeviceExtension->MouseButtonState) & Mask;
202 
203  /* Note that the defines are such:
204  * MOUSE_LEFT_BUTTON_DOWN 1
205  * MOUSE_LEFT_BUTTON_UP 2
206  */
207  MouseInput->ButtonFlags |= (NewButtonData & ButtonDiff) |
208  (((~(NewButtonData)) << 1) & (ButtonDiff << 1)) |
209  (MouseInput->RawButtons & 0xfc00);
210 
211  INFO_(I8042PRT, "Left raw/up/down: %u/%u/%u\n",
212  MouseInput->RawButtons & MOUSE_LEFT_BUTTON_DOWN,
213  MouseInput->ButtonFlags & MOUSE_LEFT_BUTTON_DOWN,
214  MouseInput->ButtonFlags & MOUSE_LEFT_BUTTON_UP);
215 
216  DeviceExtension->MouseButtonState =
217  (DeviceExtension->MouseButtonState & ~Mask) | (NewButtonData & Mask);
218 }
#define MOUSE_LEFT_BUTTON_DOWN
Definition: ntddmou.h:46
#define INFO_(ch,...)
Definition: debug.h:159
ULONG RawButtons
Definition: ntddmou.h:86
#define MOUSE_LEFT_BUTTON_UP
Definition: ntddmou.h:47
USHORT ButtonFlags
Definition: ntddmou.h:82
processorSet Mask
unsigned short USHORT
Definition: pedump.c:61

Referenced by i8042MouHandle(), and i8042MouHandlePs2pp().

◆ i8042MouHandlePs2pp()

VOID i8042MouHandlePs2pp ( IN PI8042_MOUSE_EXTENSION  DeviceExtension,
IN UCHAR  Input 
)

Definition at line 19 of file ps2pp.c.

22 {
23  UCHAR PktType;
24  PMOUSE_INPUT_DATA MouseInput;
25 
26  MouseInput = DeviceExtension->MouseBuffer + DeviceExtension->MouseInBuffer;
27 
28  /* First, collect 3 bytes for a packet
29  * We can detect out-of-sync only by checking
30  * the whole packet anyway.
31  *
32  * If bit 7 and 8 of the first byte are 0, its
33  * a normal packet.
34  *
35  * Otherwise, the packet is different, like this:
36  * 1: E 1 b3 b2 1 x x x
37  * 2: x x b1 b0 x1 x0 1 0
38  * 3: x x x x x x x1 x0
39  *
40  * b3-0 form a code that specifies the packet type:
41  *
42  * 0 Device Type
43  * 1 Rollers and buttons
44  * 2 Reserved
45  * 3 Reserved
46  * 4 Device ID
47  * 5 Channel & Battery
48  * 6 Wireless notifications
49  * 7 Reserved
50  * 8 ShortID LSB (ShortID is a number that is supposed to differentiate
51  * 9 ShortID MSB between your mouse and your neighbours')
52  * 10 Reserved
53  * 11 Mouse capabilities
54  * 12 Remote control LSB
55  * 13 Remote control MSB
56  * 14 Reserved
57  * 15 Extended packet
58  */
59 
60  switch (DeviceExtension->MouseState)
61  {
62  case MouseIdle:
63  case XMovement:
64  DeviceExtension->MouseLogiBuffer[DeviceExtension->MouseState] = Input;
65  DeviceExtension->MouseState++;
66  break;
67 
68  case YMovement:
69  DeviceExtension->MouseLogiBuffer[2] = Input;
70  DeviceExtension->MouseState = MouseIdle;
71 
72  /* first check if it's a normal packet */
73 
74  if (!(DeviceExtension->MouseLogiBuffer[0] & 0xC0))
75  {
76  DeviceExtension->MouseState = MouseIdle;
77  i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[0]);
78  i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[1]);
79  i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[2]);
80  /* We could care about wether MouseState really
81  * advances, but we don't need to because we're
82  * only doing three bytes anyway, so the packet
83  * will never complete if it's broken.
84  */
85  return;
86  }
87 
88  /* sanity check */
89  if (((DeviceExtension->MouseLogiBuffer[0] & 0x48) != 0x48) ||
90  (((DeviceExtension->MouseLogiBuffer[1] & 0x0C) >> 2) !=
91  (DeviceExtension->MouseLogiBuffer[2] & 0x03)))
92  {
93  WARN_(I8042PRT, "Ps2pp packet fails sanity checks\n");
94  return;
95  }
96 
97  /* Now get the packet type */
98  PktType = ((DeviceExtension->MouseLogiBuffer[0] & 0x30) >> 2) |
99  ((DeviceExtension->MouseLogiBuffer[1] & 0x30) >> 4);
100 
101  switch (PktType)
102  {
103  case 0:
104  /* The packet contains the device ID, but we
105  * already read that in the initialization
106  * sequence. Ignore it.
107  */
108  return;
109  case 1:
110  RtlZeroMemory(MouseInput, sizeof(MOUSE_INPUT_DATA));
111  if (DeviceExtension->MouseLogiBuffer[2] & 0x10)
112  MouseInput->RawButtons |= MOUSE_BUTTON_4_DOWN;
113 
114  if (DeviceExtension->MouseLogiBuffer[2] & 0x20)
115  MouseInput->RawButtons |= MOUSE_BUTTON_5_DOWN;
116 
117  if (DeviceExtension->MouseLogiBuffer[2] & 0x0F)
118  {
119  MouseInput->ButtonFlags |= MOUSE_WHEEL;
120  if (DeviceExtension->MouseLogiBuffer[2] & 0x08)
121  MouseInput->ButtonData = (DeviceExtension->MouseLogiBuffer[2] & 0x07) - 8;
122  else
123  MouseInput->ButtonData = DeviceExtension->MouseLogiBuffer[2] & 0x07;
124  }
126  DeviceExtension,
128  DeviceExtension->MouseHook.QueueMousePacket(DeviceExtension->MouseHook.CallContext);
129  return;
130  default:
131  /* These are for things that would probably
132  * be handled by logitechs own driver.
133  */
134  return;
135  }
136 
137  default:
138  WARN_(I8042PRT, "Unexpected input state for ps2pp!\n");
139  }
140 }
#define MOUSE_WHEEL
Definition: ntddmou.h:56
Definition: arc.h:84
VOID i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension, IN USHORT Mask)
Definition: mouse.c:191
ULONG RawButtons
Definition: ntddmou.h:86
#define MOUSE_BUTTON_4_DOWN
Definition: ntddmou.h:52
USHORT ButtonData
Definition: ntddmou.h:83
unsigned char UCHAR
Definition: xmlstorage.h:181
USHORT ButtonFlags
Definition: ntddmou.h:82
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MOUSE_BUTTON_5_DOWN
Definition: ntddmou.h:54
VOID i8042MouHandle(IN PI8042_MOUSE_EXTENSION DeviceExtension, IN UCHAR Output)
Definition: mouse.c:68
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by i8042MouInterruptService().

◆ i8042MouInitialize()

NTSTATUS i8042MouInitialize ( IN PI8042_MOUSE_EXTENSION  DeviceExtension)

Definition at line 224 of file mouse.c.

226 {
228  UCHAR Value;
229 
230  /* Enable the PS/2 mouse port */
231  i8042Write(DeviceExtension->Common.PortDeviceExtension, DeviceExtension->Common.PortDeviceExtension->ControlPort, MOUSE_ENAB);
232 
233  /* Enable the mouse */
234  if(!i8042IsrWritePort(DeviceExtension->Common.PortDeviceExtension, MOU_ENAB, CTRL_WRITE_MOUSE))
235  {
236  WARN_(I8042PRT, "Failed to enable mouse!\n");
237  return STATUS_IO_DEVICE_ERROR;
238  }
239 
240  Status = i8042ReadDataWait(DeviceExtension->Common.PortDeviceExtension, &Value);
241  if (!NT_SUCCESS(Status))
242  {
243  WARN_(I8042PRT, "Failed to read the response of MOU_ENAB, status 0x%08lx\n", Status);
244  return Status;
245  }
246 
247  if(Value == MOUSE_ACK)
248  {
249  INFO_(I8042PRT, "Mouse was enabled successfully!\n");
250  return STATUS_SUCCESS;
251  }
252 
253  WARN_(I8042PRT, "Got 0x%02x instead of 0xFA\n", Value);
254  return STATUS_IO_DEVICE_ERROR;
255 }
#define INFO_(ch,...)
Definition: debug.h:159
#define MOU_ENAB
Definition: i8042prt.h:278
LONG NTSTATUS
Definition: precomp.h:26
#define MOUSE_ENAB
Definition: i8042prt.h:223
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
BOOLEAN i8042IsrWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Value, IN UCHAR SelectCmd OPTIONAL)
Definition: readwrite.c:40
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned char UCHAR
Definition: xmlstorage.h:181
#define MOUSE_ACK
Definition: i8042prt.h:285
NTSTATUS i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
Definition: readwrite.c:95
#define STATUS_SUCCESS
Definition: shellext.h:65
#define WARN_(ch,...)
Definition: debug.h:157
#define CTRL_WRITE_MOUSE
Definition: i8042prt.h:228

Referenced by i8042ConnectMouseInterrupt().

◆ i8042PacketIsr()

BOOLEAN i8042PacketIsr ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN UCHAR  Output 
)

Definition at line 271 of file i8042prt.c.

274 {
275  if (DeviceExtension->Packet.State == Idle)
276  return FALSE;
277 
278  switch (Output)
279  {
280  case KBD_RESEND:
281  DeviceExtension->PacketResends++;
282  if (DeviceExtension->PacketResends > DeviceExtension->Settings.ResendIterations)
283  {
284  DeviceExtension->Packet.State = Idle;
285  DeviceExtension->PacketComplete = TRUE;
286  DeviceExtension->PacketResult = STATUS_IO_TIMEOUT;
287  DeviceExtension->PacketResends = 0;
288  return TRUE;
289  }
290  DeviceExtension->Packet.CurrentByte--;
291  break;
292 
293  case KBD_NACK:
294  DeviceExtension->Packet.State = Idle;
295  DeviceExtension->PacketComplete = TRUE;
296  DeviceExtension->PacketResult = STATUS_UNEXPECTED_IO_ERROR;
297  DeviceExtension->PacketResends = 0;
298  return TRUE;
299 
300  default:
301  DeviceExtension->PacketResends = 0;
302  }
303 
304  if (DeviceExtension->Packet.CurrentByte >= DeviceExtension->Packet.ByteCount)
305  {
306  DeviceExtension->Packet.State = Idle;
307  DeviceExtension->PacketComplete = TRUE;
308  DeviceExtension->PacketResult = STATUS_SUCCESS;
309  return TRUE;
310  }
311 
312  if (!i8042PacketWrite(DeviceExtension))
313  {
314  DeviceExtension->Packet.State = Idle;
315  DeviceExtension->PacketComplete = TRUE;
316  DeviceExtension->PacketResult = STATUS_IO_TIMEOUT;
317  return TRUE;
318  }
319  DeviceExtension->Packet.CurrentByte++;
320 
321  return TRUE;
322 }
#define TRUE
Definition: types.h:120
static BOOLEAN i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
Definition: i8042prt.c:248
#define FALSE
Definition: types.h:117
Definition: ntdd8042.h:62
Definition: arc.h:85
#define KBD_RESEND
Definition: i8042prt.h:244
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:469
#define STATUS_SUCCESS
Definition: shellext.h:65
#define KBD_NACK
Definition: i8042prt.h:243

Referenced by i8042KbdInterruptService(), and i8042MouInterruptService().

◆ i8042ReadData()

NTSTATUS i8042ReadData ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN UCHAR  StatusFlags,
OUT PUCHAR  Data 
)

Definition at line 56 of file readwrite.c.

60 {
63 
64  Status = i8042ReadStatus(DeviceExtension, &PortStatus);
65  if (!NT_SUCCESS(Status))
66  return Status;
67 
68  // If data is available
69  if (PortStatus & StatusFlags)
70  {
71  *Data = READ_PORT_UCHAR(DeviceExtension->DataPort);
72  INFO_(I8042PRT, "Read: 0x%02x (status: 0x%x)\n", Data[0], PortStatus);
73 
74  // If the data is valid (not timeout, not parity error)
75  if ((PortStatus & KBD_PERR) == 0)
76  return STATUS_SUCCESS;
77  }
78  return STATUS_UNSUCCESSFUL;
79 }
#define INFO_(ch,...)
Definition: debug.h:159
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
#define KBD_PERR
Definition: i8042prt.h:253
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char UCHAR
Definition: xmlstorage.h:181
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
NTSTATUS i8042ReadStatus(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Status)
Definition: readwrite.c:82
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by i8042Flush().

◆ i8042ReadDataWait()

NTSTATUS i8042ReadDataWait ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
OUT PUCHAR  Data 
)

Definition at line 95 of file readwrite.c.

98 {
99  ULONG Counter;
101 
102  Counter = DeviceExtension->Settings.PollingIterations;
103 
104  while (Counter--)
105  {
106  Status = i8042ReadKeyboardData(DeviceExtension, Data);
107 
108  if (NT_SUCCESS(Status))
109  return Status;
110 
112  }
113 
114  /* Timed out */
115  return STATUS_IO_TIMEOUT;
116 }
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define i8042ReadKeyboardData(DeviceExtension, Data)
Definition: i8042prt.h:405
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
static LARGE_INTEGER Counter
Definition: clock.c:43
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:96

Referenced by i8042BasicDetect(), i8042ChangeMode(), i8042DetectMouse(), i8042MouInitialize(), i8042SynchReadPort(), and i8042SynchWritePort().

◆ i8042ReadStatus()

NTSTATUS i8042ReadStatus ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
OUT PUCHAR  Status 
)

Definition at line 82 of file readwrite.c.

85 {
86  ASSERT(DeviceExtension->ControlPort != NULL);
87  *Status = READ_PORT_UCHAR(DeviceExtension->ControlPort);
88  return STATUS_SUCCESS;
89 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by i8042KbdInterruptService(), i8042MouInterruptService(), and i8042ReadData().

◆ i8042StartPacket()

NTSTATUS i8042StartPacket ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN PFDO_DEVICE_EXTENSION  FdoDeviceExtension,
IN PUCHAR  Bytes,
IN ULONG  ByteCount,
IN PIRP  Irp 
)

Definition at line 329 of file i8042prt.c.

335 {
336  KIRQL Irql;
338 
339  Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt);
340 
341  if (DeviceExtension->Packet.State != Idle)
342  {
344  goto done;
345  }
346 
347  switch (FdoDeviceExtension->Type)
348  {
349  case Keyboard: DeviceExtension->PacketPort = 0; break;
350  case Mouse: DeviceExtension->PacketPort = CTRL_WRITE_MOUSE; break;
351  default:
352  ERR_(I8042PRT, "Unknown FDO type %u\n", FdoDeviceExtension->Type);
353  ASSERT(FALSE);
355  goto done;
356  }
357 
358  DeviceExtension->Packet.Bytes = Bytes;
359  DeviceExtension->Packet.CurrentByte = 0;
360  DeviceExtension->Packet.ByteCount = ByteCount;
361  DeviceExtension->Packet.State = SendingBytes;
362  DeviceExtension->PacketResult = Status = STATUS_PENDING;
363  DeviceExtension->CurrentIrp = Irp;
364  DeviceExtension->CurrentIrpDevice = FdoDeviceExtension->Fdo;
365 
366  if (!i8042PacketWrite(DeviceExtension))
367  {
369  DeviceExtension->Packet.State = Idle;
370  DeviceExtension->PacketResult = STATUS_ABANDONED;
371  goto done;
372  }
373 
374  DeviceExtension->Packet.CurrentByte++;
375 
376 done:
377  KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql);
378 
379  if (Status != STATUS_PENDING)
380  {
381  DeviceExtension->CurrentIrp = NULL;
382  DeviceExtension->CurrentIrpDevice = NULL;
383  Irp->IoStatus.Status = Status;
385  }
386  return Status;
387 }
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
_In_ UINT Bytes
Definition: mmcopy.h:9
_Out_ PKIRQL Irql
Definition: csq.h:179
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
UCHAR KIRQL
Definition: env_spec_w32.h:591
static BOOLEAN i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
Definition: i8042prt.c:248
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:171
#define IoCompleteRequest
Definition: irp.c:1240
Definition: ntdd8042.h:62
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_PENDING
Definition: ntstatus.h:82
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:154
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1098
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define NULL
Definition: types.h:112
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define STATUS_ABANDONED
Definition: ntstatus.h:75
#define CTRL_WRITE_MOUSE
Definition: i8042prt.h:228

Referenced by i8042KbdStartIo().

◆ i8042SynchReadPort()

NTSTATUS NTAPI i8042SynchReadPort ( IN PVOID  Context,
OUT PUCHAR  Value,
IN BOOLEAN  WaitForAck 
)

Definition at line 125 of file readwrite.c.

129 {
130  PPORT_DEVICE_EXTENSION DeviceExtension;
131 
132  UNREFERENCED_PARAMETER(WaitForAck);
133 
134  DeviceExtension = (PPORT_DEVICE_EXTENSION)Context;
135 
136  return i8042ReadDataWait(DeviceExtension, Value);
137 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
struct _PORT_DEVICE_EXTENSION * PPORT_DEVICE_EXTENSION
NTSTATUS i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
Definition: readwrite.c:95

Referenced by i8042SendHookWorkItem().

◆ i8042SynchWritePort()

NTSTATUS NTAPI i8042SynchWritePort ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN UCHAR  Port,
IN UCHAR  Value,
IN BOOLEAN  WaitForAck 
)

Definition at line 144 of file readwrite.c.

149 {
151  UCHAR Ack;
152  ULONG ResendIterations;
153 
154  ResendIterations = DeviceExtension->Settings.ResendIterations + 1;
155 
156  do
157  {
158  if (Port)
159  if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Port))
160  {
161  WARN_(I8042PRT, "Failed to write Port\n");
162  return STATUS_IO_TIMEOUT;
163  }
164 
165  if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Value))
166  {
167  WARN_(I8042PRT, "Failed to write Value\n");
168  return STATUS_IO_TIMEOUT;
169  }
170 
171  if (WaitForAck)
172  {
173  Status = i8042ReadDataWait(DeviceExtension, &Ack);
174  if (!NT_SUCCESS(Status))
175  {
176  WARN_(I8042PRT, "Failed to read Ack\n");
177  return Status;
178  }
179  if (Ack == KBD_ACK)
180  return STATUS_SUCCESS;
181  else if (Ack == KBD_RESEND)
182  INFO_(I8042PRT, "i8042 asks for a data resend\n");
183  }
184  else
185  {
186  return STATUS_SUCCESS;
187  }
188  TRACE_(I8042PRT, "Reiterating\n");
189  ResendIterations--;
190  } while (ResendIterations);
191 
192  return STATUS_IO_TIMEOUT;
193 }
CPPORT Port[4]
Definition: headless.c:35
#define INFO_(ch,...)
Definition: debug.h:159
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
#define TRACE_(x)
Definition: compat.h:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KBD_ACK
Definition: i8042prt.h:242
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Data)
Definition: readwrite.c:95
#define KBD_RESEND
Definition: i8042prt.h:244
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by i8042DetectKeyboard(), and i8042SynchWritePortKbd().

◆ i8042SynchWritePortKbd()

NTSTATUS NTAPI i8042SynchWritePortKbd ( IN PVOID  Context,
IN UCHAR  Value,
IN BOOLEAN  WaitForAck 
)

Definition at line 87 of file keyboard.c.

91 {
92  return i8042SynchWritePort(
94  0,
95  Value,
96  WaitForAck);
97 }
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
NTSTATUS NTAPI i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Port, IN UCHAR Value, IN BOOLEAN WaitForAck)
Definition: readwrite.c:144

Referenced by i8042SendHookWorkItem().

◆ i8042Write()

BOOLEAN i8042Write ( IN PPORT_DEVICE_EXTENSION  DeviceExtension,
IN PUCHAR  addr,
IN UCHAR  data 
)

Definition at line 199 of file readwrite.c.

203 {
204  ULONG Counter;
205 
206  ASSERT(addr);
207  ASSERT(DeviceExtension->ControlPort != NULL);
208 
209  Counter = DeviceExtension->Settings.PollingIterations;
210 
211  while ((KBD_IBF & READ_PORT_UCHAR(DeviceExtension->ControlPort)) &&
212  (Counter--))
213  {
215  }
216 
217  if (Counter)
218  {
220  INFO_(I8042PRT, "Sent 0x%x to port %p\n", data, addr);
221  return TRUE;
222  }
223  return FALSE;
224 }
#define INFO_(ch,...)
Definition: debug.h:159
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define TRUE
Definition: types.h:120
#define KBD_IBF
Definition: i8042prt.h:251
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum const GLvoid * addr
Definition: glext.h:9621
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define NULL
Definition: types.h:112
static LARGE_INTEGER Counter
Definition: clock.c:43
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:96

Referenced by i8042BasicDetect(), i8042ChangeMode(), i8042ConnectKeyboardInterrupt(), i8042DetectMouse(), i8042IsrWritePort(), i8042MouInitialize(), i8042PacketWrite(), and i8042SynchWritePort().

◆ ReadRegistryEntries()

NTSTATUS ReadRegistryEntries ( IN PUNICODE_STRING  RegistryPath,
OUT PI8042_SETTINGS  Settings 
)

Definition at line 21 of file registry.c.

24 {
27 
28  ULONG DefaultKeyboardDataQueueSize = 0x64;
29  PCWSTR DefaultKeyboardDeviceBaseName = L"KeyboardPort";
30  ULONG DefaultMouseDataQueueSize = 0x64;
31  ULONG DefaultMouseResolution = 3;
32  ULONG DefaultMouseSynchIn100ns = 20000000;
33  ULONG DefaultNumberOfButtons = 2;
34  PCWSTR DefaultPointerDeviceBaseName = L"PointerPort";
35  ULONG DefaultPollStatusIterations = 1;
36  ULONG DefaultOverrideKeyboardType = 4;
37  ULONG DefaultOverrideKeyboardSubtype = 0;
38  ULONG DefaultPollingIterations = 12000;
39  ULONG DefaultPollingIterationsMaximum = 12000;
40  ULONG DefaultResendIterations = 0x3;
41  ULONG DefaultSampleRate = 60;
42  ULONG DefaultCrashOnCtrlScroll;
43 
44  /* Default value for CrashOnCtrlScroll depends if we're
45  * running a debug build or a normal build.
46  */
47 #if DBG
48  DefaultCrashOnCtrlScroll = 1;
49 #else
50  DefaultCrashOnCtrlScroll = 0;
51 #endif
52 
54 
56  Parameters[0].Name = L"Parameters";
57 
59  Parameters[1].Name = L"KeyboardDataQueueSize";
60  Parameters[1].EntryContext = &Settings->KeyboardDataQueueSize;
61  Parameters[1].DefaultType = REG_DWORD;
62  Parameters[1].DefaultData = &DefaultKeyboardDataQueueSize;
63  Parameters[1].DefaultLength = sizeof(ULONG);
64 
66  Parameters[2].Name = L"KeyboardDeviceBaseName";
67  Parameters[2].EntryContext = &Settings->KeyboardDeviceBaseName;
68  Parameters[2].DefaultType = REG_SZ;
69  Parameters[2].DefaultData = (PVOID)DefaultKeyboardDeviceBaseName;
70  Parameters[2].DefaultLength = 0;
71 
73  Parameters[3].Name = L"MouseDataQueueSize";
74  Parameters[3].EntryContext = &Settings->MouseDataQueueSize;
75  Parameters[3].DefaultType = REG_DWORD;
76  Parameters[3].DefaultData = &DefaultMouseDataQueueSize;
77  Parameters[3].DefaultLength = sizeof(ULONG);
78 
80  Parameters[4].Name = L"MouseResolution";
81  Parameters[4].EntryContext = &Settings->MouseResolution;
82  Parameters[4].DefaultType = REG_DWORD;
83  Parameters[4].DefaultData = &DefaultMouseResolution;
84  Parameters[4].DefaultLength = sizeof(ULONG);
85 
87  Parameters[5].Name = L"MouseSynchIn100ns";
88  Parameters[5].EntryContext = &Settings->MouseSynchIn100ns;
89  Parameters[5].DefaultType = REG_DWORD;
90  Parameters[5].DefaultData = &DefaultMouseSynchIn100ns;
91  Parameters[5].DefaultLength = sizeof(ULONG);
92 
94  Parameters[6].Name = L"NumberOfButtons";
95  Parameters[6].EntryContext = &Settings->NumberOfButtons;
96  Parameters[6].DefaultType = REG_DWORD;
97  Parameters[6].DefaultData = &DefaultNumberOfButtons;
98  Parameters[6].DefaultLength = sizeof(ULONG);
99 
101  Parameters[7].Name = L"PointerDeviceBaseName";
102  Parameters[7].EntryContext = &Settings->PointerDeviceBaseName;
103  Parameters[7].DefaultType = REG_SZ;
104  Parameters[7].DefaultData = (PVOID)DefaultPointerDeviceBaseName;
105  Parameters[7].DefaultLength = 0;
106 
108  Parameters[8].Name = L"PollStatusIterations";
109  Parameters[8].EntryContext = &Settings->PollStatusIterations;
110  Parameters[8].DefaultType = REG_DWORD;
111  Parameters[8].DefaultData = &DefaultPollStatusIterations;
112  Parameters[8].DefaultLength = sizeof(ULONG);
113 
115  Parameters[9].Name = L"OverrideKeyboardType";
116  Parameters[9].EntryContext = &Settings->OverrideKeyboardType;
117  Parameters[9].DefaultType = REG_DWORD;
118  Parameters[9].DefaultData = &DefaultOverrideKeyboardType;
119  Parameters[9].DefaultLength = sizeof(ULONG);
120 
122  Parameters[10].Name = L"OverrideKeyboardSubtype";
123  Parameters[10].EntryContext = &Settings->OverrideKeyboardSubtype;
124  Parameters[10].DefaultType = REG_DWORD;
125  Parameters[10].DefaultData = &DefaultOverrideKeyboardSubtype;
126  Parameters[10].DefaultLength = sizeof(ULONG);
127 
129  Parameters[11].Name = L"PollingIterations";
130  Parameters[11].EntryContext = &Settings->PollingIterations;
131  Parameters[11].DefaultType = REG_DWORD;
132  Parameters[11].DefaultData = &DefaultPollingIterations;
133  Parameters[11].DefaultLength = sizeof(ULONG);
134 
136  Parameters[12].Name = L"PollingIterationsMaximum";
137  Parameters[12].EntryContext = &Settings->PollingIterationsMaximum;
138  Parameters[12].DefaultType = REG_DWORD;
139  Parameters[12].DefaultData = &DefaultPollingIterationsMaximum;
140  Parameters[12].DefaultLength = sizeof(ULONG);
141 
143  Parameters[13].Name = L"ResendIterations";
144  Parameters[13].EntryContext = &Settings->ResendIterations;
145  Parameters[13].DefaultType = REG_DWORD;
146  Parameters[13].DefaultData = &DefaultResendIterations;
147  Parameters[13].DefaultLength = sizeof(ULONG);
148 
150  Parameters[14].Name = L"SampleRate";
151  Parameters[14].EntryContext = &Settings->SampleRate;
152  Parameters[14].DefaultType = REG_DWORD;
153  Parameters[14].DefaultData = &DefaultSampleRate;
154  Parameters[14].DefaultLength = sizeof(ULONG);
155 
157  Parameters[15].Name = L"CrashOnCtrlScroll";
158  Parameters[15].EntryContext = &Settings->CrashOnCtrlScroll;
159  Parameters[15].DefaultType = REG_DWORD;
160  Parameters[15].DefaultData = &DefaultCrashOnCtrlScroll;
161  Parameters[15].DefaultLength = sizeof(ULONG);
162 
165  RegistryPath->Buffer,
166  Parameters,
167  NULL,
168  NULL);
169 
170  if (NT_SUCCESS(Status))
171  {
172  /* Check values */
173  if (Settings->KeyboardDataQueueSize < 1)
174  Settings->KeyboardDataQueueSize = DefaultKeyboardDataQueueSize;
175  if (Settings->MouseDataQueueSize < 1)
176  Settings->MouseDataQueueSize = DefaultMouseDataQueueSize;
177  if (Settings->NumberOfButtons < 1)
178  Settings->NumberOfButtons = DefaultNumberOfButtons;
179  if (Settings->PollingIterations < 0x400)
180  Settings->PollingIterations = DefaultPollingIterations;
181  if (Settings->PollingIterationsMaximum < 0x400)
182  Settings->PollingIterationsMaximum = DefaultPollingIterationsMaximum;
183  if (Settings->ResendIterations < 1)
184  Settings->ResendIterations = DefaultResendIterations;
185  }
187  {
188  /* Registry path doesn't exist. Set defaults */
189  Settings->KeyboardDataQueueSize = DefaultKeyboardDataQueueSize;
190  Settings->MouseDataQueueSize = DefaultMouseDataQueueSize;
191  Settings->MouseResolution = DefaultMouseResolution;
192  Settings->MouseSynchIn100ns = DefaultMouseSynchIn100ns;
193  Settings->NumberOfButtons = DefaultNumberOfButtons;
194  Settings->PollStatusIterations = DefaultPollStatusIterations;
195  Settings->OverrideKeyboardType = DefaultOverrideKeyboardType;
196  Settings->OverrideKeyboardSubtype = DefaultOverrideKeyboardSubtype;
197  Settings->PollingIterations = DefaultPollingIterations;
198  Settings->PollingIterationsMaximum = DefaultPollingIterationsMaximum;
199  Settings->ResendIterations = DefaultResendIterations;
200  Settings->SampleRate = DefaultSampleRate;
201  Settings->CrashOnCtrlScroll = DefaultCrashOnCtrlScroll;
202  if (!RtlCreateUnicodeString(&Settings->KeyboardDeviceBaseName, DefaultKeyboardDeviceBaseName)
203  || !RtlCreateUnicodeString(&Settings->PointerDeviceBaseName, DefaultPointerDeviceBaseName))
204  {
205  WARN_(I8042PRT, "RtlCreateUnicodeString() failed\n");
207  }
208  else
209  {
211  }
212  }
213 
214  if (NT_SUCCESS(Status))
215  {
216  INFO_(I8042PRT, "KeyboardDataQueueSize : 0x%lx\n", Settings->KeyboardDataQueueSize);
217  INFO_(I8042PRT, "KeyboardDeviceBaseName : %wZ\n", &Settings->KeyboardDeviceBaseName);
218  INFO_(I8042PRT, "MouseDataQueueSize : 0x%lx\n", Settings->MouseDataQueueSize);
219  INFO_(I8042PRT, "MouseResolution : 0x%lx\n", Settings->MouseResolution);
220  INFO_(I8042PRT, "MouseSynchIn100ns : %lu\n", Settings->MouseSynchIn100ns);
221  INFO_(I8042PRT, "NumberOfButtons : 0x%lx\n", Settings->NumberOfButtons);
222  INFO_(I8042PRT, "PointerDeviceBaseName : %wZ\n", &Settings->PointerDeviceBaseName);
223  INFO_(I8042PRT, "PollStatusIterations : 0x%lx\n", Settings->PollStatusIterations);
224  INFO_(I8042PRT, "OverrideKeyboardType : 0x%lx\n", Settings->OverrideKeyboardType);
225  INFO_(I8042PRT, "OverrideKeyboardSubtype : 0x%lx\n", Settings->OverrideKeyboardSubtype);
226  INFO_(I8042PRT, "PollingIterations : 0x%lx\n", Settings->PollingIterations);
227  INFO_(I8042PRT, "PollingIterationsMaximum : %lu\n", Settings->PollingIterationsMaximum);
228  INFO_(I8042PRT, "ResendIterations : 0x%lx\n", Settings->ResendIterations);
229  INFO_(I8042PRT, "SampleRate : %lu\n", Settings->SampleRate);
230  }
231 
232  return Status;
233 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define INFO_(ch,...)
Definition: debug.h:159
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
static PVOID
Definition: registry.c:44
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2592
#define RTL_QUERY_REGISTRY_SUBKEY
Definition: nt_native.h:125
#define RTL_REGISTRY_OPTIONAL
Definition: nt_native.h:169
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
NTSTATUS NTAPI RtlQueryRegistryValues(IN ULONG RelativeTo, IN PCWSTR Path, IN PRTL_QUERY_REGISTRY_TABLE QueryTable, IN PVOID Context, IN PVOID Environment OPTIONAL)
Definition: registry.c:1010
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_SUCCESS
Definition: shellext.h:65
#define REG_DWORD
Definition: sdbapi.c:596
#define WARN_(ch,...)
Definition: debug.h:157
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define REG_SZ
Definition: layer.c:22

Referenced by DriverEntry().

Variable Documentation

◆ ForwardIrpAndForget

◆ ForwardIrpAndWait

DRIVER_DISPATCH ForwardIrpAndWait

Definition at line 343 of file i8042prt.h.

Referenced by ClassDeviceControl(), ClassPnp(), i8042Pnp(), ProcessorPnp(), and SerialPnp().

◆ i8042AddDevice

DRIVER_ADD_DEVICE i8042AddDevice

Definition at line 324 of file i8042prt.h.

Referenced by DriverEntry().

◆ i8042HwFlags

ULONG i8042HwFlags

Definition at line 22 of file hwhacks.c.

Referenced by i8042ParseSMBiosTables(), and StartProcedure().

◆ i8042KbdDeviceControl

DRIVER_DISPATCH i8042KbdDeviceControl

Definition at line 316 of file i8042prt.h.

Referenced by i8042DeviceControl().

◆ i8042KbdInternalDeviceControl

DRIVER_DISPATCH i8042KbdInternalDeviceControl

Definition at line 318 of file i8042prt.h.

Referenced by i8042InternalDeviceControl().

◆ i8042KbdInterruptService

KSERVICE_ROUTINE i8042KbdInterruptService

Definition at line 320 of file i8042prt.h.

Referenced by i8042ConnectKeyboardInterrupt().

◆ i8042KbdStartIo

DRIVER_STARTIO i8042KbdStartIo

Definition at line 314 of file i8042prt.h.

Referenced by i8042StartIo().

◆ i8042MouInternalDeviceControl

DRIVER_DISPATCH i8042MouInternalDeviceControl

Definition at line 367 of file i8042prt.h.

Referenced by i8042InternalDeviceControl().

◆ i8042MouInterruptService

KSERVICE_ROUTINE i8042MouInterruptService

Definition at line 369 of file i8042prt.h.

Referenced by i8042ConnectMouseInterrupt().

◆ i8042SendHookWorkItem

IO_WORKITEM_ROUTINE i8042SendHookWorkItem

Definition at line 295 of file i8042prt.h.

Referenced by i8042KbdInternalDeviceControl(), and i8042MouInternalDeviceControl().