Support for Visual studio

The changes necessary to support visual studio fall into 2 basic groups.
1) reordering of header files, and 2) changes to support syntax
differences between mingw and visual studio and 3).  All changes are
conditional upon the definition of the macro __VS_BUILD__ .
This commit is contained in:
dkulwin 2015-11-11 15:03:03 -06:00
parent d34621a289
commit dd2bf90066
10 changed files with 115 additions and 6 deletions

View File

@ -66,11 +66,15 @@
#define DBG_ENTER(FUNC_NAME) DbgEntry(FUNC_NAME)
#define DBG_LEAVE(FUNC_NAME) DbgLeave(FUNC_NAME)
#ifndef __VS_BUILD__
#define DBG_MSG(FMT, ARGS...) DbgMsg(FMT, ## ARGS)
#define DBG_MSG_NOLN(FMT, ARGS...) DbgMsgNoLn(FMT, ## ARGS)
#else
#define DBG_MSG(FMT, ...) DbgMsg(FMT, __VA_ARGS__)
#define DBG_MSG_NOLN(FMT, ...) DbgMsgNoLn(FMT, __VA_ARGS__)
#endif
#define DBG_DUMP_TO_FILE(fname, ptr, size) //DbgDumpToFile(fname, ptr, size)

View File

@ -29,10 +29,28 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __VS_BUILD__
#include <winsock2.h>
#include <Windows.h>
#include <LsaLookup.h>
#include <Ntsecapi.h>
#endif
#include <winsock2.h>
#include "Key.h"
#ifdef __VS_BUILD__
#ifdef __cplusplus
extern "C" {
#endif
#endif // __VS_BUILD__
extern LSA_SECPKG_FUNCTION_TABLE LsaApi;
#ifdef __VS_BUILD__
#ifdef __cplusplus
}
#endif
#endif
#ifdef DYNAMIC_OPENSSL
extern SSLFuncList DynSSL;

View File

@ -31,7 +31,17 @@
#include "KeyAuth.h"
#ifdef __VS_BUILD__
#ifdef __cplusplus
extern "C" {
#endif
#endif // __VS_BUILD__
extern LSA_SECPKG_FUNCTION_TABLE LsaApi;
#ifdef __VS_BUILD__
#ifdef __cplusplus
}
#endif
#endif
#ifdef DYNAMIC_OPENSSL
extern SSLFuncList DynSSL;

View File

@ -34,6 +34,15 @@
#undef STRING
#ifdef __VS_BUILD__
#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <Windows.h>
#include <LsaLookup.h>
#include <Ntsecapi.h>
#endif
#include <winsock2.h>
#include "Win64Fix.h"

View File

@ -29,10 +29,28 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __VS_BUILD__
#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <Windows.h>
#include <LsaLookup.h>
#include <Ntsecapi.h>
#endif
#include <winsock2.h>
#include "LsaString.h"
#ifdef __VS_BUILD__
#ifdef __cplusplus
extern "C" {
#endif
#endif // __VS_BUILD__
extern LSA_SECPKG_FUNCTION_TABLE LsaApi;
#ifdef __VS_BUILD__
#ifdef __cplusplus
}
#endif
#endif
//
// Allocate empty UNICODE_STRING in LSA address space.

View File

@ -34,6 +34,8 @@
#undef STRING
#include "Win64Fix.h"
#include <stdio.h>
@ -43,11 +45,15 @@
#include <Ntsecapi.h>
#include <NTSecPkg.h>
#ifndef __VS_BUILD__
#ifdef _WIN64
#include <ntstatus.h>
#else
#include <ddk/ntstatus.h>
#endif
#else
#include <ntstatus.h>
#endif
#include "Debug.h"

View File

@ -31,7 +31,17 @@
#include "PopBinary.h"
#ifdef __VS_BUILD__
#ifdef __cplusplus
extern "C" {
#endif
#endif // __VS_BUILD__
extern LSA_SECPKG_FUNCTION_TABLE LsaApi;
#ifdef __VS_BUILD__
#ifdef __cplusplus
}
#endif
#endif
#ifdef DYNAMIC_OPENSSL
extern SSLFuncList DynSSL;

View File

@ -34,6 +34,14 @@
#undef STRING
#ifdef __VS_BUILD__
#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <Windows.h>
#include <LsaLookup.h>
#include <Ntsecapi.h>
#endif
#include <winsock2.h>
#include "Win64Fix.h"

View File

@ -31,6 +31,15 @@
#define WINVER 0x501
#ifdef __VS_BUILD__
#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <Windows.h>
#include <LsaLookup.h>
#include <Ntsecapi.h>
#endif
#include <winsock2.h>
#include "Ssh-lsa.h"
@ -432,9 +441,13 @@ Int AuthorizeUser(wchar_t homeDir[MAX_PATH], HANDLE token, SshLsaAuth *auth)
if (wcschr(nextFile, ':') == NULL)
{
DBG_MSG("Expanding relative path to user homedir.\n");
#ifndef __VS_BUILD__
snwprintf(keyFileName, sizeof(keyFileName),
L"%ls\\%ls", homeDir, nextFile);
#else
_snwprintf(keyFileName, sizeof(keyFileName),
L"%ls\\%ls", homeDir, nextFile);
#endif
fileToCheck = keyFileName;
}

View File

@ -42,11 +42,15 @@
#include <NTSecPkg.h>
#ifndef __VS_BUILD__
#ifdef _WIN64
#include <ntstatus.h>
#else
#include <ddk/ntstatus.h>
#endif
#else
#include <ntstatus.h>
#endif
#include <Userenv.h>
#include <Shlwapi.h>
@ -84,9 +88,17 @@ typedef struct _SshLsaAuth
}
SshLsaAuth;
#ifndef __VS_BUILD__
typedef VOID WINAPI (*RtlInitUnicodeStringPtr)
(PUNICODE_STRING, PCWSTR SourceString);
#else
typedef VOID (WINAPI *RtlInitUnicodeStringPtr)
(PUNICODE_STRING, PCWSTR SourceString);
#endif
#ifndef __VS_BUILD__
#ifndef _WIN64
typedef struct _LSA_TOKEN_INFORMATION_V1
{
@ -106,5 +118,6 @@ typedef struct _LSA_TOKEN_INFORMATION_V1
}
LSA_TOKEN_INFORMATION_V1, *PLSA_TOKEN_INFORMATION_V1;
#endif
#endif
#endif