ReactOS  0.4.13-dev-544-gede3fdd
privateice.c File Reference
#include <ntddk.h>
#include <debug.h>
#include <rosrtl/string.h>
#include "precomp.h"
#include "serial.h"
Include dependency graph for privateice.c:

Go to the source code of this file.

Functions

NTSTATUS NTAPI pice_open (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI pice_close (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI pice_ioctl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
 

Variables

BOOLEAN bDeviceAlreadyOpen = FALSE
 
char tempPICE [1024]
 

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( PDRIVER_OBJECT  DriverObject,
PUNICODE_STRING  RegistryPath 
)

Definition at line 163 of file privateice.c.

168 {
171  UNICODE_STRING SymlinkName;
172 
173  DPRINT((0,"PICE Debugger\n"));
174 
175 #if 0 // don't enable before completely ported
176 #ifdef DEBUG
177  // first we enable output of debug strings to COM port
178  DebugSetupSerial(1,115200);
179 #endif // DEBUG
180 #endif
181 
182  if(InitPICE()){
184  //ei unimplemented DriverObject->MajorFunction[IRP_MJ_CLOSE] = pice_close;
186 
189  0,
190  &DeviceName,
192  0,
193  TRUE,
194  &DeviceObject);
196 
197  RtlRosInitUnicodeStringFromLiteral(&SymlinkName, L"\\??\\Pice");
198  IoCreateSymbolicLink(&SymlinkName, &DeviceName);
199 
200  return(STATUS_SUCCESS);
201  }
202 }
NTSTATUS NTAPI pice_open(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: privateice.c:72
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
NTSTATUS NTAPI pice_ioctl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: privateice.c:111
WCHAR DeviceName[]
Definition: adapter.cpp:21
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN InitPICE(void)
Definition: init.c:57
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define PICE_DEVICE_DEBUGGER
Definition: shared.h:57
static const WCHAR L[]
Definition: oid.c:1250
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2180
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlRosInitUnicodeStringFromLiteral(__Name__, __Value__)
Definition: hivetest.c:10
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

◆ pice_close()

NTSTATUS NTAPI pice_close ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 92 of file privateice.c.

93 {
94  DPRINT((0,"pice_close\n"));
95 
96  CleanUpPICE(); // used to be in cleanup_module
97 
98  /* We're now ready for our next caller */
101 
102  return STATUS_SUCCESS;
103 }
void CleanUpPICE(void)
Definition: init.c:346
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
BOOLEAN bDeviceAlreadyOpen
Definition: privateice.c:59
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ pice_ioctl()

NTSTATUS NTAPI pice_ioctl ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 111 of file privateice.c.

112 {
113 // char* pFilename = (char*) ioctl_param;
114 
116 
117  ULONG Code = IoStack->Parameters.DeviceIoControl.IoControlCode;
118 
119  switch(Code)
120  {
121  case PICE_IOCTL_LOAD:
122  break;
123  case PICE_IOCTL_RELOAD:
124  if(!ReloadSymbols())
125  {
126  PICE_sprintf(tempPICE,"pICE: not able to reload symbols\n");
128  }
129  break;
130  case PICE_IOCTL_UNLOAD:
131  UnloadSymbols();
132  break;
133  case PICE_IOCTL_BREAK:
134  PICE_sprintf(tempPICE,"pICE: forcible break\n");
136  __asm__ __volatile("int $3");
137  break;
138  case PICE_IOCTL_STATUS:
139  {
140  PDEBUGGER_STATUS_BLOCK ustatus_block_p;
141  DEBUGGER_STATUS_BLOCK kstatus_block;
142 
143  ULONG OutLength = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
144  if( OutLength < sizeof( DEBUGGER_STATUS_BLOCK ) ){
146  }
147 
148  ustatus_block_p = (PDEBUGGER_STATUS_BLOCK)Irp->AssociatedIrp.SystemBuffer;
149 
150  //kstatus_block.Test = 0x12345678;
151  RtlCopyMemory(ustatus_block_p, &kstatus_block, sizeof(DEBUGGER_STATUS_BLOCK) );
152  }
153  break;
154  default:
157  }
159  return STATUS_SUCCESS;
160 }
#define PICE_IOCTL_UNLOAD
Definition: shared.h:60
#define PICE_IOCTL_RELOAD
Definition: shared.h:61
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
char tempPICE[1024]
Definition: privateice.c:61
int PICE_sprintf(char *buf, const char *fmt,...)
Definition: utils.c:2053
void Print(USHORT Window, LPSTR p)
Definition: hardware.c:797
#define PICE_IOCTL_BREAK
Definition: shared.h:62
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
#define IoCompleteRequest
Definition: irp.c:1240
#define Code
Definition: deflate.h:80
struct _DEBUGGER_STATUS_BLOCK * PDEBUGGER_STATUS_BLOCK
#define PICE_IOCTL_STATUS
Definition: shared.h:63
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
BOOLEAN ReloadSymbols(void)
Definition: symbols.c:2074
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
void UnloadSymbols()
Definition: symbols.c:2093
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define PICE_IOCTL_LOAD
Definition: shared.h:59

Referenced by DriverEntry().

◆ pice_open()

NTSTATUS NTAPI pice_open ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 72 of file privateice.c.

73 {
74  DPRINT((0,"pice_open\n"));
75 
76  /* We don't want to talk to two processes at the
77  * same time */
78  if (bDeviceAlreadyOpen){
80  return STATUS_UNSUCCESSFUL; /* is there a more descriptive status code for this case? */
81  }
82 
85  return STATUS_SUCCESS;
86 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
BOOLEAN bDeviceAlreadyOpen
Definition: privateice.c:59
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2777

Referenced by DriverEntry().

Variable Documentation

◆ bDeviceAlreadyOpen

BOOLEAN bDeviceAlreadyOpen = FALSE

Definition at line 59 of file privateice.c.

Referenced by pice_close(), and pice_open().

◆ tempPICE

char tempPICE[1024]

Definition at line 61 of file privateice.c.

Referenced by pice_ioctl().