minor clean-up

removing old stuff and cleaning up currently-unused code
This commit is contained in:
Declan B. 2024-08-14 17:38:38 +01:00
parent 80bcc4f900
commit 3444c7e2c5
Signed by: yellows111
SSH key fingerprint: SHA256:ynw5IJBU1pb7fZfHgLihKu9gHHA8FVpixZbB6IEB3r8

View file

@ -18,19 +18,21 @@ hostent * (WSAAPI * Real_gethostbyname) (const char *name) = gethostbyname;
INT(WSAAPI * Real_getaddrinfo) (PCSTR pNodeName, PCSTR pServiceName, const ADDRINFOA *pHints, PADDRINFOA *ppResult) = getaddrinfo;
BOOL ServerNeedsPatching(const char* server) {
// don't redirect the service itself that's BAD
if(strcmp(server, MESSENGERSERVICE) == 0) {
return false;
}
DWORD type;
DWORD size;
LSTATUS status = RegQueryValueExA(REGISTRYROOT, server, NULL, &type, NULL, &size);
#if DEBUG
MessageBoxA(NULL, server, "checking for", MB_OK | MB_ICONINFORMATION);
#endif
LSTATUS status = RegQueryValueExA(REGISTRYROOT, server, NULL, NULL, NULL, NULL);
if (status == ERROR_SUCCESS) {
MessageBoxA(NULL, "did it", "eys", MB_OK | MB_ICONERROR);
//byte* data = (byte*)malloc(size);
//status2 = RegQueryValueExA(key, "Server", NULL, NULL, data, &size);
// TODO?: read keys to see where to go to
return true;
}
MessageBoxA(NULL, "nope", "NO", MB_OK | MB_ICONERROR);
#if DEBUG
MessageBoxA(NULL, server, "no key for", MB_OK | MB_ICONERROR);
#endif
return false;
}
@ -88,20 +90,17 @@ VOID LoadURL() {
if (status == ERROR_FILE_NOT_FOUND) {
SetFallbackService();
RegSetValueExA(key, "Server", 0, REG_SZ, (byte*)MESSENGERSERVICE, strlen(MESSENGERSERVICE));
//RegCloseKey(key);
return;
}
if (status != ERROR_SUCCESS) {
char c[128];
sprintf_s(c, "Reading MSNRedirector Server from registry failed with system error %d\nFalling back to default", status);
MessageBoxA(NULL, c, "Computernewb MSNRedirector", MB_OK | MB_ICONERROR);
//RegCloseKey(key);
SetFallbackService();
return;
}
if (type != REG_SZ) {
MessageBoxA(NULL, "Reading MSNRedirector Server from registry failed because the value is not a string.\nFalling back to default", "Computernewb MSNRedirector", MB_OK | MB_ICONERROR);
//RegCloseKey(key);
SetFallbackService();
return;
}
@ -113,11 +112,9 @@ VOID LoadURL() {
sprintf_s(c, "Reading MSNRedirector Server from registry failed with system error %d\nFalling back to default", status);
MessageBoxA(NULL, c, "Computernewb MSNRedirector", MB_OK | MB_ICONERROR);
free(data);
//RegCloseKey(key);
SetFallbackService();
return;
}
//RegCloseKey(key);
MESSENGERSERVICE = (char*)data;
return;
}
@ -163,4 +160,4 @@ BOOL APIENTRY DllMain( HMODULE hModule,
}
__declspec(dllexport) void WINAPI ImportThis() {}
__declspec(dllexport) void WINAPI ImportMe() {}
__declspec(dllexport) void WINAPI ImportMe() {}