ReactOS  0.4.15-dev-3217-gc6d1646
message.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for message.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI RtlFindMessage (IN PVOID BaseAddress, IN ULONG Type, IN ULONG Language, IN ULONG MessageId, OUT PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry)
 
NTSTATUS NTAPI RtlFormatMessageEx (IN PWSTR Message, IN ULONG MaxWidth OPTIONAL, IN BOOLEAN IgnoreInserts, IN BOOLEAN ArgumentsAreAnsi, IN BOOLEAN ArgumentsAreAnArray, IN va_list *Arguments, OUT PWSTR Buffer, IN ULONG BufferSize, OUT PULONG ReturnLength OPTIONAL, IN ULONG Flags)
 
NTSTATUS NTAPI RtlFormatMessage (IN PWSTR Message, IN ULONG MaxWidth OPTIONAL, IN BOOLEAN IgnoreInserts, IN BOOLEAN ArgumentsAreAnsi, IN BOOLEAN ArgumentsAreAnArray, IN va_list *Arguments, OUT PWSTR Buffer, IN ULONG BufferSize, OUT PULONG ReturnLength OPTIONAL)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file message.c.

Function Documentation

◆ RtlFindMessage()

NTSTATUS NTAPI RtlFindMessage ( IN PVOID  BaseAddress,
IN ULONG  Type,
IN ULONG  Language,
IN ULONG  MessageId,
OUT PMESSAGE_RESOURCE_ENTRY MessageResourceEntry 
)

Definition at line 23 of file message.c.

29 {
30  LDR_RESOURCE_INFO ResourceInfo;
31  PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
32  PMESSAGE_RESOURCE_DATA MessageTable;
34  ULONG EntryOffset = 0, IdOffset = 0;
35  PMESSAGE_RESOURCE_ENTRY MessageEntry;
36  ULONG i;
37 
38  DPRINT("RtlFindMessage()\n");
39 
40  ResourceInfo.Type = Type;
41  ResourceInfo.Name = 1;
42  ResourceInfo.Language = Language;
43 
45  &ResourceInfo,
47  &ResourceDataEntry);
48  if (!NT_SUCCESS(Status))
49  {
50  return Status;
51  }
52 
53  DPRINT("ResourceDataEntry: %p\n", ResourceDataEntry);
54 
56  ResourceDataEntry,
57  (PVOID*)&MessageTable,
58  NULL);
59  if (!NT_SUCCESS(Status))
60  {
61  return Status;
62  }
63 
64  DPRINT("MessageTable: %p\n", MessageTable);
65 
66  DPRINT("NumberOfBlocks %lu\n", MessageTable->NumberOfBlocks);
67  for (i = 0; i < MessageTable->NumberOfBlocks; i++)
68  {
69  DPRINT("LoId 0x%08lx HiId 0x%08lx Offset 0x%08lx\n",
70  MessageTable->Blocks[i].LowId,
71  MessageTable->Blocks[i].HighId,
72  MessageTable->Blocks[i].OffsetToEntries);
73  }
74 
75  for (i = 0; i < MessageTable->NumberOfBlocks; i++)
76  {
77  if ((MessageId >= MessageTable->Blocks[i].LowId) &&
78  (MessageId <= MessageTable->Blocks[i].HighId))
79  {
80  EntryOffset = MessageTable->Blocks[i].OffsetToEntries;
81  IdOffset = MessageId - MessageTable->Blocks[i].LowId;
82  break;
83  }
84 
85  if (MessageId < MessageTable->Blocks[i].LowId)
86  {
88  }
89  }
90 
91  if (MessageTable->NumberOfBlocks <= i)
92  {
94  }
95 
96  MessageEntry = (PMESSAGE_RESOURCE_ENTRY)
97  ((PUCHAR)MessageTable + MessageTable->Blocks[i].OffsetToEntries);
98 
99  DPRINT("EntryOffset 0x%08lx\n", EntryOffset);
100  DPRINT("IdOffset 0x%08lx\n", IdOffset);
101 
102  DPRINT("MessageEntry: %p\n", MessageEntry);
103  for (i = 0; i < IdOffset; i++)
104  {
105  MessageEntry = (PMESSAGE_RESOURCE_ENTRY)
106  ((PUCHAR)MessageEntry + (ULONG)MessageEntry->Length);
107  }
108 
109  if (MessageEntry->Flags == 0)
110  {
111  DPRINT("AnsiText: %s\n", MessageEntry->Text);
112  }
113  else
114  {
115  DPRINT("UnicodeText: %S\n", (PWSTR)MessageEntry->Text);
116  }
117 
118  if (MessageResourceEntry != NULL)
119  {
120  *MessageResourceEntry = MessageEntry;
121  }
122 
123  return STATUS_SUCCESS;
124 }
Definition: rtltypes.h:1891
uint16_t * PWSTR
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
USHORT Flags
Definition: rtltypes.h:1894
ULONG_PTR Type
Definition: ldrtypes.h:181
struct _MESSAGE_RESOURCE_ENTRY * PMESSAGE_RESOURCE_ENTRY
ULONG_PTR Name
Definition: ldrtypes.h:182
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)
Status
Definition: gdiplustypes.h:24
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
UCHAR Text[ANYSIZE_ARRAY]
Definition: rtltypes.h:1895
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Type
Definition: Type.h:6
USHORT Length
Definition: rtltypes.h:1893
#define RESOURCE_DATA_LEVEL
Definition: ldrtypes.h:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY]
Definition: rtltypes.h:1908
#define NULL
Definition: types.h:112
ULONG_PTR Language
Definition: ldrtypes.h:183
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define STATUS_MESSAGE_NOT_FOUND
Definition: ntstatus.h:501

◆ RtlFormatMessage()

NTSTATUS NTAPI RtlFormatMessage ( IN PWSTR  Message,
IN ULONG MaxWidth  OPTIONAL,
IN BOOLEAN  IgnoreInserts,
IN BOOLEAN  ArgumentsAreAnsi,
IN BOOLEAN  ArgumentsAreAnArray,
IN va_list Arguments,
OUT PWSTR  Buffer,
IN ULONG  BufferSize,
OUT PULONG ReturnLength  OPTIONAL 
)

Definition at line 175 of file message.c.

185 {
186  /* Call the extended API */
188  MaxWidth,
189  IgnoreInserts,
190  ArgumentsAreAnsi,
191  ArgumentsAreAnArray,
192  Arguments,
193  Buffer,
194  BufferSize,
195  ReturnLength,
196  0);
197 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
Definition: bufpool.h:45
CHAR Message[80]
Definition: alive.c:5
NTSTATUS NTAPI RtlFormatMessageEx(IN PWSTR Message, IN ULONG MaxWidth OPTIONAL, IN BOOLEAN IgnoreInserts, IN BOOLEAN ArgumentsAreAnsi, IN BOOLEAN ArgumentsAreAnArray, IN va_list *Arguments, OUT PWSTR Buffer, IN ULONG BufferSize, OUT PULONG ReturnLength OPTIONAL, IN ULONG Flags)
Definition: message.c:131
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

◆ RtlFormatMessageEx()

NTSTATUS NTAPI RtlFormatMessageEx ( IN PWSTR  Message,
IN ULONG MaxWidth  OPTIONAL,
IN BOOLEAN  IgnoreInserts,
IN BOOLEAN  ArgumentsAreAnsi,
IN BOOLEAN  ArgumentsAreAnArray,
IN va_list Arguments,
OUT PWSTR  Buffer,
IN ULONG  BufferSize,
OUT PULONG ReturnLength  OPTIONAL,
IN ULONG  Flags 
)

Definition at line 131 of file message.c.

142 {
143  DPRINT1("RtlFormatMessage(%S, %lu, %s, %s, %s, %p, %p, %lu, %p, %lx)\n",
144  Message, MaxWidth, IgnoreInserts ? "TRUE" : "FALSE", ArgumentsAreAnsi ? "TRUE" : "FALSE",
145  ArgumentsAreAnArray ? "TRUE" : "FALSE", Arguments, Buffer, BufferSize,
147 
149  return STATUS_NOT_IMPLEMENTED;
150 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
return STATUS_NOT_IMPLEMENTED
Definition: bufpool.h:45
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
CHAR Message[80]
Definition: alive.c:5
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:115
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by RtlFormatMessage().