xref: /PHP-7.3/win32/winutil.h (revision 03f3b847)
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 
19 #ifndef PHP_WIN32_WINUTIL_H
20 #define PHP_WIN32_WINUTIL_H
21 
22 #ifdef PHP_EXPORTS
23 # define PHP_WINUTIL_API __declspec(dllexport)
24 #else
25 # define PHP_WINUTIL_API __declspec(dllimport)
26 #endif
27 
28 PHP_WINUTIL_API char *php_win32_error_to_msg(HRESULT error);
29 
30 #define php_win_err()	php_win32_error_to_msg(GetLastError())
31 int php_win32_check_trailing_space(const char * path, const size_t path_len);
32 PHP_WINUTIL_API int php_win32_get_random_bytes(unsigned char *buf, size_t size);
33 #ifdef PHP_EXPORTS
34 BOOL php_win32_init_random_bytes(void);
35 BOOL php_win32_shutdown_random_bytes(void);
36 #endif
37 
38 #if !defined(ECURDIR)
39 # define ECURDIR        EACCES
40 #endif /* !ECURDIR */
41 #if !defined(ENOSYS)
42 # define ENOSYS         EPERM
43 #endif /* !ENOSYS */
44 
45 PHP_WINUTIL_API int php_win32_code_to_errno(unsigned long w32Err);
46 
47 #define SET_ERRNO_FROM_WIN32_CODE(err) \
48 	do { \
49 	int ern = php_win32_code_to_errno(err); \
50 	SetLastError(err); \
51 	_set_errno(ern); \
52 	} while (0)
53 
54 PHP_WINUTIL_API char *php_win32_get_username(void);
55 
56 #endif
57 
58 /*
59  * Local variables:
60  * tab-width: 4
61  * c-basic-offset: 4
62  * End:
63  * vim600: sw=4 ts=4 fdm=marker
64  * vim<600: sw=4 ts=4
65  */
66