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

Go to the source code of this file.

Functions

bool GetRegistryPortValue (DWORD &portValue)
 

Variables

std::unique_ptr< PanoptesService::Stub > stub_
 

Function Documentation

◆ GetRegistryPortValue()

bool GetRegistryPortValue ( DWORD portValue)

Definition at line 10 of file service_client_pe.cpp.

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

Variable Documentation

◆ stub_

std::unique_ptr<PanoptesService::Stub> stub_

Definition at line 8 of file service_client_pe.cpp.