diff --git a/.clang-format b/.clang-format index df2202e..8e5fe5a 100644 --- a/.clang-format +++ b/.clang-format @@ -3,81 +3,4 @@ # Author: Kehan Xue, kehan.xue (at) gmail.com Language: Cpp -BasedOnStyle: Google -AccessModifierOffset: -1 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: None -AlignOperands: Align -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: Empty -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding -AllowShortLambdasOnASingleLine: Inline -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterReturnType: None -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: true -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterStruct: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - BeforeLambdaBody: false - IndentBraces: false - SplitEmptyFunction: false - SplitEmptyRecord: false - SplitEmptyNamespace: false -BreakBeforeBinaryOperators: None -BreakBeforeTernaryOperators: true -BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon -ColumnLimit: 80 -CompactNamespaces: false -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false # Make sure the * or & align on the left -EmptyLineBeforeAccessModifier: LogicalBlock -FixNamespaceComments: true -IncludeBlocks: Preserve -IndentCaseLabels: true -IndentPPDirectives: None -IndentWidth: 2 -KeepEmptyLinesAtTheStartOfBlocks: true -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PointerAlignment: Left -ReflowComments: false -# SeparateDefinitionBlocks: Always # Only support since clang-format 14 -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceBeforeSquareBrackets: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpacesInContainerLiterals: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: c++11 -TabWidth: 4 -UseTab: Never +BasedOnStyle: Chromium \ No newline at end of file diff --git a/src/appid.h b/src/appid.h index 95a4d5f..80d0389 100644 --- a/src/appid.h +++ b/src/appid.h @@ -6,10 +6,12 @@ #include typedef HRESULT(WINAPI* pPSStringFromPropertyKey)(REFPROPERTYKEY pkey, - LPWSTR psz, UINT cch); + LPWSTR psz, + UINT cch); pPSStringFromPropertyKey RawPSStringFromPropertyKey = nullptr; -HRESULT WINAPI MyPSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, +HRESULT WINAPI MyPSStringFromPropertyKey(REFPROPERTYKEY pkey, + LPWSTR psz, UINT cch) { HRESULT result = RawPSStringFromPropertyKey(pkey, psz, cch); if (SUCCEEDED(result)) { diff --git a/src/config.h b/src/config.h index 1a8a742..f1afcef 100644 --- a/src/config.h +++ b/src/config.h @@ -11,7 +11,8 @@ bool IsIniExist() { return false; } -std::wstring GetIniString(const std::wstring& section, const std::wstring& key, +std::wstring GetIniString(const std::wstring& section, + const std::wstring& key, const std::wstring& default_value) { std::vector buffer(100); DWORD bytesread = 0; diff --git a/src/fastsearch.h b/src/fastsearch.h index 9cdc8c7..0395060 100644 --- a/src/fastsearch.h +++ b/src/fastsearch.h @@ -14,7 +14,9 @@ static const uint8_t* ForceSearch(const uint8_t* s, int n, const uint8_t* p) { return NULL; } -static const uint8_t* SundaySearch(const uint8_t* s, int n, const uint8_t* p, +static const uint8_t* SundaySearch(const uint8_t* s, + int n, + const uint8_t* p, int m) { int i, j; diff --git a/src/green.h b/src/green.h index 185de7b..ca0667d 100644 --- a/src/green.h +++ b/src/green.h @@ -19,11 +19,14 @@ BOOL WINAPI FakeGetVolumeInformation(_In_opt_ LPCTSTR lpRootPathName, return 0; } -BOOL WINAPI MyCryptProtectData( - _In_ DATA_BLOB* pDataIn, _In_opt_ LPCWSTR szDataDescr, - _In_opt_ DATA_BLOB* pOptionalEntropy, _Reserved_ PVOID pvReserved, - _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, _In_ DWORD dwFlags, - _Out_ DATA_BLOB* pDataOut) { +BOOL WINAPI +MyCryptProtectData(_In_ DATA_BLOB* pDataIn, + _In_opt_ LPCWSTR szDataDescr, + _In_opt_ DATA_BLOB* pOptionalEntropy, + _Reserved_ PVOID pvReserved, + _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, + _In_ DWORD dwFlags, + _Out_ DATA_BLOB* pDataOut) { pDataOut->cbData = pDataIn->cbData; pDataOut->pbData = (BYTE*)LocalAlloc(LMEM_FIXED, pDataOut->cbData); memcpy(pDataOut->pbData, pDataIn->pbData, pDataOut->cbData); @@ -31,18 +34,24 @@ BOOL WINAPI MyCryptProtectData( } typedef BOOL(WINAPI* pCryptUnprotectData)( - _In_ DATA_BLOB* pDataIn, _Out_opt_ LPWSTR* ppszDataDescr, - _In_opt_ DATA_BLOB* pOptionalEntropy, _Reserved_ PVOID pvReserved, - _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, _In_ DWORD dwFlags, + _In_ DATA_BLOB* pDataIn, + _Out_opt_ LPWSTR* ppszDataDescr, + _In_opt_ DATA_BLOB* pOptionalEntropy, + _Reserved_ PVOID pvReserved, + _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, + _In_ DWORD dwFlags, _Out_ DATA_BLOB* pDataOut); pCryptUnprotectData RawCryptUnprotectData = NULL; -BOOL WINAPI MyCryptUnprotectData( - _In_ DATA_BLOB* pDataIn, _Out_opt_ LPWSTR* ppszDataDescr, - _In_opt_ DATA_BLOB* pOptionalEntropy, _Reserved_ PVOID pvReserved, - _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, _In_ DWORD dwFlags, - _Out_ DATA_BLOB* pDataOut) { +BOOL WINAPI +MyCryptUnprotectData(_In_ DATA_BLOB* pDataIn, + _Out_opt_ LPWSTR* ppszDataDescr, + _In_opt_ DATA_BLOB* pOptionalEntropy, + _Reserved_ PVOID pvReserved, + _In_opt_ CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, + _In_ DWORD dwFlags, + _Out_ DATA_BLOB* pDataOut) { if (RawCryptUnprotectData(pDataIn, ppszDataDescr, pOptionalEntropy, pvReserved, pPromptStruct, dwFlags, pDataOut)) { return true; @@ -54,15 +63,21 @@ BOOL WINAPI MyCryptUnprotectData( return true; } -typedef DWORD(WINAPI* pLogonUserW)(LPCWSTR lpszUsername, LPCWSTR lpszDomain, - LPCWSTR lpszPassword, DWORD dwLogonType, - DWORD dwLogonProvider, PHANDLE phToken); +typedef DWORD(WINAPI* pLogonUserW)(LPCWSTR lpszUsername, + LPCWSTR lpszDomain, + LPCWSTR lpszPassword, + DWORD dwLogonType, + DWORD dwLogonProvider, + PHANDLE phToken); pLogonUserW RawLogonUserW = NULL; -DWORD WINAPI MyLogonUserW(LPCWSTR lpszUsername, LPCWSTR lpszDomain, - LPCWSTR lpszPassword, DWORD dwLogonType, - DWORD dwLogonProvider, PHANDLE phToken) { +DWORD WINAPI MyLogonUserW(LPCWSTR lpszUsername, + LPCWSTR lpszDomain, + LPCWSTR lpszPassword, + DWORD dwLogonType, + DWORD dwLogonProvider, + PHANDLE phToken) { DWORD ret = RawLogonUserW(lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken); @@ -84,13 +99,16 @@ BOOL WINAPI MyIsOS(DWORD dwOS) { } typedef NET_API_STATUS(WINAPI* pNetUserGetInfo)(LPCWSTR servername, - LPCWSTR username, DWORD level, + LPCWSTR username, + DWORD level, LPBYTE* bufptr); pNetUserGetInfo RawNetUserGetInfo = NULL; -NET_API_STATUS WINAPI MyNetUserGetInfo(LPCWSTR servername, LPCWSTR username, - DWORD level, LPBYTE* bufptr) { +NET_API_STATUS WINAPI MyNetUserGetInfo(LPCWSTR servername, + LPCWSTR username, + DWORD level, + LPBYTE* bufptr) { NET_API_STATUS ret = RawNetUserGetInfo(servername, username, level, bufptr); if (level == 1 && ret == 0) { LPUSER_INFO_1 user_info = (LPUSER_INFO_1)*bufptr; @@ -107,16 +125,23 @@ NET_API_STATUS WINAPI MyNetUserGetInfo(LPCWSTR servername, LPCWSTR username, (0x00000001ui64 << 28) typedef BOOL(WINAPI* pUpdateProcThreadAttribute)( - LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, DWORD dwFlags, - DWORD_PTR Attribute, PVOID lpValue, SIZE_T cbSize, PVOID lpPreviousValue, + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + DWORD dwFlags, + DWORD_PTR Attribute, + PVOID lpValue, + SIZE_T cbSize, + PVOID lpPreviousValue, PSIZE_T lpReturnSize); pUpdateProcThreadAttribute RawUpdateProcThreadAttribute = nullptr; BOOL WINAPI MyUpdateProcThreadAttribute( - __inout LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, __in DWORD dwFlags, - __in DWORD_PTR Attribute, __in_bcount_opt(cbSize) PVOID lpValue, - __in SIZE_T cbSize, __out_bcount_opt(cbSize) PVOID lpPreviousValue, + __inout LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + __in DWORD dwFlags, + __in DWORD_PTR Attribute, + __in_bcount_opt(cbSize) PVOID lpValue, + __in SIZE_T cbSize, + __out_bcount_opt(cbSize) PVOID lpPreviousValue, __in_opt PSIZE_T lpReturnSize) { if (Attribute == PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY && cbSize >= sizeof(DWORD64)) { diff --git a/src/hotkey.h b/src/hotkey.h index a56d468..2f41158 100644 --- a/src/hotkey.h +++ b/src/hotkey.h @@ -68,7 +68,8 @@ BOOL CALLBACK SearchChromeWindow(HWND hWnd, LPARAM lParam) { wchar_t buff[256]; GetClassNameW(hWnd, buff, 255); if (wcscmp(buff, L"Chrome_WidgetWin_1") == - 0) // || wcscmp(buff, L"Chrome_WidgetWin_2")==0 || wcscmp(buff, L"SysShadow")==0 ) + 0) // || wcscmp(buff, L"Chrome_WidgetWin_2")==0 || wcscmp(buff, + // L"SysShadow")==0 ) { ShowWindow(hWnd, SW_HIDE); hwnd_list.push_back(hWnd); diff --git a/src/iaccessible.h b/src/iaccessible.h index 93dd62b..f4b0055 100644 --- a/src/iaccessible.h +++ b/src/iaccessible.h @@ -118,7 +118,8 @@ void TraversalAccessible(NodePtr node, Function f, bool raw_traversal = false) { } if (is_task_completed) { - arrChildren[j].pdispVal->Release(); // Release immediately to avoid memory leaks. + arrChildren[j] + .pdispVal->Release(); // Release immediately to avoid memory leaks. continue; } @@ -356,7 +357,6 @@ bool IsOnTheTabBar(NodePtr top, POINT pt) { // Determine whether it is a new tab page from the name of the current tab page. bool IsNameNewTab(NodePtr top) { - bool flag = false; std::unique_ptr new_tab_name(nullptr, free); NodePtr page_tab_list = FindElementWithRole(top, ROLE_SYSTEM_PAGETABLIST); @@ -367,7 +367,8 @@ bool IsNameNewTab(NodePtr top) { TraversalAccessible(page_tab_list, [&new_tab_name](NodePtr child) { if (GetAccessibleRole(child) == ROLE_SYSTEM_PUSHBUTTON) { GetAccessibleName(child, [&new_tab_name](BSTR bstr) { - new_tab_name.reset(_wcsdup(bstr)); // Save the name obtained from the new tab button. + new_tab_name.reset( + _wcsdup(bstr)); // Save the name obtained from the new tab button. }); } return false; @@ -407,9 +408,9 @@ bool IsNameNewTab(NodePtr top) { return flag; } -// Determine whether it is a new tab page from the document value of the tab page. +// Determine whether it is a new tab page from the document value of the tab +// page. bool IsDocNewTab() { - auto cr_command_line = GetCrCommandLine(); if (cr_command_line.find(L"--force-renderer-accessibility") == std::wstring::npos) { diff --git a/src/pakfile.h b/src/pakfile.h index 2f2d5c1..93f1d7b 100644 --- a/src/pakfile.h +++ b/src/pakfile.h @@ -39,7 +39,8 @@ struct PAK_ALIAS { }; #pragma pack(pop) -bool CheckHeader(uint8_t* buffer, PAK_ENTRY*& pak_entry, +bool CheckHeader(uint8_t* buffer, + PAK_ENTRY*& pak_entry, PAK_ENTRY*& end_entry) { uint32_t version = *(uint32_t*)buffer; diff --git a/src/pakpatch.h b/src/pakpatch.h index 4cd3c19..587796f 100644 --- a/src/pakpatch.h +++ b/src/pakpatch.h @@ -40,7 +40,6 @@ HANDLE WINAPI MyMapViewOfFile(_In_ HANDLE hFileMappingObject, uint8_t* pos = memmem(begin, size, search_start, sizeof(search_start) - 1); if (pos) { - // Compress the HTML for writing patch information. std::string html((char*)begin, size); compression_html(html); @@ -82,10 +81,13 @@ HANDLE WINAPI MyMapViewOfFile(_In_ HANDLE hFileMappingObject, HANDLE resources_pak_file = NULL; -typedef HANDLE(WINAPI* pCreateFileMapping)( - _In_ HANDLE hFile, _In_opt_ LPSECURITY_ATTRIBUTES lpAttributes, - _In_ DWORD flProtect, _In_ DWORD dwMaximumSizeHigh, - _In_ DWORD dwMaximumSizeLow, _In_opt_ LPCTSTR lpName); +typedef HANDLE(WINAPI* pCreateFileMapping)(_In_ HANDLE hFile, + _In_opt_ LPSECURITY_ATTRIBUTES + lpAttributes, + _In_ DWORD flProtect, + _In_ DWORD dwMaximumSizeHigh, + _In_ DWORD dwMaximumSizeLow, + _In_opt_ LPCTSTR lpName); pCreateFileMapping RawCreateFileMapping = NULL; @@ -116,15 +118,19 @@ HANDLE WINAPI MyCreateFileMapping(_In_ HANDLE hFile, dwMaximumSizeLow, lpName); } -typedef HANDLE(WINAPI* pCreateFile)( - _In_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, - _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, - _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, - _In_opt_ HANDLE hTemplateFile); +typedef HANDLE(WINAPI* pCreateFile)(_In_ LPCTSTR lpFileName, + _In_ DWORD dwDesiredAccess, + _In_ DWORD dwShareMode, + _In_opt_ LPSECURITY_ATTRIBUTES + lpSecurityAttributes, + _In_ DWORD dwCreationDisposition, + _In_ DWORD dwFlagsAndAttributes, + _In_opt_ HANDLE hTemplateFile); pCreateFile RawCreateFile = NULL; -HANDLE WINAPI MyCreateFile(_In_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, +HANDLE WINAPI MyCreateFile(_In_ LPCTSTR lpFileName, + _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, diff --git a/src/patch.h b/src/patch.h index 9e9f553..fa4932f 100644 --- a/src/patch.h +++ b/src/patch.h @@ -26,11 +26,11 @@ pLdrLoadDll RawLdrLoadDll = nullptr; // void Outdated(HMODULE module) { // // "OutdatedUpgradeBubble.Show" // #ifdef _WIN64 -// BYTE search[] = {0x48, 0x89, 0x8C, 0x24, 0xF0, 0x00, 0x00, 0x00, 0x80, 0x3D}; -// uint8_t* match = SearchModuleRaw(module, search, sizeof(search)); +// BYTE search[] = {0x48, 0x89, 0x8C, 0x24, 0xF0, 0x00, 0x00, 0x00, 0x80, +// 0x3D}; uint8_t* match = SearchModuleRaw(module, search, sizeof(search)); // #else -// BYTE search[] = {0x31, 0xE8, 0x89, 0x45, 0xF0, 0x88, 0x5D, 0xEF, 0x80, 0x3D}; -// uint8_t* match = SearchModuleRaw(module, search, sizeof(search)); +// BYTE search[] = {0x31, 0xE8, 0x89, 0x45, 0xF0, 0x88, 0x5D, 0xEF, 0x80, +// 0x3D}; uint8_t* match = SearchModuleRaw(module, search, sizeof(search)); // #endif // if (match) { // if (*(match + 0xF) == 0x74) { diff --git a/src/portable.h b/src/portable.h index 44efb8d..16b8110 100644 --- a/src/portable.h +++ b/src/portable.h @@ -67,7 +67,8 @@ std::wstring GetCommand(LPWSTR param) { // Get the command line and append parameters // Intercept and split the parameters starting with each --, // and then args.push_back multiple times - // Repeat the above process until the -- sign no longer exists in the string + // Repeat the above process until the -- sign no longer exists in the + // string { auto cr_command_line = GetCrCommandLine(); std::wstring temp = cr_command_line; diff --git a/src/tabbookmark.h b/src/tabbookmark.h index 4442e38..a9311ba 100644 --- a/src/tabbookmark.h +++ b/src/tabbookmark.h @@ -311,7 +311,6 @@ LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) { } int HandleKeepTab(WPARAM wParam) { - if (!(wParam == 'W' && IsPressed(VK_CONTROL) && !IsPressed(VK_SHIFT)) && !(wParam == VK_F4 && IsPressed(VK_CONTROL))) { return 0; diff --git a/src/utils.h b/src/utils.h index 3de50cf..88dd18a 100644 --- a/src/utils.h +++ b/src/utils.h @@ -14,7 +14,6 @@ #include "FastSearch.h" - // https://source.chromium.org/chromium/chromium/src/+/main:chrome/app/chrome_command_ids.h?q=chrome_command_ids.h&ss=chromium%2Fchromium%2Fsrc #define IDC_NEW_TAB 34014 #define IDC_CLOSE_TAB 34015 @@ -106,7 +105,8 @@ std::vector StringSplit(const std::wstring& str, } // Replace string in INI file. -void ReplaceStringIni(std::wstring& subject, const std::wstring& search, +void ReplaceStringIni(std::wstring& subject, + const std::wstring& search, const std::wstring& replace) { size_t pos = 0; while ((pos = subject.find(search, pos)) != std::wstring::npos) { @@ -155,7 +155,8 @@ void compression_html(std::string& html) { } } -bool ReplaceStringInPlace(std::string& subject, const std::string& search, +bool ReplaceStringInPlace(std::string& subject, + const std::string& search, const std::string& replace) { bool find = false; size_t pos = 0; @@ -167,7 +168,6 @@ bool ReplaceStringInPlace(std::string& subject, const std::string& search, return find; } - // Memory and module search functions. // Search memory. uint8_t* memmem(uint8_t* src, int n, const uint8_t* sub, int m) { @@ -214,19 +214,18 @@ uint8_t* SearchModuleRaw2(HMODULE module, const uint8_t* sub, int m) { return nullptr; } -//bool WriteMemory(PBYTE BaseAddress, PBYTE Buffer, DWORD nSize) { -// DWORD ProtectFlag = 0; -// if (VirtualProtectEx(GetCurrentProcess(), BaseAddress, nSize, -// PAGE_EXECUTE_READWRITE, &ProtectFlag)) { -// memcpy(BaseAddress, Buffer, nSize); -// FlushInstructionCache(GetCurrentProcess(), BaseAddress, nSize); -// VirtualProtectEx(GetCurrentProcess(), BaseAddress, nSize, ProtectFlag, -// &ProtectFlag); -// return true; -// } -// return false; -//} - +// bool WriteMemory(PBYTE BaseAddress, PBYTE Buffer, DWORD nSize) { +// DWORD ProtectFlag = 0; +// if (VirtualProtectEx(GetCurrentProcess(), BaseAddress, nSize, +// PAGE_EXECUTE_READWRITE, &ProtectFlag)) { +// memcpy(BaseAddress, Buffer, nSize); +// FlushInstructionCache(GetCurrentProcess(), BaseAddress, nSize); +// VirtualProtectEx(GetCurrentProcess(), BaseAddress, nSize, ProtectFlag, +// &ProtectFlag); +// return true; +// } +// return false; +// } // Path and file manipulation functions. // Get the directory where the application is located. @@ -267,30 +266,28 @@ std::wstring ExpandEnvironmentPath(const std::wstring& path) { return std::wstring(&buffer[0], 0, ExpandedLength); } - // Debug log function. void DebugLog(const wchar_t* format, ...) { -// va_list args; -// -// va_start(args, format); -// auto str = Format(format, args); -// va_end(args); -// -// str = Format(L"[chrome++] %s\n", str.c_str()); -// -// std::string nstr = wstring_to_string(str); -// const char* cstr = nstr.c_str(); -// -// FILE* fp = nullptr; -// std::wstring logPath = GetAppDir() + L"\\Chrome++_Debug.log"; -// _wfopen_s(&fp, logPath.c_str(), L"a+"); -// if (fp) { -// fwrite(cstr, strlen(cstr), 1, fp); -// fclose(fp); -// } + // va_list args; + // + // va_start(args, format); + // auto str = Format(format, args); + // va_end(args); + // + // str = Format(L"[chrome++] %s\n", str.c_str()); + // + // std::string nstr = wstring_to_string(str); + // const char* cstr = nstr.c_str(); + // + // FILE* fp = nullptr; + // std::wstring logPath = GetAppDir() + L"\\Chrome++_Debug.log"; + // _wfopen_s(&fp, logPath.c_str(), L"a+"); + // if (fp) { + // fwrite(cstr, strlen(cstr), 1, fp); + // fclose(fp); + // } } - // Window and message processing functions. HWND GetTopWnd(HWND hwnd) { while (::GetParent(hwnd) && ::IsWindowVisible(::GetParent(hwnd))) { @@ -310,13 +307,12 @@ void ExecuteCommand(int id, HWND hwnd = 0) { bool IsFullScreen(HWND hwnd) { RECT windowRect; - return (GetClientRect(hwnd, &windowRect) - && (windowRect.left == 0 && windowRect.top == 0 - && windowRect.right == GetSystemMetrics(SM_CXSCREEN) - && windowRect.bottom == GetSystemMetrics(SM_CYSCREEN))); + return (GetClientRect(hwnd, &windowRect) && + (windowRect.left == 0 && windowRect.top == 0 && + windowRect.right == GetSystemMetrics(SM_CXSCREEN) && + windowRect.bottom == GetSystemMetrics(SM_CYSCREEN))); } - // Keyboard and mouse input functions. // Send the combined key operation. // class SendKeys {