mirror of
https://github.com/haunted-zeroday/PE-XRay-EDR
synced 2026-06-06 15:44:31 +00:00
Updated to wchar_t
This commit is contained in:
+18
-18
@@ -63,29 +63,29 @@ void print_analysis_results_cli(const AnalysisResult* result) {
|
||||
}
|
||||
}
|
||||
|
||||
void print_usage(const char* app_name) {
|
||||
printf("PE-XRay Command-Line Analyzer\n");
|
||||
printf("Usage:\n");
|
||||
printf(" %s <path_to_file.exe_or_dll> : Analyze a file.\n", app_name);
|
||||
printf(" %s --install : Enable context menu integration (needs admin rights).\n", app_name);
|
||||
printf(" %s --uninstall : Disable context menu integration (needs admin rights).\n", app_name);
|
||||
printf(" %s --help : Show this help message.\n", app_name);
|
||||
void print_usage(WCHAR* app_name) {
|
||||
wprintf(L"PE-XRay Command-Line Analyzer\n");
|
||||
wprintf(L"Usage:\n");
|
||||
wprintf(L" %s <path_to_file.exe_or_dll> : Analyze a file.\n", app_name);
|
||||
wprintf(L" %s --install : Enable context menu integration (needs admin rights).\n", app_name);
|
||||
wprintf(L" %s --uninstall : Disable context menu integration (needs admin rights).\n", app_name);
|
||||
wprintf(L" %s --help : Show this help message.\n", app_name);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int wmain(int argc, WCHAR** argv) {
|
||||
if (argc < 2) {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* command = argv[1];
|
||||
WCHAR* command = argv[1];
|
||||
|
||||
if (strcmp(command, "--help") == 0 || strcmp(command, "-h") == 0) {
|
||||
if (wcscmp(command, L"--help") == 0 || wcscmp(command, L"-h") == 0) {
|
||||
print_usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(command, "--install") == 0) {
|
||||
if (wcscmp(command, L"--install") == 0) {
|
||||
if (enable_integration_all()) {
|
||||
printf("Context menu integration enabled successfully.\n");
|
||||
return 0;
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(command, "--uninstall") == 0) {
|
||||
if (wcscmp(command, L"--uninstall") == 0) {
|
||||
if (disable_integration_all()) {
|
||||
printf("Context menu integration disabled successfully.\n");
|
||||
return 0;
|
||||
@@ -104,11 +104,11 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
char* filePathUtf8 = command;
|
||||
printf("Analyzing file: %s\n\n", filePathUtf8);
|
||||
WCHAR* filePathUtf8 = command;
|
||||
wprintf(L"Analyzing file: %s\n\n", filePathUtf8);
|
||||
|
||||
WCHAR* filePathWchar = ConvertUtf8ToWchar(filePathUtf8);
|
||||
if (!filePathWchar) {
|
||||
// WCHAR* filePathWchar = ConvertUtf8ToWchar(filePathUtf8);
|
||||
if (!filePathUtf8) {
|
||||
fprintf(stderr, "Error: Could not convert file path to wide string.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -116,13 +116,13 @@ int main(int argc, char** argv) {
|
||||
AnalysisResult result_data;
|
||||
memset(&result_data, 0, sizeof(AnalysisResult));
|
||||
|
||||
if (analyze_pe_file(filePathWchar, &result_data)) {
|
||||
if (analyze_pe_file(filePathUtf8, &result_data)) {
|
||||
print_analysis_results_cli(&result_data);
|
||||
} else {
|
||||
fprintf(stderr, "Error: Failed to analyze the PE file. It might be corrupted or not a PE file.\n");
|
||||
}
|
||||
|
||||
free(filePathWchar);
|
||||
free(filePathUtf8);
|
||||
free_analysis_result(&result_data);
|
||||
system("pause");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user