Prefer _WIN to _POSIX for defines.

Also miscellaneous fixes here and there.
This commit is contained in:
Rosen Penev
2017-02-23 15:55:06 -08:00
parent de186ceda5
commit 4ceb7a1afa
17 changed files with 82 additions and 101 deletions
-1
View File
@@ -12,7 +12,6 @@
#define _POSIX
#elif defined (__WINNT__)
#define _WIN 1
#define WIN 1
#else
#error Your Operating System is not supported or detected
#endif
+4 -6
View File
@@ -8,16 +8,14 @@
#include <stdlib.h>
#if defined (_POSIX)
#ifdef _WIN
#include <windows.h>
#else
#include <dlfcn.h>
#if defined (__APPLE__)
#include <mach-o/dyld.h>
#endif // __APPLE__
#endif // _POSIX
#ifdef _WIN
#include <windows.h>
#endif
#endif // _WIN
#ifdef _WIN
HMODULE hc_dlopen (LPCSTR lpLibFileName);
+7 -10
View File
@@ -10,19 +10,16 @@
#include <unistd.h>
#include <limits.h>
#if defined (_POSIX)
#include <sys/types.h>
#include <pwd.h>
#endif
#if defined (__APPLE__)
#include <mach-o/dyld.h>
#endif // __APPLE__
#if defined (_WIN)
#include <windows.h>
#include <direct.h>
#endif
#else
#include <sys/types.h>
#include <pwd.h>
#if defined (__APPLE__)
#include <mach-o/dyld.h>
#endif // __APPLE__
#endif // _WIN
#define DOT_HASHCAT ".hashcat"
#define SESSIONS_FOLDER "sessions"
+3 -5
View File
@@ -10,14 +10,12 @@
#include <unistd.h>
#include <errno.h>
#if defined (_POSIX)
#include <sys/types.h>
#include <sys/stat.h>
#endif // _POSIX
#if defined (_WIN)
#include <windows.h>
#include <psapi.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif // _WIN
int pidfile_ctx_init (hashcat_ctx_t *hashcat_ctx);
+3 -5
View File
@@ -10,14 +10,12 @@
#include <unistd.h>
#include <errno.h>
#if defined (_POSIX)
#include <sys/types.h>
#include <sys/stat.h>
#endif // _POSIX
#if defined (_WIN)
#include <windows.h>
#include <psapi.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif // _WIN
#define RESTORE_VERSION_MIN 340
+3 -5
View File
@@ -12,15 +12,13 @@
#include <sys/types.h>
#include <unistd.h>
#if defined (_POSIX)
#if defined (_WIN)
#include <windows.h>
#else
#include <termios.h>
#if defined (__APPLE__)
#include <sys/ioctl.h>
#endif // __APPLE__
#endif // _POSIX
#if defined (_WIN)
#include <windows.h>
#endif // _WIN
void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag);
+4 -5
View File
@@ -8,12 +8,11 @@
#include <signal.h>
#if defined (_POSIX)
#include <pthread.h>
#include <semaphore.h>
#endif // _POSIX
#if defined (_WIN)
#include <windows.h>
#else
#include <pthread.h>
#include <semaphore.h>
#endif // _WIN
#if defined (_WIN)
@@ -27,7 +26,7 @@
#define hc_thread_mutex_init(m) InitializeCriticalSection (&m)
#define hc_thread_mutex_delete(m) DeleteCriticalSection (&m)
#elif defined (_POSIX)
#else
#define hc_thread_create(t,f,a) pthread_create (&t, NULL, f, a)
#define hc_thread_wait(n,a) for (u32 i = 0; i < n; i++) pthread_join ((a)[i], NULL)
+7 -9
View File
@@ -41,7 +41,7 @@ typedef uint64_t u64;
#if defined (_WIN)
typedef LARGE_INTEGER hc_timer_t;
#elif defined (_POSIX)
#else
typedef struct timeval hc_timer_t;
#endif
@@ -54,19 +54,17 @@ typedef struct timeval hc_timer_t;
#if defined (_WIN)
typedef HANDLE hc_thread_t;
typedef CRITICAL_SECTION hc_thread_mutex_t;
#elif defined (_POSIX)
#else
typedef pthread_t hc_thread_t;
typedef pthread_mutex_t hc_thread_mutex_t;
#endif
// stat
#if defined (_POSIX)
typedef struct stat hc_stat_t;
#endif
#if defined (_WIN)
typedef struct _stat64 hc_stat_t;
#else
typedef struct stat hc_stat_t;
#endif
// enums
@@ -1205,10 +1203,10 @@ typedef struct dictstat_ctx
dictstat_t *base;
#if defined (_POSIX)
size_t cnt;
#else
#if defined (_WIN)
u32 cnt;
#else
size_t cnt;
#endif
} dictstat_ctx_t;