WinFunctions.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //===-- WinFunctions.h - Windows Functions for other platforms --*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines Windows-specific functions used in the codebase for
  11. // non-Windows platforms.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_SUPPORT_WINFUNCTIONS_H
  15. #define LLVM_SUPPORT_WINFUNCTIONS_H
  16. #ifndef _WIN32
  17. #include "dxc/Support/WinAdapter.h"
  18. HRESULT StringCchCopyEx(LPSTR pszDest, size_t cchDest, LPCSTR pszSrc,
  19. LPSTR *ppszDestEnd, size_t *pcchRemaining, DWORD dwFlags);
  20. HRESULT StringCchPrintfA(char *dst, size_t dstSize, const char *format, ...);
  21. HRESULT UIntAdd(UINT uAugend, UINT uAddend, UINT *puResult);
  22. HRESULT IntToUInt(int in, UINT *out);
  23. HRESULT SizeTToInt(size_t in, INT *out);
  24. HRESULT UInt32Mult(UINT a, UINT b, UINT *out);
  25. int strnicmp(const char *str1, const char *str2, size_t count);
  26. int _stricmp(const char *str1, const char *str2);
  27. int _wcsicmp(const wchar_t *str1, const wchar_t *str2);
  28. int _wcsnicmp(const wchar_t *str1, const wchar_t *str2, size_t n);
  29. int wsprintf(wchar_t *wcs, const wchar_t *fmt, ...);
  30. unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask);
  31. HRESULT CoGetMalloc(DWORD dwMemContext, IMalloc **ppMalloc);
  32. HANDLE CreateFile2(_In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess,
  33. _In_ DWORD dwShareMode, _In_ DWORD dwCreationDisposition,
  34. _In_opt_ void *pCreateExParams);
  35. HANDLE CreateFileW(_In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess,
  36. _In_ DWORD dwShareMode, _In_opt_ void *lpSecurityAttributes,
  37. _In_ DWORD dwCreationDisposition,
  38. _In_ DWORD dwFlagsAndAttributes,
  39. _In_opt_ HANDLE hTemplateFile);
  40. BOOL GetFileSizeEx(_In_ HANDLE hFile, _Out_ PLARGE_INTEGER lpFileSize);
  41. BOOL ReadFile(_In_ HANDLE hFile, _Out_ LPVOID lpBuffer,
  42. _In_ DWORD nNumberOfBytesToRead,
  43. _Out_opt_ LPDWORD lpNumberOfBytesRead,
  44. _Inout_opt_ void *lpOverlapped);
  45. BOOL WriteFile(_In_ HANDLE hFile, _In_ LPCVOID lpBuffer,
  46. _In_ DWORD nNumberOfBytesToWrite,
  47. _Out_opt_ LPDWORD lpNumberOfBytesWritten,
  48. _Inout_opt_ void *lpOverlapped);
  49. BOOL CloseHandle(_In_ HANDLE hObject);
  50. // Windows-specific heap functions
  51. HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize , SIZE_T dwMaximumSize);
  52. BOOL HeapDestroy(HANDLE heap);
  53. LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T nBytes);
  54. LPVOID HeapReAlloc(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes);
  55. BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
  56. SIZE_T HeapSize(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);
  57. HANDLE GetProcessHeap();
  58. #endif // _WIN32
  59. #endif // LLVM_SUPPORT_WINFUNCTIONS_H