C:/Web/handle/src/handle.h

Go to the documentation of this file.
00001 #ifndef _ENUM2_H_
00002  #define _ENUM2_H_
00003 
00004 
00005 #include <stdio.h>
00006 //#include <sddl.h>
00007 #include <windows.h>
00008 #include <psapi.h>
00009 #include <shlwapi.h>
00010 
00011 #pragma comment(lib, "ws2_32.lib")
00012 #pragma comment(lib, "advapi32.lib")
00013 #pragma comment(lib, "shlwapi.lib")
00014 #pragma comment(lib, "psapi.lib")
00015 
00016 typedef struct _credenciales{
00017    HANDLE hToken;
00018    DWORD pid; //Identificador de proceso del que se ha extraido el Token
00019    char user[256];
00020    SYSTEMTIME SystemTime;
00021 } CREDENCIALES;
00022 
00023 #define MAX_USERS 1000
00024    
00025 typedef LONG   NTSTATUS;
00026 typedef VOID   *POBJECT;
00027 
00028 
00029 typedef struct _IO_STATUS_BLOCK {
00030    union {
00031       NTSTATUS Status;
00032       PVOID Pointer;
00033    };
00034    ULONG_PTR Information;
00035 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
00036 
00037 
00038 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, DWORD);
00039 
00040 typedef LONG TDI_STATUS;
00041 typedef PVOID CONNECTION_CONTEXT;       // connection context
00042 
00043 typedef struct _TDI_REQUEST {
00044    union {
00045       HANDLE AddressHandle;
00046       CONNECTION_CONTEXT ConnectionContext;
00047       HANDLE ControlChannel;
00048    } Handle;
00049    
00050    PVOID RequestNotifyObject;
00051    PVOID RequestContext;
00052    TDI_STATUS TdiStatus;
00053 } TDI_REQUEST, *PTDI_REQUEST;
00054 
00055 typedef struct _TDI_CONNECTION_INFORMATION {
00056    LONG UserDataLength;        // length of user data buffer
00057    PVOID UserData;             // pointer to user data buffer
00058    LONG OptionsLength;         // length of following buffer
00059    PVOID Options;              // pointer to buffer containing options
00060    LONG RemoteAddressLength;   // length of following buffer
00061    PVOID RemoteAddress;        // buffer containing the remote address
00062 } TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION;
00063 
00064 typedef struct _TDI_REQUEST_QUERY_INFORMATION {
00065    TDI_REQUEST Request;
00066    ULONG QueryType;                          // class of information to be queried.
00067    PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
00068 } TDI_REQUEST_QUERY_INFORMATION, *PTDI_REQUEST_QUERY_INFORMATION;
00069 
00070 #define TDI_QUERY_ADDRESS_INFO                  0x00000003
00071 #define IOCTL_TDI_QUERY_INFORMATION             CTL_CODE(FILE_DEVICE_TRANSPORT, 4, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
00072 
00073 
00074 typedef struct _SYSTEM_HANDLE {
00075    ULONG           uIdProcess;
00076    UCHAR           ObjectType;
00077    UCHAR           Flags;
00078    USHORT          Handle;
00079    POBJECT         pObject;
00080    ACCESS_MASK     GrantedAccess;
00081 } SYSTEM_HANDLE, *PSYSTEM_HANDLE;
00082 
00083 typedef struct _SYSTEM_HANDLE_INFORMATION {
00084    ULONG                   uCount;
00085    SYSTEM_HANDLE   Handles[1];
00086 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
00087 
00088 typedef struct _UNICODE_STRING {
00089    USHORT Length;
00090    USHORT MaximumLength;
00091    PWSTR  Buffer;
00092 } UNICODE_STRING;
00093 
00094 typedef UNICODE_STRING *PUNICODE_STRING;
00095 typedef const UNICODE_STRING *PCUNICODE_STRING;
00096 
00097 typedef UNICODE_STRING OBJECT_NAME_INFORMATION;
00098 typedef UNICODE_STRING *POBJECT_NAME_INFORMATION;
00099 
00100 
00101 typedef enum _OBJECT_INFORMATION_CLASS{
00102    ObjectBasicInformation,
00103       ObjectNameInformation,
00104       ObjectTypeInformation,
00105       ObjectAllTypesInformation,
00106       ObjectHandleInformation
00107 } OBJECT_INFORMATION_CLASS;
00108 
00109 #define STATUS_SUCCESS                          ((NTSTATUS)0x00000000L)
00110 #define STATUS_INFO_LENGTH_MISMATCH             ((NTSTATUS)0xC0000004L)
00111 #define STATUS_BUFFER_OVERFLOW                  ((NTSTATUS)0x80000005L)
00112 #define SystemHandleInformation                 16
00113 
00114 
00115 typedef enum _PROCESSINFOCLASS {
00116    ProcessBasicInformation,
00117       ProcessQuotaLimits,
00118       ProcessIoCounters,
00119       ProcessVmCounters,
00120       ProcessTimes,
00121       ProcessBasePriority,
00122       ProcessRaisePriority,
00123       ProcessDebugPort,
00124       ProcessExceptionPort,
00125       ProcessAccessToken,
00126       ProcessLdtInformation,
00127       ProcessLdtSize,
00128       ProcessDefaultHardErrorMode,
00129       ProcessIoPortHandlers,          // Note: this is kernel mode only
00130       ProcessPooledUsageAndLimits,
00131       ProcessWorkingSetWatch,
00132       ProcessUserModeIOPL,
00133       ProcessEnableAlignmentFaultFixup,
00134       ProcessPriorityClass,
00135       MaxProcessInfoClass
00136 } PROCESSINFOCLASS;
00137 
00138 
00139 typedef enum _THREADINFOCLASS {
00140     ThreadBasicInformation,
00141     ThreadTimes,
00142     ThreadPriority,
00143     ThreadBasePriority,
00144     ThreadAffinityMask,
00145     ThreadImpersonationToken,
00146     ThreadDescriptorTableEntry,
00147     ThreadEnableAlignmentFaultFixup,
00148     ThreadEventPair,
00149     ThreadQuerySetWin32StartAddress,
00150     ThreadZeroTlsCell,
00151     ThreadPerformanceCount,
00152     ThreadAmILastThread,
00153     MaxThreadInfoClass
00154     } THREADINFOCLASS;
00155 
00156 
00157 
00158 typedef struct _PROCESS_BASIC_INFORMATION {
00159    DWORD ExitStatus;
00160    PVOID PebBaseAddress;
00161    DWORD AffinityMask;
00162    DWORD BasePriority;
00163    DWORD UniqueProcessId;
00164    DWORD InheritedFromUniqueProcessId;
00165 } PROCESS_BASIC_INFORMATION;
00166 
00167 typedef enum _FILE_INFORMATION_CLASS {
00168 
00169 FileDirectoryInformation, 
00170 FileFullDirectoryInformation, 
00171 FileBothDirectoryInformation, 
00172 FileBasicInformation, 
00173 FileStandardInformation, 
00174 FileInternalInformation, 
00175 FileEaInformation, 
00176 FileAccessInformation, 
00177 FileNameInformation, 
00178 FileRenameInformation, 
00179 FileLinkInformation, 
00180 FileNamesInformation, 
00181 FileDispositionInformation, 
00182 FilePositionInformation, 
00183 FileFullEaInformation, 
00184 FileModeInformation, 
00185 FileAlignmentInformation, 
00186 FileAllInformation, 
00187 FileAllocationInformation, 
00188 FileEndOfFileInformation, 
00189 FileAlternateNameInformation, 
00190 FileStreamInformation, 
00191 FilePipeInformation, 
00192 FilePipeLocalInformation, 
00193 FilePipeRemoteInformation, 
00194 FileMailslotQueryInformation, 
00195 FileMailslotSetInformation, 
00196 FileCompressionInformation, 
00197 FileCopyOnWriteInformation, 
00198 FileCompletionInformation, 
00199 FileMoveClusterInformation, 
00200 FileQuotaInformation, 
00201 FileReparsePointInformation, 
00202 FileNetworkOpenInformation, 
00203 FileObjectIdInformation, 
00204 FileTrackingInformation, 
00205 FileOleDirectoryInformation, 
00206 FileContentIndexInformation, 
00207 FileInheritContentIndexInformation, 
00208 FileOleInformation, 
00209 FileMaximumInformation
00210 
00211 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
00212 
00213 
00214 typedef struct _FILE_NAME_INFORMATION {
00215   ULONG  FileNameLength;
00216   WCHAR  FileName[1];
00217 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
00218 
00219 
00220 typedef         NTSTATUS (WINAPI *NTQUERYINFORMATIONPROCESS) (
00221                                                        HANDLE ProcessHandle,
00222                                                        PROCESSINFOCLASS ProcessInformationClass,
00223                                                        PVOID ProcessInformation,
00224                                                        DWORD ProcessInformationLength,
00225                                                        DWORD *ReturnLength);
00226 
00227 typedef NTSTATUS (WINAPI *NTQUERYSYSTEMINFORMATION)(DWORD SystemInformationClass, 
00228                                                     PVOID SystemInformation,
00229                                                     DWORD SystemInformationLength, 
00230                                                     PDWORD ReturnLength);
00231 
00232 typedef NTSTATUS (WINAPI *NTQUERYOBJECT)(
00233                                          HANDLE ObjectHandle, 
00234                                          OBJECT_INFORMATION_CLASS ObjectInformationClass, 
00235                                          PVOID ObjectInformation,
00236                                          DWORD Length, 
00237                                          PDWORD ResultLength);
00238 
00239 typedef NTSTATUS (WINAPI *NTDEVICEIOCONTROLFILE)(HANDLE FileHandle, 
00240                                                  HANDLE Event, 
00241                                                  PIO_APC_ROUTINE ApcRoutine, 
00242                                                  PVOID ApcContext,
00243                                                  PIO_STATUS_BLOCK IoStatusBlock, 
00244                                                  DWORD IoControlCode,
00245                                                  PVOID InputBuffer, 
00246                                                  DWORD InputBufferLength,
00247                                                  PVOID OutputBuffer, 
00248                                                  DWORD OutputBufferLength);
00249 
00250 typedef NTSTATUS (WINAPI * NTQUERYINFORMATIONTHREAD) (
00251                                  HANDLE hthread,
00252                                                                                         THREADINFOCLASS ThreadInfoClass,
00253                                                                                         PVOID ThreadInformation,
00254                                                                                         DWORD Length,
00255                                                                                         DWORD *ReturnLength);
00256 
00257 
00258 typedef         NTSTATUS (WINAPI *NTQUERYINFORMATIONFILE )(
00259                                                     HANDLE FileHandle,
00260                                                     PVOID IoStatusBlock,
00261                                                     PVOID FileInformation,
00262                                                     DWORD Length,
00263                                                     DWORD FileInformationClass);
00264 
00265 
00266 typedef NTSTATUS (WINAPI *NTCOMPARETOKENS) (
00267   HANDLE FirstTokenHandle,
00268   HANDLE SecondTokenHandle,
00269   PBOOLEAN Equal
00270 );
00271 
00272 
00273 #define OBJTOKEN 1
00274 #define OBJTHREAD 2
00275 #define OBJPROCESS 3
00276 #define OBJFILE 4
00277 #define OBJUNKNOWN 5
00278 
00279 #endif

Generated on Fri Feb 22 14:14:32 2008 for Handle by  doxygen 1.5.4