|
From: Noam R. <no...@be...> - 2003-10-25 08:22:09
|
Hi,
I was able to compile the OpenVPN under the Visual C++ environment it
required some changes
1) I need to change
#define OPENVPN_S_ERROR -1
#define OPENVPN_S_UNDEF 0
#define OPENVPN_S_INITIAL 1 /* tls_init() was called */
#define OPENVPN_S_PRE_START 2 /* waiting for initial reset &
acknowledgement */
#define OPENVPN_S_START 3 /* ready to exchange keys */
#define OPENVPN_S_SENT_KEY 4 /* client does S_SENT_KEY ->
S_GOT_KEY */
#define OPENVPN_S_GOT_KEY 5 /* server does S_GOT_KEY ->
S_SENT_KEY */
#define OPENVPN_S_ACTIVE 6 /* ready to exchange data channel
packets */
#define OPENVPN_S_NORMAL 7 /* normal operations */
Instead of those that are currently in place, as S_NORMAL already exist =
as
an MFC #define.
2) And:
fd =3D open (filename, O_CREAT | O_TRUNC | O_WRONLY
#ifndef _WINDOWS =09
, S_IRUSR | S_IWUSR
#endif
);
Instead of what it is currently, as S_IRUSR and S_IWUSR do not exist, =
nor is
there a permission problem for file descriptors, if you request a =
O_WRONLY,
you will fail if you cannot write to it due to permission errors.
3) Also inside config-win32.h I did:
#ifndef _WINDOWS
#include <windows.h>
#endif
As windows.h is the console include, and when building an MFC =
environment it
is not needed.
4) And last but not least I created an MFC.h file to include all the =
things
I needed:
#ifndef MFC_H
#define MFC_H
#undef TIME_WITH_SYS_TIME
#undef HAVE_SYS_TIME_H
#undef HAVE_SYS_FILE_H
#undef HAVE_STDINT_H
#undef HAVE_UNISTD_H
#include <stdio.h>
#include <io.h>
#include <direct.h>
#include <openssl/err.h>
#define vsnprintf _vsnprintf
#define snwprintf _snwprintf=20
#ifdef _WINDOWS
InternalMsg (flags, ...);
#endif
#endif
5) And replaced in error.h:
#ifdef _WINDOWS
#define msg InternalMsg
#else
#if defined(HAVE_CPP_VARARG_MACRO_ISO) && !defined(__LCLINT__)
#define HAVE_VARARG_MACROS
#define msg(flags, ...) do { if (MSG_TEST(flags)) x_msg((flags),
__VA_ARGS__); } while (false)
#elif defined(HAVE_CPP_VARARG_MACRO_GCC) && !defined(__LCLINT__)
#define HAVE_VARARG_MACROS
#define msg(flags, args...) do { if (MSG_TEST(flags)) x_msg((flags), =
args);
} while (false)
#else
#warning this compiler appears to lack vararg macros which will cause a
significant degradation in efficiency (you can ignore this warning if =
you
are using LCLINT)
#define msg x_msg
#endif
#endif
As Visual C++ does not support any unnumbered variable in Macros
(InternalMsg is a wrapper). This is the only problem BTW, I cannot make =
the
InternalMsg behave correctly as the msg macro does, as I cannot properly
parse the values passes to the InternalMsg function.
The only solution that appears to be the valid one at the moment is
replacing the msg calls, with msg0, msg1, msg2, msg3, etc instead of a
single unnumber msg call (this is how Microsoft's Debugging functions =
work).
I also attached a short txt explaining how to compile.
Any help / comments will be greatly appreciated.
Thanks
Noam Rathaus
CTO
Beyond Security Ltd.
http://www.securiteam.com=20
-----Original Message-----
From: James Yonan [mailto:ji...@yo...]=20
Sent: Sunday, October 19, 2003 20:51
To: Noam Rathaus
Subject: Re: OpenVPN and Windows
Noam,
I don't use Visual C++, but I've posted your message to the =
openvpn-devel
list.
James
Noam Rathaus <no...@be...> said:
> Hi,
>=20
> I am sorry for contacting you directly, but I tried posting to the=20
> Mailing
list multiple times, but I wasn't able to get through (even though I am =
able
to receive the mailing, so I am subscribed), this is the email I tried =
to
post into the list.
>=20
> =3D=3D=3D=3D=3D
>=20
> I have been trying for a few hours now to get my Visual C++ to compile =
> the
OpenVPN user mode client, but without any luck, I would be happy to hear
from someone who was able to, or has an idea how to do it.
>=20
> I have MinGW, MSYS, GCC, etc installed, but I want to create an Open=20
> Source
MFC GUI for the client, as opposed to the console one.
>=20
> =3D=3D=3D=3D=3D
>=20
> Thanks
> Noam Rathaus
> CTO
> Beyond Security Ltd.
> http://www.securiteam.com
>=20
>=20
--=20
|