ReactOS  0.4.12-dev-685-gf36cbf7
compat.c File Reference
#include "dbghelp_private.h"
Include dependency graph for compat.c:

Go to the source code of this file.

Functions

void__HeapAlloc (int heap, int flags, size_t size)
 
void__HeapReAlloc (int heap, DWORD d2, void *slab, SIZE_T newsize)
 
WCHARlstrcpynW (WCHAR *lpString1, const WCHAR *lpString2, int iMaxLength)
 
PIMAGE_NT_HEADERS __RtlImageNtHeader (void *data)
 
PIMAGE_SECTION_HEADER __RtlImageRvaToSection (const IMAGE_NT_HEADERS *NtHeader, PVOID BaseAddress, ULONG Rva)
 
PVOID __RtlImageRvaToVa (const IMAGE_NT_HEADERS *NtHeader, PVOID BaseAddress, ULONG Rva, PIMAGE_SECTION_HEADER *SectionHeader)
 
PVOID __RtlImageDirectoryEntryToData (PVOID BaseAddress, BOOLEAN MappedAsImage, USHORT Directory, PULONG Size)
 
BOOL __GetFileSizeEx (HANDLE file, PLARGE_INTEGER fsize)
 
BOOL __CloseHandle (HANDLE handle)
 
HANDLE __CreateFileW (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
 
void__MapViewOfFile (HANDLE file, DWORD d1, DWORD d2, DWORD d3, SIZE_T s)
 
BOOL __UnmapViewOfFile (const void *data)
 
LPSTR __lstrcpynA (LPSTR d, LPCSTR s, int c)
 
INT __WideCharToMultiByte (UINT page, DWORD flags, LPCWSTR src, INT srclen, LPSTR dst, INT dstlen, LPCSTR defchar, BOOL *used)
 
INT __MultiByteToWideChar (UINT page, DWORD flags, LPCSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
HANDLE __FindExecutableImageExW (PCWSTR file, PCWSTR path, PWSTR out_buffer, PFIND_EXE_FILE_CALLBACKW x, PVOID y)
 
const charwine_dbg_sprintf (const char *format,...)
 
const charwine_dbgstr_an (const char *str, int n)
 
const charwine_dbgstr_wn (const WCHAR *str, int n)
 

Function Documentation

◆ __CloseHandle()

BOOL __CloseHandle ( HANDLE  handle)

Definition at line 146 of file compat.c.

147 {
148  fclose(handle);
149  return TRUE;
150 }
#define TRUE
Definition: types.h:120
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)

◆ __CreateFileW()

HANDLE __CreateFileW ( LPCWSTR  lpFileName,
DWORD  dwDesiredAccess,
DWORD  dwShareMode,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
DWORD  dwCreationDisposition,
DWORD  dwFlagsAndAttributes,
HANDLE  hTemplateFile 
)

Definition at line 152 of file compat.c.

160 {
161  char buf[MAX_PATH];
162  HANDLE res;
163 
165  res = CreateFileA(buf, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
166  return res;
167 }
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
_In_ LPCSTR lpFileName
Definition: winbase.h:3011

◆ __FindExecutableImageExW()

HANDLE __FindExecutableImageExW ( PCWSTR  file,
PCWSTR  path,
PWSTR  out_buffer,
PFIND_EXE_FILE_CALLBACKW  x,
PVOID  y 
)

Definition at line 261 of file compat.c.

262 {
263  HANDLE ret = CreateFileW(file, 0, 0, NULL, 0, 0, NULL);
264  if(ret)
265  memcpy(out_buffer, file, (strlenW(file) + 1)*sizeof(WCHAR));
266 
267  return ret;
268 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
Definition: file.c:100
smooth NULL
Definition: ftsmooth.c:416
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CreateFileW
Definition: compat.h:400
Definition: fci.c:126

◆ __GetFileSizeEx()

BOOL __GetFileSizeEx ( HANDLE  file,
PLARGE_INTEGER  fsize 
)

Definition at line 138 of file compat.c.

139 {
140  if (fseek((FILE*)file, 0, 2) == -1)
141  return FALSE;
142  fsize->QuadPart = ftell((FILE*)file);
143  return TRUE;
144 }
#define TRUE
Definition: types.h:120
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
Definition: fci.c:126
GLint fsize
Definition: glext.h:9408

◆ __HeapAlloc()

void* __HeapAlloc ( int  heap,
int  flags,
size_t  size 
)

Definition at line 3 of file compat.c.

4 {
5  void * ret = malloc(size);
7  memset(ret, 0, size);
8  return ret;
9 }
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
int ret
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define malloc
Definition: debug_ros.c:4
#define memset(x, y, z)
Definition: compat.h:39

◆ __HeapReAlloc()

void* __HeapReAlloc ( int  heap,
DWORD  d2,
void slab,
SIZE_T  newsize 
)

Definition at line 11 of file compat.c.

12 {
13  return realloc(slab, newsize);
14 }
#define realloc
Definition: debug_ros.c:6

◆ __lstrcpynA()

LPSTR __lstrcpynA ( LPSTR  d,
LPCSTR  s,
int  c 
)

Definition at line 200 of file compat.c.

201 {
202  LPSTR r = d;
203  while(*s && c)
204  {
205  *d++ = *s++;
206  c--;
207  }
208  return r;
209 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char * LPSTR
Definition: xmlstorage.h:182
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039

◆ __MapViewOfFile()

void* __MapViewOfFile ( HANDLE  file,
DWORD  d1,
DWORD  d2,
DWORD  d3,
SIZE_T  s 
)

Definition at line 169 of file compat.c.

170 {
171  FILE *f = (FILE*)file;
173  char *result;
174 
175  if (file == INVALID_HANDLE_VALUE)
176  return NULL;
177 
178  if (!GetFileSizeEx(file, &size))
179  return NULL;
180 
181  if (fseek(f, 0, 0) == -1)
182  return NULL;
183 
184  result = malloc(size.LowPart);
185  if (fread(result, 1, size.LowPart, f) != size.LowPart)
186  {
187  free(result);
188  return NULL;
189  }
190 
191  return result;
192 }
#define free
Definition: debug_ros.c:5
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
GLfloat f
Definition: glext.h:7540
GLsizeiptr size
Definition: glext.h:5919
#define GetFileSizeEx
Definition: compat.h:414
#define malloc
Definition: debug_ros.c:4
GLuint64EXT * result
Definition: glext.h:11304
Definition: fci.c:126

◆ __MultiByteToWideChar()

INT __MultiByteToWideChar ( UINT  page,
DWORD  flags,
LPCSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)

Definition at line 238 of file compat.c.

240 {
241  int i;
242 
243  if (!src || !srclen || (!dst && dstlen))
244  {
246  return 0;
247  }
248 
249  if (srclen < 0) srclen = strlen(src) + 1;
250 
251  if(!dstlen)
252  return srclen;
253 
254  for(i=0; i<srclen && i<dstlen; i++)
255  dst[i] = src[i];
256 
257  return i;
258 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define SetLastError(x)
Definition: compat.h:409
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340

◆ __RtlImageDirectoryEntryToData()

PVOID __RtlImageDirectoryEntryToData ( PVOID  BaseAddress,
BOOLEAN  MappedAsImage,
USHORT  Directory,
PULONG  Size 
)

Definition at line 102 of file compat.c.

107 {
108  PIMAGE_NT_HEADERS NtHeader;
109  ULONG Va;
110 
111  /* Magic flag for non-mapped images. */
112  if ((ULONG_PTR)BaseAddress & 1)
113  {
116  }
117 
118  NtHeader = RtlImageNtHeader(BaseAddress);
119  if (NtHeader == NULL)
120  return NULL;
121 
123  return NULL;
124 
126  if (Va == 0)
127  return NULL;
128 
130 
131  if (MappedAsImage || Va < SWAPD(NtHeader->OptionalHeader.SizeOfHeaders))
132  return (PVOID)((ULONG_PTR)BaseAddress + Va);
133 
134  /* Image mapped as ordinary file, we must find raw pointer */
135  return RtlImageRvaToVa(NtHeader, BaseAddress, Va, NULL);
136 }
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
#define RtlImageRvaToVa
Definition: compat.h:458
#define SWAPD(x)
Definition: bytesex.h:7
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ BOOLEAN MappedAsImage
Definition: rtlfuncs.h:3718
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define RtlImageNtHeader
Definition: compat.h:457
unsigned int ULONG
Definition: retypes.h:1
base for all directory entries
Definition: entries.h:138
#define ULONG_PTR
Definition: config.h:101

◆ __RtlImageNtHeader()

PIMAGE_NT_HEADERS __RtlImageNtHeader ( void data)

Definition at line 34 of file compat.c.

35 {
37  PIMAGE_NT_HEADERS NtHeaders;
38  PCHAR NtHeaderPtr;
39  if (DosHeader->e_magic != IMAGE_DOS_SIGNATURE)
40  return NULL;
41  NtHeaderPtr = ((PCHAR)data) + DosHeader->e_lfanew;
42  NtHeaders = (PIMAGE_NT_HEADERS)NtHeaderPtr;
43  if (NtHeaders->Signature != IMAGE_NT_SIGNATURE)
44  return NULL;
45  return NtHeaders;
46 }
signed char * PCHAR
Definition: retypes.h:7
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
smooth NULL
Definition: ftsmooth.c:416
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
#define PCHAR
Definition: match.c:90
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ __RtlImageRvaToSection()

PIMAGE_SECTION_HEADER __RtlImageRvaToSection ( const IMAGE_NT_HEADERS NtHeader,
PVOID  BaseAddress,
ULONG  Rva 
)

Definition at line 49 of file compat.c.

53 {
54  PIMAGE_SECTION_HEADER Section;
55  ULONG Va;
56  ULONG Count;
57 
59  Section = IMAGE_FIRST_SECTION(NtHeader);
60 
61  while (Count--)
62  {
63  Va = SWAPD(Section->VirtualAddress);
64  if ((Va <= Rva) && (Rva < Va + SWAPD(Section->SizeOfRawData)))
65  return Section;
66  Section++;
67  }
68 
69  return NULL;
70 }
#define SWAPW(x)
Definition: bytesex.h:8
#define SWAPD(x)
Definition: bytesex.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define IMAGE_FIRST_SECTION(NtHeader)
Definition: ntimage.h:427
smooth NULL
Definition: ftsmooth.c:416
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
unsigned int ULONG
Definition: retypes.h:1

◆ __RtlImageRvaToVa()

PVOID __RtlImageRvaToVa ( const IMAGE_NT_HEADERS NtHeader,
PVOID  BaseAddress,
ULONG  Rva,
PIMAGE_SECTION_HEADER SectionHeader 
)

Definition at line 74 of file compat.c.

78 {
79  PIMAGE_SECTION_HEADER Section = NULL;
80 
81  if (SectionHeader)
82  Section = *SectionHeader;
83 
84  if ((Section == NULL) ||
85  (Rva < SWAPD(Section->VirtualAddress)) ||
86  (Rva >= SWAPD(Section->VirtualAddress) + SWAPD(Section->SizeOfRawData)))
87  {
88  Section = RtlImageRvaToSection(NtHeader, BaseAddress, Rva);
89  if (Section == NULL)
90  return NULL;
91 
92  if (SectionHeader)
93  *SectionHeader = Section;
94  }
95 
96  return (PVOID)((ULONG_PTR)BaseAddress + Rva +
97  (ULONG_PTR)SWAPD(Section->PointerToRawData) -
98  (ULONG_PTR)SWAPD(Section->VirtualAddress));
99 }
#define SWAPD(x)
Definition: bytesex.h:7
DWORD PointerToRawData
Definition: pedump.c:290
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define RtlImageRvaToSection
Definition: compat.h:459
#define ULONG_PTR
Definition: config.h:101

◆ __UnmapViewOfFile()

BOOL __UnmapViewOfFile ( const void data)

Definition at line 194 of file compat.c.

195 {
196  free((void *)data);
197  return TRUE;
198 }
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ __WideCharToMultiByte()

INT __WideCharToMultiByte ( UINT  page,
DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPSTR  dst,
INT  dstlen,
LPCSTR  defchar,
BOOL used 
)

Definition at line 213 of file compat.c.

215 {
216  int i;
217 
218  if (!src || !srclen || (!dst && dstlen))
219  {
221  return 0;
222  }
223 
224  if (srclen < 0) srclen = strlenW(src) + 1;
225 
226  if(!dstlen)
227  return srclen;
228 
229  for(i=0; i<srclen && i<dstlen; i++)
230  dst[i] = src[i] & 0xFF;
231 
232  if (used) *used = FALSE;
233 
234  return i;
235 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
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
c used
Definition: write.c:2885
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define SetLastError(x)
Definition: compat.h:409
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340

◆ lstrcpynW()

WCHAR* lstrcpynW ( WCHAR lpString1,
const WCHAR lpString2,
int  iMaxLength 
)

Definition at line 16 of file compat.c.

17 {
18  LPWSTR d = lpString1;
19  const WCHAR* s = lpString2;
20  UINT count = iMaxLength;
21 
22  while ((count > 1) && *s)
23  {
24  count--;
25  *d++ = *s++;
26  }
27 
28  if (count)
29  *d = 0;
30 
31  return lpString1;
32 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define d
Definition: ke_i.h:81
unsigned int UINT
Definition: ndis.h:50
GLdouble s
Definition: gl.h:2039
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ wine_dbg_sprintf()

const char * wine_dbg_sprintf ( const char format,
  ... 
)

Definition at line 271 of file compat.c.

272 {
273  static const int max_size = 200;
274  static char buffer[256];
275  char *ret;
276  int len;
277  va_list valist;
278 
280  ret = buffer;
282  if (len == -1 || len >= max_size) ret[max_size-1] = 0;
283  va_end(valist);
284  return ret;
285 }
#define vsnprintf
Definition: tif_win32.c:408
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define va_end(ap)
Definition: acmsvcex.h:90
static INT max_size
Definition: history.c:51
char * va_list
Definition: acmsvcex.h:78
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define va_start(ap, A)
Definition: acmsvcex.h:91
static __ms_va_list valist
Definition: printf.c:59

Referenced by context_dump_fbo_attachment(), dbgstr_tag(), dbgstr_type_info(), debug_box(), debug_color(), debug_d3dshaderinstructionhandler(), debug_d3dstate(), debug_d3dusage(), debug_d3dusagequery(), debug_fboattachment(), debug_gl_shader_type(), debug_hlsl_type(), debug_ivec4(), debug_modifiers(), debug_print_dstreg(), debug_print_relarg(), debug_print_srcreg(), debug_print_swizzle(), debug_print_writemask(), debug_uvec4(), debug_vec4(), debug_wic_rect(), debug_writemask(), debuglvhittestinfo(), debugnmlistview(), debugrange(), debugstr_bindstatus(), debugstr_chunk(), debugstr_dmversion(), debugstr_filetime(), debugstr_flags(), debugstr_formatetc(), debugstr_fourcc(), debugstr_INTERPRETER_OPT_FLAGS(), debugstr_jsstr(), debugstr_jsval(), debugstr_nodetype(), debugstr_pointf(), debugstr_PROC_PF(), debugstr_protocol_flags(), debugstr_reader_prop(), debugstr_rectf(), debugstr_sid(), debugstr_status_info(), debugstr_user_flags(), debugstr_writer_prop(), device_io(), dump_fmtetc(), dumpCooperativeLevel(), DumpEvent(), dwarf2_debug_ctx(), dwarf2_debug_di(), dwarf2_debug_traverse_ctx(), filetime_to_str(), get_regname(), hex_str(), NodeName(), shdebugstr_guid(), SPY_GetMsgName(), wine_dbgstr_addr(), wine_dbgstr_fcc(), wine_dbgstr_icerr(), wined3d_debug_location(), and wined3d_debug_resource_access().

◆ wine_dbgstr_an()

const char* wine_dbgstr_an ( const char str,
int  n 
)

Definition at line 288 of file compat.c.

289 {
290  static const char hex[16] = "0123456789abcdef";
291  char *dst, *res;
292  size_t size;
293  static char buffer[256];
294 
295  if (!((ULONG_PTR)str >> 16))
296  {
297  if (!str) return "(null)";
298  res = buffer;
299  sprintf( res, "#%04x", LOWORD(str) );
300  return res;
301  }
302  if (n == -1) n = strlen(str);
303  if (n < 0) n = 0;
304  size = 10 + min( 300, n * 4 );
305  dst = res = buffer;
306  *dst++ = '"';
307  while (n-- > 0 && dst <= res + size - 9)
308  {
309  unsigned char c = *str++;
310  switch (c)
311  {
312  case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
313  case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
314  case '\t': *dst++ = '\\'; *dst++ = 't'; break;
315  case '"': *dst++ = '\\'; *dst++ = '"'; break;
316  case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
317  default:
318  if (c >= ' ' && c <= 126)
319  *dst++ = c;
320  else
321  {
322  *dst++ = '\\';
323  *dst++ = 'x';
324  *dst++ = hex[(c >> 4) & 0x0f];
325  *dst++ = hex[c & 0x0f];
326  }
327  }
328  }
329  *dst++ = '"';
330  if (n > 0)
331  {
332  *dst++ = '.';
333  *dst++ = '.';
334  *dst++ = '.';
335  }
336  *dst++ = 0;
337  return res;
338 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
static const char hex[16]
Definition: profile.c:123
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const WCHAR * str
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLenum GLenum dst
Definition: glext.h:6340
#define min(a, b)
Definition: monoChain.cc:55
GLuint res
Definition: glext.h:9613
#define c
Definition: ke_i.h:80
#define LOWORD(l)
Definition: pedump.c:82

◆ wine_dbgstr_wn()

const char* wine_dbgstr_wn ( const WCHAR str,
int  n 
)

Definition at line 342 of file compat.c.

343 {
344  char *dst, *res;
345  size_t size;
346  static char buffer[256];
347 
348  if (!((ULONG_PTR)str >> 16))
349  {
350  if (!str) return "(null)";
351  res = buffer;
352  sprintf( res, "#%04x", LOWORD(str) );
353  return res;
354  }
355  if (n == -1)
356  {
357  const WCHAR *end = str;
358  while (*end) end++;
359  n = end - str;
360  }
361  if (n < 0) n = 0;
362  size = 12 + min( 300, n * 5 );
363  dst = res = buffer;
364  *dst++ = 'L';
365  *dst++ = '"';
366  while (n-- > 0 && dst <= res + size - 10)
367  {
368  WCHAR c = *str++;
369  switch (c)
370  {
371  case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
372  case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
373  case '\t': *dst++ = '\\'; *dst++ = 't'; break;
374  case '"': *dst++ = '\\'; *dst++ = '"'; break;
375  case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
376  default:
377  if (c >= ' ' && c <= 126)
378  *dst++ = c;
379  else
380  {
381  *dst++ = '\\';
382  sprintf(dst,"%04x",c);
383  dst+=4;
384  }
385  }
386  }
387  *dst++ = '"';
388  if (n > 0)
389  {
390  *dst++ = '.';
391  *dst++ = '.';
392  *dst++ = '.';
393  }
394  *dst++ = 0;
395  return res;
396 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLuint GLuint end
Definition: gl.h:1545
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const WCHAR * str
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLenum GLenum dst
Definition: glext.h:6340
#define min(a, b)
Definition: monoChain.cc:55
GLuint res
Definition: glext.h:9613
#define c
Definition: ke_i.h:80
#define LOWORD(l)
Definition: pedump.c:82

Referenced by _test_hkey_main_Value_W(), get_token(), map_type(), mqr_GetMetadataByName(), SoftModalMessageBox(), START_TEST(), tally_test_file(), test_flags_NtQueryDirectoryFile(), test_GetStateText(), test_IdnToAscii(), test_IdnToNameprepUnicode(), test_IdnToUnicode(), test_IMLangConvertCharset(), test_IWinHttpRequest(), test_marshal_bstr(), test_NtQueryDirectoryFile(), test_NtQueryDirectoryFile_case(), test_NtQueryKey(), test_query_attribute_information_file(), test_readdirectorychanges_cr(), test_reg_query_info(), test_RtlUTF8ToUnicodeN(), test_saxstr(), test_SQLGetPrivateProfileStringW(), test_string_data(), test_string_data_process(), test_utf7_decoding(), Widget_bstr(), and wine_dbgstr_us().