winevt_c 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -0
- data/example/locale.rb +13 -0
- data/ext/winevt/winevt.c +1 -0
- data/ext/winevt/winevt_c.h +9 -3
- data/ext/winevt/winevt_locale.c +82 -58
- data/ext/winevt/winevt_locale_info.c +68 -0
- data/ext/winevt/winevt_query.c +1 -1
- data/ext/winevt/winevt_subscribe.c +1 -1
- data/lib/winevt/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29ee7a14f6020b16b7c7dda19d85898f1403721b49074555d71dc43a7a10544f
|
4
|
+
data.tar.gz: 48be391283aa449cc09d1d997ab2915c48276cd21239a75f8013bca60aaafc03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f321563ec5c53f3305c130b1b13dddaa7136e38a46dbfac5c35e20a0d7525f4cc424546c6247fa226a50fd9932df65f849d5d4c354a56106cd9bcfa15908ec7c
|
7
|
+
data.tar.gz: 53af124b46df922069f703e624a07bd31f427c1e715f8cb4227a93e3efd5cd94e83eddeb1be649b0db30312fbb594aae143eb27023ee37c230cbfd2ddbf43133
|
data/README.md
CHANGED
@@ -31,6 +31,61 @@ Or install it yourself as:
|
|
31
31
|
## Usage
|
32
32
|
|
33
33
|
Usage examples are found in [example directory](example).
|
34
|
+
|
35
|
+
### Multilingual description
|
36
|
+
|
37
|
+
Currently, the following locales should be supported to output description:
|
38
|
+
|
39
|
+
locale | language
|
40
|
+
---------:|:--------
|
41
|
+
bg\_BG | Bulgarian
|
42
|
+
zh\_CN | Simplified Chinese
|
43
|
+
zh\_TW | Traditional Chinese
|
44
|
+
zh\_HK | Chinese (Hong Kong)
|
45
|
+
zh\_SG | Chinese (Singapore)
|
46
|
+
hr\_HR | Croatian
|
47
|
+
cz\_CZ | Czech
|
48
|
+
da\_DK | Danish
|
49
|
+
nl\_NL | Dutch
|
50
|
+
nl\_BG | Dutch (Belgium)
|
51
|
+
en\_US | English (United States)
|
52
|
+
en\_GB | English (UK)
|
53
|
+
en\_AU | English (Australia)
|
54
|
+
en\_CA | English (Canada)
|
55
|
+
en\_NZ | English (New Zealand)
|
56
|
+
en\_IE | English (Ireland)
|
57
|
+
fi\_FI | Finnish
|
58
|
+
fr\_FR | French
|
59
|
+
fr\_BE | French (Belgium)
|
60
|
+
fr\_CA | French (Canada)
|
61
|
+
fr\_CH | French (Swiss)
|
62
|
+
de\_DE | German
|
63
|
+
de\_CH | German (Swiss)
|
64
|
+
de\_AT | German (Austria)
|
65
|
+
el\_GR | Greek (Ελληνικά)
|
66
|
+
hu\_HU | Hungarian
|
67
|
+
is\_IS | Icelandic
|
68
|
+
it\_IT | Italian (Italy)
|
69
|
+
it\_CH | Italian (Swiss)
|
70
|
+
ja\_JP | Japanese
|
71
|
+
ko\_KO | Korean
|
72
|
+
no\_NO | Norwegian (Bokmål)
|
73
|
+
nb\_NO | Norwegian (Bokmål)
|
74
|
+
nn\_NO | Norwegian (Nynorsk)
|
75
|
+
pl\_PL | Polish (Poland)
|
76
|
+
pt\_PT | Portuguese
|
77
|
+
pt\_BR | Portuguese (Brazil)
|
78
|
+
ro\_RO | Romanian
|
79
|
+
ru\_RU | Russian (русский язык)
|
80
|
+
sk\_SK | Slovak
|
81
|
+
sl\_SI | Slovenian
|
82
|
+
es\_ES | Spanish
|
83
|
+
es\_ES\_T | Spanish (Traditional)
|
84
|
+
es\_MX | Spanish (Mexico)
|
85
|
+
es\_ES\_M | Spanish (Modern)
|
86
|
+
sv\_SE | Swedish
|
87
|
+
tr\_TR | Turkish
|
88
|
+
|
34
89
|
## Development
|
35
90
|
|
36
91
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/example/locale.rb
ADDED
data/ext/winevt/winevt.c
CHANGED
data/ext/winevt/winevt_c.h
CHANGED
@@ -23,8 +23,9 @@
|
|
23
23
|
#define EventChannel(object) ((struct WinevtChannel*)DATA_PTR(object))
|
24
24
|
|
25
25
|
typedef struct {
|
26
|
-
|
27
|
-
|
26
|
+
LANGID langID;
|
27
|
+
CHAR* langCode;
|
28
|
+
CHAR* description;
|
28
29
|
} LocaleInfo;
|
29
30
|
|
30
31
|
#ifdef __cplusplus
|
@@ -40,7 +41,7 @@ VALUE render_to_rb_str(EVT_HANDLE handle, DWORD flags);
|
|
40
41
|
WCHAR* get_description(EVT_HANDLE handle, LANGID langID);
|
41
42
|
VALUE get_values(EVT_HANDLE handle);
|
42
43
|
VALUE render_system_event(EVT_HANDLE handle, BOOL preserve_qualifiers);
|
43
|
-
LocaleInfo*
|
44
|
+
LocaleInfo* get_locale_info_from_rb_str(VALUE rb_locale_str);
|
44
45
|
|
45
46
|
#ifdef __cplusplus
|
46
47
|
}
|
@@ -52,9 +53,13 @@ extern VALUE rb_cChannel;
|
|
52
53
|
extern VALUE rb_cBookmark;
|
53
54
|
extern VALUE rb_cSubscribe;
|
54
55
|
extern VALUE rb_eWinevtQueryError;
|
56
|
+
extern VALUE rb_cLocale;
|
55
57
|
|
58
|
+
extern LocaleInfo localeInfoTable[];
|
56
59
|
extern LocaleInfo default_locale;
|
57
60
|
|
61
|
+
struct WinevtLocale {};
|
62
|
+
|
58
63
|
struct WinevtChannel
|
59
64
|
{
|
60
65
|
EVT_HANDLE channels;
|
@@ -105,5 +110,6 @@ void Init_winevt_query(VALUE rb_cEventLog);
|
|
105
110
|
void Init_winevt_channel(VALUE rb_cEventLog);
|
106
111
|
void Init_winevt_bookmark(VALUE rb_cEventLog);
|
107
112
|
void Init_winevt_subscribe(VALUE rb_cEventLog);
|
113
|
+
void Init_winevt_locale(VALUE rb_cEventLog);
|
108
114
|
|
109
115
|
#endif // _WINEVT_C_H
|
data/ext/winevt/winevt_locale.c
CHANGED
@@ -1,68 +1,92 @@
|
|
1
1
|
#include <winevt_c.h>
|
2
2
|
|
3
|
-
static LocaleInfo localeInfoTable [] = {
|
4
|
-
{ MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT), "bg_BG"},
|
5
|
-
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), "zh_CN"},
|
6
|
-
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), "zh_TW"},
|
7
|
-
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_HONGKONG), "zh_HK"},
|
8
|
-
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE), "zh_SG"},
|
9
|
-
{ MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), "hr_HR"},
|
10
|
-
{ MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), "cs_CZ"},
|
11
|
-
{ MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), "da_DK"},
|
12
|
-
{ MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH), "nl_NL"},
|
13
|
-
{ MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH_BELGIAN), "nl_BE"},
|
14
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), "en_US"},
|
15
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK), "en_GB"},
|
16
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_AUS), "en_AU"},
|
17
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_CAN), "en_CA"},
|
18
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_NZ), "en_NZ"},
|
19
|
-
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_EIRE), "en_IE"},
|
20
|
-
{ MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT), "fi_FI"},
|
21
|
-
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), "fr_FR"},
|
22
|
-
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_BELGIAN), "fr_BE"},
|
23
|
-
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_CANADIAN), "fr_CA"},
|
24
|
-
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_SWISS), "fr_CH"},
|
25
|
-
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), "de_DE"},
|
26
|
-
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN_SWISS), "de_CH"},
|
27
|
-
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN), "de_AT"},
|
28
|
-
{ MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), "el_GR"},
|
29
|
-
{ MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT), "hu_HU"},
|
30
|
-
{ MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), "is_IS"},
|
31
|
-
{ MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), "it_IT"},
|
32
|
-
{ MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN_SWISS), "it_CH"},
|
33
|
-
{ MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), "ja_JP"},
|
34
|
-
{ MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT), "ko_KO"},
|
35
|
-
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL), "no_NO"},
|
36
|
-
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL), "nb_NO"},
|
37
|
-
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK), "nn_NO"},
|
38
|
-
{ MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), "pl_PL"},
|
39
|
-
{ MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE), "pt_PT"},
|
40
|
-
{ MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN), "pt_BR"},
|
41
|
-
{ MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), "ro_RO"},
|
42
|
-
{ MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), "ru_RU"},
|
43
|
-
{ MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), "sk_SK"},
|
44
|
-
{ MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), "sl_SI"},
|
45
|
-
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), "es_ES"},
|
46
|
-
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), "es_ES_T"},
|
47
|
-
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MEXICAN), "es_MX"},
|
48
|
-
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), "es_ES_M"},
|
49
|
-
{ MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT), "sv_SE"},
|
50
|
-
{ MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), "tr_TR"},
|
51
|
-
{ 0, NULL}
|
52
|
-
};
|
53
3
|
|
54
|
-
|
4
|
+
/* clang-format off */
|
5
|
+
/*
|
6
|
+
* Document-class: Winevt::EventLog::Locale
|
7
|
+
*
|
8
|
+
* handle locales for Windows EventLog's description.
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* require 'winevt'
|
12
|
+
*
|
13
|
+
* @locale = Winevt::EventLog::Locale.new
|
14
|
+
* @locale.each {|code, desc|
|
15
|
+
* print code, desc
|
16
|
+
* }
|
17
|
+
* @since v0.8.1
|
18
|
+
*/
|
19
|
+
/* clang-format on */
|
55
20
|
|
56
|
-
|
57
|
-
|
21
|
+
VALUE rb_cLocale;
|
22
|
+
|
23
|
+
static void locale_free(void* ptr);
|
24
|
+
|
25
|
+
static const rb_data_type_t rb_winevt_locale_type = { "winevt/locale",
|
26
|
+
{
|
27
|
+
0,
|
28
|
+
locale_free,
|
29
|
+
0,
|
30
|
+
},
|
31
|
+
NULL,
|
32
|
+
NULL,
|
33
|
+
RUBY_TYPED_FREE_IMMEDIATELY };
|
34
|
+
|
35
|
+
static void
|
36
|
+
locale_free(void* ptr)
|
58
37
|
{
|
59
|
-
|
38
|
+
xfree(ptr);
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
rb_winevt_locale_alloc(VALUE klass)
|
43
|
+
{
|
44
|
+
VALUE obj;
|
45
|
+
struct WinevtLocale* winevtLocale;
|
46
|
+
obj = TypedData_Make_Struct(
|
47
|
+
klass, struct WinevtLocale, &rb_winevt_locale_type, winevtLocale);
|
48
|
+
return obj;
|
49
|
+
}
|
50
|
+
|
51
|
+
/*
|
52
|
+
* Initalize Locale class.
|
53
|
+
*
|
54
|
+
* @return [Locale]
|
55
|
+
*
|
56
|
+
*/
|
57
|
+
static VALUE
|
58
|
+
rb_winevt_locale_initialize(VALUE self)
|
59
|
+
{
|
60
|
+
return Qnil;
|
61
|
+
}
|
62
|
+
|
63
|
+
/*
|
64
|
+
* Enumerate supported locales and its descriptions
|
65
|
+
*
|
66
|
+
* @yield (String, String)
|
67
|
+
*
|
68
|
+
*/
|
69
|
+
static VALUE
|
70
|
+
rb_winevt_locale_each(VALUE self)
|
71
|
+
{
|
72
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
60
73
|
|
61
74
|
for (int i = 0; localeInfoTable[i].langCode != NULL; i++) {
|
62
|
-
|
63
|
-
|
64
|
-
|
75
|
+
rb_yield_values(2,
|
76
|
+
rb_utf8_str_new_cstr(localeInfoTable[i].langCode),
|
77
|
+
rb_utf8_str_new_cstr(localeInfoTable[i].description));
|
65
78
|
}
|
66
79
|
|
67
|
-
|
80
|
+
return Qnil;
|
81
|
+
}
|
82
|
+
|
83
|
+
void
|
84
|
+
Init_winevt_locale(VALUE rb_cEventLog)
|
85
|
+
{
|
86
|
+
rb_cLocale = rb_define_class_under(rb_cEventLog, "Locale", rb_cObject);
|
87
|
+
|
88
|
+
rb_define_alloc_func(rb_cLocale, rb_winevt_locale_alloc);
|
89
|
+
|
90
|
+
rb_define_method(rb_cLocale, "initialize", rb_winevt_locale_initialize, 0);
|
91
|
+
rb_define_method(rb_cLocale, "each", rb_winevt_locale_each, 0);
|
68
92
|
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#include <winevt_c.h>
|
2
|
+
|
3
|
+
LocaleInfo localeInfoTable [] = {
|
4
|
+
{ MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT), "bg_BG", "Bulgarian"},
|
5
|
+
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), "zh_CN", "Simplified Chinese "},
|
6
|
+
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), "zh_TW", "Traditional Chinese"},
|
7
|
+
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_HONGKONG), "zh_HK", "Chinese (Hong Kong)"},
|
8
|
+
{ MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SINGAPORE), "zh_SG", "Chinese (Singapore)"},
|
9
|
+
{ MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), "hr_HR", "Croatian"},
|
10
|
+
{ MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), "cs_CZ", "Czech"},
|
11
|
+
{ MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), "da_DK", "Dannish"},
|
12
|
+
{ MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH), "nl_NL", "Dutch"},
|
13
|
+
{ MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH_BELGIAN), "nl_BE", "Dutch (Belgium)"},
|
14
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), "en_US", "English (United States)"},
|
15
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK), "en_GB", "English (UK)"},
|
16
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_AUS), "en_AU", "English (Australia)"},
|
17
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_CAN), "en_CA", "English (Canada)"},
|
18
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_NZ), "en_NZ", "English (New Zealand)"},
|
19
|
+
{ MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_EIRE), "en_IE", "English (Ireland)"},
|
20
|
+
{ MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT), "fi_FI", "Finnish"},
|
21
|
+
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), "fr_FR", "French"},
|
22
|
+
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_BELGIAN), "fr_BE", "French (Belgium)"},
|
23
|
+
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_CANADIAN), "fr_CA", "French (Canada)"},
|
24
|
+
{ MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH_SWISS), "fr_CH", "French (Swiss)"},
|
25
|
+
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), "de_DE", "German"},
|
26
|
+
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN_SWISS), "de_CH", "German (Swiss)"},
|
27
|
+
{ MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN), "de_AT", "German (Austria))"},
|
28
|
+
{ MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), "el_GR", "Greek (Ελληνικά)"},
|
29
|
+
{ MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT), "hu_HU", "Hungarian"},
|
30
|
+
{ MAKELANGID(LANG_ICELANDIC, SUBLANG_DEFAULT), "is_IS", "Icelandic"},
|
31
|
+
{ MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), "it_IT", "Italian (Italy)"},
|
32
|
+
{ MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN_SWISS), "it_CH", "Italian (Swiss)"},
|
33
|
+
{ MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), "ja_JP", "Japanases"},
|
34
|
+
{ MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT), "ko_KO", "Korean"},
|
35
|
+
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL), "no_NO", "Norwegian (Bokmål)"},
|
36
|
+
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL), "nb_NO", "Norwegian (Bokmål)"},
|
37
|
+
{ MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK), "nn_NO", "Norwegian (Nynorsk)"},
|
38
|
+
{ MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), "pl_PL", "Polish"},
|
39
|
+
{ MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE), "pt_PT", "Portuguese"},
|
40
|
+
{ MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN), "pt_BR", "Portuguese (Brazil)"},
|
41
|
+
{ MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), "ro_RO", "Romanian"},
|
42
|
+
{ MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), "ru_RU", "Russian (русский язык)"},
|
43
|
+
{ MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), "sk_SK", "Slovak"},
|
44
|
+
{ MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), "sl_SI", "Slovenian"},
|
45
|
+
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), "es_ES", "Spanish"},
|
46
|
+
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), "es_ES_T", "Spanish (Traditional)"},
|
47
|
+
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MEXICAN), "es_MX", "Spanish (Mexico)"},
|
48
|
+
{ MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), "es_ES_M", "Spanish (Modern)"},
|
49
|
+
{ MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT), "sv_SE", "Swedish"},
|
50
|
+
{ MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), "tr_TR", "Turkish"},
|
51
|
+
{ 0, NULL, NULL}
|
52
|
+
};
|
53
|
+
|
54
|
+
LocaleInfo default_locale = {MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), "neutral", "Default"};
|
55
|
+
|
56
|
+
LocaleInfo*
|
57
|
+
get_locale_info_from_rb_str(VALUE rb_locale_str)
|
58
|
+
{
|
59
|
+
CHAR* locale_str = StringValuePtr(rb_locale_str);
|
60
|
+
|
61
|
+
for (int i = 0; localeInfoTable[i].langCode != NULL; i++) {
|
62
|
+
if (stricmp(localeInfoTable[i].langCode, locale_str) == 0) {
|
63
|
+
return &localeInfoTable[i];
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
rb_raise(rb_eArgError, "Unknown locale: %s", locale_str);
|
68
|
+
}
|
data/ext/winevt/winevt_query.c
CHANGED
@@ -448,7 +448,7 @@ rb_winevt_query_set_locale(VALUE self, VALUE rb_locale_str)
|
|
448
448
|
TypedData_Get_Struct(
|
449
449
|
self, struct WinevtQuery, &rb_winevt_query_type, winevtQuery);
|
450
450
|
|
451
|
-
locale_info =
|
451
|
+
locale_info = get_locale_info_from_rb_str(rb_locale_str);
|
452
452
|
|
453
453
|
winevtQuery->localeInfo = locale_info;
|
454
454
|
|
@@ -570,7 +570,7 @@ rb_winevt_subscribe_set_locale(VALUE self, VALUE rb_locale_str)
|
|
570
570
|
TypedData_Get_Struct(
|
571
571
|
self, struct WinevtSubscribe, &rb_winevt_subscribe_type, winevtSubscribe);
|
572
572
|
|
573
|
-
locale_info =
|
573
|
+
locale_info = get_locale_info_from_rb_str(rb_locale_str);
|
574
574
|
|
575
575
|
winevtSubscribe->localeInfo = locale_info;
|
576
576
|
|
data/lib/winevt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winevt_c
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- example/bookmark.rb
|
122
122
|
- example/enumerate_channels.rb
|
123
123
|
- example/eventlog.rb
|
124
|
+
- example/locale.rb
|
124
125
|
- example/rate_limit.rb
|
125
126
|
- example/tailing.rb
|
126
127
|
- ext/winevt/extconf.rb
|
@@ -129,6 +130,7 @@ files:
|
|
129
130
|
- ext/winevt/winevt_c.h
|
130
131
|
- ext/winevt/winevt_channel.c
|
131
132
|
- ext/winevt/winevt_locale.c
|
133
|
+
- ext/winevt/winevt_locale_info.c
|
132
134
|
- ext/winevt/winevt_query.c
|
133
135
|
- ext/winevt/winevt_subscribe.c
|
134
136
|
- ext/winevt/winevt_utils.cpp
|