static void test_StrStrW(void) { static const WCHAR emptyW[] = {0}; static const WCHAR deadbeefW[] = {'D','e','A','d','B','e','E','f',0}; static const WCHAR deadW[] = {'D','e','A','d',0}; static const WCHAR dead_lowerW[] = {'d','e','a','d',0}; static const WCHAR adbeW[] = {'A','d','B','e',0}; static const WCHAR adbe_lowerW[] = {'a','d','b','e',0}; static const WCHAR beefW[] = {'B','e','E','f',0}; static const WCHAR beef_lowerW[] = {'b','e','e','f',0}; const struct { const WCHAR *search; const WCHAR *expect; } StrStrW_cases[] = { {emptyW, NULL}, {deadW, deadbeefW}, {dead_lowerW, NULL}, {adbeW, deadbeefW + 2}, {adbe_lowerW, NULL}, {beefW, deadbeefW + 4}, {beef_lowerW, NULL}, }; LPWSTR ret; int i; /* Tests crash on Win2k */ if (0) { ret = StrStrW(NULL, NULL); ok(!ret, "Expected StrStrW to return NULL, got %p\n", ret); ret = StrStrW(NULL, emptyW); ok(!ret, "Expected StrStrW to return NULL, got %p\n", ret); ret = StrStrW(emptyW, NULL); ok(!ret, "Expected StrStrW to return NULL, got %p\n", ret); } ret = StrStrW(emptyW, emptyW); ok(!ret, "Expected StrStrW to return NULL, got %p\n", ret); for (i = 0; i < sizeof(StrStrW_cases)/sizeof(StrStrW_cases[0]); i++) { ret = StrStrW(deadbeefW, StrStrW_cases[i].search); ok(ret == StrStrW_cases[i].expect, "[%d] Expected StrStrW to return %p, got %p\n", i, StrStrW_cases[i].expect, ret); } }
void set_hotkey(LPWNDINFO pInfo) { WCHAR lpstr[VALUE_LEN+1]; const WCHAR delim[] = L"+"; WCHAR tmp_stor[3][16] = { {0,0} }; pInfo->key_mod = 0x06; /* CONTROL+SHIFT 键 */ pInfo->key_vk = 0xc0; /* ~键 */ if ( read_appkey(L"attach",L"Hotkey",lpstr,sizeof(lpstr)) ) { int i = 0; LPWSTR p = lpstr; int tmp[3] = {0}; int num; LPWSTR strtmp = StrStrW(lpstr, delim); while( strtmp != NULL && i < 3 ) { strtmp[0]=L'\0'; wcsncpy(tmp_stor[i++],p,15); p = strtmp + wcslen(delim); strtmp = StrStrW( p, delim); if (!strtmp) { wcsncpy(tmp_stor[i],p,15); } } for ( num = 0 ; num <= i ; num++ ) { tmp[num] = StrToIntW(tmp_stor[num]); } if ( is_modkey(tmp[0]) ) { if ( (i==2) && is_modkey(tmp[1]) && !is_modkey(tmp[2]) ) { pInfo->key_mod = tmp[0]|tmp[1]; pInfo->key_vk = tmp[2]; } else if ( i==1 && tmp[1]>0x2f ) { pInfo->key_mod = tmp[0]; pInfo->key_vk = tmp[1]; } } } }
HRESULT CBoxView::FindInputFilters(void** gottaFilter, const GUID DeviceCategory) { CComPtr<ICreateDevEnum> pSysDevEnum; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void **)&pSysDevEnum); if (FAILED(hr)) return hr; CComPtr<IEnumMoniker> pEnumCat; hr = pSysDevEnum->CreateClassEnumerator(DeviceCategory, &pEnumCat, 0); if (FAILED(hr) || pEnumCat == NULL) return hr; while (TRUE) { CComPtr<IMoniker> pMoniker; ULONG cFetched; hr = pEnumCat->Next(1, &pMoniker, &cFetched); if (hr != S_OK) //不应该用FAILED()来判断 break; LPOLESTR strName = NULL; hr = pMoniker->GetDisplayName(NULL, NULL, &strName); CComPtr<IPropertyBag> pPropBag; hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag); if (FAILED(hr)) continue; CComVariant varProp; if (DeviceCategory == CLSID_VideoInputDeviceCategory) { hr = pPropBag->Read(L"DevicePath", &varProp, 0); //视频设备有这个属性,能看到vid和pid,比较容易认 if (FAILED(hr) || StrCmpIW(varProp.bstrVal, m_szCableName.c_str()) != 0) continue; } else { hr = pPropBag->Read(L"FriendlyName", &varProp, 0); //音频设备只有类似于这样的名字:“麦克风 (6- USB 2.0 Camera)”。不太容易辨认和区分 if (FAILED(hr) || StrStrW(varProp.bstrVal, L"USB 2.0 Camera") == NULL) continue; } hr = pMoniker->BindToObject(NULL, NULL, IID_IBaseFilter, gottaFilter); if (SUCCEEDED(hr)) return TRUE; } return S_FALSE; }
BOOL foreach_section(LPCWSTR cat, /* ini 区段 */ WCHAR (*lpdata)[VALUE_LEN+1], /* 二维数组首地址,保存多个段值 */ int line /* 二维数组行数 */ ) { DWORD res = 0; LPWSTR lpstring; LPWSTR strKey; int i = 0; const WCHAR delim[] = L"="; DWORD num = VALUE_LEN*sizeof(WCHAR)*line; if ( profile_path[1] != L':' ) { if (!ini_ready(profile_path,MAX_PATH)) { return res; } } if ( (lpstring = (LPWSTR)SYS_MALLOC(num)) != NULL ) { if ( (res = GetPrivateProfileSectionW(cat, lpstring, num, profile_path)) > 0 ) { fzero(*lpdata,num); strKey = lpstring; while(*strKey != L'\0'&& i < line) { LPWSTR strtmp; WCHAR t_str[VALUE_LEN] = {0}; wcsncpy(t_str,strKey,VALUE_LEN-1); strtmp = StrStrW(t_str, delim); if (strtmp) { wcsncpy(lpdata[i],&strtmp[1],VALUE_LEN-1); } strKey += wcslen(strKey)+1; ++i; } } SYS_FREE(lpstring); } return (BOOL)res; }
// fake/hooked CreateFileW function (unicode) HANDLE WINAPI DetourCreateFileW( _In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, _In_opt_ HANDLE hTemplateFile ) { // identify open call for DualShock 4 device if (StrStrW(lpFileName, L"\\\\?\\hid#vid_054c&pid_05c4") != nullptr) { // fake open error SetLastError(ERROR_FILE_NOT_FOUND); // fake return value return INVALID_HANDLE_VALUE; } // legit call, forward to original function return OriginalCreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); }
long Cx_TextUtil::GetLineCount(const std::wstring& text) { if (text.empty()) { return 0; } long nCount = 1; LPCWSTR pszStart = text.c_str(); LPCWSTR pszEnd; for (; (pszEnd = StrStrW(pszStart, L"\n\r")) != NULL; nCount++) { pszStart = pszEnd + 1; if (*pszStart != *pszEnd && ('\n' == *pszStart || '\r' == *pszStart)) { pszStart++; } } return nCount; }
int BLBS_ReadSetting() { // Init and declare variables HANDLE hFile; uint8_t make_ini = FALSE; // If this is true, use default option wchar_t* file_buf = NULL; wchar_t path_buf[MAX_PATH] = {0}; uint32_t file_size = 0; BLBS_GetIniFullPath(path_buf, sizeof(path_buf)); #ifdef _DEBUG_CONSOLE printf("[IniFile]\n%S\n\n", path_buf); #endif // _DEBUG_CONSOLE // File IO // https://msdn.microsoft.com/en-us/library/windows/desktop/bb540534%28v=vs.85%29.aspx // Open File hFile = CreateFileW(path_buf, // lpFileName GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess FILE_SHARE_READ, // dwShareMode NULL, // lpSecurityAttributes OPEN_EXISTING, // dwCreationDisposition FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes NULL); // hTemplateFile // Cannot open! Error Handling if (hFile == INVALID_HANDLE_VALUE) { // No ini file, use default opntion! if (GetLastError() == ERROR_FILE_NOT_FOUND) make_ini = TRUE; else JV_ErrorHandle(JVERR_CreateFile, TRUE); } if (make_ini) { // no BatteryLine.ini, so generate BatteryLine.ini. Note : hFile is invalid at this point uint32_t written_byte = 0; // Write default setting to file hFile = CreateFileW(path_buf, // lpFileName GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess 0, // dwShareMode NULL, // lpSecurityAttributes CREATE_ALWAYS, // dwCreationDisposition FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes NULL); // hTemplateFile // Is handle is opened without problem? if (hFile == INVALID_HANDLE_VALUE) JV_ErrorHandle(JVERR_CreateFile, TRUE); // Write BOM to File if (!WriteFile(hFile, &BOM, sizeof(uint16_t), (DWORD*)&written_byte, NULL)) JV_ErrorHandle(JVERR_WriteFile, TRUE); // Is BOM written to file fully? if (written_byte != sizeof(uint16_t)) JV_ErrorHandle(JVERR_FILEIO_WRITTEN_BYTES, FALSE); // Write default setting string to File if (!WriteFile(hFile, (void*) BL_DefaultSettingStr, wcslen(BL_DefaultSettingStr) * sizeof(wchar_t), (DWORD*)&written_byte, NULL)) JV_ErrorHandle(JVERR_WriteFile, TRUE); // Is string writeen to file fully? if (written_byte != wcslen(BL_DefaultSettingStr) * sizeof(wchar_t)) JV_ErrorHandle(JVERR_FILEIO_WRITTEN_BYTES, FALSE); // Close Handle CloseHandle(hFile); // point file_buf to BL_DefaultSettingStr, no dyn alloc file_buf = BL_DefaultSettingStr; } else { // file is successfully open, read setting from file. Note : hFile is alive at this point uint32_t read_byte = 0; size_t sztmp = 0; // Get file size, and dyn allocate file_buf file_size = GetFileSize(hFile, NULL); file_buf = (wchar_t*) malloc(file_size+16); memset((void*) file_buf, 0, file_size+16); // Read from file if (!ReadFile(hFile, // hFile file_buf, // lpBuffer file_size, // nNumberOfBytesToRead (DWORD*) &read_byte, // lpNumberOfBytesRead NULL)) // lpOverlapped JV_ErrorHandle(JVERR_ReadFile, TRUE); // Is all bytes successfully read? if (read_byte != file_size) JV_ErrorHandle(JVERR_FILEIO_READ_BYTES, FALSE); // Close Handle CloseHandle(hFile); // Add \r\n at EOF sztmp = wcslen(file_buf); file_buf[sztmp] = L'\r'; file_buf[sztmp+1] = L'\n'; file_buf[sztmp+2] = L'\0'; } // Parse ini File - Too complex... wchar_t* str_cursor = NULL, *str_next = NULL; wchar_t line_token[BS_TOKEN_BUF_SIZE]; // Unicode LineFeed : \r\n (00d0 00a0) wchar_t line_rawbuf[BS_LINE_BUF_SIZE], line_buf[BS_LINE_BUF_SIZE]; size_t line_len = 0; wchar_t* equal_pos = NULL; wchar_t equal_left[BS_LINE_BUF_SIZE], equal_right[BS_LINE_BUF_SIZE]; uint8_t state_section = BS_SECTION_OFF; uint8_t color_idx = 0; BL_OPTION valid; // 01 using \r\n as token, traverse all lines in BL_SettingFile line_token[0] = L'\r'; line_token[1] = L'\n'; line_token[2] = L'\0'; // str_cursor will serve as cursor for each line str_cursor = file_buf; // 'valid' will be used to check wether these option is already set - FALSE for not set, TRUE for set ZeroMemory(&valid, sizeof(BL_OPTION)); // Parsing loop. Escape when meet EOF while (1) { // 02 Copy one line to line_rawbuf. // 02 Note that line_rawbuf contains 'raw' strings, which has tab, space, \r, \n. str_next = StrStrW(str_cursor, line_token); // Start of next line if (str_next == NULL) // No more line, EOF break; line_len = str_next - str_cursor; // Get this line's length StringCchCopyNW(line_rawbuf, BS_LINE_BUF_SIZE, str_cursor+1, line_len-1); // Copy one line to line_buf, +1 for remove first \r\n, -1 for remove last \r str_cursor = str_next + 1; // Fot next iteration, move cursor to next line // For debugging, there is too many segfaults in parsing alg! #ifdef _DEBUG_PARSING printf("line_rawbuf : %S\n", line_rawbuf); printf("state : %u\n", state_section); #endif // Finite State Machine Model // 03 line_rawbuf has [] -> start a section, represent as 'state' if (StrChrW(line_rawbuf, L'[') != NULL && StrChrW(line_rawbuf, L']') != NULL) { // Contains [ ] switch (state_section) { case BS_SECTION_OFF: if (StrStrIW(line_rawbuf, L"[General]") != NULL) state_section = BS_SECTION_GENERAL; else if (StrStrIW(line_rawbuf, L"[Color]") != NULL) state_section = BS_SECTION_COLOR; break; case BS_SECTION_GENERAL: if (StrStrIW(line_rawbuf, L"[General]") != NULL) state_section = BS_SECTION_GENERAL; else if (StrStrIW(line_rawbuf, L"[Color]") != NULL) state_section = BS_SECTION_COLOR; else state_section = BS_SECTION_OFF; break; case BS_SECTION_COLOR: if (StrStrIW(line_rawbuf, L"[General]") != NULL) state_section = BS_SECTION_GENERAL; else if (StrStrIW(line_rawbuf, L"[Color]") != NULL) state_section = BS_SECTION_COLOR; else state_section = BS_SECTION_OFF; break; } } // 04 line_rawbuf does not have [] -> remove Tab, Space, \r, \n and put into line_buf else if (line_rawbuf[0] != L'#') // This line is not comment and do not contain [] { int32_t dword = 0; uint8_t lowedge8 = 0, highedge8 = 0, r8 = 0, g8 = 0, b8 = 0; wchar_t quote_tmp[BS_TOKEN_BUF_SIZE] = {0}; wchar_t* quote_pos = NULL, *quote_next = NULL; uint32_t x = 0; // 04 Remove Tab, Space, \r, \n from line_rawbuf and put into line_buf for (uint32_t i = 0; i < line_len; i++) { if (line_rawbuf[i] == L'#') // if we meet # in the middle, ignore remnant characters break; if (line_rawbuf[i] != L'\t' && line_rawbuf[i] != L' ' && line_rawbuf[i] != L'\r' && line_rawbuf[i] != L'\n') { line_buf[x] = line_rawbuf[i]; x++; } } line_buf[x] = L'\0'; line_len = x; #ifdef _DEBUG_PARSING printf("line_buf : %S\n", line_buf); #endif switch (state_section) { case BS_SECTION_OFF: break; case BS_SECTION_GENERAL: // 05 using = as basis, cut left sting and right string. // 06 left string : which option to set? // 06 right string : how to parse right string? equal_pos = StrChrW(line_buf, L'='); if (equal_pos == NULL) // no '=' { state_section = BS_SECTION_OFF; // invalid option, think this as end of section. continue; // so ignore this line and go to next line } StringCchCopyNW(equal_left, BS_LINE_BUF_SIZE, line_buf, equal_pos-line_buf); // Copy left part StringCchCopyW(equal_right, BS_LINE_BUF_SIZE, line_buf+(equal_pos-line_buf+1)); // Copy right part if (StrCmpIW(equal_left, L"showcharge") == 0) { // {true, false} if (StrCmpIW(equal_right, L"true") == 0) option.showcharge = TRUE; else if (StrCmpIW(equal_right, L"false") == 0) option.showcharge = FALSE; else JV_ErrorHandle(JVERR_OPT_INI_INVALID_SHOWCHARGE, FALSE); valid.showcharge = TRUE; } else if (StrCmpIW(equal_left, L"monitor") == 0) { // {primary, 1, 2, ... , 32} if (StrCmpIW(equal_right, L"primary") == 0) option.monitor = BL_MON_PRIMARY; else { int32_t dword = _wtoi(equal_right); // Count Monitor's number and write to g_nMon g_nMon = 0; g_nPriMon = 0; ZeroMemory(&g_monInfo, sizeof(MONITORINFO) * BL_MAX_MONITOR); EnumDisplayMonitors(NULL, NULL, BLCB_MonEnumProc_GetFullInfo, 0); #ifdef _DEBUG_MONITOR printf("[Monitor]\nThis system has %d monitors.\n\n", g_nMon); #endif if (!(1 <= dword && dword <= BL_MAX_MONITOR)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_MONITOR, FALSE); if (!(dword <= g_nMon)) // JV_ErrorHandle(JVERR_OPT_INI_NOT_EXIST_MONITOR, FALSE); option.monitor = (uint8_t) dword; } valid.monitor = TRUE; } else if (StrCmpIW(equal_left, L"position") == 0) { // {top, bottom, left, right} if (StrCmpIW(equal_right, L"top") == 0) option.position = BL_POS_TOP; else if (StrCmpIW(equal_right, L"bottom") == 0) option.position = BL_POS_BOTTOM; else if (StrCmpIW(equal_right, L"left") == 0) option.position = BL_POS_LEFT; else if (StrCmpIW(equal_right, L"right") == 0) option.position = BL_POS_RIGHT; else JV_ErrorHandle(JVERR_OPT_INI_INVALID_POSITION, FALSE); valid.position = TRUE; } else if (StrCmpIW(equal_left, L"taskbar") == 0) { // {ignore, evade} if (StrCmpIW(equal_right, L"ignore") == 0) option.taskbar = BL_TASKBAR_IGNORE; else if (StrCmpIW(equal_right, L"evade") == 0) option.taskbar = BL_TASKBAR_EVADE; else JV_ErrorHandle(JVERR_OPT_INI_INVALID_TASKBAR, FALSE); valid.taskbar = TRUE; } else if (StrCmpIW(equal_left, L"transparency") == 0) { // {0 <= number <= 255} int32_t dword = _wtoi(equal_right); if (!(0 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_TRANSPARENCY, FALSE); option.transparency = (uint8_t) dword; valid.transparency = TRUE; } else if (StrCmpIW(equal_left, L"height") == 0) { // {1 <= number <= 255} int32_t dword = _wtoi(equal_right); if (!(1 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_HEIGHT, FALSE); option.height = (uint8_t) dword; valid.height = TRUE; } break; case BS_SECTION_COLOR: // 05 using = as basis, cut left sting and right string. // 06 left string : which option to set? // 06 right string : how to parse right string? equal_pos = StrChrW(line_buf, L'='); if (equal_pos == NULL) // no '=' { state_section = BS_SECTION_OFF; // invalid option, think this as end of section. continue; // so ignore this line and go to next line } StringCchCopyNW(equal_left, BS_LINE_BUF_SIZE, line_buf, equal_pos-line_buf); // Copy left part StringCchCopyW(equal_right, BS_LINE_BUF_SIZE, line_buf+(equal_pos-line_buf+1)); // Copy right part if (!StrCmpIW(equal_left, L"defaultcolor")) { // Format : {R, G, B} quote_pos = equal_right; for (uint32_t i = 0; i < 3; i++) // R, G, B { quote_next = StrChrW(quote_pos, L','); if (quote_next != NULL) // , still exists { StringCchCopyNW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos, quote_next-quote_pos); // Copy a number quote_pos = quote_next+1; // +1 for , } else // NULL, no ','! StringCchCopyW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos); // Copy last number dword = _wtoi(quote_tmp); if (!(0 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_DEFAULTCOLOR, FALSE); switch (i) { case 0: r8 = dword; break; case 1: g8 = dword; break; case 2: b8 = dword; break; } } option.defaultcolor = RGB(r8, g8, b8); valid.defaultcolor = TRUE; } else if (!StrCmpIW(equal_left, L"chargecolor")) { // Format : {R, G, B} quote_pos = equal_right; for (uint32_t i = 0; i < 3; i++) // R, G, B { quote_next = StrChrW(quote_pos, L','); if (quote_next != NULL) // , still exists { StringCchCopyNW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos, quote_next-quote_pos); // Copy a number quote_pos = quote_next+1; // +1 for , } else // NULL, no ','! StringCchCopyW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos); // Copy last number dword = _wtoi(quote_tmp); if (!(0 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_CHARGECOLOR, FALSE); switch (i) { case 0: r8 = dword; break; case 1: g8 = dword; break; case 2: b8 = dword; break; } } option.chargecolor = RGB(r8, g8, b8); valid.chargecolor = TRUE; } else if (!StrCmpIW(equal_left, L"fullcolor")) { // Format : {R, G, B} quote_pos = equal_right; for (uint32_t i = 0; i < 3; i++) // R, G, B { quote_next = StrChrW(quote_pos, L','); if (quote_next != NULL) // , still exists { StringCchCopyNW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos, quote_next-quote_pos); // Copy a number quote_pos = quote_next+1; // +1 for , } else // NULL, no ','! StringCchCopyW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos); // Copy last number dword = _wtoi(quote_tmp); if (!(0 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_FULLCOLOR, FALSE); switch (i) { case 0: r8 = dword; break; case 1: g8 = dword; break; case 2: b8 = dword; break; } } option.fullcolor = RGB(r8, g8, b8); valid.fullcolor = TRUE; } else if (StrCmpIW(equal_left, L"color") == 0) { // {LowEdge, HighEdge, R, G, B}, Support up to 16 thresholds quote_pos = equal_right; for (uint32_t i = 0; i < 5; i++) // R, G, B { quote_next = StrChrW(quote_pos, L','); if (quote_next != NULL) // , still exists { StringCchCopyNW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos, quote_next-quote_pos); // Copy a number quote_pos = quote_next+1; // +1 for , } else // NULL, no ','! StringCchCopyW(quote_tmp, BS_TOKEN_BUF_SIZE, quote_pos); // Copy last number dword = _wtoi(quote_tmp); if (!(0 <= dword && dword <= 255)) JV_ErrorHandle(JVERR_OPT_INI_INVALID_COLOR, FALSE); switch (i) { case 0: lowedge8 = dword; break; case 1: highedge8 = dword; break; case 2: r8 = dword; break; case 3: g8 = dword; break; case 4: b8 = dword; break; } } if (BL_COLOR_LEVEL <= color_idx) JV_ErrorHandle(JVERR_OPT_INI_TOO_MUCH_COLOR, FALSE); option.threshold[color_idx*2+0] = lowedge8; option.threshold[color_idx*2+1] = highedge8; option.color[color_idx] = RGB(r8, g8, b8); color_idx++; } break; } } } for (uint32_t i = color_idx; i < BL_COLOR_LEVEL; i++) { option.color[i] = 0; option.threshold[2*i] = 0; option.threshold[2*i+1] = 0; } // Free allocated byte in file_buf if (file_buf != BL_DefaultSettingStr) { free(file_buf); file_buf = NULL; } // Debug print #ifdef _DEBUG_CONSOLE puts("[Setting]"); printf("showcharge = %u\n", option.showcharge); printf("monitor = %u\n", option.monitor); printf("position = %u\n", option.position); printf("taskbar = %u\n", option.taskbar); printf("transparency = %u\n", option.transparency); printf("height = %u\n", option.height); putchar('\n'); puts("[Color]"); printf("defaultcolor = %lu,%lu,%lu\n", BLU_RGB_R(option.defaultcolor), BLU_RGB_G(option.defaultcolor), BLU_RGB_B(option.defaultcolor)); printf("chargecolor = %lu,%lu,%lu\n", BLU_RGB_R(option.chargecolor), BLU_RGB_G(option.chargecolor), BLU_RGB_B(option.chargecolor)); for (uint32_t i = 0; i < BL_COLOR_LEVEL; i++) { printf("color[%02d] = %lu,%lu,%lu\n", i, BLU_RGB_R(option.color[i]), BLU_RGB_G(option.color[i]), BLU_RGB_B(option.color[i])); printf("threshold[%02d] = %u\n", 2*i, option.threshold[2*i]); printf("threshold[%02d] = %u\n", 2*i+1, option.threshold[2*i+1]); } putchar('\n'); puts("[Event]"); // For WndProcedure Debug Message #endif // Check necessary options are read successfully if (!(valid.showcharge && valid.monitor && valid.position && valid.taskbar && valid.transparency && valid.height // Section [General] && valid.defaultcolor && valid.chargecolor && valid.fullcolor)) // Section [Color] { JV_ErrorHandle(JVERR_OPT_INI_MISSING_OPTIONS, FALSE); } return 0; }