mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Implemented LdrQueryImageFileExecutionOptions().
svn path=/trunk/; revision=5285
This commit is contained in:
parent
f82ee00571
commit
4a35181ef2
5 changed files with 184 additions and 8 deletions
|
@ -117,6 +117,14 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
|
||||||
IN PUNICODE_STRING Name,
|
IN PUNICODE_STRING Name,
|
||||||
OUT PVOID *BaseAddress OPTIONAL);
|
OUT PVOID *BaseAddress OPTIONAL);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
LdrQueryImageFileExecutionOptions (IN PUNICODE_STRING SubKey,
|
||||||
|
IN PCWSTR ValueName,
|
||||||
|
IN ULONG ValueSize,
|
||||||
|
OUT PVOID Buffer,
|
||||||
|
IN ULONG BufferSize,
|
||||||
|
OUT PULONG RetunedLength OPTIONAL);
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
LdrQueryProcessModuleInformation(IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
|
LdrQueryProcessModuleInformation(IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
|
||||||
IN ULONG Size OPTIONAL,
|
IN ULONG Size OPTIONAL,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntdll.def,v 1.105 2003/07/24 14:25:32 royce Exp $
|
; $Id: ntdll.def,v 1.106 2003/07/27 11:40:01 ekohl Exp $
|
||||||
;
|
;
|
||||||
; ReactOS Operating System
|
; ReactOS Operating System
|
||||||
;
|
;
|
||||||
|
@ -47,7 +47,7 @@ LdrGetProcedureAddress@16
|
||||||
LdrInitializeThunk@16
|
LdrInitializeThunk@16
|
||||||
LdrLoadDll@16
|
LdrLoadDll@16
|
||||||
;LdrProcessRelocationBlock@16
|
;LdrProcessRelocationBlock@16
|
||||||
;LdrQueryImageFileExecutionOptions@24
|
LdrQueryImageFileExecutionOptions@24
|
||||||
LdrQueryProcessModuleInformation@12
|
LdrQueryProcessModuleInformation@12
|
||||||
LdrShutdownProcess@0
|
LdrShutdownProcess@0
|
||||||
LdrShutdownThread@0
|
LdrShutdownThread@0
|
||||||
|
@ -158,7 +158,6 @@ NtPrivilegedServiceAuditAlarm@20
|
||||||
NtPrivilegeObjectAuditAlarm@24
|
NtPrivilegeObjectAuditAlarm@24
|
||||||
NtProtectVirtualMemory@20
|
NtProtectVirtualMemory@20
|
||||||
NtPulseEvent@8
|
NtPulseEvent@8
|
||||||
NtQueueApcThread@20
|
|
||||||
NtQueryAttributesFile@8
|
NtQueryAttributesFile@8
|
||||||
NtQueryDefaultLocale@8
|
NtQueryDefaultLocale@8
|
||||||
NtQueryDirectoryFile@44
|
NtQueryDirectoryFile@44
|
||||||
|
@ -192,6 +191,7 @@ NtQueryTimerResolution@12
|
||||||
NtQueryValueKey@24
|
NtQueryValueKey@24
|
||||||
NtQueryVirtualMemory@24
|
NtQueryVirtualMemory@24
|
||||||
NtQueryVolumeInformationFile@20
|
NtQueryVolumeInformationFile@20
|
||||||
|
NtQueueApcThread@20
|
||||||
NtRaiseException@12
|
NtRaiseException@12
|
||||||
NtRaiseHardError@24
|
NtRaiseHardError@24
|
||||||
NtReadFile@36
|
NtReadFile@36
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntdll.edf,v 1.94 2003/07/24 14:25:32 royce Exp $
|
; $Id: ntdll.edf,v 1.95 2003/07/27 11:40:01 ekohl Exp $
|
||||||
;
|
;
|
||||||
; ReactOS Operating System
|
; ReactOS Operating System
|
||||||
;
|
;
|
||||||
|
@ -47,7 +47,7 @@ LdrGetProcedureAddress=LdrGetProcedureAddress@16
|
||||||
LdrInitializeThunk=LdrInitializeThunk@16
|
LdrInitializeThunk=LdrInitializeThunk@16
|
||||||
LdrLoadDll=LdrLoadDll@16
|
LdrLoadDll=LdrLoadDll@16
|
||||||
;LdrProcessRelocationBlock
|
;LdrProcessRelocationBlock
|
||||||
;LdrQueryImageFileExecutionOptions
|
LdrQueryImageFileExecutionOptions=LdrQueryImageFileExecutionOptions@24
|
||||||
LdrQueryProcessModuleInformation=LdrQueryProcessModuleInformation@12
|
LdrQueryProcessModuleInformation=LdrQueryProcessModuleInformation@12
|
||||||
LdrShutdownProcess=LdrShutdownProcess@0
|
LdrShutdownProcess=LdrShutdownProcess@0
|
||||||
LdrShutdownThread=LdrShutdownThread@0
|
LdrShutdownThread=LdrShutdownThread@0
|
||||||
|
@ -158,7 +158,6 @@ NtPrivilegedServiceAuditAlarm=NtPrivilegedServiceAuditAlarm@20
|
||||||
NtPrivilegeObjectAuditAlarm=NtPrivilegeObjectAuditAlarm@24
|
NtPrivilegeObjectAuditAlarm=NtPrivilegeObjectAuditAlarm@24
|
||||||
NtProtectVirtualMemory=NtProtectVirtualMemory@20
|
NtProtectVirtualMemory=NtProtectVirtualMemory@20
|
||||||
NtPulseEvent=NtPulseEvent@8
|
NtPulseEvent=NtPulseEvent@8
|
||||||
NtQueueApcThread=NtQueueApcThread@20
|
|
||||||
NtQueryAttributesFile=NtQueryAttributesFile@8
|
NtQueryAttributesFile=NtQueryAttributesFile@8
|
||||||
NtQueryDefaultLocale=NtQueryDefaultLocale@8
|
NtQueryDefaultLocale=NtQueryDefaultLocale@8
|
||||||
NtQueryDirectoryFile=NtQueryDirectoryFile@44
|
NtQueryDirectoryFile=NtQueryDirectoryFile@44
|
||||||
|
@ -192,6 +191,7 @@ NtQueryTimerResolution=NtQueryTimerResolution@12
|
||||||
NtQueryValueKey=NtQueryValueKey@24
|
NtQueryValueKey=NtQueryValueKey@24
|
||||||
NtQueryVirtualMemory=NtQueryVirtualMemory@24
|
NtQueryVirtualMemory=NtQueryVirtualMemory@24
|
||||||
NtQueryVolumeInformationFile=NtQueryVolumeInformationFile@20
|
NtQueryVolumeInformationFile=NtQueryVolumeInformationFile@20
|
||||||
|
NtQueueApcThread=NtQueueApcThread@20
|
||||||
NtRaiseException=NtRaiseException@12
|
NtRaiseException=NtRaiseException@12
|
||||||
NtRaiseHardError=NtRaiseHardError@24
|
NtRaiseHardError=NtRaiseHardError@24
|
||||||
NtReadFile=NtReadFile@36
|
NtReadFile=NtReadFile@36
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: utils.c,v 1.68 2003/07/26 12:44:20 hbirr Exp $
|
/* $Id: utils.c,v 1.69 2003/07/27 11:39:18 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -2066,4 +2066,173 @@ LdrVerifyImageMatchesChecksum (IN HANDLE FileHandle,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* LdrQueryImageFileExecutionOptions
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* NOTE
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
LdrQueryImageFileExecutionOptions (IN PUNICODE_STRING SubKey,
|
||||||
|
IN PCWSTR ValueName,
|
||||||
|
IN ULONG ValueSize,
|
||||||
|
OUT PVOID Buffer,
|
||||||
|
IN ULONG BufferSize,
|
||||||
|
OUT PULONG ReturnedLength OPTIONAL)
|
||||||
|
{
|
||||||
|
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING ValueNameString;
|
||||||
|
UNICODE_STRING ValueString;
|
||||||
|
UNICODE_STRING KeyName;
|
||||||
|
WCHAR NameBuffer[256];
|
||||||
|
HANDLE KeyHandle;
|
||||||
|
ULONG KeyInfoSize;
|
||||||
|
ULONG ResultSize;
|
||||||
|
PWCHAR Ptr;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
wcscpy (NameBuffer,
|
||||||
|
L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\");
|
||||||
|
Ptr = wcsrchr (SubKey->Buffer, L'\\');
|
||||||
|
if (Ptr == NULL)
|
||||||
|
{
|
||||||
|
Ptr = SubKey->Buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Ptr++;
|
||||||
|
}
|
||||||
|
wcscat (NameBuffer, Ptr);
|
||||||
|
RtlInitUnicodeString (&KeyName,
|
||||||
|
NameBuffer);
|
||||||
|
|
||||||
|
InitializeObjectAttributes (&ObjectAttributes,
|
||||||
|
&KeyName,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = NtOpenKey (&KeyHandle,
|
||||||
|
KEY_READ,
|
||||||
|
&ObjectAttributes);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1 ("NtOpenKey() failed (Status %lx)\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 32;
|
||||||
|
KeyInfo = RtlAllocateHeap (RtlGetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
KeyInfoSize);
|
||||||
|
|
||||||
|
RtlInitUnicodeString (&ValueNameString,
|
||||||
|
(PWSTR)ValueName);
|
||||||
|
Status = NtQueryValueKey (KeyHandle,
|
||||||
|
&ValueNameString,
|
||||||
|
KeyValuePartialInformation,
|
||||||
|
KeyInfo,
|
||||||
|
KeyInfoSize,
|
||||||
|
&ResultSize);
|
||||||
|
if (Status == STATUS_BUFFER_OVERFLOW)
|
||||||
|
{
|
||||||
|
KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + KeyInfo->DataLength;
|
||||||
|
RtlFreeHeap (RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
KeyInfo);
|
||||||
|
KeyInfo = RtlAllocateHeap (RtlGetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
KeyInfoSize);
|
||||||
|
if (KeyInfo == NULL)
|
||||||
|
{
|
||||||
|
NtClose (KeyHandle);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = NtQueryValueKey (KeyHandle,
|
||||||
|
&ValueNameString,
|
||||||
|
KeyValuePartialInformation,
|
||||||
|
KeyInfo,
|
||||||
|
KeyInfoSize,
|
||||||
|
&ResultSize);
|
||||||
|
}
|
||||||
|
NtClose (KeyHandle);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
if (KeyInfo != NULL)
|
||||||
|
{
|
||||||
|
RtlFreeHeap (RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
KeyInfo);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KeyInfo->Type != REG_SZ)
|
||||||
|
{
|
||||||
|
RtlFreeHeap (RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
KeyInfo);
|
||||||
|
return STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ValueSize == sizeof(ULONG))
|
||||||
|
{
|
||||||
|
if (BufferSize != sizeof(ULONG))
|
||||||
|
{
|
||||||
|
ResultSize = 0;
|
||||||
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResultSize = sizeof(ULONG);
|
||||||
|
ValueString.Length = (USHORT)KeyInfo->DataLength - sizeof(WCHAR);
|
||||||
|
ValueString.MaximumLength = (USHORT)KeyInfo->DataLength;
|
||||||
|
ValueString.Buffer = (PWSTR)&KeyInfo->Data;
|
||||||
|
Status = RtlUnicodeStringToInteger (&ValueString,
|
||||||
|
0,
|
||||||
|
Buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResultSize = BufferSize;
|
||||||
|
if (ResultSize < KeyInfo->DataLength)
|
||||||
|
{
|
||||||
|
Status = STATUS_BUFFER_OVERFLOW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResultSize = KeyInfo->DataLength;
|
||||||
|
}
|
||||||
|
RtlCopyMemory (Buffer,
|
||||||
|
&KeyInfo->Data,
|
||||||
|
ResultSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlFreeHeap (RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
KeyInfo);
|
||||||
|
|
||||||
|
if (ReturnedLength != NULL)
|
||||||
|
{
|
||||||
|
*ReturnedLength = ResultSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
STUB(KiRaiseUserExceptionDispatcher)
|
STUB(KiRaiseUserExceptionDispatcher)
|
||||||
STUB(LdrEnumResources)
|
STUB(LdrEnumResources)
|
||||||
STUB(LdrProcessRelocationBlock)
|
STUB(LdrProcessRelocationBlock)
|
||||||
STUB(LdrQueryImageFileExecutionOptions)
|
|
||||||
STUB(NPXEMULATORTABLE)
|
STUB(NPXEMULATORTABLE)
|
||||||
STUB(PfxFindPrefix)
|
STUB(PfxFindPrefix)
|
||||||
STUB(PfxInitialize)
|
STUB(PfxInitialize)
|
||||||
|
|
Loading…
Reference in a new issue