Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions | Variables
scanner_ipc.cpp File Reference
#include <grpcpp/grpcpp.h>
#include "panoptes.grpc.pb.h"
#include "scanner_ipc.hpp"

Go to the source code of this file.

Functions

bool GetRegistryPortValue (DWORD &portValue)
 Get the Panoptes Service port value from the registry.
 

Variables

std::unique_ptr< PanoptesService::Stub > stub_
 

Function Documentation

◆ GetRegistryPortValue()

bool GetRegistryPortValue ( DWORD portValue)

Get the Panoptes Service port value from the registry.

Parameters
portValueThe port value from the registry
Returns
True if the port value was retrieved successfully, false otherwise

Definition at line 14 of file scanner_ipc.cpp.

14 {
15 HKEY hKey;
16 DWORD dwType = REG_DWORD;
17 DWORD dwSize = sizeof(DWORD);
18
19 // Open the key
20 LONG lResult = RegOpenKeyExA(
21 HKEY_LOCAL_MACHINE,
22 "SOFTWARE\\Panoptes",
23 0,
24 KEY_READ,
25 &hKey
26 );
27
28 if (lResult != ERROR_SUCCESS) {
29 std::cerr << "Error opening registry key. Error code: " << lResult << std::endl;
30 return false;
31 }
32
33 // Read the SRV_PORT value
34 lResult = RegQueryValueExA(
35 hKey,
36 "SRV_PORT",
37 NULL,
38 &dwType,
39 reinterpret_cast<LPBYTE>(&portValue),
40 &dwSize
41 );
42
43 RegCloseKey(hKey);
44
45 if (lResult != ERROR_SUCCESS) {
46 std::cerr << "Error reading registry value. Error code: " << lResult << std::endl;
47 return false;
48 }
49
50 if (dwType != REG_DWORD) {
51 std::cerr << "Unexpected value type in registry." << std::endl;
52 return false;
53 }
54
55 return true;
56}
unsigned long DWORD
Definition inject.h:2

Variable Documentation

◆ stub_

std::unique_ptr<PanoptesService::Stub> stub_

Definition at line 9 of file scanner_ipc.cpp.