Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required (VERSION 3.7.0)

project(ripole)

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

set(SOURCE ${PROJECT_SOURCE_DIR}/ole.c
${PROJECT_SOURCE_DIR}/olestream-unwrap.c
${PROJECT_SOURCE_DIR}/bytedecoders.c
${PROJECT_SOURCE_DIR}/logger.c
${PROJECT_SOURCE_DIR}/pldstr.c
${PROJECT_SOURCE_DIR}/bt-int.c
${PROJECT_SOURCE_DIR}/ripole.c)

add_executable(ripole ${SOURCE})

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ripole)
2 changes: 2 additions & 0 deletions logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,11 @@ int LOGGER_log( char *format, ...)
case _LOGGER_STDERR:
fprintf(stderr,"%s%s",output, lineend );
break;
#ifndef WIN32
case _LOGGER_SYSLOG:
syslog(_LOGGER_syslog_mode,"%s",output);
break;
#endif
case _LOGGER_STDOUT:
fprintf(stdout,"%s%s",output, lineend);
fflush(stdout);
Expand Down
11 changes: 9 additions & 2 deletions ole.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include <sys/stat.h>
#include <sys/types.h>

#ifndef WIN32
#include <direct.h>
#endif

#include "logger.h"
#include "pldstr.h"
#include "bt-int.h"
Expand Down Expand Up @@ -1450,8 +1454,11 @@ int OLE_open_file( struct OLE_object *ole, char *fullpath )
int OLE_open_directory( struct OLE_object *ole, char *directory )
{
int result=0;

result = mkdir( directory, S_IRWXU );
#ifndef WIN32
result = mkdir(directory, S_IRWXU);
#else
result = _mkdir(directory);
#endif
if ((result != 0)&&(errno != EEXIST))
{
LOGGER_log("%s:%d:OLE_open_directory:ERROR: %s",FL,strerror(errno));
Expand Down
12 changes: 12 additions & 0 deletions olestream-unwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,31 @@ int OLEUNWRAP_decode_attachment( struct OLEUNWRAP_object *oleuw, char *stream, s
sp += 2;

// Full attachment string
#ifndef WIN32
oh.attach_name = strdup( sp );
#else
oh.attach_name = _strdup(sp);
#endif
sp = sp + strlen(oh.attach_name) +1;

// Attachment full path
#ifndef WIN32
oh.fname_1 = strdup( sp );
#else
oh.fname_1 = _strdup(sp);
#endif
sp += strlen(oh.fname_1) +1;

// Unknown memory segment
memcpy( oh.data2, sp, 8 );
sp = sp +8;

// Attachment full path
#ifndef WIN32
oh.fname_2 = strdup( sp );
#else
oh.fname_2 = _strdup(sp);
#endif
sp += strlen(oh.fname_2) +1;

oh.attach_size = (size_t)get_uint32( sp );
Expand Down
8 changes: 8 additions & 0 deletions pldstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ char *PLD_strstr(char *haystack, char *needle, int insensitive)

if (insensitive > 0)
{
#ifndef WIN32
hs = strdup(haystack);
#else
hs = _strdup(haystack);
#endif
PLD_strlower(hs);
#ifndef WIN32
ne = strdup(needle);
#else
ne = _strdup(needle);
#endif
PLD_strlower(ne);
} else {
hs = haystack;
Expand Down
8 changes: 8 additions & 0 deletions ripole.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,20 @@ int ROLE_parse_parameters( struct ripOLE_object *role, int argc, char **argv )
{
case 'i':
i++;
#ifndef WIN32
role->inputfile = strdup(argv[i]);
#else
role->inputfile = _strdup(argv[i]);
#endif
break;

case 'd':
i++;
#ifndef WIN32
role->outputdir = strdup(argv[i]);
#else
role->outputdir = _strdup(argv[i]);
#endif
break;

case 'v':
Expand Down