winutil.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_WIN32_WINUTIL_H
  19. #define PHP_WIN32_WINUTIL_H
  20. #ifdef PHP_EXPORTS
  21. # define PHP_WINUTIL_API __declspec(dllexport)
  22. #else
  23. # define PHP_WINUTIL_API __declspec(dllimport)
  24. #endif
  25. PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error);
  26. #define php_win_err() php_win32_error_to_msg(GetLastError())
  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. #endif
  48. /*
  49. * Local variables:
  50. * tab-width: 4
  51. * c-basic-offset: 4
  52. * End:
  53. * vim600: sw=4 ts=4 fdm=marker
  54. * vim<600: sw=4 ts=4
  55. */