Skip to content

Commit

Permalink
Windows shim.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Dec 19, 2023
1 parent 43658d1 commit 8bf9b7c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ if(BKPAD_MINIDUMP)
${PROCESSOR_SRC_DIR}/call_stack.cc
${PROCESSOR_SRC_DIR}/cfi_frame_info.cc
${PROCESSOR_SRC_DIR}/convert_old_arm64_context.cc
${PROCESSOR_SRC_DIR}/disassembler_objdump.cc
${PROCESSOR_SRC_DIR}/disassembler_x86.cc
${PROCESSOR_SRC_DIR}/dump_context.cc
${PROCESSOR_SRC_DIR}/dump_object.cc
Expand Down Expand Up @@ -468,7 +467,6 @@ if(BKPAD_MINIDUMP)
set(PROCESSOR_COMMON_HEADERS
${PROCESSOR_SRC_DIR}/basic_code_modules.h
${PROCESSOR_SRC_DIR}/cfi_frame_info.h
${PROCESSOR_SRC_DIR}/disassembler_objdump.h
${PROCESSOR_SRC_DIR}/disassembler_x86.h
${PROCESSOR_SRC_DIR}/exploitability_win.h
${PROCESSOR_SRC_DIR}/exploitability_linux.h
Expand All @@ -488,6 +486,13 @@ if(BKPAD_MINIDUMP)
${PROCESSOR_SRC_DIR}/stackwalker_x86.h
${PROCESSOR_SRC_DIR}/tokenize.h)

if(UNIX)
list(APPEND PROCESSOR_COMMON_SRCS
${PROCESSOR_SRC_DIR}/disassembler_objdump.cc)
list(APPEND PROCESSOR_COMMON_HEADERS
${PROCESSOR_SRC_DIR}/disassembler_objdump.h)
endif()

add_library(processor_common STATIC ${PROCESSOR_COMMON_SRCS} ${PROCESSOR_COMMON_HEADERS})
breakpad_set_project_properties(processor_common)

Expand Down
4 changes: 2 additions & 2 deletions src/third_party/windows/libgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <string.h>

char *basename(char *path) {
static char fname[_MAX_FNAME];
static char fname[_MAX_FNAME] = {0};

strncpy_s(fname, sizeof(fname), path, strlen(path));
fname[sizeof(fname) - 1] = 0;
Expand All @@ -13,7 +13,7 @@ char *basename(char *path) {
}

char *dirname(char *path) {
static char dname[_MAX_DIR];
static char dname[_MAX_DIR] = {0};

strncpy_s(dname, sizeof(dname), path, strlen(path));
dname[sizeof(dname) - 1] = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/third_party/windows/libgen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#define strdup _strdup

#ifdef __cplusplus
extern "C" {
#endif

char *basename(char *path);
char *dirname(char *path);

#ifdef __cplusplus
}
#endif

0 comments on commit 8bf9b7c

Please sign in to comment.