object


for GETTING port handle


I want to use NtQueryInformationPort function below in DriverEntry function to know all of the listening ports number. However, I don't know how to get PortHandle which is the first parameter in NtQueryInformationPort.
Is there someway to get PortHandle?
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt).
If you do not agree to the terms, do not use the code.
Module Name:
lpcquery.c
Abstract:
Local Inter-Process Communication (LPC) query services
--*/
#include "lpcp.h"
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE,NtQueryInformationPort)
#endif
NTSTATUS
NTAPI
NtQueryInformationPort (
__in HANDLE PortHandle,
__in PORT_INFORMATION_CLASS PortInformationClass,
__out_bcount(Length) PVOID PortInformation,
__in ULONG Length,
__out_opt PULONG ReturnLength
)
/*++
Routine Description:
This routine should be used to query an lpc port, but is pretty much a
noop. Currently it can only indicate if the input handle is for a port
object.
Arguments:
PortHandle - Supplies the handle for the port being queried
PortInformationClass - Specifies the type information class being asked
for. Currently ignored.
PortInformation - Supplies a pointer to the buffer to receive the
information. Currently just probed and then ignored.
Length - Specifies, in bytes, the size of the port information buffer.
ReturnLength - Optionally receives the size, in bytes, of the information
being returned. Currently just probed and then ignored.
Return Value:
NTSTATUS - An appropriate status value.
--*/
{
KPROCESSOR_MODE PreviousMode;
NTSTATUS Status;
PLPCP_PORT_OBJECT PortObject;
PAGED_CODE();
UNREFERENCED_PARAMETER ( PortInformationClass );
//
// Get previous processor mode and probe output argument if necessary.
//
PreviousMode = KeGetPreviousMode();
if (PreviousMode != KernelMode) {
try {
ProbeForWrite( PortInformation,
Length,
sizeof( ULONG ));
if (ARGUMENT_PRESENT( ReturnLength )) {
ProbeForWriteUlong( ReturnLength );
}
} except( EXCEPTION_EXECUTE_HANDLER ) {
return( GetExceptionCode() );
}
}
//
// If the user gave us a handle then reference the object. And return
// success if we got a good reference and an error otherwise.
//
if (ARGUMENT_PRESENT( PortHandle )) {
Status = ObReferenceObjectByHandle( PortHandle,
GENERIC_READ,
LpcPortObjectType,
PreviousMode,
&PortObject,
NULL );
if (!NT_SUCCESS( Status )) {
//
// It might be a waitable port object.
// Let's try again as this object type
//
Status = ObReferenceObjectByHandle( PortHandle,
GENERIC_READ,
LpcWaitablePortObjectType,
PreviousMode,
&PortObject,
NULL );
//
// If this one fails too we'll return that status
//
if (!NT_SUCCESS( Status )) {
return( Status );
}
}
ObDereferenceObject( PortObject );
return STATUS_SUCCESS;
} else {
return STATUS_INVALID_INFO_CLASS;
}
}
*******

Related Links

how to find out all properties of an object in lua?
How to detect changing of attributes in a class?
SWFObject Flash not showing
Monotouch: convert an Object to NSObject
Storing and retrieving JavaScript objects in/from MongoDB
Sending a object to server with jQuery
What's the difference between object file and static library(archive file)?
Connection/Object pool for OrganizationServiceProxy in XRM/Dynamics CRM 2011
Should Comment History be an Entity,DDD
Limiting a text object in Crystal reports to 50 characters
Need help Creating new objects in inform7
extending Object.prototype.myNewMethod over all my Node application
How to define a jQuery object with noConflict()?
storing objects of a different class in a vector in C++
Something like strace for shared objects?
jQuery deep copy with Ext JS?

Categories

HOME
android
shell
phantom-dsl
grok
fabricjs
ecmascript-6
angular-formly
youtube-data-api-v3
sitecore
database-normalization
permissions
mips
azure-container-service
gluon-mobile
crystal-lang
boto3
nfs
jquery-ui-sortable
owin
ibeacon-android
datastage
jxl
ipmitool
tput
automatic-ref-counting
searchview
intershop
vuejs
asp.net-mvc-viewmodel
html5-appcache
mapstruct
postscript
interpreter
resourcebundle
motion-detection
outliers
cppreference
corenlp-server
rselenium
card.io
joomla2.5
getpixel
modalviewcontroller
slacktextviewcontroller
magento-1.9.2.4
release
z-notation
connection-pool
trigonometry
android-softkeyboard
chronicle-map
placeholder
mesosphere
libgphoto2
magento-2.0.7
activeperl
boxing
oracleclient
reshape
jtree
pocketsphinx-android
latin
iotivity
jboss-tools
embedding
phpgrid
pypiserver
intel-c++
android-launcher
mirror
ansi
umlgraph
grouping-sets
dbaccess
cocos3d
jama
merb
route-provider
server-administration
resource-management
fragmenttransaction
uimanageddocument
vfs
saleslogix
os.system
wcf-configuration
correlated-subquery
multiplexing
agility.js
denied
ie-compatibility-mode
application-verifier
cfwindow
echo3
skype4java
fail-fast-fail-early
entitykey
unmanagedresources

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile