mirror of
https://github.com/reactos/reactos.git
synced 2024-07-19 10:56:09 +00:00
- Use regular PE structures in NTOSKRNL/NTDLL/DISKDUMP.
- Add WDMGUID library. - Get rid of few more headers. svn path=/trunk/; revision=16067
This commit is contained in:
parent
c09b52bf01
commit
7971e8425b
|
@ -18,8 +18,8 @@
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
|
VOID WINSNMPAPI SnmpSvcInitUptime();
|
||||||
DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
|
DWORD WINSNMPAPI SnmpSvcGetUptime();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ DiskDumpPrepare(PDEVICE_OBJECT DeviceObject, PDUMP_POINTERS DumpPointers)
|
||||||
PIMAGE_NT_HEADERS NtHeader;
|
PIMAGE_NT_HEADERS NtHeader;
|
||||||
PVOID ImportDirectory;
|
PVOID ImportDirectory;
|
||||||
ULONG ImportDirectorySize;
|
ULONG ImportDirectorySize;
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
|
||||||
PVOID DriverBase;
|
PVOID DriverBase;
|
||||||
PCH Name;
|
PCH Name;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
@ -325,12 +325,12 @@ DiskDumpPrepare(PDEVICE_OBJECT DeviceObject, PDUMP_POINTERS DumpPointers)
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
/* Process each import module */
|
/* Process each import module */
|
||||||
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)ImportDirectory;
|
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)ImportDirectory;
|
||||||
DPRINT("Processeing import directory at %p\n", ImportModuleDirectory);
|
DPRINT("Processeing import directory at %p\n", ImportModuleDirectory);
|
||||||
while (ImportModuleDirectory->dwRVAModuleName)
|
while (ImportModuleDirectory->Name)
|
||||||
{
|
{
|
||||||
/* Check to make sure that import lib is kernel */
|
/* Check to make sure that import lib is kernel */
|
||||||
Name = (PCHAR) DriverBase + ImportModuleDirectory->dwRVAModuleName;
|
Name = (PCHAR) DriverBase + ImportModuleDirectory->Name;
|
||||||
|
|
||||||
if (strcmp(Name, "scsiport.sys") != 0)
|
if (strcmp(Name, "scsiport.sys") != 0)
|
||||||
{
|
{
|
||||||
|
@ -341,18 +341,18 @@ DiskDumpPrepare(PDEVICE_OBJECT DeviceObject, PDUMP_POINTERS DumpPointers)
|
||||||
|
|
||||||
/* Get the import address list */
|
/* Get the import address list */
|
||||||
ImportAddressList = (PVOID *) ((PUCHAR)DriverBase +
|
ImportAddressList = (PVOID *) ((PUCHAR)DriverBase +
|
||||||
ImportModuleDirectory->dwRVAFunctionAddressList);
|
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
|
|
||||||
/* Get the list of functions to import */
|
/* Get the list of functions to import */
|
||||||
if (ImportModuleDirectory->dwRVAFunctionNameList != 0)
|
if (ImportModuleDirectory->OriginalFirstThunk != 0)
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG) ((PUCHAR)DriverBase +
|
FunctionNameList = (PULONG) ((PUCHAR)DriverBase +
|
||||||
ImportModuleDirectory->dwRVAFunctionNameList);
|
(ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG) ((PUCHAR)DriverBase +
|
FunctionNameList = (PULONG) ((PUCHAR)DriverBase +
|
||||||
ImportModuleDirectory->dwRVAFunctionAddressList);
|
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
}
|
}
|
||||||
/* Walk through function list and fixup addresses */
|
/* Walk through function list and fixup addresses */
|
||||||
while (*FunctionNameList != 0L)
|
while (*FunctionNameList != 0L)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#define __DD_INCLUDED__
|
#define __DD_INCLUDED__
|
||||||
|
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
#include <ole32/guiddef.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
/*
|
|
||||||
* PURPOSE: The number of device specific level levels
|
|
||||||
*/
|
|
||||||
#define NR_DEVICE_SPECIFIC_LEVELS (16)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#ifndef __INCLUDE_DDK_I386_PAGESIZE_H
|
|
||||||
#define __INCLUDE_DDK_I386_PAGESIZE_H
|
|
||||||
|
|
||||||
#define PAGE_SIZE (4096)
|
|
||||||
#define PAGE_SHIFT 12L
|
|
||||||
|
|
||||||
#endif /* __INCLUDE_DDK_I386_PAGESIZE_H */
|
|
|
@ -1,151 +0,0 @@
|
||||||
#ifndef __INCLUDE_INTERNAL_PORT_H
|
|
||||||
#define __INCLUDE_INTERNAL_PORT_H
|
|
||||||
|
|
||||||
#include <napi/lpc.h>
|
|
||||||
|
|
||||||
typedef
|
|
||||||
struct _EPORT
|
|
||||||
{
|
|
||||||
KSPIN_LOCK Lock;
|
|
||||||
KEVENT Event;
|
|
||||||
|
|
||||||
ULONG State;
|
|
||||||
|
|
||||||
struct _EPORT * OtherPort;
|
|
||||||
|
|
||||||
ULONG QueueLength;
|
|
||||||
LIST_ENTRY QueueListHead;
|
|
||||||
|
|
||||||
ULONG ConnectQueueLength;
|
|
||||||
LIST_ENTRY ConnectQueueListHead;
|
|
||||||
|
|
||||||
ULONG MaxDataLength;
|
|
||||||
ULONG MaxConnectInfoLength;
|
|
||||||
|
|
||||||
} EPORT, * PEPORT;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _EPORT_TERMINATION_REQUEST
|
|
||||||
{
|
|
||||||
LIST_ENTRY ThreadListEntry;
|
|
||||||
PEPORT Port;
|
|
||||||
|
|
||||||
} EPORT_TERMINATION_REQUEST, *PEPORT_TERMINATION_REQUEST;
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
LpcRequestPort (
|
|
||||||
PEPORT Port,
|
|
||||||
PLPC_MESSAGE LpcMessage
|
|
||||||
);
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
LpcSendTerminationPort (
|
|
||||||
PEPORT Port,
|
|
||||||
TIME CreationTime
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/* Port Object Access */
|
|
||||||
|
|
||||||
#define PORT_ALL_ACCESS (0x1)
|
|
||||||
|
|
||||||
|
|
||||||
/* EPORT.State */
|
|
||||||
|
|
||||||
#define EPORT_INACTIVE (0)
|
|
||||||
#define EPORT_WAIT_FOR_CONNECT (1)
|
|
||||||
#define EPORT_WAIT_FOR_ACCEPT (2)
|
|
||||||
#define EPORT_WAIT_FOR_COMPLETE_SRV (3)
|
|
||||||
#define EPORT_WAIT_FOR_COMPLETE_CLT (4)
|
|
||||||
#define EPORT_CONNECTED_CLIENT (5)
|
|
||||||
#define EPORT_CONNECTED_SERVER (6)
|
|
||||||
#define EPORT_DISCONNECTED (7)
|
|
||||||
|
|
||||||
typedef
|
|
||||||
struct _QUEUEDMESSAGE
|
|
||||||
{
|
|
||||||
PEPORT Sender;
|
|
||||||
LIST_ENTRY QueueListEntry;
|
|
||||||
LPC_MESSAGE Message;
|
|
||||||
UCHAR MessageData [MAX_MESSAGE_DATA];
|
|
||||||
|
|
||||||
} QUEUEDMESSAGE, *PQUEUEDMESSAGE;
|
|
||||||
|
|
||||||
/* Code in ntoskrnl/lpc/close.c */
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NiClosePort (
|
|
||||||
PVOID ObjectBody,
|
|
||||||
ULONG HandleCount
|
|
||||||
);
|
|
||||||
VOID
|
|
||||||
NiDeletePort (
|
|
||||||
IN PVOID ObjectBody
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/* Code in ntoskrnl/lpc/queue.c */
|
|
||||||
|
|
||||||
VOID
|
|
||||||
STDCALL
|
|
||||||
EiEnqueueConnectMessagePort (
|
|
||||||
IN OUT PEPORT Port,
|
|
||||||
IN PQUEUEDMESSAGE Message
|
|
||||||
);
|
|
||||||
VOID
|
|
||||||
STDCALL
|
|
||||||
EiEnqueueMessagePort (
|
|
||||||
IN OUT PEPORT Port,
|
|
||||||
IN PQUEUEDMESSAGE Message
|
|
||||||
);
|
|
||||||
PQUEUEDMESSAGE
|
|
||||||
STDCALL
|
|
||||||
EiDequeueConnectMessagePort (
|
|
||||||
IN OUT PEPORT Port
|
|
||||||
);
|
|
||||||
PQUEUEDMESSAGE
|
|
||||||
STDCALL
|
|
||||||
EiDequeueMessagePort (
|
|
||||||
IN OUT PEPORT Port
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Code in ntoskrnl/lpc/create.c */
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NiCreatePort (
|
|
||||||
PVOID ObjectBody,
|
|
||||||
PVOID Parent,
|
|
||||||
PWSTR RemainingPath,
|
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Code in ntoskrnl/lpc/port.c */
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
NiInitializePort (
|
|
||||||
IN OUT PEPORT Port
|
|
||||||
);
|
|
||||||
NTSTATUS
|
|
||||||
NiInitPort (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
extern POBJECT_TYPE ExPortType;
|
|
||||||
extern ULONG EiNextLpcMessageId;
|
|
||||||
|
|
||||||
/* Code in ntoskrnl/lpc/reply.c */
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
STDCALL
|
|
||||||
EiReplyOrRequestPort (
|
|
||||||
IN PEPORT Port,
|
|
||||||
IN PLPC_MESSAGE LpcReply,
|
|
||||||
IN ULONG MessageType,
|
|
||||||
IN PEPORT Sender
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_PORT_H */
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
#endif /* __NTOSKRNL__ || __NTDRIVER__ || __NTHAL__ || __NTDLL__ || __NTAPP__ */
|
#endif /* __NTOSKRNL__ || __NTDRIVER__ || __NTHAL__ || __NTDLL__ || __NTAPP__ */
|
||||||
|
|
||||||
#include <pe.h>
|
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||||
#include <ole32/guiddef.h>
|
#define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
|
||||||
|
|
||||||
#ifndef __USE_W32API
|
#ifndef __USE_W32API
|
||||||
|
|
||||||
|
|
|
@ -1,208 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: include\ole32\guiddef.h
|
|
||||||
* PURPOSE: Guid definition macros
|
|
||||||
* PROGRAMMER: jurgen van gael [jurgen.vangael@student.kuleuven.ac.be]
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* Created 05/01/2001
|
|
||||||
*/
|
|
||||||
/********************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with this library; see the file COPYING.LIB. If
|
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
|
||||||
Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
#ifndef _GUIDDEF_H
|
|
||||||
#define _GUIDDEF_H
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef __USE_W32API
|
|
||||||
#include <basetyps.h>
|
|
||||||
#endif /* __USE_W32API */
|
|
||||||
|
|
||||||
#ifndef EXTERN_C
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define EXTERN_C extern "C"
|
|
||||||
#else
|
|
||||||
#define EXTERN_C extern
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __USE_W32API
|
|
||||||
|
|
||||||
/* guid definition */
|
|
||||||
#ifndef GUID_DEFINED
|
|
||||||
#define GUID_DEFINED
|
|
||||||
typedef struct _GUID {
|
|
||||||
unsigned long Data1;
|
|
||||||
unsigned short Data2;
|
|
||||||
unsigned short Data3;
|
|
||||||
unsigned char Data4[ 8 ];
|
|
||||||
} GUID;
|
|
||||||
typedef GUID* LPGUID;
|
|
||||||
typedef const GUID* LPCGUID;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __USE_W32API */
|
|
||||||
|
|
||||||
|
|
||||||
/* guid definition macro */
|
|
||||||
#ifdef DEFINE_GUID
|
|
||||||
#undef DEFINE_GUID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef INITGUID
|
|
||||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
||||||
const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}
|
|
||||||
#else
|
|
||||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
|
||||||
const GUID name
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFINE_OLEGUID
|
|
||||||
#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* IID section */
|
|
||||||
#ifndef __USE_W32API
|
|
||||||
typedef GUID IID;
|
|
||||||
typedef IID* LPIID;
|
|
||||||
#endif /* __USE_W32API */
|
|
||||||
#ifndef IsEqualIID
|
|
||||||
#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* CLSID section */
|
|
||||||
#ifndef __USE_W32API
|
|
||||||
typedef GUID CLSID;
|
|
||||||
typedef CLSID* LPCLSID;
|
|
||||||
#endif /* __USE_W32API */
|
|
||||||
#ifndef IsEqualCLSID
|
|
||||||
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* FMTID */
|
|
||||||
#ifndef __USE_W32API
|
|
||||||
typedef GUID FMTID;
|
|
||||||
typedef FMTID* LPFMTID;
|
|
||||||
#endif /* __USE_W32API */
|
|
||||||
#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
|
|
||||||
|
|
||||||
|
|
||||||
/* REFGUID section */
|
|
||||||
#ifndef _REFGUID_DEFINED
|
|
||||||
#define _REFGUID_DEFINED
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define REFGUID const GUID &
|
|
||||||
#else
|
|
||||||
#define REFGUID const GUID *
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* REFIID section */
|
|
||||||
#if !defined(_REFIID_DEFINED) && !defined(_REFGIID_DEFINED)
|
|
||||||
#define _REFIID_DEFINED
|
|
||||||
#define _REFGIID_DEFINED
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define REFIID const IID &
|
|
||||||
#else
|
|
||||||
#define REFIID const IID *
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* REFCLSID section */
|
|
||||||
#ifndef _REFCLSID_DEFINED
|
|
||||||
#define _REFCLSID_DEFINED
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define REFCLSID const IID &
|
|
||||||
#else
|
|
||||||
#define REFCLSID const IID *
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* REFFMTID section */
|
|
||||||
#ifndef _REFFMTID_DEFINED
|
|
||||||
#define _REFFMTID_DEFINED
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define REFFMTID const IID &
|
|
||||||
#else
|
|
||||||
#define REFFMTID const IID *
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* compare functions for GUID */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
/* cpp versions */
|
|
||||||
__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
|
|
||||||
{
|
|
||||||
return(((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
|
|
||||||
((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
|
|
||||||
((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
|
|
||||||
((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
|
|
||||||
}
|
|
||||||
__inline int IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
|
|
||||||
{
|
|
||||||
return !memcmp(&rguid1, &rguid2, sizeof(GUID));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* c versions */
|
|
||||||
#define InlineIsEqualGUID(rguid1, rguid2) \
|
|
||||||
(((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] && \
|
|
||||||
((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] && \
|
|
||||||
((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] && \
|
|
||||||
((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])
|
|
||||||
|
|
||||||
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* use the inline version??? */
|
|
||||||
#ifdef __INLINE_ISEQUAL_GUID
|
|
||||||
#define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID(rguid1, rguid2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* compare functions for IID CLSID */
|
|
||||||
#ifndef IsEqualIID
|
|
||||||
#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
|
|
||||||
#endif
|
|
||||||
#ifndef IsEqualCLSID
|
|
||||||
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* c++ helper functions */
|
|
||||||
#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
|
|
||||||
#define _SYS_GUID_OPERATOR_EQ_
|
|
||||||
#ifdef __cplusplus
|
|
||||||
__inline int operator==(REFGUID guidOne, REFGUID guidTwo)
|
|
||||||
{
|
|
||||||
return IsEqualGUID(guidOne ,guidTwo);
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline int operator!=(REFGUID guidOne, REFGUID guidTwo)
|
|
||||||
{
|
|
||||||
return !(guidOne == guidTwo);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
1162
reactos/include/pe.h
1162
reactos/include/pe.h
File diff suppressed because it is too large
Load diff
|
@ -1,290 +0,0 @@
|
||||||
/*
|
|
||||||
* ReactOS Simple Network Management Protocol - SNMP
|
|
||||||
*
|
|
||||||
* snmp.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __SNMP_H__
|
|
||||||
#define __SNMP_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SNMP Error Codes
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SNMP_MEM_ALLOC_ERROR 1
|
|
||||||
#define SNMP_BERAPI_INVALID_LENGTH 10
|
|
||||||
#define SNMP_BERAPI_INVALID_TAG 11
|
|
||||||
#define SNMP_BERAPI_OVERFLOW 12
|
|
||||||
#define SNMP_BERAPI_SHORT_BUFFER 13
|
|
||||||
#define SNMP_BERAPI_INVALID_OBJELEM 14
|
|
||||||
#define SNMP_PDUAPI_UNRECOGNIZED_PDU 20
|
|
||||||
#define SNMP_PDUAPI_INVALID_ES 21
|
|
||||||
#define SNMP_PDUAPI_INVALID_GT 22
|
|
||||||
#define SNMP_AUTHAPI_INVALID_VERSION 30
|
|
||||||
#define SNMP_AUTHAPI_INVALID_MSG_TYPE 31
|
|
||||||
#define SNMP_AUTHAPI_TRIV_AUTH_FAILED 32
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SNMP Type Definitions
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <pshpack4.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE* stream;
|
|
||||||
UINT length;
|
|
||||||
BOOL dynamic;
|
|
||||||
} AsnOctetString;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT idLength;
|
|
||||||
UINT* ids;
|
|
||||||
} AsnObjectIdentifier;
|
|
||||||
|
|
||||||
typedef LONG AsnInteger32;
|
|
||||||
typedef ULONG AsnUnsigned32;
|
|
||||||
typedef ULARGE_INTEGER AsnCounter64;
|
|
||||||
typedef AsnUnsigned32 AsnCounter32;
|
|
||||||
typedef AsnUnsigned32 AsnGauge32;
|
|
||||||
typedef AsnUnsigned32 AsnTimeticks;
|
|
||||||
typedef AsnOctetString AsnBits;
|
|
||||||
typedef AsnOctetString AsnSequence;
|
|
||||||
typedef AsnOctetString AsnImplicitSequence;
|
|
||||||
typedef AsnOctetString AsnIPAddress;
|
|
||||||
typedef AsnOctetString AsnNetworkAddress;
|
|
||||||
typedef AsnOctetString AsnDisplayString;
|
|
||||||
typedef AsnOctetString AsnOpaque;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
BYTE asnType;
|
|
||||||
union {
|
|
||||||
AsnInteger32 number; // ASN_INTEGER & ASN_INTEGER32
|
|
||||||
AsnUnsigned32 unsigned32; // ASN_UNSIGNED32
|
|
||||||
AsnCounter64 counter64; // ASN_COUNTER64
|
|
||||||
AsnOctetString string; // ASN_OCTETSTRING
|
|
||||||
AsnBits bits; // ASN_BITS
|
|
||||||
AsnObjectIdentifier object; // ASN_OBJECTIDENTIFIER
|
|
||||||
AsnSequence sequence; // ASN_SEQUENCE
|
|
||||||
AsnIPAddress address; // ASN_IPADDRESS
|
|
||||||
AsnCounter32 counter; // ASN_COUNTER32
|
|
||||||
AsnGauge32 gauge; // ASN_GAUGE32
|
|
||||||
AsnTimeticks ticks; // ASN_TIMETICKS
|
|
||||||
AsnOpaque arbitrary; // ASN_OPAQUE
|
|
||||||
} asnValue;
|
|
||||||
} AsnAny;
|
|
||||||
|
|
||||||
typedef AsnObjectIdentifier AsnObjectName;
|
|
||||||
typedef AsnAny AsnObjectSyntax;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
AsnObjectName name;
|
|
||||||
AsnObjectSyntax value;
|
|
||||||
} SnmpVarBind;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
SnmpVarBind* list;
|
|
||||||
UINT len;
|
|
||||||
} SnmpVarBindList;
|
|
||||||
|
|
||||||
#include <poppack.h>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SNMP Function Prototypes
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SNMPAPI INT
|
|
||||||
#ifndef SNMP_FUNC_TYPE
|
|
||||||
#define SNMP_FUNC_TYPE STDCALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//LPVOID SNMP_FUNC_TYPE SnmpUtilMemAlloc(UINT nBytes);
|
|
||||||
//VOID SNMP_FUNC_TYPE SnmpUtilMemFree(LPVOID pMem);
|
|
||||||
//SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidCpy(AsnObjectIdentifier* pOidDst, AsnObjectIdentifier* pOidSrc);
|
|
||||||
//VOID SNMP_FUNC_TYPE SnmpUtilOidFree(AsnObjectIdentifier* pOid);
|
|
||||||
//VOID SNMP_FUNC_TYPE SnmpUtilVarBindFree(SnmpVarBind* pVb);
|
|
||||||
|
|
||||||
LPVOID SNMP_FUNC_TYPE SnmpUtilMemAlloc(
|
|
||||||
UINT nBytes // bytes to allocate for object
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilMemFree(
|
|
||||||
LPVOID pMem // pointer to memory object to release
|
|
||||||
);
|
|
||||||
|
|
||||||
LPVOID SNMP_FUNC_TYPE SnmpUtilMemReAlloc(
|
|
||||||
LPVOID pMem, // pointer to memory object
|
|
||||||
UINT nBytes // bytes to allocate
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
|
|
||||||
|
|
||||||
DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpSvcSetLogLevel(
|
|
||||||
INT nLogLevel // level of severity of the event
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpSvcSetLogType(
|
|
||||||
INT nLogType // destination for debug output
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilAsnAnyCpy(
|
|
||||||
AsnAny *pAnyDst, // destination structure
|
|
||||||
AsnAny *pAnySrc // source structure
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilAsnAnyFree(
|
|
||||||
AsnAny *pAny // pointer to structure to free
|
|
||||||
);
|
|
||||||
|
|
||||||
//VOID SNMP_FUNC_TYPE SnmpUtilDbgPrint(
|
|
||||||
// INT nLogLevel, // level of severity of event
|
|
||||||
// LPSTR szFormat // pointer to a format string
|
|
||||||
//);
|
|
||||||
|
|
||||||
LPSTR SNMP_FUNC_TYPE SnmpUtilIdsToA(
|
|
||||||
UINT *Ids, // object identifier to convert
|
|
||||||
UINT IdLength // number of elements
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsCmp(
|
|
||||||
AsnOctetString *pOctets1, // first octet string
|
|
||||||
AsnOctetString *pOctets2 // second octet string
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsCpy(
|
|
||||||
AsnOctetString *pOctetsDst, // destination octet string
|
|
||||||
AsnOctetString *pOctetsSrc // source octet string
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilOctetsFree(
|
|
||||||
AsnOctetString *pOctets // octet string to free
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOctetsNCmp(
|
|
||||||
AsnOctetString *pOctets1, // first octet string
|
|
||||||
AsnOctetString *pOctets2, // second octet string
|
|
||||||
UINT nChars // maximum length to compare
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidAppend(
|
|
||||||
AsnObjectIdentifier *pOidDst, // destination object identifier
|
|
||||||
AsnObjectIdentifier *pOidSrc // source object identifier
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidCmp(
|
|
||||||
AsnObjectIdentifier *pOid1, // first object identifier
|
|
||||||
AsnObjectIdentifier *pOid2 // second object identifier
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidCpy(
|
|
||||||
AsnObjectIdentifier *pOidDst, // destination object identifier
|
|
||||||
AsnObjectIdentifier *pOidSrc // source object identifier
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilOidFree(
|
|
||||||
AsnObjectIdentifier *pOid // object identifier to free
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilOidNCmp(
|
|
||||||
AsnObjectIdentifier *pOid1, // first object identifier
|
|
||||||
AsnObjectIdentifier *pOid2, // second object identifier
|
|
||||||
UINT nSubIds // maximum length to compare
|
|
||||||
);
|
|
||||||
|
|
||||||
LPSTR SNMP_FUNC_TYPE SnmpUtilOidToA(
|
|
||||||
AsnObjectIdentifier *Oid // object identifier to convert
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilPrintAsnAny(
|
|
||||||
AsnAny *pAny // pointer to value to print
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilPrintOid(
|
|
||||||
AsnObjectIdentifier *Oid // object identifier to print
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilVarBindCpy(
|
|
||||||
SnmpVarBind *pVbDst, // destination variable bindings
|
|
||||||
SnmpVarBind *pVbSrc // source variable bindings
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilVarBindFree(
|
|
||||||
SnmpVarBind *pVb // variable binding to free
|
|
||||||
);
|
|
||||||
|
|
||||||
SNMPAPI SNMP_FUNC_TYPE SnmpUtilVarBindListCpy(
|
|
||||||
SnmpVarBindList *pVblDst, // destination variable bindings list
|
|
||||||
SnmpVarBindList *pVblSrc // source variable bindings list
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID SNMP_FUNC_TYPE SnmpUtilVarBindListFree(
|
|
||||||
SnmpVarBindList *pVbl // variable bindings list to free
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SNMP Debugging Definitions
|
|
||||||
//
|
|
||||||
|
|
||||||
#define SNMP_LOG_SILENT 0x0
|
|
||||||
#define SNMP_LOG_FATAL 0x1
|
|
||||||
#define SNMP_LOG_ERROR 0x2
|
|
||||||
#define SNMP_LOG_WARNING 0x3
|
|
||||||
#define SNMP_LOG_TRACE 0x4
|
|
||||||
#define SNMP_LOG_VERBOSE 0x5
|
|
||||||
|
|
||||||
#define SNMP_OUTPUT_TO_CONSOLE 0x1
|
|
||||||
#define SNMP_OUTPUT_TO_LOGFILE 0x2
|
|
||||||
//#define SNMP_OUTPUT_TO_EVENTLOG 0x4 // no longer supported
|
|
||||||
#define SNMP_OUTPUT_TO_DEBUGGER 0x8
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SNMP Debugging Prototypes
|
|
||||||
//
|
|
||||||
|
|
||||||
VOID
|
|
||||||
SNMP_FUNC_TYPE
|
|
||||||
SnmpUtilDbgPrint(
|
|
||||||
IN INT nLogLevel, // see log levels above...
|
|
||||||
IN LPSTR szFormat,
|
|
||||||
IN ...
|
|
||||||
);
|
|
||||||
|
|
||||||
#if DBG
|
|
||||||
#define SNMPDBG(_x_) SnmpUtilDbgPrint _x_
|
|
||||||
#else
|
|
||||||
#define SNMPDBG(_x_)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __SNMP_H__
|
|
||||||
|
|
|
@ -268,6 +268,9 @@
|
||||||
<directory name="version">
|
<directory name="version">
|
||||||
<xi:include href="version/version.xml" />
|
<xi:include href="version/version.xml" />
|
||||||
</directory>
|
</directory>
|
||||||
|
<directory name="wdmguid">
|
||||||
|
<xi:include href="wdmguid/wdmguid.xml" />
|
||||||
|
</directory>
|
||||||
<directory name="wininet">
|
<directory name="wininet">
|
||||||
<xi:include href="wininet/wininet.xml" />
|
<xi:include href="wininet/wininet.xml" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -1110,7 +1110,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
* If is possible that this function overwrite the last information in runtimeinfo
|
* If is possible that this function overwrite the last information in runtimeinfo
|
||||||
* with the null terminator for the unicode string.
|
* with the null terminator for the unicode string.
|
||||||
*/
|
*/
|
||||||
RuntimeInfo_U.Length = RuntimeInfo_U.MaximumLength = ROUND_UP(lpStartupInfo->cbReserved2, 2) + 2;
|
RuntimeInfo_U.Length = RuntimeInfo_U.MaximumLength = (lpStartupInfo->cbReserved2 + 1) & ~1;
|
||||||
RuntimeInfo_U.Buffer = RtlAllocateHeap(GetProcessHeap(), 0, RuntimeInfo_U.Length);
|
RuntimeInfo_U.Buffer = RtlAllocateHeap(GetProcessHeap(), 0, RuntimeInfo_U.Length);
|
||||||
memcpy(RuntimeInfo_U.Buffer, lpStartupInfo->lpReserved2, lpStartupInfo->cbReserved2);
|
memcpy(RuntimeInfo_U.Buffer, lpStartupInfo->lpReserved2, lpStartupInfo->cbReserved2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,9 +249,9 @@ __true_LdrInitializeThunk (ULONG Unknown1,
|
||||||
PEDosHeader = (PIMAGE_DOS_HEADER) ImageBase;
|
PEDosHeader = (PIMAGE_DOS_HEADER) ImageBase;
|
||||||
DPRINT("PEDosHeader %x\n", PEDosHeader);
|
DPRINT("PEDosHeader %x\n", PEDosHeader);
|
||||||
|
|
||||||
if (PEDosHeader->e_magic != IMAGE_DOS_MAGIC ||
|
if (PEDosHeader->e_magic != IMAGE_DOS_SIGNATURE ||
|
||||||
PEDosHeader->e_lfanew == 0L ||
|
PEDosHeader->e_lfanew == 0L ||
|
||||||
*(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_PE_MAGIC)
|
*(PULONG)((PUCHAR)ImageBase + PEDosHeader->e_lfanew) != IMAGE_NT_SIGNATURE)
|
||||||
{
|
{
|
||||||
DPRINT1("Image has bad header\n");
|
DPRINT1("Image has bad header\n");
|
||||||
ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL);
|
ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL);
|
||||||
|
|
|
@ -659,9 +659,9 @@ LdrpMapDllImageFile(IN PWSTR SearchPath OPTIONAL,
|
||||||
/*
|
/*
|
||||||
* Check it is a PE image file.
|
* Check it is a PE image file.
|
||||||
*/
|
*/
|
||||||
if ((DosHeader->e_magic != IMAGE_DOS_MAGIC)
|
if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE)
|
||||||
|| (DosHeader->e_lfanew == 0L)
|
|| (DosHeader->e_lfanew == 0L)
|
||||||
|| (*(PULONG)(NTHeaders) != IMAGE_PE_MAGIC))
|
|| (*(PULONG)(NTHeaders) != IMAGE_NT_SIGNATURE))
|
||||||
{
|
{
|
||||||
DPRINT("NTDLL format invalid\n");
|
DPRINT("NTDLL format invalid\n");
|
||||||
NtClose(FileHandle);
|
NtClose(FileHandle);
|
||||||
|
@ -1365,7 +1365,7 @@ LdrpGetOrLoadModule(PWCHAR SerachPath,
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
LdrpProcessImportDirectoryEntry(PLDR_MODULE Module,
|
LdrpProcessImportDirectoryEntry(PLDR_MODULE Module,
|
||||||
PLDR_MODULE ImportedModule,
|
PLDR_MODULE ImportedModule,
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory)
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID* ImportAddressList;
|
PVOID* ImportAddressList;
|
||||||
|
@ -1375,22 +1375,22 @@ LdrpProcessImportDirectoryEntry(PLDR_MODULE Module,
|
||||||
ULONG Ordinal;
|
ULONG Ordinal;
|
||||||
ULONG IATSize;
|
ULONG IATSize;
|
||||||
|
|
||||||
if (ImportModuleDirectory == NULL || ImportModuleDirectory->dwRVAModuleName == 0)
|
if (ImportModuleDirectory == NULL || ImportModuleDirectory->Name == 0)
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the import address list. */
|
/* Get the import address list. */
|
||||||
ImportAddressList = (PVOID *)(Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionAddressList);
|
ImportAddressList = (PVOID *)(Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
|
|
||||||
/* Get the list of functions to import. */
|
/* Get the list of functions to import. */
|
||||||
if (ImportModuleDirectory->dwRVAFunctionNameList != 0)
|
if (ImportModuleDirectory->OriginalFirstThunk != 0)
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG) (Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionNameList);
|
FunctionNameList = (PULONG) (Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG)(Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionAddressList);
|
FunctionNameList = (PULONG)(Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the size of IAT. */
|
/* Get the size of IAT. */
|
||||||
|
@ -1464,14 +1464,14 @@ LdrpProcessImportDirectory(
|
||||||
PCHAR ImportedName)
|
PCHAR ImportedName)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
|
||||||
PCHAR Name;
|
PCHAR Name;
|
||||||
|
|
||||||
DPRINT("LdrpProcessImportDirectory(%x '%wZ', '%s')\n",
|
DPRINT("LdrpProcessImportDirectory(%x '%wZ', '%s')\n",
|
||||||
Module, &Module->BaseDllName, ImportedName);
|
Module, &Module->BaseDllName, ImportedName);
|
||||||
|
|
||||||
|
|
||||||
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)
|
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
|
||||||
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
||||||
TRUE,
|
TRUE,
|
||||||
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
||||||
|
@ -1481,9 +1481,9 @@ LdrpProcessImportDirectory(
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ImportModuleDirectory->dwRVAModuleName)
|
while (ImportModuleDirectory->Name)
|
||||||
{
|
{
|
||||||
Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->dwRVAModuleName;
|
Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->Name;
|
||||||
if (0 == _stricmp(Name, ImportedName))
|
if (0 == _stricmp(Name, ImportedName))
|
||||||
{
|
{
|
||||||
Status = LdrpProcessImportDirectoryEntry(Module,
|
Status = LdrpProcessImportDirectoryEntry(Module,
|
||||||
|
@ -1507,7 +1507,7 @@ LdrpAdjustImportDirectory(PLDR_MODULE Module,
|
||||||
PLDR_MODULE ImportedModule,
|
PLDR_MODULE ImportedModule,
|
||||||
PCHAR ImportedName)
|
PCHAR ImportedName)
|
||||||
{
|
{
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID* ImportAddressList;
|
PVOID* ImportAddressList;
|
||||||
PVOID Start;
|
PVOID Start;
|
||||||
|
@ -1523,7 +1523,7 @@ LdrpAdjustImportDirectory(PLDR_MODULE Module,
|
||||||
DPRINT("LdrpAdjustImportDirectory(Module %x '%wZ', %x '%wZ', %x '%s')\n",
|
DPRINT("LdrpAdjustImportDirectory(Module %x '%wZ', %x '%wZ', %x '%s')\n",
|
||||||
Module, &Module->BaseDllName, ImportedModule, &ImportedModule->BaseDllName, ImportedName);
|
Module, &Module->BaseDllName, ImportedModule, &ImportedModule->BaseDllName, ImportedName);
|
||||||
|
|
||||||
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)
|
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
|
||||||
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
||||||
TRUE,
|
TRUE,
|
||||||
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
||||||
|
@ -1533,23 +1533,23 @@ LdrpAdjustImportDirectory(PLDR_MODULE Module,
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ImportModuleDirectory->dwRVAModuleName)
|
while (ImportModuleDirectory->Name)
|
||||||
{
|
{
|
||||||
Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->dwRVAModuleName;
|
Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->Name;
|
||||||
if (0 == _stricmp(Name, (PCHAR)ImportedName))
|
if (0 == _stricmp(Name, (PCHAR)ImportedName))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Get the import address list. */
|
/* Get the import address list. */
|
||||||
ImportAddressList = (PVOID *)(Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionAddressList);
|
ImportAddressList = (PVOID *)(Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
|
|
||||||
/* Get the list of functions to import. */
|
/* Get the list of functions to import. */
|
||||||
if (ImportModuleDirectory->dwRVAFunctionNameList != 0)
|
if (ImportModuleDirectory->OriginalFirstThunk != 0)
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG) (Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionNameList);
|
FunctionNameList = (PULONG) (Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FunctionNameList = (PULONG)(Module->BaseAddress + ImportModuleDirectory->dwRVAFunctionAddressList);
|
FunctionNameList = (PULONG)(Module->BaseAddress + (ULONG_PTR)ImportModuleDirectory->FirstThunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the size of IAT. */
|
/* Get the size of IAT. */
|
||||||
|
@ -1628,8 +1628,8 @@ static NTSTATUS
|
||||||
LdrFixupImports(IN PWSTR SearchPath OPTIONAL,
|
LdrFixupImports(IN PWSTR SearchPath OPTIONAL,
|
||||||
IN PLDR_MODULE Module)
|
IN PLDR_MODULE Module)
|
||||||
{
|
{
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectoryCurrent;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectoryCurrent;
|
||||||
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor;
|
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor;
|
||||||
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent;
|
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent;
|
||||||
PIMAGE_TLS_DIRECTORY TlsDirectory;
|
PIMAGE_TLS_DIRECTORY TlsDirectory;
|
||||||
|
@ -1662,7 +1662,7 @@ LdrFixupImports(IN PWSTR SearchPath OPTIONAL,
|
||||||
/*
|
/*
|
||||||
* Process each import module.
|
* Process each import module.
|
||||||
*/
|
*/
|
||||||
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)
|
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
|
||||||
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
||||||
TRUE,
|
TRUE,
|
||||||
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
||||||
|
@ -1809,9 +1809,9 @@ LdrFixupImports(IN PWSTR SearchPath OPTIONAL,
|
||||||
DPRINT("ImportModuleDirectory %x\n", ImportModuleDirectory);
|
DPRINT("ImportModuleDirectory %x\n", ImportModuleDirectory);
|
||||||
|
|
||||||
ImportModuleDirectoryCurrent = ImportModuleDirectory;
|
ImportModuleDirectoryCurrent = ImportModuleDirectory;
|
||||||
while (ImportModuleDirectoryCurrent->dwRVAModuleName)
|
while (ImportModuleDirectoryCurrent->Name)
|
||||||
{
|
{
|
||||||
ImportedName = (PCHAR)Module->BaseAddress + ImportModuleDirectoryCurrent->dwRVAModuleName;
|
ImportedName = (PCHAR)Module->BaseAddress + ImportModuleDirectoryCurrent->Name;
|
||||||
TRACE_LDR("%wZ imports functions from %s\n", &Module->BaseDllName, ImportedName);
|
TRACE_LDR("%wZ imports functions from %s\n", &Module->BaseDllName, ImportedName);
|
||||||
|
|
||||||
Status = LdrpGetOrLoadModule(SearchPath, ImportedName, &ImportedModule, TRUE);
|
Status = LdrpGetOrLoadModule(SearchPath, ImportedName, &ImportedModule, TRUE);
|
||||||
|
@ -2125,7 +2125,7 @@ static NTSTATUS
|
||||||
LdrpUnloadModule(PLDR_MODULE Module,
|
LdrpUnloadModule(PLDR_MODULE Module,
|
||||||
BOOLEAN Unload)
|
BOOLEAN Unload)
|
||||||
{
|
{
|
||||||
PIMAGE_IMPORT_MODULE_DIRECTORY ImportModuleDirectory;
|
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
|
||||||
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor;
|
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor;
|
||||||
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent;
|
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent;
|
||||||
PCHAR ImportedName;
|
PCHAR ImportedName;
|
||||||
|
@ -2183,7 +2183,7 @@ LdrpUnloadModule(PLDR_MODULE Module,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImportModuleDirectory = (PIMAGE_IMPORT_MODULE_DIRECTORY)
|
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
|
||||||
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
RtlImageDirectoryEntryToData(Module->BaseAddress,
|
||||||
TRUE,
|
TRUE,
|
||||||
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
||||||
|
@ -2191,9 +2191,9 @@ LdrpUnloadModule(PLDR_MODULE Module,
|
||||||
if (ImportModuleDirectory)
|
if (ImportModuleDirectory)
|
||||||
{
|
{
|
||||||
/* dereferencing all imported modules, use the import descriptor */
|
/* dereferencing all imported modules, use the import descriptor */
|
||||||
while (ImportModuleDirectory->dwRVAModuleName)
|
while (ImportModuleDirectory->Name)
|
||||||
{
|
{
|
||||||
ImportedName = (PCHAR)Module->BaseAddress + ImportModuleDirectory->dwRVAModuleName;
|
ImportedName = (PCHAR)Module->BaseAddress + ImportModuleDirectory->Name;
|
||||||
TRACE_LDR("%wZ trys to unload %s\n", &Module->BaseDllName, ImportedName);
|
TRACE_LDR("%wZ trys to unload %s\n", &Module->BaseDllName, ImportedName);
|
||||||
Status = LdrpGetOrLoadModule(NULL, ImportedName, &ImportedModule, FALSE);
|
Status = LdrpGetOrLoadModule(NULL, ImportedName, &ImportedModule, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ntos.h>
|
#include <ntos.h>
|
||||||
#include <sm/helper.h>
|
#include <sm/helper.h>
|
||||||
#include <pe.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
4
reactos/lib/wdmguid/wdmguid.xml
Normal file
4
reactos/lib/wdmguid/wdmguid.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<module name="wdmguid" type="staticlibrary">
|
||||||
|
<define name="__USE_W32API" />
|
||||||
|
<file>wdmguid.c</file>
|
||||||
|
</module>
|
|
@ -46,9 +46,6 @@
|
||||||
*/
|
*/
|
||||||
//#define CACHE_BITMAP
|
//#define CACHE_BITMAP
|
||||||
|
|
||||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
|
||||||
#define ROUND_DOWN(N, S) (((N) % (S)) ? ROUND_UP(N, S) - S : N)
|
|
||||||
|
|
||||||
static LIST_ENTRY DirtySegmentListHead;
|
static LIST_ENTRY DirtySegmentListHead;
|
||||||
static LIST_ENTRY CacheSegmentListHead;
|
static LIST_ENTRY CacheSegmentListHead;
|
||||||
static LIST_ENTRY CacheSegmentLRUListHead;
|
static LIST_ENTRY CacheSegmentLRUListHead;
|
||||||
|
|
|
@ -46,6 +46,11 @@ STATIC MODULE_TEXT_SECTION NtoskrnlTextSection;
|
||||||
STATIC MODULE_TEXT_SECTION LdrHalTextSection;
|
STATIC MODULE_TEXT_SECTION LdrHalTextSection;
|
||||||
ULONG_PTR LdrHalBase;
|
ULONG_PTR LdrHalBase;
|
||||||
|
|
||||||
|
#define OPTHDROFFSET(a) ((LPVOID)((BYTE *)a + \
|
||||||
|
((PIMAGE_DOS_HEADER)a)->e_lfanew + \
|
||||||
|
IMAGE_SIZEOF_NT_OPTIONAL_HEADER + \
|
||||||
|
sizeof (IMAGE_FILE_HEADER)))
|
||||||
|
|
||||||
#ifndef HIWORD
|
#ifndef HIWORD
|
||||||
#define HIWORD(X) ((WORD) (((DWORD) (X) >> 16) & 0xFFFF))
|
#define HIWORD(X) ((WORD) (((DWORD) (X) >> 16) & 0xFFFF))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<library>rosrtl</library>
|
<library>rosrtl</library>
|
||||||
<library>rossym</library>
|
<library>rossym</library>
|
||||||
<library>string</library>
|
<library>string</library>
|
||||||
|
<library>wdmguid</library>
|
||||||
<directory name="include">
|
<directory name="include">
|
||||||
<pch>ntoskrnl.h</pch>
|
<pch>ntoskrnl.h</pch>
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>rpcrt4</library>
|
<library>rpcrt4</library>
|
||||||
|
<library>wdmguid</library>
|
||||||
<file>umpnpmgr.c</file>
|
<file>umpnpmgr.c</file>
|
||||||
<file>umpnpmgr.rc</file>
|
<file>umpnpmgr.rc</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#endif
|
#endif
|
||||||
#define assert(x)
|
#define assert(x)
|
||||||
|
|
||||||
#define ROUND_DOWN(N, S) (((N) / (S)) * (S))
|
|
||||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
|
||||||
|
|
||||||
extern HANDLE ProcessHeap;
|
extern HANDLE ProcessHeap;
|
||||||
|
|
||||||
extern UNICODE_STRING SourceRootPath;
|
extern UNICODE_STRING SourceRootPath;
|
||||||
|
|
|
@ -851,7 +851,13 @@ typedef DWORD FLONG;
|
||||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C
|
#define IMAGE_OS2_SIGNATURE_LE 0x454C
|
||||||
#define IMAGE_VXD_SIGNATURE 0x454C
|
#define IMAGE_VXD_SIGNATURE 0x454C
|
||||||
#define IMAGE_NT_SIGNATURE 0x00004550
|
#define IMAGE_NT_SIGNATURE 0x00004550
|
||||||
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
|
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
|
||||||
|
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
|
||||||
|
#else
|
||||||
|
#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
|
||||||
|
#endif
|
||||||
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||||
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
|
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
|
||||||
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||||
|
@ -888,6 +894,10 @@ typedef DWORD FLONG;
|
||||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
|
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
|
||||||
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
|
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
|
||||||
#define IMAGE_DIRECTORY_ENTRY_IAT 12
|
#define IMAGE_DIRECTORY_ENTRY_IAT 12
|
||||||
|
#define IMAGE_SCN_TYPE_REG 0
|
||||||
|
#define IMAGE_SCN_TYPE_DSECT 1
|
||||||
|
#define IMAGE_SCN_TYPE_NOLOAD 2
|
||||||
|
#define IMAGE_SCN_TYPE_GROUP 4
|
||||||
#define IMAGE_SCN_TYPE_NO_PAD 8
|
#define IMAGE_SCN_TYPE_NO_PAD 8
|
||||||
#define IMAGE_SCN_CNT_CODE 32
|
#define IMAGE_SCN_CNT_CODE 32
|
||||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 64
|
#define IMAGE_SCN_CNT_INITIALIZED_DATA 64
|
||||||
|
|
Loading…
Reference in a new issue