Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions
error_message.h File Reference
#include <Windows.h>
#include <string>
#include "service_constants.h"
#include "ResourceCore.h"

Go to the source code of this file.

Functions

void DisplayErrorMessage (std::string errorMessage)
 
std::string GetErrorMessage (UINT resourceID)
 

Function Documentation

◆ DisplayErrorMessage()

void DisplayErrorMessage ( std::string  errorMessage)

Definition at line 24 of file error_message.cpp.

25{
26 MessageBoxA(NULL, errorMessage.c_str(), "Panoptes EDR", MB_OK | MB_ICONERROR);
27 return;
28}

Referenced by CleanupWithError(), and WinMain().

◆ GetErrorMessage()

std::string GetErrorMessage ( UINT  resourceID)

Definition at line 5 of file error_message.cpp.

6{
7 char buffer[MAX_PATH];
8 GetModuleFileNameA(NULL, buffer, MAX_PATH);
9 std::string::size_type pos = std::string(buffer).find_last_of("\\/");
10 std::string currentPath = std::string(buffer).substr(0, pos);
11
12 std::string fullPath = currentPath + "\\Resources.dll";
13
14 HMODULE hModule = LoadLibraryA(fullPath.c_str());
15 if(hModule == NULL)
16 return "";
17
18 char err_buffer[1024];
19 LoadStringA(hModule, resourceID, (LPSTR)err_buffer, MAX_PATH);
20
21 return std::string(err_buffer);;
22}
#define MAX_PATH
Definition callbacks.h:6

References MAX_PATH.

Referenced by CleanupWithError(), and WinMain().