This source file includes following definitions.
- get_proc_addr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef W32COMMON_H
22 #define W32COMMON_H
23
24 #include <windows.h>
25
26 #define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1))
27 #define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1))
28
29 #define get_page_size() sysinfo_cache.dwPageSize
30 #define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
31 #define get_processor_type() sysinfo_cache.dwProcessorType
32 #define get_w32_major_version() w32_major_version
33 #define get_w32_minor_version() w32_minor_version
34
35 extern SYSTEM_INFO sysinfo_cache;
36 extern OSVERSIONINFO osinfo_cache;
37 extern DWORD_PTR syspage_mask;
38
39 extern int w32_major_version;
40 extern int w32_minor_version;
41 extern int w32_build_number;
42
43 enum {
44 OS_SUBTYPE_9X = 1,
45 OS_SUBTYPE_NT
46 };
47
48 extern int os_subtype;
49
50
51 extern void cache_system_info (void);
52
53 #ifdef WINDOWSNT
54
55 extern char * w32_version_string (void);
56 #endif
57
58 typedef void (* VOIDFNPTR) (void);
59
60
61
62
63 INLINE VOIDFNPTR get_proc_addr (HINSTANCE, LPCSTR);
64 INLINE VOIDFNPTR
65 get_proc_addr (HINSTANCE handle, LPCSTR fname)
66 {
67 return (VOIDFNPTR) GetProcAddress (handle, fname);
68 }
69
70
71
72
73
74
75 #define DEF_DLL_FN(type, func, ...) \
76 typedef type (CDECL *W32_PFN_##func) __VA_ARGS__; \
77 static W32_PFN_##func fn_##func
78
79
80 #define LOAD_DLL_FN(lib, func) \
81 do \
82 { \
83 fn_##func = (W32_PFN_##func) get_proc_addr (lib, #func); \
84 if (!fn_##func) \
85 return false; \
86 } \
87 while (false)
88
89
90 #define LOAD_DLL_FN_OPT(lib, func) \
91 do \
92 { \
93 fn_##func = (W32_PFN_##func) get_proc_addr (lib, #func); \
94 } \
95 while (false)
96
97 #ifdef HAVE_HARFBUZZ
98 extern bool hbfont_init_w32_funcs (HMODULE);
99 #endif
100
101 #endif