winutil.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_WIN32_WINUTIL_H
  17. #define PHP_WIN32_WINUTIL_H
  18. #ifdef PHP_EXPORTS
  19. # define PHP_WINUTIL_API __declspec(dllexport)
  20. #else
  21. # define PHP_WINUTIL_API __declspec(dllimport)
  22. #endif
  23. PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error);
  24. PHP_WINUTIL_API void php_win32_error_msg_free(char *msg);
  25. #define php_win_err() php_win32_error_to_msg(GetLastError())
  26. #define php_win_err_free(err) php_win32_error_msg_free(err)
  27. int php_win32_check_trailing_space(const char * path, const size_t path_len);
  28. PHP_WINUTIL_API int php_win32_get_random_bytes(unsigned char *buf, size_t size);
  29. #ifdef PHP_EXPORTS
  30. BOOL php_win32_init_random_bytes(void);
  31. BOOL php_win32_shutdown_random_bytes(void);
  32. #endif
  33. #if !defined(ECURDIR)
  34. # define ECURDIR EACCES
  35. #endif /* !ECURDIR */
  36. #if !defined(ENOSYS)
  37. # define ENOSYS EPERM
  38. #endif /* !ENOSYS */
  39. PHP_WINUTIL_API int php_win32_code_to_errno(unsigned long w32Err);
  40. #define SET_ERRNO_FROM_WIN32_CODE(err) \
  41. do { \
  42. int ern = php_win32_code_to_errno(err); \
  43. SetLastError(err); \
  44. _set_errno(ern); \
  45. } while (0)
  46. PHP_WINUTIL_API char *php_win32_get_username(void);
  47. PHP_WINUTIL_API BOOL php_win32_image_compatible(HMODULE handle, char **err);
  48. PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err);
  49. #endif