Skip to content

Commit

Permalink
Version 1.0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
loopback-kr committed Apr 27, 2024
1 parent 3b57474 commit ccee30d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Deployment/Installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
!define PRODUCT_FULLNAME "KakaoTalk ADGuard"
!define PRODUCT_NAME "KakaoTalkADGuard"
!define PRODUCT_COMMENTS "AD removal tool for Windows KakaoTalk"
!define PRODUCT_VERSION "1.0.0.6"
!define PRODUCT_VERSION "1.0.0.7"
!define BUILD_ARCH "x64"
!define PRODUCT_PUBLISHER "loopback.kr"
!define PRODUCT_REG_ROOTKEY "HKCU"
Expand Down Expand Up @@ -58,9 +58,9 @@ FunctionEnd
Section "Installer Section"
SetOutPath $INSTDIR
${If} ${RunningX64}
File "..\Release\x64\${PRODUCT_NAME}.exe"
File /oname=${PRODUCT_NAME}.exe "..\Release\x64\${PRODUCT_NAME}.x64.exe"
${Else}
File "..\Release\win32\${PRODUCT_NAME}.exe"
File /oname=${PRODUCT_NAME}.exe "..\Release\win32\${PRODUCT_NAME}.x86.exe"
${EndIf}
; File "RestoreTrayIcon.exe"
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
Expand Down
Binary file modified KakaoTalkADGuard/KakaoTalkADGuard.aps
Binary file not shown.
Binary file modified KakaoTalkADGuard/KakaoTalkADGuard.rc
Binary file not shown.
2 changes: 2 additions & 0 deletions KakaoTalkADGuard/KakaoTalkADGuard.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName).$(PlatformTarget)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down Expand Up @@ -140,6 +141,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName).$(PlatformTarget)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
41 changes: 37 additions & 4 deletions KakaoTalkADGuard/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,22 @@ BOOL DeleteTrayIcon(NOTIFYICONDATA nid) {

void ShowContextMenu(HWND hwnd, POINT pt) {
HMENU hMenu;
WCHAR szAppName[MAX_LOADSTRING];
WCHAR szVersion[MAX_LOADSTRING];
WCHAR szFullAppName[MAX_LOADSTRING];
szFullAppName[0] = L'\0';
LoadStringW(hInst, IDS_APP_NAME, szAppName, MAX_LOADSTRING);
LoadStringW(hInst, IDS_APP_VERSION, szVersion, MAX_LOADSTRING);
wcscpy_s(szFullAppName, szAppName);
wcscat_s(szFullAppName, L" ");
wcscat_s(szFullAppName, szVersion);

if (bPortable) {
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TRAY_CONTEXTMENU_PORTABLE));
ModifyMenuW(hMenu, ID__APP_TITLE, MF_BYCOMMAND | MF_STRING | MF_DISABLED, ID__APP_TITLE, (LPCWSTR) szFullAppName);
} else {
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_TRAY_CONTEXTMENU));
ModifyMenuW(hMenu, ID__APP_TITLE, MF_BYCOMMAND | MF_STRING | MF_DISABLED, ID__APP_TITLE, (LPCWSTR)szFullAppName);
}
HMENU hSubMenu = GetSubMenu(hMenu, 0);
SetForegroundWindow(hwnd); // our window must be foreground before calling TrackPopupMenu or the menu will not disappear when the user clicks away
Expand Down Expand Up @@ -299,13 +311,26 @@ BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) {
WCHAR windowText[256] = L"";
GetClassName(hwnd, className, 256);
GetWindowText(hwnd, windowText, 256);
RECT Recthwnd;

if (wcscmp(className, L"EVA_ChildWindow") == 0) {
if (wcsncmp(windowText, L"OnlineMainView_", 15) == 0) { // Expand chat widget to empty space
SetWindowPos(hwnd, HWND_TOP, 0, 0, (RectKakaoTalkMain.right - RectKakaoTalkMain.left), (RectKakaoTalkMain.bottom - RectKakaoTalkMain.top - 32), SWP_NOMOVE);
} else if (wcscmp(windowText, L"") == 0) {
GetWindowRect(hwnd, &Recthwnd);
int width = Recthwnd.right - Recthwnd.left;
int height = Recthwnd.bottom - Recthwnd.top;
if (height <= 200 && width > height) {
ShowWindow(hwnd, SW_HIDE);
}
}
return TRUE;
}
if (wcsncmp(windowText, L"LockModeView_", 13) == 0) { // Expand numpad in Lockdown mode
HWND hLockdownNumpad = FindWindowEx(hwnd, NULL, L"EVA_ChildWindow", L"");
if (hLockdownNumpad != NULL)
SetWindowPos(hwnd, HWND_TOP, 0, 0, (RectKakaoTalkMain.right - RectKakaoTalkMain.left), (RectKakaoTalkMain.bottom - RectKakaoTalkMain.top), SWP_NOMOVE);
}
if (wcscmp(className, L"BannerAdWnd") == 0) {
ShowWindow(hwnd, SW_HIDE);
return TRUE;
Expand All @@ -325,32 +350,40 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT message, UINT idEvent, DWORD dwTimer) {
switch (idEvent) {
case 1: // Remove KakaoTalk ADs
// Find main handle
HWND hKakaoTalkMain = FindWindow(L"EVA_Window_Dblclk", L"카카오톡");
HWND hKakaoTalkMain = NULL;
const WCHAR* kakaoTalkNames[] = {L"카카오톡", L"カカオトーク", L"KakaoTalk"};
int numNames = sizeof(kakaoTalkNames) / sizeof(kakaoTalkNames[0]);
for (int i = 0; i < numNames; ++i) {
hKakaoTalkMain = FindWindow(L"EVA_Window_Dblclk", kakaoTalkNames[i]);
if (hKakaoTalkMain != NULL)
break;
}

// Block banner AD
HWND hKakaoTalkAd = FindWindow(L"EVA_Window_Dblclk", L"");
RECT RectKakaoTalkAd;
if (GetParent(hKakaoTalkAd) == hKakaoTalkMain) {
GetWindowRect(hKakaoTalkAd, &RectKakaoTalkAd);
int width = RectKakaoTalkAd.right - RectKakaoTalkAd.left;
int height = RectKakaoTalkAd.bottom - RectKakaoTalkAd.top;
if (height == 100) {
if (height <= 200 && width > height) {
ShowWindow(hKakaoTalkAd, SW_HIDE);
}
}

// Scan ADs recursive
GetWindowRect(hKakaoTalkMain, &RectKakaoTalkMain);
EnumChildWindows(hKakaoTalkMain, EnumChildProc, NULL);
EnumChildWindows(hKakaoTalkAd, EnumChildProc, NULL);

// Sanity check for Popup AD
// Block popup AD
DWORD pid_main = 0;
DWORD pid_popup = 0;
HWND hPopupWnd = FindWindow(L"RichPopWnd", L"");
GetWindowThreadProcessId(hKakaoTalkMain, &pid_main);
GetWindowThreadProcessId(hPopupWnd, &pid_popup);
if (pid_main == pid_popup)
ShowWindow(hPopupWnd, SW_HIDE);

break;
}
}
6 changes: 4 additions & 2 deletions KakaoTalkADGuard/resource.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++에서 생성한 포함 파일입니다.
// KakaoTalkADGuard.rc에서 사용되고 있습니다.
// Microsoft Visual C++ generated include file.
// Used by KakaoTalkADGuard.rc
//
#define IDC_MYICON 2
#define IDD_KAKAOTALKADGUARD_DIALOG 102
Expand All @@ -13,6 +13,7 @@
#define IDC_KAKAOTALKADGUARD 109
#define IDC_KAKAOTALKADGUARD_RESTORETRAY 110
#define IDS_MSGBOX_RESTORETRAY 111
#define IDS_APP_VERSION 112
#define IDR_MAINFRAME 128
#define IDR_TRAY_CONTEXTMENU 133
#define IDI_ICON1 134
Expand All @@ -30,6 +31,7 @@
#define IDM_STARTONSYSTEMSTARTUP 32780
#define ID__ 32781
#define IDM__TEST 32782
#define ID__APP_TITLE 32783
#define IDC_STATIC -1

// Next default values for new objects
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ AD removal tool for Windows KakaoTalk

- On Windows with HiDPI, the trayicon menu is displayed in an abnormal position.

- If a KakaoTalk process is running on a regular user account that has been promoted to administrator privileges due to a KakaoTalk update, it is not possible to block ADs unless KakaoTalk ADGuard is also running as administrator privileges.

## Preview

![Highlights](https://github.com/loopback-kr/KakaoTalkADGuard/assets/28856527/493bea2b-87c9-4792-9cfd-c534aec02b14)

## Release notes

### 1.0.0.7

<sup>Apr. 27, 2024</sup>

- Support for multilingual versions of KakaoTalk
- Changed banner AD blocking criteria
- Removed white box at lockdown mode
- Code refactoring

### 1.0.0.6

<sup>Apr. 22, 2024</sup>
Expand Down

0 comments on commit ccee30d

Please sign in to comment.