字符串:
RtlUpperString ansic
RtlUpcaseUnicodeString unicode
RtlInitUnicodeString Unicode
RtlUnicodeStringToInteger
RtlIntegerToUnicodeString
RtlFreeUnicodeString
RtlUnicodeStringToAnsiString
RtlAnsiStringToUnicodeString
RtlFreeAnsiString
RtlInitString
设备:
ZwCreatFile
InitializeObjectAttributes
ZwOpenFile
ZwClose
ZwSetInfomationFile
ZwQueryInformationFile
ZwWriteFile
内存:
PsGetCurrentProcess
ExAllocatePool
ExAllocatePoolWithTag
ExAllocatePoolWithQuota
ExAllocatePoolWithQuotaTag
ExFreePool
ExFreePoolWithTag
CONTANING_RECORD macro
ExInitializeNPagedLookasideList
ExInitializePagedLookasideList
ExAllocateFromNPagedLookasideList
ExAllocateFromPagedLookasideList
ExFreeToNPagedLookasideList
ExFreeToPagedLookasideList
ExDeleteNPagedLookasideList
ExDeletePageLookasideList
RtlCopyMemory
RtlMoveMemory
RtlFillMemory
RtlZeroMemory
RtlEqualMemory
RtlCompareMemory
IRP
IoCompleteRequest(pIrp,IO_NO_INCREMENT);
IoCreateSymbolicLink
IoGetCurrentIrpStackLocation(pIrp)
IoCreateDevice
IRP PCOCESS
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(pIrp);
ULONG ulReadLength = stack->Parameters.Read.Length;
pIrp->IoStatus.Status = STATUS_SUCCESS;
pIrp->IoStatus.Information = ulReadLength;
memset(pIrp->AssociatedIrp.SystemBuffer,0xAA,ulReadLength);
IoCompleteRequest(pIrp,IO_NO_INCREMENT);
write size:
stack->Parameters.Write.Length
get offset:
(ULONG)stack->Parameter.Write.ByteOffset.QuadPart
write to Extension:
- memcpy(pDevExt->buffer+ulWriteOffset,pIrp->AssociatedIrp.SystemBuffer,ulWriteLength)
driver synchronization:
- KeGetCurrnetIrql()// get current IRQL
- // the lowest level in the user mode is PASSIVE_LEVEL,
- // the highest DISPATCH_LEVEL.
IRQL adjusting functions:
- KeRaiseIrql()
- KeLowerIrql()
Spin Lock:
- KeInitializeSpinLock()
- //initialization
- KeAcquireSpinLock()
- //application for mem
- KeReleaseSpinLock()
- //release spin lock
- KeAcquireSpinLockAtDpcLevel()
- KeReleaseSpinLockAtDpcLevel()
- //acquire and release spin lock without level changed when at DISPATCH_LEVEL
Synchronize under user mode
- WaitForSingleObject()
- WaitMultipleObjects()
- CreateEvent()
- SetEvent()// to set the event usable
- /
- //sephamore
- /
- CreateSephamore()
- ReleaseSephamore()
- / sephamore can be waited by waitforsingleobject functions
- /
- //Mutex
- /
- CreateMutex()
- ReleaseMutex()
- /
- // the usage of WaitForMutipleObjects()
- HANDLE hThread[2];
- hThread[0] = (HANDLE)_beginthread(...);
- hThread[1] = (HANDLE)_beginthread(...);
- WaitForMutipleObjects(...);
- end
- //
Synchronizing Objects under user mode:
- KeWaitForSingleObject(...)
- KeWaitForMutipleObjects(...)
- //Even
- //
- PsCreateSystemThread(...)
- IoGetCurrentProcess(...)
- PsTerminateSystemThread(...)
- //
Synchronizing Objects under kernel mode:
- //
- KeInitializeEven(...)
- KeSetEvent(...)
- KeInitializeSephamore(...)
- KereleaseSephamore(...)
- KeReadStateSephamore(...)
- //
- KeInitializeMutex(...)
- KeReleaseMutex(...)
- KeStallExecutionProcessor(time)
- //force the process stop for time.
- //
- //
- //
- //Fast Mutex
- ExAcquireFastMutex(...)
- ExReleaseFastMutex(...)
- ExInitializeFastMutex(...)
- //