ReactOS  0.4.15-dev-1203-g0e5a4d5
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)
 
BOOL __ReadFile (HANDLE file, PVOID buffer, DWORD len, PDWORD outlen, PVOID overlap)
 
DWORD __SetFilePointer (HANDLE file, LONG low, PLONG high, DWORD move)
 
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)
 
BOOL __IsWow64Process (HANDLE Process, BOOL *is_wow64)
 
ULONG __RtlComputeCrc32 (ULONG Initial, PUCHAR Data, ULONG Length)
 

Variables

static const ULONG CrcTable [256]
 

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:111
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:109
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:34
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
_In_ LPCSTR lpFileName
Definition: winbase.h:3034

◆ __FindExecutableImageExW()

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

Definition at line 286 of file compat.c.

287 {
288  HANDLE ret = CreateFileW(file, 0, 0, NULL, 0, 0, NULL);
289  if(ret)
290  memcpy(out_buffer, file, (strlenW(file) + 1)*sizeof(WCHAR));
291 
292  return ret;
293 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CreateFileW
Definition: compat.h:600
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
#define FALSE
Definition: types.h:117
_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:134
#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

◆ __IsWow64Process()

BOOL __IsWow64Process ( HANDLE  Process,
BOOL is_wow64 
)

Definition at line 423 of file compat.c.

424 {
425  *is_wow64 = FALSE;
426  return TRUE;
427 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL is_wow64
Definition: loader.c:55

◆ __lstrcpynA()

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

Definition at line 225 of file compat.c.

226 {
227  LPSTR r = d;
228  while(*s && c)
229  {
230  *d++ = *s++;
231  c--;
232  }
233  return r;
234 }
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 194 of file compat.c.

195 {
196  FILE *f = (FILE*)file;
198  char *result;
199 
200  if (file == INVALID_HANDLE_VALUE)
201  return NULL;
202 
203  if (!GetFileSizeEx(file, &size))
204  return NULL;
205 
206  if (fseek(f, 0, 0) == -1)
207  return NULL;
208 
209  result = malloc(size.LowPart);
210  if (fread(result, 1, size.LowPart, f) != size.LowPart)
211  {
212  free(result);
213  return NULL;
214  }
215 
216  return result;
217 }
#define free
Definition: debug_ros.c:5
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_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:616
#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 263 of file compat.c.

265 {
266  int i;
267 
268  if (!src || !srclen || (!dst && dstlen))
269  {
271  return 0;
272  }
273 
274  if (srclen < 0) srclen = strlen(src) + 1;
275 
276  if(!dstlen)
277  return srclen;
278 
279  for(i=0; i<srclen && i<dstlen; i++)
280  dst[i] = src[i];
281 
282  return i;
283 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
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:611
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340

◆ __ReadFile()

BOOL __ReadFile ( HANDLE  file,
PVOID  buffer,
DWORD  len,
PDWORD  outlen,
PVOID  overlap 
)

Definition at line 169 of file compat.c.

170 {
171  size_t read;
172 
173  assert(overlap == NULL);
174 
175  read = fread(buffer, 1, len, file);
176 
177  if (ferror(file) != 0)
178  return FALSE;
179 
180  *outlen = (DWORD)read;
181  return TRUE;
182 }
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
#define TRUE
Definition: types.h:120
#define assert(x)
Definition: debug.h:53
GLuint buffer
Definition: glext.h:5915
#define DWORD
Definition: nt_native.h:44
_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)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
Definition: fci.c:126

◆ __RtlComputeCrc32()

ULONG __RtlComputeCrc32 ( ULONG  Initial,
PUCHAR  Data,
ULONG  Length 
)

Definition at line 501 of file compat.c.

502 {
503  ULONG CrcValue = ~Initial;
504 
505  while (Length > 0)
506  {
507  CrcValue = CrcTable[(CrcValue ^ *Data) & 0xff] ^ (CrcValue >> 8);
508  Data++;
509  Length--;
510  }
511  return ~CrcValue;
512 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const ULONG CrcTable[256]
Definition: compat.c:438
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG_PTR Data
Definition: cdrom.h:947

◆ __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:666
#define SWAPD(x)
Definition: bytesex.h:7
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
_In_ BOOLEAN MappedAsImage
Definition: rtlfuncs.h:3872
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:361
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define RtlImageNtHeader
Definition: compat.h:665
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
#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
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187

◆ __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:1223
#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:65
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define RtlImageRvaToSection
Definition: compat.h:667
#define ULONG_PTR
Definition: config.h:101

◆ __SetFilePointer()

DWORD __SetFilePointer ( HANDLE  file,
LONG  low,
PLONG  high,
DWORD  move 
)

Definition at line 184 of file compat.c.

185 {
186  assert(move == FILE_BEGIN);
187  assert(high == NULL);
188 
189  if (fseek(file, low, SEEK_SET))
191  return low;
192 }
#define assert(x)
Definition: debug.h:53
#define FILE_BEGIN
Definition: compat.h:620
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
#define SEEK_SET
Definition: jmemansi.c:26
#define INVALID_SET_FILE_POINTER
Definition: compat.h:591
Definition: fci.c:126

◆ __UnmapViewOfFile()

BOOL __UnmapViewOfFile ( const void data)

Definition at line 219 of file compat.c.

220 {
221  free((void *)data);
222  return TRUE;
223 }
#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 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 = strlenW(src) + 1;
250 
251  if(!dstlen)
252  return srclen;
253 
254  for(i=0; i<srclen && i<dstlen; i++)
255  dst[i] = src[i] & 0xFF;
256 
257  if (used) *used = FALSE;
258 
259  return i;
260 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
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
#define FALSE
Definition: types.h:117
c used
Definition: write.c:2857
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define SetLastError(x)
Definition: compat.h:611
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 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define d
Definition: ke_i.h:81
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble s
Definition: gl.h:2039
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ wine_dbg_sprintf()

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

Definition at line 296 of file compat.c.

297 {
298  static const int max_size = 200;
299  static char buffer[256];
300  char *ret;
301  int len;
302  va_list valist;
303 
305  ret = buffer;
307  if (len == -1 || len >= max_size) ret[max_size-1] = 0;
308  va_end(valist);
309  return ret;
310 }
#define vsnprintf
Definition: tif_win32.c:406
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:64

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_sqllen(), debugstr_sqlulen(), 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(), 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 313 of file compat.c.

314 {
315  static const char hex[16] = "0123456789abcdef";
316  char *dst, *res;
317  size_t size;
318  static char buffer[256];
319 
320  if (!((ULONG_PTR)str >> 16))
321  {
322  if (!str) return "(null)";
323  res = buffer;
324  sprintf( res, "#%04x", LOWORD(str) );
325  return res;
326  }
327  if (n == -1) n = strlen(str);
328  if (n < 0) n = 0;
329  size = 10 + min( 300, n * 4 );
330  dst = res = buffer;
331  *dst++ = '"';
332  while (n-- > 0 && dst <= res + size - 9)
333  {
334  unsigned char c = *str++;
335  switch (c)
336  {
337  case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
338  case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
339  case '\t': *dst++ = '\\'; *dst++ = 't'; break;
340  case '"': *dst++ = '\\'; *dst++ = '"'; break;
341  case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
342  default:
343  if (c >= ' ' && c <= 126)
344  *dst++ = c;
345  else
346  {
347  *dst++ = '\\';
348  *dst++ = 'x';
349  *dst++ = hex[(c >> 4) & 0x0f];
350  *dst++ = hex[c & 0x0f];
351  }
352  }
353  }
354  *dst++ = '"';
355  if (n > 0)
356  {
357  *dst++ = '.';
358  *dst++ = '.';
359  *dst++ = '.';
360  }
361  *dst++ = 0;
362  return res;
363 }
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:65
#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 367 of file compat.c.

368 {
369  char *dst, *res;
370  size_t size;
371  static char buffer[256];
372 
373  if (!((ULONG_PTR)str >> 16))
374  {
375  if (!str) return "(null)";
376  res = buffer;
377  sprintf( res, "#%04x", LOWORD(str) );
378  return res;
379  }
380  if (n == -1)
381  {
382  const WCHAR *end = str;
383  while (*end) end++;
384  n = end - str;
385  }
386  if (n < 0) n = 0;
387  size = 12 + min( 300, n * 5 );
388  dst = res = buffer;
389  *dst++ = 'L';
390  *dst++ = '"';
391  while (n-- > 0 && dst <= res + size - 10)
392  {
393  WCHAR c = *str++;
394  switch (c)
395  {
396  case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
397  case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
398  case '\t': *dst++ = '\\'; *dst++ = 't'; break;
399  case '"': *dst++ = '\\'; *dst++ = '"'; break;
400  case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
401  default:
402  if (c >= ' ' && c <= 126)
403  *dst++ = c;
404  else
405  {
406  *dst++ = '\\';
407  sprintf(dst,"%04x",c);
408  dst+=4;
409  }
410  }
411  }
412  *dst++ = '"';
413  if (n > 0)
414  {
415  *dst++ = '.';
416  *dst++ = '.';
417  *dst++ = '.';
418  }
419  *dst++ = 0;
420  return res;
421 }
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:65
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const WCHAR * str
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
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(), check_output_raw(), get_token(), map_type(), mqr_GetMetadataByName(), SoftModalMessageBox(), START_TEST(), tally_test_file(), test_flags_NtQueryDirectoryFile(), test_GetStateText(), test_IdnToAscii(), test_IdnToNameprepUnicode(), test_IdnToUnicode(), Test_ImageSection(), 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().

Variable Documentation

◆ CrcTable

const ULONG CrcTable[256]
static

Definition at line 438 of file compat.c.

Referenced by __RtlComputeCrc32().