3 #include "gdipp_lib/minidump.h"
8 bool wstring_ci_less::operator()(const std::wstring
&string1
, const std::wstring
&string2
) const
10 return (_wcsicmp(string1
.c_str(), string2
.c_str()) < 0);
13 BOOL
get_dir_file_path(HMODULE h_module
, const wchar_t *file_name
, wchar_t *out_path
)
15 // append the file name after the module's resident directory name
16 // if the module handle is NULL, use the current exe as the module
21 dw_ret
= GetModuleFileNameW(h_module
, out_path
, MAX_PATH
);
25 b_ret
= PathRemoveFileSpecW(out_path
);
29 return PathAppendW(out_path
, file_name
);
34 SetUnhandledExceptionFilter(minidump_filter
);
37 void register_minidump_module(HMODULE h_module
)
39 h_minidump_modules
.push_back(h_module
);
42 char get_gdi_weight_class(unsigned short weight
)
46 weight 1 to 550 are rendered as Regular
47 551 to 611 are Semibold
48 612 to infinity are Bold
53 const long weight_class_max
[] = {0, 550, 611};
54 const char max_weight_class
= sizeof(weight_class_max
) / sizeof(long);
56 for (char i
= 0; i
< max_weight_class
; ++i
)
58 if (weight
<= weight_class_max
[i
])
62 return max_weight_class
;
65 unsigned long get_render_config_trait(char weight_class
, bool italic
, LONG height
, const wchar_t *font_name
)
67 const size_t font_name_len
= wcslen(font_name
) + 1;
68 const size_t trait_size
= sizeof(weight_class
) + sizeof(italic
) + sizeof(height
) + font_name_len
* sizeof(wchar_t);
69 BYTE
*trait_data
= new BYTE
[trait_size
];
71 *reinterpret_cast<char *>(trait_data
) = weight_class
;
72 *reinterpret_cast<bool *>(trait_data
+ sizeof(char)) = italic
;
73 *reinterpret_cast<LONG
*>(trait_data
+ sizeof(char) + sizeof(bool)) = height
;
74 wcscpy_s(reinterpret_cast<wchar_t *>(trait_data
+ sizeof(char) + sizeof(bool) + sizeof(LONG
)), font_name_len
, font_name
);
76 unsigned long trait_id
;
77 MurmurHash3_x86_32(trait_data
, static_cast<int>(trait_size
), 0, &trait_id
);