mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:02:16 +00:00
Replaced call to LdrLoadModule() by call to ZwSetSystemInformation()
svn path=/trunk/; revision=1316
This commit is contained in:
parent
1a10e72f31
commit
24d06e9f82
8 changed files with 128 additions and 59 deletions
|
@ -121,9 +121,9 @@ enum _SYSTEM_INFORMATION_CLASS
|
|||
SystemPoolTagInformation = 22, /* Q (checked build only) */
|
||||
SystemProcessorScheduleInfo = 23, /* Q */
|
||||
SystemDpcInformation = 24, /* QS */
|
||||
SystemInformation25 = 25,
|
||||
SystemLoadImage = 26, /* S (callable) */
|
||||
SystemUnloadImage = 27, /* S (callable) */
|
||||
SystemFullMemoryInformation = 25,
|
||||
SystemLoadGdiDriverInformation = 26, /* S (callable) */
|
||||
SystemUnloadGdiDriverInformation = 27, /* S (callable) */
|
||||
SystemTimeAdjustmentInformation = 28, /* QS */
|
||||
SystemInformation29 = 29,
|
||||
SystemInformation30 = 30,
|
||||
|
@ -558,7 +558,7 @@ struct _SYSTEM_POOL_TAG_INFO
|
|||
{
|
||||
ULONG Count;
|
||||
SYSTEM_POOL_TAG_ENTRY PoolEntry [1];
|
||||
|
||||
|
||||
} SYSTEM_POOL_TAG_INFO, *PSYSTEM_POOL_TAG_INFO;
|
||||
|
||||
// SystemProcessorScheduleInfo (23)
|
||||
|
@ -589,26 +589,17 @@ struct _SYSTEM_DPC_INFORMATION
|
|||
// SystemInformation25 (25)
|
||||
// UNKNOWN
|
||||
|
||||
// SystemLoadImage (26)
|
||||
typedef
|
||||
struct _SYSTEM_IMAGE_LOAD
|
||||
// SystemLoadGdiDriverInformation (26)
|
||||
// SystemUnloadGdiDriverInformation (27)
|
||||
typedef struct _SYSTEM_GDI_DRIVER_INFORMATION
|
||||
{
|
||||
UNICODE_STRING ModuleFileName IN;
|
||||
PVOID BaseAddress OUT;
|
||||
PVOID Section OUT;
|
||||
PVOID EntryPoint OUT;
|
||||
PVOID ExportDirectory OUT;
|
||||
|
||||
} SYSTEM_IMAGE_LOAD, *PSYSTEM_IMAGE_LOAD;
|
||||
|
||||
// SystemUnloadImage (27)
|
||||
typedef
|
||||
struct _SYSTEM_IMAGE_UNLOAD
|
||||
{
|
||||
PVOID Section IN; /* see SYSTEM_IMAGE_LOAD.ModuleSection */
|
||||
|
||||
} SYSTEM_IMAGE_UNLOAD, *PSYSTEM_IMAGE_UNLOAD;
|
||||
|
||||
UNICODE_STRING DriverName;
|
||||
PVOID ImageAddress;
|
||||
PVOID SectionPointer;
|
||||
PVOID EntryPoint;
|
||||
// PIMAGE_EXPORT_DIRECTORY ExportSectionPointer;
|
||||
PVOID ExportSectionPointer;
|
||||
} SYSTEM_GDI_DRIVER_INFORMATION, *PSYSTEM_GDI_DRIVER_INFORMATION;
|
||||
|
||||
// SystemTimeAdjustmentInformation (28)
|
||||
// (what is the right one?)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sysinfo.c,v 1.5 2000/04/25 23:22:56 ea Exp $
|
||||
/* $Id: sysinfo.c,v 1.6 2000/08/26 16:19:40 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -15,6 +15,7 @@
|
|||
#include <ddk/zwtypes.h>
|
||||
#include <string.h>
|
||||
#include <internal/ex.h>
|
||||
#include <internal/ldr.h>
|
||||
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
@ -423,15 +424,26 @@ QSI_DEF(SystemInformation25)
|
|||
return (STATUS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/* Class 26 - Load Image (callable) */
|
||||
SSI_DEF(SystemLoadImage)
|
||||
/* Class 26 - Load Gdi Driver Information */
|
||||
SSI_DEF(SystemLoadGdiDriverInformation)
|
||||
{
|
||||
/* FIXME */
|
||||
return (STATUS_NOT_IMPLEMENTED);
|
||||
PSYSTEM_GDI_DRIVER_INFORMATION Sdi
|
||||
= (PSYSTEM_GDI_DRIVER_INFORMATION) Buffer;
|
||||
|
||||
if (sizeof (SYSTEM_GDI_DRIVER_INFORMATION) != Size)
|
||||
{
|
||||
return (STATUS_INFO_LENGTH_MISMATCH);
|
||||
}
|
||||
|
||||
return LdrLoadGdiDriver (&Sdi->DriverName,
|
||||
&Sdi->ImageAddress,
|
||||
&Sdi->SectionPointer,
|
||||
&Sdi->EntryPoint,
|
||||
&Sdi->ExportSectionPointer);
|
||||
}
|
||||
|
||||
/* Class 27 - Unload Image (callable) */
|
||||
SSI_DEF(SystemUnloadImage)
|
||||
/* Class 27 - Unload Gdi Driver Information */
|
||||
SSI_DEF(SystemUnloadGdiDriverInformation)
|
||||
{
|
||||
/* FIXME */
|
||||
return (STATUS_NOT_IMPLEMENTED);
|
||||
|
@ -666,8 +678,8 @@ CallQS [] =
|
|||
SI_QX(SystemProcessorScheduleInfo),
|
||||
SI_QS(SystemDpcInformation),
|
||||
SI_QX(SystemInformation25), /* it should be SI_XX */
|
||||
SI_XS(SystemLoadImage),
|
||||
SI_XS(SystemUnloadImage),
|
||||
SI_XS(SystemLoadGdiDriverInformation),
|
||||
SI_XS(SystemUnloadGdiDriverInformation),
|
||||
SI_QS(SystemTimeAdjustmentInformation),
|
||||
SI_QX(SystemInformation29), /* it should be SI_XX */
|
||||
SI_QX(SystemInformation30), /* it should be SI_XX */
|
||||
|
|
|
@ -53,6 +53,11 @@ LdrGetProcedureAddress (IN PVOID BaseAddress,
|
|||
IN ULONG Ordinal,
|
||||
OUT PVOID *ProcedureAddress);
|
||||
|
||||
NTSTATUS LdrLoadGdiDriver (PUNICODE_STRING DriverName,
|
||||
PVOID *ImageAddress,
|
||||
PVOID *SectionPointer,
|
||||
PVOID *EntryPoint,
|
||||
PVOID *ExportSectionPointer);
|
||||
|
||||
PVOID STDCALL
|
||||
RtlImageDirectoryEntryToData (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: loader.c,v 1.61 2000/08/24 19:11:06 ekohl Exp $
|
||||
/* $Id: loader.c,v 1.62 2000/08/26 16:20:34 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -260,6 +260,36 @@ NTSTATUS LdrLoadDriver(PUNICODE_STRING Filename)
|
|||
return IoInitializeDriver(ModuleObject->EntryPoint);
|
||||
}
|
||||
|
||||
NTSTATUS LdrLoadGdiDriver (PUNICODE_STRING DriverName,
|
||||
PVOID *ImageAddress,
|
||||
PVOID *SectionPointer,
|
||||
PVOID *EntryPoint,
|
||||
PVOID *ExportSectionPointer)
|
||||
{
|
||||
PMODULE_OBJECT ModuleObject;
|
||||
|
||||
ModuleObject = LdrLoadModule(DriverName);
|
||||
if (ModuleObject == 0)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (ImageAddress)
|
||||
*ImageAddress = ModuleObject->Base;
|
||||
|
||||
// if (SectionPointer)
|
||||
// *SectionPointer = ModuleObject->
|
||||
|
||||
if (EntryPoint)
|
||||
*EntryPoint = ModuleObject->EntryPoint;
|
||||
|
||||
// if (ExportSectionPointer)
|
||||
// *ExportSectionPointer = ModuleObject->
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PMODULE_OBJECT
|
||||
LdrLoadModule(PUNICODE_STRING Filename)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.85 2000/08/11 12:38:45 ekohl Exp $
|
||||
; $Id: ntoskrnl.def,v 1.86 2000/08/26 16:18:58 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -435,7 +435,6 @@ KiDispatchInterrupt@0
|
|||
;LdrEnumResources@20
|
||||
;LdrFindResourceDirectory_U@16
|
||||
;LdrFindResource_U@16
|
||||
LdrLoadModule
|
||||
;LpcRequestPort@8
|
||||
;LsaCallAuthenticationPackage
|
||||
;LsaDeregisterLogonProcess
|
||||
|
@ -748,7 +747,7 @@ RtlOemToUnicodeN@20
|
|||
RtlPrefixString@12
|
||||
RtlPrefixUnicodeString@12
|
||||
;RtlQueryAtomInAtomTable
|
||||
RtlQueryRegistryValues=RtlQueryRegistryValues@20
|
||||
RtlQueryRegistryValues@20
|
||||
;RtlQueryTimeZoneInformation
|
||||
;RtlRaiseException
|
||||
;RtlRandom
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.72 2000/08/11 12:38:45 ekohl Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.73 2000/08/26 16:18:58 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -435,7 +435,6 @@ KiDispatchInterrupt=KiDispatchInterrupt@0
|
|||
;LdrEnumResources@20
|
||||
;LdrFindResourceDirectory_U@16
|
||||
;LdrFindResource_U@16
|
||||
LdrLoadModule=LdrLoadModule
|
||||
;LpcRequestPort@8
|
||||
;LsaCallAuthenticationPackage
|
||||
;LsaDeregisterLogonProcess
|
||||
|
|
|
@ -1,18 +1,48 @@
|
|||
/* $Id: loader.c,v 1.5 2000/08/26 16:21:28 ekohl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
// HANDLE __cdecl LdrLoadModule (LPWSTR);
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
EngLoadImage (LPWSTR DriverName)
|
||||
{
|
||||
return (HANDLE) LdrLoadModule(DriverName);
|
||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlInitUnicodeString (&GdiDriverInfo.DriverName,
|
||||
DriverName);
|
||||
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation,
|
||||
&GdiDriverInfo,
|
||||
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return NULL;
|
||||
|
||||
return (HANDLE)GdiDriverInfo.ImageAddress;
|
||||
}
|
||||
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
EngLoadModule(LPWSTR ModuleName)
|
||||
{
|
||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||
NTSTATUS Status;
|
||||
|
||||
// FIXME: should load as readonly
|
||||
return (HANDLE) LdrLoadModule(ModuleName);
|
||||
|
||||
RtlInitUnicodeString (&GdiDriverInfo.DriverName,
|
||||
ModuleName);
|
||||
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation,
|
||||
&GdiDriverInfo,
|
||||
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return NULL;
|
||||
|
||||
return (HANDLE)GdiDriverInfo.ImageAddress;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: driver.c,v 1.14 2000/07/07 11:59:11 ekohl Exp $
|
||||
/* $Id: driver.c,v 1.15 2000/08/26 16:22:04 ekohl Exp $
|
||||
*
|
||||
* GDI Driver support routines
|
||||
* (mostly swiped from Wine)
|
||||
|
@ -63,9 +63,9 @@ BOOL DRIVER_RegisterDriver(LPCWSTR Name, PGD_ENABLEDRIVER EnableDriver)
|
|||
|
||||
PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
||||
{
|
||||
UNICODE_STRING DriverNameW;
|
||||
PMODULE_OBJECT ModuleObject;
|
||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||
GRAPHICS_DRIVER *Driver = DriverList;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* First see if the driver hasn't already been loaded */
|
||||
while (Driver && Name)
|
||||
|
@ -78,14 +78,16 @@ PGD_ENABLEDRIVER DRIVER_FindDDIDriver(LPCWSTR Name)
|
|||
}
|
||||
|
||||
/* If not, then load it */
|
||||
RtlInitUnicodeString (&DriverNameW, Name);
|
||||
RtlInitUnicodeString (&GdiDriverInfo.DriverName,
|
||||
(LPWSTR)Name);
|
||||
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation,
|
||||
&GdiDriverInfo,
|
||||
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return NULL;
|
||||
|
||||
ModuleObject = EngLoadImage(&DriverNameW);
|
||||
if (ModuleObject == NULL)
|
||||
return NULL;
|
||||
|
||||
DRIVER_RegisterDriver( L"DISPLAY", ModuleObject->EntryPoint );
|
||||
return (PGD_ENABLEDRIVER)ModuleObject->EntryPoint;
|
||||
DRIVER_RegisterDriver( L"DISPLAY", GdiDriverInfo.EntryPoint);
|
||||
return (PGD_ENABLEDRIVER)GdiDriverInfo.EntryPoint;
|
||||
}
|
||||
|
||||
BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,
|
||||
|
@ -136,7 +138,7 @@ BOOL DRIVER_BuildDDIFunctions(PDRVENABLEDATA DED,
|
|||
if(DED->pdrvfn[i].iFunc == INDEX_DrvGetModes) DF->GetModes = (PGD_GETMODES)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvFree) DF->Free = (PGD_FREE)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvDestroyFont) DF->DestroyFont = (PGD_DESTROYFONT)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvQueryFontCaps) DF->QueryFontCaps = (PGD_LOADFONTFILE)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvQueryFontCaps) DF->QueryFontCaps = (PGD_QUERYFONTCAPS)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvLoadFontFile) DF->LoadFontFile = (PGD_LOADFONTFILE)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvUnloadFontFile) DF->UnloadFontFile = (PGD_UNLOADFONTFILE)DED->pdrvfn[i].pfn;
|
||||
if(DED->pdrvfn[i].iFunc == INDEX_DrvFontManagement) DF->FontManagement = (PGD_FONTMANAGEMENT)DED->pdrvfn[i].pfn;
|
||||
|
@ -169,9 +171,7 @@ typedef VP_STATUS (*PMP_DRIVERENTRY)(PVOID, PVOID);
|
|||
|
||||
HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
||||
{
|
||||
UNICODE_STRING DriverNameW;
|
||||
PMODULE_OBJECT ModuleObject;
|
||||
|
||||
SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
|
||||
PWSTR lName;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName;
|
||||
|
@ -182,9 +182,12 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
|||
PMP_DRIVERENTRY PMP_DriverEntry;
|
||||
|
||||
/* Phase 1 */
|
||||
RtlInitUnicodeString (&DriverNameW, L"\\??\\C:\\reactos\\system32\\drivers\\vgamp.sys");
|
||||
ModuleObject = EngLoadImage(&DriverNameW);
|
||||
if (ModuleObject == NULL)
|
||||
RtlInitUnicodeString (&GdiDriverInfo.DriverName,
|
||||
L"\\SystemRoot\\system32\\drivers\\vgamp.sys");
|
||||
Status = ZwSetSystemInformation (SystemLoadGdiDriverInformation,
|
||||
&GdiDriverInfo,
|
||||
sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
|
||||
if (!NT_SUCCESS(Status))
|
||||
return NULL;
|
||||
|
||||
/* Phase 2 */
|
||||
|
@ -220,7 +223,7 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
|||
// We pass the DriverObject to the Miniport driver, which passes it to the VideoPort driver
|
||||
// The VideoPort driver then creates the Device Object
|
||||
|
||||
PMP_DriverEntry = ModuleObject->EntryPoint;
|
||||
PMP_DriverEntry = GdiDriverInfo.EntryPoint;
|
||||
PMP_DriverEntry(DriverObject, NULL);
|
||||
|
||||
return DriverObject;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue