Skip to content

Commit 727a519

Browse files
committed
Url_handler.exe: removed functions to access the registry and start NVDA. Removed shell32 and advapi32 from linked libraries, they are nolonger required
1 parent 7259e29 commit 727a519

File tree

2 files changed

+5
-45
lines changed

2 files changed

+5
-45
lines changed

addon/globalPlugins/remoteClient/url_handler.cpp

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#include <string>
33
#include <windows.h>
44

5-
std::wstring GetNVDAPath ();
6-
LONG GetStringRegKey(HKEY hKey, const std::wstring &strValueName, std::wstring &strValue, const std::wstring &strDefaultValue);
7-
85
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
96
{
107
if (__argc < 2) {
@@ -24,51 +21,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpC
2421
cds.cbData = (args.length()*2)+2;
2522
HWND hwnd;
2623
hwnd = FindWindow(L"TeleNVDAURLHandler", NULL);
27-
if (hwnd == 0) {
28-
NVDAPath = GetNVDAPath();
29-
ShellExecute(0, NULL, NVDAPath.c_str(), NULL, NULL, 0);
30-
};
3124
for (int tries = 0; tries < 300; tries++) {
32-
Sleep(100);
33-
hwnd = FindWindow(L"TeleNVDAURLHandler", NULL);
34-
if (hwnd > 0) {
25+
if (hwnd > (HWND)0) {
3526
Sleep(100); /* Needed to ensure the window is fully created */
3627
SendMessage(hwnd, WM_COPYDATA, 0, (LPARAM)&cds);
3728
return 0;
3829
};
39-
}
40-
return 1;
41-
}
42-
43-
/* Get the path to the NVDA executable if installed
44-
Return an empty string if the path cannot be found. */
45-
46-
std::wstring GetNVDAPath () {
47-
HKEY hKey;
48-
LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\NVDA", 0, KEY_READ, &hKey);
49-
if (lRes != ERROR_SUCCESS) {
50-
return L"";
51-
}
52-
std::wstring result;
53-
std::wstring BadValue;
54-
GetStringRegKey(hKey, L"InstallDir", result, L"bad");
55-
if (result == L"bad") {
56-
return L"";
30+
Sleep(100);
31+
hwnd = FindWindow(L"TeleNVDAURLHandler", NULL);
5732
}
58-
result += L"\\NVDA.exe";
59-
return result;
33+
return 1;
6034
}
61-
62-
LONG GetStringRegKey(HKEY hKey, const std::wstring &strValueName, std::wstring &strValue, const std::wstring &strDefaultValue)
63-
{
64-
strValue = strDefaultValue;
65-
WCHAR szBuffer[512];
66-
DWORD dwBufferSize = sizeof(szBuffer);
67-
ULONG nError;
68-
nError = RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, (LPBYTE)szBuffer, &dwBufferSize);
69-
if (ERROR_SUCCESS == nError)
70-
{
71-
strValue = szBuffer;
72-
}
73-
return nError;
74-
}

sconstruct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ env.Depends(manifest, "buildVars.py")
322322

323323
env.Depends(addon, manifest)
324324

325-
url_handler = env.Program('addon/globalPlugins/remoteClient/url_handler.cpp', CCFLAGS='/EHsc', LIBS=['advapi32', 'shell32', 'user32'])
325+
url_handler = env.Program('addon/globalPlugins/remoteClient/url_handler.cpp', CCFLAGS='/EHsc', LIBS=['user32'])
326326
env.Depends(addon, url_handler)
327327

328328
env.Default(addon)

0 commit comments

Comments
 (0)