ReactOS  0.4.15-dev-1070-ge1a01de
pofuncs.h File Reference

Go to the source code of this file.

Macros

#define PoSetDeviceBusy(IdlePointer)   ((void)(*(IdlePointer) = 0))
 

Functions

 $if (_WDMDDK_) _IRQL_requires_max_(DISPATCH_LEVEL) NTKERNELAPI NTSTATUS NTAPI PoCallDriver(_In_ struct _DEVICE_OBJECT *DeviceObject
 
 _IRQL_requires_max_ (APC_LEVEL) NTKERNELAPI PULONG NTAPI PoRegisterDeviceForIdleDetection(_In_ struct _DEVICE_OBJECT *DeviceObject
 
 _IRQL_requires_max_ (DISPATCH_LEVEL) NTKERNELAPI NTSTATUS NTAPI PoRequestPowerIrp(_In_ struct _DEVICE_OBJECT *DeviceObject
 
NTKERNELAPI NTSTATUS NTAPI PoRequestShutdownEvent (OUT PVOID *Event)
 
 $endif (_WDMDDK_) $if(_NTIFS_) _IRQL_requires_max_(APC_LEVEL) NTKERNELAPI NTSTATUS NTAPI PoQueueShutdownWorkItem(_Inout_ __drv_aliasesMem PWORK_QUEUE_ITEM WorkItem)
 
 $endif (_NTIFS_) $if(_WDMDDK_) _IRQL_requires_max_(DISPATCH_LEVEL) NTKRNLVISTAAPI VOID NTAPI PoSetSystemWake(_Inout_ struct _IRP *Irp)
 
NTKERNELAPI VOID NTAPI PoSetDeviceBusyEx (_Inout_ PULONG IdlePointer)
 
NTKERNELAPI VOID NTAPI PoStartDeviceBusy (_Inout_ PULONG IdlePointer)
 
NTKERNELAPI VOID NTAPI PoEndDeviceBusy (_Inout_ PULONG IdlePointer)
 

Variables

_Inout_ __drv_aliasesMem struct _IRPIrp
 
_In_ ULONG ConservationIdleTime
 
_In_ ULONG _In_ ULONG PerformanceIdleTime
 
_In_ ULONG _In_ ULONG _In_ DEVICE_POWER_STATE State
 
_In_ EXECUTION_STATE Flags
 
_In_ UCHAR MinorFunction
 
_In_ UCHAR _In_ POWER_STATE PowerState
 
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
 
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE _In_opt_ __drv_aliasesMem PVOID Context
 
_In_ POWER_STATE_TYPE Type
 
_In_ LPCGUID SettingGuid
 
_In_ LPCGUID _In_ PPOWER_SETTING_CALLBACK Callback
 
_In_ LPCGUID _In_ PPOWER_SETTING_CALLBACK _In_opt_ PVOID _Outptr_opt_ PVOIDHandle
 
_Out_ PULONG SecondsRemaining
 
_In_ PDEVICE_OBJECT DeviceObject
 

Macro Definition Documentation

◆ PoSetDeviceBusy

#define PoSetDeviceBusy (   IdlePointer)    ((void)(*(IdlePointer) = 0))

Function Documentation

◆ $endif() [1/2]

$endif ( _WDMDDK_  )

Definition at line 202 of file ke.h.

226 {
227  ULONGLONG Low;
228  LONGLONG High;
229 } NEON128, *PNEON128;
Definition: strmini.h:380
int64_t LONGLONG
Definition: typedefs.h:68
uint64_t ULONGLONG
Definition: typedefs.h:67
Definition: strmini.h:378
NEON128
Definition: ke.h:229
* PNEON128
Definition: ke.h:229

◆ $endif() [2/2]

$endif ( _NTIFS_  )

Definition at line 2827 of file rtlfuncs.h.

2841 {
2843  ret.QuadPart = SignedInteger;
2844  return ret;
2845 }
return ret
Definition: rtlfuncs.h:3092

◆ $if()

$if ( _WDMDDK_  )

Kernel definitions for AMD64

Kernel definitions for ARM

Definition at line 1 of file ke.h.

31 {
32  ULONG Dummy;
struct _KFLOATING_SAVE KFLOATING_SAVE
struct _KFLOATING_SAVE * PKFLOATING_SAVE
unsigned int ULONG
Definition: retypes.h:1

◆ _IRQL_requires_max_() [1/2]

_IRQL_requires_max_ ( APC_LEVEL  )

Definition at line 197 of file cddata.c.

254 {
255  THREAD_CONTEXT ThreadContext = {0};
256  PIRP_CONTEXT IrpContext = NULL;
257  BOOLEAN Wait;
258 
259 #ifdef CD_SANITY
260  PVOID PreviousTopLevel;
261 #endif
262 
264 
265 #if DBG
266 
267  KIRQL SaveIrql = KeGetCurrentIrql();
268 
269 #endif
270 
272 
274 
276 
277 #ifdef CD_SANITY
278  PreviousTopLevel = IoGetTopLevelIrp();
279 #endif
280 
281  //
282  // Loop until this request has been completed or posted.
283  //
284 
285  do {
286 
287  //
288  // Use a try-except to handle the exception cases.
289  //
290 
291  _SEH2_TRY {
292 
293  //
294  // If the IrpContext is NULL then this is the first pass through
295  // this loop.
296  //
297 
298  if (IrpContext == NULL) {
299 
300  //
301  // Decide if this request is waitable an allocate the IrpContext.
302  // If the file object in the stack location is NULL then this
303  // is a mount which is always waitable. Otherwise we look at
304  // the file object flags.
305  //
306 
308 
309  Wait = TRUE;
310 
311  } else {
312 
313  Wait = CanFsdWait( Irp );
314  }
315 
316  IrpContext = CdCreateIrpContext( Irp, Wait );
317 
318  //
319  // Update the thread context information.
320  //
321 
322  CdSetThreadContext( IrpContext, &ThreadContext );
323 
324 #ifdef CD_SANITY
325  NT_ASSERT( !CdTestTopLevel ||
326  SafeNodeType( IrpContext->TopLevel ) == CDFS_NTC_IRP_CONTEXT );
327 #endif
328 
329  //
330  // Otherwise cleanup the IrpContext for the retry.
331  //
332 
333  } else {
334 
335  //
336  // Set the MORE_PROCESSING flag to make sure the IrpContext
337  // isn't inadvertently deleted here. Then cleanup the
338  // IrpContext to perform the retry.
339  //
340 
341  SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING );
342  CdCleanupIrpContext( IrpContext, FALSE );
343  }
344 
345  //
346  // Case on the major irp code.
347  //
348 
349  switch (IrpContext->MajorFunction) {
350 
351  case IRP_MJ_CREATE :
352 
353  Status = CdCommonCreate( IrpContext, Irp );
354  break;
355 
356  case IRP_MJ_CLOSE :
357 
358  Status = CdCommonClose( IrpContext, Irp );
359  break;
360 
361  case IRP_MJ_READ :
362 
363  //
364  // If this is an Mdl complete request, don't go through
365  // common read.
366  //
367 
368  if (FlagOn( IrpContext->MinorFunction, IRP_MN_COMPLETE )) {
369 
370  Status = CdCompleteMdl( IrpContext, Irp );
371 
372  } else {
373 
374  Status = CdCommonRead( IrpContext, Irp );
375  }
376 
377  break;
378 
379  case IRP_MJ_WRITE :
380 
381  Status = CdCommonWrite( IrpContext, Irp );
382  break;
383 
385 
386  Status = CdCommonQueryInfo( IrpContext, Irp );
387  break;
388 
390 
391  Status = CdCommonSetInfo( IrpContext, Irp );
392  break;
393 
395 
396  Status = CdCommonQueryVolInfo( IrpContext, Irp );
397  break;
398 
400 
401  Status = CdCommonDirControl( IrpContext, Irp );
402  break;
403 
405 
406  Status = CdCommonFsControl( IrpContext, Irp );
407  break;
408 
409  case IRP_MJ_DEVICE_CONTROL :
410 
411  Status = CdCommonDevControl( IrpContext, Irp );
412  break;
413 
414  case IRP_MJ_LOCK_CONTROL :
415 
416  Status = CdCommonLockControl( IrpContext, Irp );
417  break;
418 
419  case IRP_MJ_CLEANUP :
420 
421  Status = CdCommonCleanup( IrpContext, Irp );
422  break;
423 
424  case IRP_MJ_PNP :
425 
426  Status = CdCommonPnp( IrpContext, Irp );
427  break;
428 
429  case IRP_MJ_SHUTDOWN :
430 
431  Status = CdCommonShutdown( IrpContext, Irp );
432  break;
433 
434  default :
435 
437  CdCompleteRequest( IrpContext, Irp, Status );
438  }
439 
441 
442  Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
443  } _SEH2_END;
444 
445  } while (Status == STATUS_CANT_WAIT);
446 
447 #ifdef CD_SANITY
448  NT_ASSERT( !CdTestTopLevel ||
449  (PreviousTopLevel == IoGetTopLevelIrp()) );
450 #endif
451 
453 
454  NT_ASSERT( SaveIrql == KeGetCurrentIrql( ));
455 
456  return Status;
457 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
VOID CdSetThreadContext(_Inout_ PIRP_CONTEXT IrpContext, _In_ PTHREAD_CONTEXT ThreadContext)
Definition: cddata.c:981
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define IRP_CONTEXT_FLAG_MORE_PROCESSING
Definition: cdstruc.h:1220
#define SafeNodeType(Ptr)
Definition: nodetype.h:54
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_SEH2_TRY
Definition: create.c:4226
#define IRP_MN_COMPLETE
Definition: iotypes.h:4399
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#define IRP_MJ_FILE_SYSTEM_CONTROL
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define CanFsdWait(I)
Definition: cdprocs.h:2001
NTSTATUS CdCompleteMdl(_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: cachesup.c:411
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
NTSTATUS CdCommonDevControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: devctrl.c:46
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4400
LONG CdExceptionFilter(_Inout_ PIRP_CONTEXT IrpContext, _In_ PEXCEPTION_POINTERS ExceptionPointer)
Definition: cddata.c:525
#define ASSERT_OPTIONAL_IRP(I)
Definition: cddata.h:252
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
VOID CdCleanupIrpContext(_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
Definition: strucsup.c:1733
NTSTATUS CdCommonLockControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: lockctrl.c:35
#define CDFS_NTC_IRP_CONTEXT
Definition: nodetype.h:34
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_CLEANUP
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext(_In_ PIRP Irp, _In_ BOOLEAN Wait)
Definition: strucsup.c:1573
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define STATUS_CANT_WAIT
Definition: ntstatus.h:452
IN BOOLEAN Wait
Definition: fatprocs.h:1538
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ _IRQL_requires_max_() [2/2]

_IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 188 of file autorun.c.

197 {
199  ULONG requiredSize;
201 
202  status = RtlULongAdd((sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION) - sizeof(UCHAR)),
204  &requiredSize);
205 
206  if (!(NT_SUCCESS(status)) || (requiredSize > 0x0000ffff)) {
207  // MAX_USHORT, max total size for these events!
208  TracePrint((TRACE_LEVEL_WARNING, TRACE_FLAG_MCN,
209  "Error sending event: size too large! (%x)\n",
210  requiredSize));
211  return;
212  }
213 
214  notification = ExAllocatePoolWithTag(NonPagedPoolNx,
215  requiredSize,
216  'oNcS');
217 
218  //
219  // if none allocated, exit
220  //
221 
222  if (notification == NULL) {
223  return;
224  }
225 
226  //
227  // Prepare and send the request!
228  //
229 
230  RtlZeroMemory(notification, requiredSize);
231  notification->Version = 1;
232  notification->Size = (USHORT)(requiredSize);
233  notification->FileObject = NULL;
234  notification->NameBufferOffset = -1;
235  notification->Event = *Guid;
236 
237  if (ExtraData != NULL && ExtraDataSize != 0) {
238  RtlCopyMemory(notification->CustomDataBuffer, ExtraData, ExtraDataSize);
239  }
240 
242  notification,
243  NULL, NULL);
244 
246  return;
247 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ const GUID _In_ ULONG ExtraDataSize
Definition: classpnp.h:1429
LONG NTSTATUS
Definition: precomp.h:26
static GUID * Guid
Definition: apphelp.c:93
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
#define FREE_POOL(_PoolPtr)
Definition: classpnp.h:63
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
NTSTATUS NTAPI IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PVOID NotificationStructure, IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL, IN PVOID Context OPTIONAL)
Definition: pnpreport.c:515
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ PoEndDeviceBusy()

NTKERNELAPI VOID NTAPI PoEndDeviceBusy ( _Inout_ PULONG  IdlePointer)

◆ PoRequestShutdownEvent()

NTKERNELAPI NTSTATUS NTAPI PoRequestShutdownEvent ( OUT PVOID Event)

Definition at line 399 of file poshtdwn.c.

400 {
402  PAGED_CODE();
403 
404  /* Initialize to NULL */
405  if (Event) *Event = NULL;
406 
407  /* Request a shutdown wait */
409  if (!NT_SUCCESS(Status))
410  {
411  return Status;
412  }
413 
414  /* Return the global shutdown event */
415  if (Event) *Event = &PopShutdownEvent;
416  return STATUS_SUCCESS;
417 }
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI PoRequestShutdownWait(_In_ PETHREAD Thread)
Definition: poshtdwn.c:55
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
KEVENT PopShutdownEvent
Definition: poshtdwn.c:24
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define PAGED_CODE()

Referenced by RawInputThreadMain().

◆ PoSetDeviceBusyEx()

NTKERNELAPI VOID NTAPI PoSetDeviceBusyEx ( _Inout_ PULONG  IdlePointer)

◆ PoStartDeviceBusy()

NTKERNELAPI VOID NTAPI PoStartDeviceBusy ( _Inout_ PULONG  IdlePointer)

Variable Documentation

◆ Callback

Definition at line 120 of file pofuncs.h.

◆ CompletionFunction

Definition at line 42 of file pofuncs.h.

Referenced by PoRequestPowerIrp().

◆ ConservationIdleTime

_In_ ULONG ConservationIdleTime

Definition at line 24 of file pofuncs.h.

◆ Context

◆ DeviceObject

Definition at line 193 of file pofuncs.h.

◆ Flags

Definition at line 34 of file pofuncs.h.

◆ Handle

◆ Irp

◆ MinorFunction

◆ PerformanceIdleTime

_In_ ULONG _In_ ULONG PerformanceIdleTime

Definition at line 24 of file pofuncs.h.

◆ PowerState

◆ SecondsRemaining

_Out_ PULONG SecondsRemaining

Definition at line 162 of file pofuncs.h.

◆ SettingGuid

_In_ LPCGUID SettingGuid

Definition at line 120 of file pofuncs.h.

Referenced by _Function_class_().

◆ State

Definition at line 24 of file pofuncs.h.

◆ Type

Definition at line 54 of file pofuncs.h.