-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Notes
#include <iostream>
#include <windows.h>
int main(int argc, char* argv[]) {
const char* filename = argv[1];
// Open the .exe file
HANDLE hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
std::cerr << "Error: Unable to open the file." << std::endl;
return 1;
}
// Check the .exe file type
DWORD exeType = 0;
if (GetBinaryType(filename, &exeType)) {
if (exeType == SCS_32BIT_BINARY) {
std::cout << "32-bit .exe file" << std::endl;
} else if (exeType == SCS_64BIT_BINARY) {
std::cout << "64-bit .exe file" << std::endl;
} else {
std::cout << "Unknown or not a .exe file" << std::endl;
}
} else {
std::cerr << "Error: Unable to determine file type." << std::endl;
}
CloseHandle(hFile);
return 0;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request