MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / OnInitDialog

Method OnInitDialog

cppcryptfs/ui/SettingsPropertyPage.cpp:101–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100
101BOOL CSettingsPropertyPage::OnInitDialog()
102{
103 CCryptPropertyPage::OnInitDialog();
104
105 //Moved, otherwise the array will be loaded before we determine the GUI language at program startup.
106 static const CString listBoxStringInfinite = LocUtils::GetStringFromResources(IDS_TTL_INFINITE).c_str();
107 static const CString listBoxStringSec1 = LocUtils::GetStringFromResources(IDS_TTL_SEC_1).c_str();
108 static const CString listBoxStringSec2 = LocUtils::GetStringFromResources(IDS_TTL_SEC_2).c_str();
109 static const CString listBoxStringSec5 = LocUtils::GetStringFromResources(IDS_TTL_SEC_5).c_str();
110 static const CString listBoxStringSec10 = LocUtils::GetStringFromResources(IDS_TTL_SEC_10).c_str();
111 static const CString listBoxStringSec15 = LocUtils::GetStringFromResources(IDS_TTL_SEC_15).c_str();
112 static const CString listBoxStringSec30 = LocUtils::GetStringFromResources(IDS_TTL_SEC_30).c_str();
113 static const CString listBoxStringSec45 = LocUtils::GetStringFromResources(IDS_TTL_SEC_45).c_str();
114 static const CString listBoxStringSec60 = LocUtils::GetStringFromResources(IDS_TTL_SEC_60).c_str();
115 static const CString listBoxStringSec90 = LocUtils::GetStringFromResources(IDS_TTL_SEC_90).c_str();
116 static const CString listBoxStringMin2 = LocUtils::GetStringFromResources(IDS_TTL_MIN_2).c_str();
117 static const CString listBoxStringMin5 = LocUtils::GetStringFromResources(IDS_TTL_MIN_5).c_str();
118 static const CString listBoxStringMin10 = LocUtils::GetStringFromResources(IDS_TTL_MIN_10).c_str();
119 static const CString listBoxStringMin15 = LocUtils::GetStringFromResources(IDS_TTL_MIN_15).c_str();
120 static const CString listBoxStringMin30 = LocUtils::GetStringFromResources(IDS_TTL_MIN_30).c_str();
121 static const CString listBoxStringHour1 = LocUtils::GetStringFromResources(IDS_TTL_HOUR_1).c_str();
122
123 static const WCHAR* ttl_strings[] = { listBoxStringInfinite, listBoxStringSec1, listBoxStringSec2, listBoxStringSec5,
124 listBoxStringSec10, listBoxStringSec15, listBoxStringSec30, listBoxStringSec45,
125 listBoxStringSec60, listBoxStringSec90, listBoxStringMin2, listBoxStringMin5,
126 listBoxStringMin10, listBoxStringMin15, listBoxStringMin30, listBoxStringHour1 };
127
128 auto bufferblocks_set_from_registry = [](CComboBox* pBox, int val) {
129
130 int bufferblocks = val;
131
132 buffer_size_t kb = bufferblocks * 4;
133
134 auto p = bsearch(&kb, buffer_sizes, _countof(buffer_sizes), sizeof(buffer_size_t), [](const void* pkey, const void* pval) -> int {
135 return *reinterpret_cast<const buffer_size_t*>(pkey) - *reinterpret_cast<const buffer_size_t*>(pval);
136 });
137
138 if (!p)
139 bufferblocks = BUFFERBLOCKS_DEFAULT;
140
141 WCHAR buf[80];
142 if (!pBox)
143 return;
144
145 pBox->ResetContent();
146
147 for (int i = 0; i < sizeof(buffer_sizes) / sizeof(buffer_sizes[0]); i++) {
148 swprintf_s(buf, L"%d", buffer_sizes[i]);
149 pBox->AddString(buf);
150 }
151
152 int bits = 0;
153
154 int n = bufferblocks;
155 while (n) {
156 bits++;
157 n >>= 1;
158 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected