ReactOS  0.4.14-dev-593-g1793dcc
ntverrsrc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NTSTATUS NtGetVersionResource (IN PVOID BaseAddress, OUT PVOID *Resource, OUT PULONG ResourceSize OPTIONAL)
 
NTSTATUS NtVerQueryValue (IN const VOID *pBlock, IN PCWSTR lpSubBlock, OUT PVOID *lplpBuffer, OUT PUINT puLen)
 

Function Documentation

◆ NtGetVersionResource()

NTSTATUS NtGetVersionResource ( IN PVOID  BaseAddress,
OUT PVOID Resource,
OUT PULONG ResourceSize  OPTIONAL 
)

Definition at line 26 of file ntverrsrc.c.

30 {
31 // #define RT_VERSION MAKEINTRESOURCE(16) // See winuser.h
32 #define VS_VERSION_INFO 1 // See psdk/verrsrc.h
33 #define VS_FILE_INFO RT_VERSION
34 
36  LDR_RESOURCE_INFO ResourceInfo;
37  PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
38  PVOID Data = NULL;
39  ULONG Size = 0;
40 
41  /* Try to find the resource */
42  ResourceInfo.Type = 16; // RT_VERSION;
43  ResourceInfo.Name = VS_VERSION_INFO; // MAKEINTRESOURCEW(VS_VERSION_INFO);
44  ResourceInfo.Language = 0; // Don't care about the language
45 
47  &ResourceInfo,
49  &ResourceDataEntry);
50  if (!NT_SUCCESS(Status))
51  {
52  DPRINT1("NtGetVersionResource: Version resource not found, Status 0x%08lx\n", Status);
53  return Status;
54  }
55 
56  /* Access the resource */
58  ResourceDataEntry,
59  &Data,
60  &Size);
61  if (!NT_SUCCESS(Status))
62  {
63  DPRINT1("NtGetVersionResource: Cannot access Version resource, Status 0x%08lx\n", Status);
64  return Status;
65  }
66 
67  *Resource = Data;
68  if (ResourceSize) *ResourceSize = Size;
69 
70  return STATUS_SUCCESS;
71 }
LONG NTSTATUS
Definition: precomp.h:26
ULONG_PTR Type
Definition: ldrtypes.h:181
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
ULONG_PTR Name
Definition: ldrtypes.h:182
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
Definition: pedump.c:457
NTSTATUS NTAPI LdrFindResource_U(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry)
NTSTATUS NTAPI LdrAccessResource(_In_ PVOID BaseAddress, _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry, _Out_opt_ PVOID *Resource, _Out_opt_ PULONG Size)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define RESOURCE_DATA_LEVEL
Definition: ldrtypes.h:33
#define VS_VERSION_INFO
#define DPRINT1
Definition: precomp.h:8
ULONG_PTR Language
Definition: ldrtypes.h:183
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CheckForValidPEAndVendor().

◆ NtVerQueryValue()

NTSTATUS NtVerQueryValue ( IN const VOID pBlock,
IN PCWSTR  lpSubBlock,
OUT PVOID lplpBuffer,
OUT PUINT  puLen 
)

Definition at line 174 of file ntverrsrc.c.

179 {
181 
182  DPRINT("%s (%p, %S, %p, %p)\n", __FUNCTION__, pBlock, lpSubBlock, lplpBuffer, puLen);
183 
184  if (!pBlock)
185  return FALSE;
186 
187  if (!lpSubBlock || !*lpSubBlock)
188  lpSubBlock = L"\\";
189 
190  return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL);
191 }
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static NTSTATUS VersionInfo32_QueryValue(IN PCVS_VERSION_INFO_STRUCT32 info, IN PCWSTR lpSubBlock, OUT PVOID *lplpBuffer, OUT PUINT puLen OPTIONAL, OUT BOOL *pbText OPTIONAL)
Definition: ntverrsrc.c:124
static const WCHAR L[]
Definition: oid.c:1250
#define __FUNCTION__
Definition: types.h:112

Referenced by CheckForValidPEAndVendor().