ReactOS  0.4.15-dev-3173-g40ee59d
LdrEnumResources.c File Reference
#include "precomp.h"
#include <pseh/pseh2.h>
Include dependency graph for LdrEnumResources.c:

Go to the source code of this file.

Classes

struct  _TEST_RESOURCES
 
struct  _TEST_IMAGE
 

Macros

#define ok_nwstr(str1, str2, count)
 
#define ok_enumres(_Res, _Type, _Name, _Lang, _Data, _Size)
 

Typedefs

typedef struct _TEST_RESOURCES TEST_RESOURCES
 
typedef struct _TEST_RESOURCESPTEST_RESOURCES
 
typedef struct _TEST_IMAGE TEST_IMAGE
 
typedef struct _TEST_IMAGEPTEST_IMAGE
 

Functions

static VOID InitializeResourceDirectory (PIMAGE_RESOURCE_DIRECTORY ResourceDirectory, USHORT NumberOfNamedEntries, USHORT NumberOfIdEntries)
 
static VOID InitializeNamedEntry (PTEST_RESOURCES Resource, PIMAGE_RESOURCE_DIRECTORY_ENTRY DirEntry, PWCHAR Name, PVOID Data)
 
static VOID InitializeIdEntry (PTEST_RESOURCES Resource, PIMAGE_RESOURCE_DIRECTORY_ENTRY DirEntry, USHORT Id, PVOID Data)
 
static VOID InitializeDataEntry (PVOID ImageBase, PIMAGE_RESOURCE_DATA_ENTRY DataEntry, PVOID Data, ULONG Size)
 
static VOID InitializeTestResource (PVOID ImageBase, PTEST_RESOURCES Resource)
 
VOID InitializeTestImage (PTEST_IMAGE TestImage)
 
static void Test_Data (PTEST_IMAGE TestImage)
 
static void Test_Parameters (PTEST_IMAGE TestImage)
 
 START_TEST (LdrEnumResources)
 

Macro Definition Documentation

◆ ok_enumres

#define ok_enumres (   _Res,
  _Type,
  _Name,
  _Lang,
  _Data,
  _Size 
)
Value:
ok_dec((_Res)->Type, _Type); \
if ((ULONG_PTR)(_Name) > 0xFFFF) \
{ \
ok_dec(*(WORD*)((_Res)->Name), wcslen((PWCHAR)(_Name))); \
ok_nwstr((PWCHAR)((_Res)->Name + 2), (PWCHAR)_Name, *(WORD*)((_Res)->Name)); \
} \
else \
{ \
ok_dec((_Res)->Name, (ULONG_PTR)_Name); \
} \
ok_hex((_Res)->Language, _Lang); \
ok_ptr((PVOID)(_Res)->Data, _Data); \
ok_dec((_Res)->Size, _Size); \
ok_dec((_Res)->Reserved, 0);
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
unsigned short WORD
Definition: ntddk_ex.h:93
Type
Definition: Type.h:6
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Size
Definition: malloc.h:108
#define ok_dec(expression, result)
Definition: atltest.h:101

Definition at line 201 of file LdrEnumResources.c.

◆ ok_nwstr

#define ok_nwstr (   str1,
  str2,
  count 
)
Value:
ok(wcsncmp((PWCHAR)str1, (PWCHAR)str2, count) == 0, \
"string is wrong, expected: '%S', got '%S'\n", str1, str2); \
GLuint GLuint GLsizei count
Definition: gl.h:1545
uint16_t * PWCHAR
Definition: typedefs.h:56
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define ok(value,...)
Definition: atltest.h:57

Definition at line 197 of file LdrEnumResources.c.

Typedef Documentation

◆ PTEST_IMAGE

◆ PTEST_RESOURCES

◆ TEST_IMAGE

◆ TEST_RESOURCES

Function Documentation

◆ InitializeDataEntry()

static VOID InitializeDataEntry ( PVOID  ImageBase,
PIMAGE_RESOURCE_DATA_ENTRY  DataEntry,
PVOID  Data,
ULONG  Size 
)
static

Definition at line 92 of file LdrEnumResources.c.

97 {
98 
99  DataEntry->OffsetToData = (PUCHAR)Data - (PUCHAR)ImageBase;
100  DataEntry->Size = Size;
101  DataEntry->CodePage = 0;
102  DataEntry->Reserved = 0;
103 }
DWORD CodePage
Definition: pedump.c:461
unsigned char * PUCHAR
Definition: retypes.h:3
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
DWORD OffsetToData
Definition: pedump.c:459
DWORD Reserved
Definition: pedump.c:462
DWORD Size
Definition: pedump.c:460

Referenced by InitializeTestResource().

◆ InitializeIdEntry()

static VOID InitializeIdEntry ( PTEST_RESOURCES  Resource,
PIMAGE_RESOURCE_DIRECTORY_ENTRY  DirEntry,
USHORT  Id,
PVOID  Data 
)
static

Definition at line 77 of file LdrEnumResources.c.

82 {
83  DirEntry->Name = Id;
84  DirEntry->NameIsString = 0;
85  DirEntry->OffsetToData = (PUCHAR)Data - (PUCHAR)Resource;
86  if (DirEntry < Resource->Lang1Entries)
87  DirEntry->DataIsDirectory = 1;
88 }
unsigned char * PUCHAR
Definition: retypes.h:3
DWORD Id
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843

Referenced by InitializeTestResource().

◆ InitializeNamedEntry()

static VOID InitializeNamedEntry ( PTEST_RESOURCES  Resource,
PIMAGE_RESOURCE_DIRECTORY_ENTRY  DirEntry,
PWCHAR  Name,
PVOID  Data 
)
static

Definition at line 59 of file LdrEnumResources.c.

64 {
65  DirEntry->Name = Resource->StringIndex * 2 + FIELD_OFFSET(TEST_RESOURCES, StringBuffer);
66  DirEntry->NameIsString = 1;
67  DirEntry->OffsetToData = (PUCHAR)Data - (PUCHAR)Resource;
68  if (DirEntry < Resource->Lang1Entries)
69  DirEntry->DataIsDirectory = 1;
70  Resource->StringBuffer[Resource->StringIndex] = (USHORT)wcslen(Name);
71  wcscpy(&Resource->StringBuffer[Resource->StringIndex + 1], Name);
72  Resource->StringIndex += Resource->StringBuffer[Resource->StringIndex] * 2 + 1;
73 }
unsigned char * PUCHAR
Definition: retypes.h:3
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
WCHAR StringBuffer[156]
Definition: ldrinit.c:41

Referenced by InitializeTestResource().

◆ InitializeResourceDirectory()

static VOID InitializeResourceDirectory ( PIMAGE_RESOURCE_DIRECTORY  ResourceDirectory,
USHORT  NumberOfNamedEntries,
USHORT  NumberOfIdEntries 
)
static

Definition at line 44 of file LdrEnumResources.c.

48 {
49  ResourceDirectory->Characteristics = 0;
50  ResourceDirectory->TimeDateStamp = 0;
51  ResourceDirectory->MajorVersion = 0;
52  ResourceDirectory->MinorVersion = 0;
53  ResourceDirectory->NumberOfNamedEntries = NumberOfNamedEntries;
54  ResourceDirectory->NumberOfIdEntries = NumberOfIdEntries;
55 }

Referenced by InitializeTestResource().

◆ InitializeTestImage()

VOID InitializeTestImage ( PTEST_IMAGE  TestImage)

Definition at line 155 of file LdrEnumResources.c.

157 {
158  PIMAGE_DATA_DIRECTORY ResourceDirectory;
159 
161  TestImage->DosHeader.e_lfanew = sizeof(IMAGE_DOS_HEADER);
162 
164 
166  TestImage->NtHeaders.FileHeader.NumberOfSections = 1;
167  TestImage->NtHeaders.FileHeader.TimeDateStamp = 0;
169  TestImage->NtHeaders.FileHeader.NumberOfSymbols = 0;
171  TestImage->NtHeaders.FileHeader.Characteristics = 0;
172 
174  TestImage->NtHeaders.OptionalHeader.ImageBase = (DWORD_PTR)TestImage;
175  TestImage->NtHeaders.OptionalHeader.SizeOfImage = sizeof(TEST_IMAGE);
178 
179  ResourceDirectory = &TestImage->NtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE];
180  ResourceDirectory->VirtualAddress = FIELD_OFFSET(TEST_IMAGE, Resources);
181  ResourceDirectory->Size = sizeof(TEST_RESOURCES);
182 
183  strcpy((char*)TestImage->SectionHeaders[0].Name, ".rsrc");
184  TestImage->SectionHeaders[0].Misc.VirtualSize = sizeof(TEST_IMAGE);
186  TestImage->SectionHeaders[0].SizeOfRawData = sizeof(TEST_IMAGE);
188  TestImage->SectionHeaders[0].PointerToRelocations = 0;
189  TestImage->SectionHeaders[0].PointerToLinenumbers = 0;
190  TestImage->SectionHeaders[0].NumberOfRelocations = 0;
191  TestImage->SectionHeaders[0].NumberOfLinenumbers = 0;
192  TestImage->SectionHeaders[0].Characteristics = 0;
193 
194  InitializeTestResource(TestImage, &TestImage->Resources);
195 }
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
#define DWORD_PTR
Definition: treelist.c:76
WORD NumberOfRelocations
Definition: pedump.c:293
union _IMAGE_SECTION_HEADER::@1509 Misc
struct _TEST_IMAGE TEST_IMAGE
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
Definition: ntimage.h:376
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD PointerToRawData
Definition: pedump.c:290
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
TEST_RESOURCES Resources
WORD SizeOfOptionalHeader
Definition: ntddk_ex.h:127
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
struct _IMAGE_OPTIONAL_HEADER IMAGE_OPTIONAL_HEADER
WORD NumberOfLinenumbers
Definition: pedump.c:294
DWORD NumberOfSymbols
Definition: ntddk_ex.h:126
IMAGE_NT_HEADERS NtHeaders
DWORD PointerToLinenumbers
Definition: pedump.c:292
IMAGE_DOS_HEADER DosHeader
struct _TEST_RESOURCES TEST_RESOURCES
static VOID InitializeTestResource(PVOID ImageBase, PTEST_RESOURCES Resource)
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
DWORD PointerToSymbolTable
Definition: ntddk_ex.h:125
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
IMAGE_SECTION_HEADER SectionHeaders[1]
BYTE Name[IMAGE_SIZEOF_SHORT_NAME]
Definition: pedump.c:281
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
DWORD PointerToRelocations
Definition: pedump.c:291

Referenced by Test_Data(), and Test_Parameters().

◆ InitializeTestResource()

static VOID InitializeTestResource ( PVOID  ImageBase,
PTEST_RESOURCES  Resource 
)
static

Definition at line 107 of file LdrEnumResources.c.

110 {
111 
112  memset(Resource->StringBuffer, 0, sizeof(Resource->StringBuffer));
113  Resource->StringIndex = 0;
114 
115  InitializeResourceDirectory(&Resource->TypeDirectory, 0, 2);
116  InitializeIdEntry(Resource, &Resource->TypeEntries[0], 1, &Resource->Name1Directory);
117  InitializeIdEntry(Resource, &Resource->TypeEntries[1], 2, &Resource->Name2Directory);
118 
119  InitializeResourceDirectory(&Resource->Name1Directory, 1, 1);
120  InitializeNamedEntry(Resource, &Resource->Name1Entries[0], L"TEST", &Resource->Lang1Directory);
121  InitializeIdEntry(Resource, &Resource->Name1Entries[1], 7, &Resource->Lang2Directory);
122 
123  InitializeResourceDirectory(&Resource->Name2Directory, 2, 0);
124  InitializeNamedEntry(Resource, &Resource->Name2Entries[0], L"LOL", &Resource->Lang3Directory);
125  InitializeNamedEntry(Resource, &Resource->Name2Entries[1], L"xD", &Resource->Lang4Directory);
126 
127  InitializeResourceDirectory(&Resource->Lang1Directory, 0, 2);
128  InitializeIdEntry(Resource, &Resource->Lang1Entries[0], 0x409, &Resource->DataEntries[0]);
129  InitializeIdEntry(Resource, &Resource->Lang1Entries[1], 0x407, &Resource->DataEntries[1]);
130 
131  InitializeResourceDirectory(&Resource->Lang2Directory, 0, 2);
132  InitializeIdEntry(Resource, &Resource->Lang2Entries[0], 0x408, &Resource->DataEntries[2]);
133  InitializeIdEntry(Resource, &Resource->Lang2Entries[1], 0x406, &Resource->DataEntries[3]);
134 
135  InitializeResourceDirectory(&Resource->Lang3Directory, 0, 2);
136  InitializeIdEntry(Resource, &Resource->Lang3Entries[0], 0x405, &Resource->DataEntries[4]);
137  InitializeIdEntry(Resource, &Resource->Lang3Entries[1], 0x403, &Resource->DataEntries[5]);
138 
139  InitializeResourceDirectory(&Resource->Lang4Directory, 0, 2);
140  InitializeIdEntry(Resource, &Resource->Lang4Entries[0], 0x402, &Resource->DataEntries[6]);
141  InitializeIdEntry(Resource, &Resource->Lang4Entries[1], 0x404, &Resource->DataEntries[7]);
142 
143  InitializeDataEntry(ImageBase, &Resource->DataEntries[0], Resource->StringBuffer + 0, 2);
144  InitializeDataEntry(ImageBase, &Resource->DataEntries[1], Resource->StringBuffer + 2, 4);
145  InitializeDataEntry(ImageBase, &Resource->DataEntries[2], Resource->StringBuffer + 4, 6);
146  InitializeDataEntry(ImageBase, &Resource->DataEntries[3], Resource->StringBuffer + 6, 8);
147  InitializeDataEntry(ImageBase, &Resource->DataEntries[4], Resource->StringBuffer + 8, 10);
148  InitializeDataEntry(ImageBase, &Resource->DataEntries[5], Resource->StringBuffer + 10, 12);
149  InitializeDataEntry(ImageBase, &Resource->DataEntries[6], Resource->StringBuffer + 12, 14);
150  InitializeDataEntry(ImageBase, &Resource->DataEntries[7], Resource->StringBuffer + 14, 16);
151 
152 }
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
static VOID InitializeIdEntry(PTEST_RESOURCES Resource, PIMAGE_RESOURCE_DIRECTORY_ENTRY DirEntry, USHORT Id, PVOID Data)
static const WCHAR L[]
Definition: oid.c:1250
static VOID InitializeResourceDirectory(PIMAGE_RESOURCE_DIRECTORY ResourceDirectory, USHORT NumberOfNamedEntries, USHORT NumberOfIdEntries)
static VOID InitializeDataEntry(PVOID ImageBase, PIMAGE_RESOURCE_DATA_ENTRY DataEntry, PVOID Data, ULONG Size)
static VOID InitializeNamedEntry(PTEST_RESOURCES Resource, PIMAGE_RESOURCE_DIRECTORY_ENTRY DirEntry, PWCHAR Name, PVOID Data)
#define memset(x, y, z)
Definition: compat.h:39

Referenced by InitializeTestImage().

◆ START_TEST()

START_TEST ( LdrEnumResources  )

Definition at line 362 of file LdrEnumResources.c.

363 {
364  TEST_IMAGE TestImage;
365  RtlZeroMemory(&TestImage, sizeof(TestImage));
366 
367  Test_Parameters(&TestImage);
368  Test_Data(&TestImage);
369 
370 }
static void Test_Parameters(PTEST_IMAGE TestImage)
static void Test_Data(PTEST_IMAGE TestImage)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ Test_Data()

static void Test_Data ( PTEST_IMAGE  TestImage)
static

Definition at line 219 of file LdrEnumResources.c.

220 {
221  LDR_RESOURCE_INFO ResourceInfo;
222  LDR_ENUM_RESOURCE_INFO EnumRes[8];
225 
226  InitializeTestImage(TestImage);
227 
228  memset(EnumRes, 0xcc, sizeof(EnumRes));
229 
230  ResourceInfo.Type = 1;
231  ResourceInfo.Name = 1;
232  ResourceInfo.Language = 0x408;
233  ResourceCount = 8;
234  Status = LdrEnumResources(TestImage, &ResourceInfo, 0, &ResourceCount, EnumRes);
236  ok_dec(ResourceCount, 8);
237 
238  ok_ptr((PVOID)EnumRes[0].Data, TestImage->Resources.StringBuffer);
239  ok_dec(EnumRes[0].Size, 2);
240 
241  ok_enumres(&EnumRes[0], 1, L"TEST", 0x409, TestImage->Resources.StringBuffer, 2)
242  ok_enumres(&EnumRes[1], 1, L"TEST", 0x407, TestImage->Resources.StringBuffer + 2, 4)
243  ok_enumres(&EnumRes[2], 1, 7, 0x408, TestImage->Resources.StringBuffer + 4, 6)
244  ok_enumres(&EnumRes[3], 1, 7, 0x406, TestImage->Resources.StringBuffer + 6, 8)
245  ok_enumres(&EnumRes[4], 2, L"LOL", 0x405, TestImage->Resources.StringBuffer + 8, 10)
246  ok_enumres(&EnumRes[5], 2, L"LOL", 0x403, TestImage->Resources.StringBuffer + 10, 12)
247  ok_enumres(&EnumRes[6], 2, L"xD", 0x402, TestImage->Resources.StringBuffer + 12, 14)
248  ok_enumres(&EnumRes[7], 2, L"xD", 0x404, TestImage->Resources.StringBuffer + 14, 16)
249 
250  Status = LdrEnumResources(TestImage, &ResourceInfo, 1, &ResourceCount, EnumRes);
252  ok_dec(ResourceCount, 4);
253 
254 }
NTSTATUS NTAPI LdrEnumResources(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Inout_ ULONG *ResourceCount, _Out_writes_to_(*ResourceCount, *ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources)
Definition: res.c:343
WCHAR StringBuffer[20]
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define ok_ptr(expression, result)
Definition: atltest.h:108
#define ok_enumres(_Res, _Type, _Name, _Lang, _Data, _Size)
#define ok_hex(expression, result)
Definition: atltest.h:94
ULONG_PTR Type
Definition: ldrtypes.h:181
TEST_RESOURCES Resources
ULONG_PTR Name
Definition: ldrtypes.h:182
Status
Definition: gdiplustypes.h:24
VOID InitializeTestImage(PTEST_IMAGE TestImage)
static ULONG ResourceCount
Definition: inbv.c:92
static const WCHAR L[]
Definition: oid.c:1250
Definition: comm.c:64
ULONG_PTR Language
Definition: ldrtypes.h:183
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define memset(x, y, z)
Definition: compat.h:39
#define ok_dec(expression, result)
Definition: atltest.h:101
WCHAR StringBuffer[156]
Definition: ldrinit.c:41

Referenced by START_TEST().

◆ Test_Parameters()

static void Test_Parameters ( PTEST_IMAGE  TestImage)
static

Definition at line 259 of file LdrEnumResources.c.

260 {
261  LDR_RESOURCE_INFO ResourceInfo;
265 
266  InitializeTestImage(TestImage);
267 
268  ResourceInfo.Type = 6;
269  ResourceInfo.Name = 1;
270  ResourceInfo.Language = 0x409;
271 
272  ResourceCount = 8;
273  Status = LdrEnumResources(TestImage, &ResourceInfo, 3, &ResourceCount, Resources);
275  ok_dec(ResourceCount, 0);
276 
277  ResourceInfo.Type = 1;
278  ResourceInfo.Name = 7;
279  ResourceInfo.Language = 0x406;
280  ResourceCount = 8;
281  Status = LdrEnumResources(TestImage, &ResourceInfo, 0, &ResourceCount, Resources);
283  ok_dec(ResourceCount, 8);
284 
285  ResourceCount = 8;
286  Status = LdrEnumResources(TestImage, &ResourceInfo, 1, &ResourceCount, Resources);
288  ok_dec(ResourceCount, 4);
289 
290  ResourceCount = 8;
291  Status = LdrEnumResources(TestImage, &ResourceInfo, 2, &ResourceCount, Resources);
293  ok_dec(ResourceCount, 2);
294 
295  ResourceCount = 8;
296  Status = LdrEnumResources(TestImage, &ResourceInfo, 3, &ResourceCount, Resources);
298  ok_dec(ResourceCount, 1);
299 
300  ResourceCount = 8;
301  Status = LdrEnumResources(TestImage, &ResourceInfo, 99, &ResourceCount, Resources);
303  ok_dec(ResourceCount, 1);
304 
305  ResourceCount = 0;
306  Status = LdrEnumResources(TestImage, &ResourceInfo, 0, &ResourceCount, Resources);
308  ok_dec(ResourceCount, 8);
309 
310  ResourceCount = 7;
311  Status = LdrEnumResources(TestImage, &ResourceInfo, 0, &ResourceCount, Resources);
313  ok_dec(ResourceCount, 8);
314 
315  ResourceCount = 8;
316  Status = LdrEnumResources(NULL, &ResourceInfo, 1, &ResourceCount, Resources);
318  ok_dec(ResourceCount, 0);
319 
320  ResourceCount = 8;
321  Status = LdrEnumResources(TestImage, &ResourceInfo, 1, &ResourceCount, NULL);
323  ok_dec(ResourceCount, 4);
324 
325  ResourceCount = 8;
326  _SEH2_TRY
327  {
329  }
331  {
332  Status = 0xDeadC0de;
333  }
334  _SEH2_END
335  ok_hex(Status, 0xDeadC0de);
336 
337  ResourceCount = 42;
338  _SEH2_TRY
339  {
340  Status = LdrEnumResources(TestImage, &ResourceInfo, 1, NULL, Resources);
341  }
343  {
344  Status = 0xDeadC0de;
345  }
346  _SEH2_END
347  ok_hex(Status, 0xDeadC0de);
348  ok_dec(ResourceCount, 42);
349 
350  ResourceCount = 8;
351  Status = LdrEnumResources(TestImage + 2, &ResourceInfo, 1, &ResourceCount, NULL);
353  ok_dec(ResourceCount, 0);
354 
355  TestImage->Resources.TypeEntries[0].DataIsDirectory = 0;
356  Status = LdrEnumResources(TestImage, &ResourceInfo, 1, &ResourceCount, NULL);
358  ok_dec(ResourceCount, 0);
359 
360 }
NTSTATUS NTAPI LdrEnumResources(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Inout_ ULONG *ResourceCount, _Out_writes_to_(*ResourceCount, *ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources)
Definition: res.c:343
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
#define ok_hex(expression, result)
Definition: atltest.h:94
ULONG_PTR Type
Definition: ldrtypes.h:181
_SEH2_TRY
Definition: create.c:4226
TEST_RESOURCES Resources
ULONG_PTR Name
Definition: ldrtypes.h:182
Status
Definition: gdiplustypes.h:24
IMAGE_RESOURCE_DIRECTORY_ENTRY TypeEntries[2]
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:359
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
VOID InitializeTestImage(PTEST_IMAGE TestImage)
static ULONG ResourceCount
Definition: inbv.c:92
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:373
_SEH2_END
Definition: create.c:4400
ULONG DataIsDirectory
Definition: ntimage.h:195
#define NULL
Definition: types.h:112
ULONG_PTR Language
Definition: ldrtypes.h:183
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ok_dec(expression, result)
Definition: atltest.h:101

Referenced by START_TEST().