#include <grpcpp/grpcpp.h>
#include "panoptes.grpc.pb.h"
#include "scanner_ipc.hpp"
Go to the source code of this file.
|
| std::unique_ptr< PanoptesService::Stub > | stub_ |
| |
◆ GetRegistryPortValue()
| bool GetRegistryPortValue |
( |
DWORD & |
portValue | ) |
|
Get the Panoptes Service port value from the registry.
- Parameters
-
| portValue | The 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;
18
19
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
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}
◆ stub_
| std::unique_ptr<PanoptesService::Stub> stub_ |