Skip to content

Commit

Permalink
[FEATURE] Added unicode support
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Feb 17, 2022
1 parent 6bb8ac5 commit 6fb7f09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ cmake_minimum_required ( VERSION 3.0 )
# replace "peconv_project" by your own project name:
project ( peconv_project )


# libs
# modules:
set ( M_PARSER "libpeconv/libpeconv" )

option(PECONV_UNICODE "Enable Unicode" OFF)

# enable unicode support
if(PECONV_UNICODE)
add_definitions (-DUNICODE -D_UNICODE)
endif()

# modules paths:
set (PECONV_DIR "${CMAKE_SOURCE_DIR}/${M_PARSER}" CACHE PATH "PEConv main path")
add_subdirectory ( ${PECONV_DIR} )
Expand Down
7 changes: 4 additions & 3 deletions project_template/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include <Windows.h>
#include <iostream>
#include <tchar.h>

#include <peconv.h> // include libPeConv header

/**
A demo of a basic manual PE loader - you can use it as a starting point for your own project,
or delete it and start from the scratch
*/
int load_and_run(LPCSTR pe_path)
int load_and_run(LPCTSTR pe_path)
{
// manually load the PE file using libPeConv:
size_t v_size = 0;
Expand Down Expand Up @@ -41,12 +42,12 @@ int load_and_run(LPCSTR pe_path)
return new_main();
}

int main(int argc, char *argv[])
int _tmain(int argc, LPTSTR argv[])
{
if (argc < 2) {
std::cout << "Args: <path to the exe>" << std::endl;
return 0;
}
const LPCSTR pe_path = argv[1];
const LPTSTR pe_path = argv[1];
return load_and_run(pe_path);
}

0 comments on commit 6fb7f09

Please sign in to comment.