Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
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.

Classes

class  PanoptesService_Stub_Holder

Macros

#define PANOPTES_REG_ROOT   HKEY_LOCAL_MACHINE

Functions

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

Macro Definition Documentation

◆ PANOPTES_REG_ROOT

#define PANOPTES_REG_ROOT   HKEY_LOCAL_MACHINE

Definition at line 18 of file scanner_ipc.cpp.

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 24 of file scanner_ipc.cpp.

24 {
25 HKEY hKey;
26 DWORD dwType = REG_DWORD;
27 DWORD dwSize = sizeof(DWORD);
28
29 // Open the key
30 LONG lResult = RegOpenKeyExA(
32 "SOFTWARE\\Panoptes",
33 0,
34 KEY_READ,
35 &hKey
36 );
37
38 if (lResult != ERROR_SUCCESS) {
39 std::cerr << "Error opening registry key. Error code: " << lResult << std::endl;
40 return false;
41 }
42
43 // Read the SRV_PORT value
44 lResult = RegQueryValueExA(
45 hKey,
46 "SRV_PORT",
47 NULL,
48 &dwType,
49 reinterpret_cast<LPBYTE>(&portValue),
50 &dwSize
51 );
52
53 RegCloseKey(hKey);
54
55 if (lResult != ERROR_SUCCESS) {
56 std::cerr << "Error reading registry value. Error code: " << lResult << std::endl;
57 return false;
58 }
59
60 if (dwType != REG_DWORD) {
61 std::cerr << "Unexpected value type in registry." << std::endl;
62 return false;
63 }
64
65 return true;
66}
#define PANOPTES_REG_ROOT
Definition container.cpp:24

References PANOPTES_REG_ROOT.