From 3083f45b52ad3b5c50240e9d92d2e22c1677b5d9 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 2 Jun 2026 16:59:00 -0700 Subject: [PATCH] prowizard: avoid duplicate htonl and _cdecl definitions Some hosts provide htonl as a macro through system headers. Avoid redeclaring the Pro-Wizard helper in that case. Also provide a no-op _cdecl definition for non-Windows builds so shared Pro-Wizard declarations compile without Windows calling-convention macros. --- prowizard/include/extern.h | 2 ++ prowizard/include/globals.h | 4 ++++ prowizard/misc/misc.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/prowizard/include/extern.h b/prowizard/include/extern.h index 5f424f63..83f89487 100644 --- a/prowizard/include/extern.h +++ b/prowizard/include/extern.h @@ -332,7 +332,9 @@ extern short test_smps ( long, long, long, Uchar, Uchar ); extern long PWGetFileSize ( char * ); extern FILE * PW_fopen ( char *, char * ); extern void fillPTKtable ( Uchar[37][2] ); +#ifndef htonl extern unsigned int htonl(unsigned int); +#endif /* globals */ /* Some say it's badly coding when using Globals ... sure it is, now what's the solution ? */ diff --git a/prowizard/include/globals.h b/prowizard/include/globals.h index a32710ba..11c978af 100644 --- a/prowizard/include/globals.h +++ b/prowizard/include/globals.h @@ -26,6 +26,10 @@ __inline Ulong htonlx (Ulong v) { return (v >> 24) | ((v >> 8) & 0xff00) | (v << 24) | ((v << 8) & 0xff0000); } +#else +#ifndef _cdecl +#define _cdecl +#endif #endif #define _KNOWN_FORMATS 135 diff --git a/prowizard/misc/misc.c b/prowizard/misc/misc.c index 8d71d6fe..1ade02dd 100644 --- a/prowizard/misc/misc.c +++ b/prowizard/misc/misc.c @@ -508,7 +508,9 @@ void fillPTKtable (Uchar poss[37][2]) return; } +#ifndef htonl unsigned int htonl(unsigned int v) { return ((v >> 24) & 0x000000ff) | ((v >> 8) & 0x0000ff00) | ((v << 8) & 0x00ff0000) | ((v << 24) & 0xff000000); } +#endif -- 2.47.3