Skip to content

Commit

Permalink
make libwinpe_test compatible with tcc
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Oct 16, 2024
1 parent 77cc93c commit 554b2b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion project/windll_winpe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif
ifneq (,$(findstring d, $(BUILD_TYPE)))
CFLAGS+=-g -D_DEBUG
else
CFLAGS+=-O3
CFLAGS+=-O3 # winpe_memGetProcAddress might fail if use inline and -O3 by llvm-clang
endif
ifneq (,$(findstring tcc, $(CC)))
LDFLAGS= # tcc can not remove at at stdcall in i686
Expand Down
5 changes: 2 additions & 3 deletions project/windll_winpe/src/libwinpe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ void test_findkernel32()

void test_findloadlibrarya()
{

void *func = (void*)LoadLibraryA;
void *func = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"); // compatible with tcc
void *func2 = winpe_findloadlibrarya();
printf("[test_findloadlibrarya] LoadLibraryA=%p\n", func2);
assert(func==func2);
}

void test_findgetprocaddress()
{
void *func = (void*)GetProcAddress;
void *func = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetProcAddress"); // compatible with tcc
void *func2 = winpe_findgetprocaddress();
printf("[test_findgetprocaddress] GetProcAddress=%p\n", func2);
assert(func==func2);
Expand Down
8 changes: 4 additions & 4 deletions src/commdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@
#define LOG_LEVEL_INFO 3
#define LOG_LEVEL_DEBUG 4
#define LOG_LEVEL_VERBOSE 5
#define LogTagPrintf(format, tag, ...) \
#define LogTagPrintf(format, tag, ...) {\
printf("[%s,%d,%s,%s] ", __FILE__, __LINE__, __func__, tag);\
printf(format, ##__VA_ARGS__);
#define LogTagWprintf(format, tag, ...) \
printf(format, ##__VA_ARGS__);}
#define LogTagWprintf(format, tag, ...) {\
printf("[%s,%d,%s,%s] ", __FILE__, __LINE__, __func__, tag);\
wprintf(format, ##__VA_ARGS__);
wprintf(format, ##__VA_ARGS__);}
#define DummyPrintf(format, ...)
#define LOG(format, ...) LogTagPrintf(format, "I", ##__VA_ARGS__)
#define LOGL(format, ...) LogTagWprintf(format, "I", ##__VA_ARGS__)
Expand Down

0 comments on commit 554b2b1

Please sign in to comment.