windows: start fixing windows compilation

This commit is contained in:
Marc-André Moreau 2011-08-15 17:05:48 -04:00
parent 200b4c4493
commit 0efc0c5a44
22 changed files with 139 additions and 101 deletions

10
.gitignore vendored
View File

@ -20,6 +20,16 @@ docs/api
# Mac OS X
.DS_Store
# Windows
*.vcxproj
*.vcxproj.*
*.sdf
*.sln
*.suo
*.opensdf
ipch
Debug
# Binaries
*.so
*.so.*

View File

@ -67,9 +67,12 @@ check_include_files(unistd.h HAVE_UNISTD_H)
# Libraries that we have a hard dependency on
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(ALSA)
find_package(PulseAudio)
if(!WINDOWS)
find_package(ZLIB REQUIRED)
find_package(ALSA)
find_package(PulseAudio)
endif()
# Endian
test_big_endian(BIG_ENDIAN)

View File

@ -77,6 +77,7 @@
#define SC_DEFAULT 0xF160
/* Client Notify Event PDU */
#ifndef _WIN32
#define WM_LBUTTONDOWN 0x00000201
#define WM_LBUTTONUP 0x00000202
#define WM_RBUTTONDOWN 0x00000204
@ -91,12 +92,13 @@
#define NIN_BALLOONHIDE 0x00000403
#define NIN_BALLOONTIMEOUT 0x00000404
#define NIN_BALLOONUSERCLICK 0x00000405
#endif
/* Client Information PDU */
#define RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE 0x00000001
#define RAIL_CLIENTSTATUS_AUTORECONNECT 0x00000002
/*HIGHCONTRAST flags values */
/* HIGHCONTRAST flags values */
#define HCF_AVAILABLE 0x00000002
#define HCF_CONFIRMHOTKEY 0x00000008
#define HCF_HIGHCONTRASTON 0x00000001

View File

@ -90,7 +90,7 @@ typedef struct
} SYSTEM_TIME;
/* TIME_ZONE_INFORMATION */
typedef struct
struct _TIME_ZONE_INFO
{
uint32 bias;
char standardName[32];
@ -99,7 +99,8 @@ typedef struct
char daylightName[32];
SYSTEM_TIME daylightDate;
uint32 daylightBias;
} TIME_ZONE_INFORMATION;
};
typedef struct _TIME_ZONE_INFO TIME_ZONE_INFO;
/* ARC_CS_PRIVATE_PACKET */
typedef struct
@ -171,8 +172,8 @@ struct rdp_settings
uint32 encryption_method;
uint32 encryption_level;
BLOB server_random;
BLOB server_certificate;
rdpBlob server_random;
rdpBlob server_certificate;
boolean console_audio;
boolean console_session;
@ -205,7 +206,7 @@ struct rdp_settings
boolean ipv6;
char* ip_address;
char* client_dir;
TIME_ZONE_INFORMATION client_time_zone;
TIME_ZONE_INFO client_time_zone;
boolean auto_reconnection;
ARC_CS_PRIVATE_PACKET client_auto_reconnect_cookie;

View File

@ -21,6 +21,10 @@
#ifndef __RDP_TYPES_H
#define __RDP_TYPES_H
#ifdef _WIN32
#include <WinDef.h>
#endif
/* Base Types */
typedef unsigned char uint8;
@ -45,7 +49,11 @@ typedef signed long long sint64;
#define False (0)
#endif
#ifndef _WIN32
typedef int boolean;
#else
#define boolean BOOLEAN
#endif
#ifndef MIN
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
@ -57,74 +65,75 @@ typedef int boolean;
#include <freerdp/settings.h>
typedef void *FRDP_HBITMAP;
typedef void *FRDP_HGLYPH;
typedef void *FRDP_HPALETTE;
typedef void *FRDP_HCURSOR;
typedef void* FRDP_HBITMAP;
typedef void* FRDP_HGLYPH;
typedef void* FRDP_HPALETTE;
typedef void* FRDP_HCURSOR;
typedef struct _FRDP_POINT
struct _FRDP_POINT
{
sint16 x, y;
}
FRDP_POINT;
sint16 x;
sint16 y;
};
typedef struct _FRDP_POINT FRDP_POINT;
typedef struct _FRDP_PALETTEENTRY
struct _FRDP_PALETTEENTRY
{
uint8 red;
uint8 green;
uint8 blue;
}
FRDP_PALETTEENTRY;
};
typedef struct _FRDP_PALETTEENTRY FRDP_PALETTEENTRY;
typedef struct _FRDP_PALETTE
struct _FRDP_PALETTE
{
uint16 count;
FRDP_PALETTEENTRY *entries;
}
FRDP_PALETTE;
FRDP_PALETTEENTRY* entries;
};
typedef struct _FRDP_PALETTE FRDP_PALETTE;
typedef struct _FRDP_PEN
struct _FRDP_PEN
{
uint8 style;
uint8 width;
uint32 color;
}
FRDP_PEN;
};
typedef struct _FRDP_PEN FRDP_PEN;
/* this is what is in the brush cache */
typedef struct _FRDP_BRUSHDATA
struct _FRDP_BRUSHDATA
{
uint32 color_code;
uint32 data_size;
uint8 *data;
}
FRDP_BRUSHDATA;
};
typedef struct _FRDP_BRUSHDATA FRDP_BRUSHDATA;
typedef struct _FRDP_BRUSH
struct _FRDP_BRUSH
{
uint8 xorigin;
uint8 yorigin;
uint8 style;
uint8 pattern[8];
FRDP_BRUSHDATA *bd;
}
FRDP_BRUSH;
};
typedef struct _FRDP_BRUSH FRDP_BRUSH;
typedef struct _FRDP_PLUGIN_DATA
struct _FRDP_PLUGIN_DATA
{
uint16 size;
void* data[4];
}
FRDP_PLUGIN_DATA;
};
typedef struct _FRDP_PLUGIN_DATA FRDP_PLUGIN_DATA;
typedef struct _FRDP_RECT
struct _FRDP_RECT
{
sint16 x;
sint16 y;
sint16 width;
sint16 height;
}
FRDP_RECT;
};
typedef struct _FRDP_RECT FRDP_RECT;
/* Plugin events */
typedef struct _FRDP_EVENT FRDP_EVENT;
@ -147,6 +156,4 @@ enum FRDP_EVENT_CLASS
FRDP_EVENT_CLASS_RAIL
};
typedef struct rdp_inst rdpInst;
#endif /* __RDP_TYPES_H */

View File

@ -803,10 +803,12 @@ typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND;
#define BMF_24BPP 0x5
#define BMF_32BPP 0x6
#ifndef _WIN32
#define BS_SOLID 0x00
#define BS_NULL 0x01
#define BS_HATCHED 0x02
#define BS_PATTERN 0x03
#endif
#define HS_HORIZONTAL 0x00
#define HS_VERTICAL 0x01

View File

@ -25,9 +25,9 @@ struct rdp_blob
void* data;
int length;
};
typedef struct rdp_blob BLOB;
typedef struct rdp_blob rdpBlob;
void freerdp_blob_alloc(BLOB* blob, int length);
void freerdp_blob_free(BLOB* blob);
void freerdp_blob_alloc(rdpBlob* blob, int length);
void freerdp_blob_free(rdpBlob* blob);
#endif /* __BLOB_UTILS_H */

View File

@ -51,7 +51,7 @@ typedef struct
typedef struct
{
BLOB modulus;
rdpBlob modulus;
uint8 exponent[4];
} CERT_INFO;

View File

@ -196,11 +196,11 @@ int credssp_authenticate(rdpCredssp* credssp)
* @param s
*/
void credssp_encrypt_public_key(rdpCredssp* credssp, BLOB* d)
void credssp_encrypt_public_key(rdpCredssp* credssp, rdpBlob* d)
{
uint8 *p;
uint8 signature[16];
BLOB encrypted_public_key;
rdpBlob encrypted_public_key;
NTLMSSP *ntlmssp = credssp->ntlmssp;
freerdp_blob_alloc(d, credssp->public_key.length + 16);
@ -234,12 +234,12 @@ void credssp_encrypt_public_key(rdpCredssp* credssp, BLOB* d)
* @return 1 if verification is successful, 0 otherwise
*/
int credssp_verify_public_key(rdpCredssp* credssp, BLOB* d)
int credssp_verify_public_key(rdpCredssp* credssp, rdpBlob* d)
{
uint8 *p1, *p2;
uint8 *signature;
BLOB public_key;
BLOB encrypted_public_key;
rdpBlob public_key;
rdpBlob encrypted_public_key;
signature = d->data;
encrypted_public_key.data = (void*) (signature + 16);
@ -269,11 +269,11 @@ int credssp_verify_public_key(rdpCredssp* credssp, BLOB* d)
* @param s
*/
void credssp_encrypt_ts_credentials(rdpCredssp* credssp, BLOB* d)
void credssp_encrypt_ts_credentials(rdpCredssp* credssp, rdpBlob* d)
{
uint8 *p;
uint8 signature[16];
BLOB encrypted_ts_credentials;
rdpBlob encrypted_ts_credentials;
NTLMSSP *ntlmssp = credssp->ntlmssp;
freerdp_blob_alloc(d, credssp->ts_credentials.length + 16);
@ -454,7 +454,7 @@ int credssp_skip_ts_request(int length)
* @param pubKeyAuth
*/
void credssp_send(rdpCredssp* credssp, BLOB* negoToken, BLOB* authInfo, BLOB* pubKeyAuth)
void credssp_send(rdpCredssp* credssp, rdpBlob* negoToken, rdpBlob* authInfo, rdpBlob* pubKeyAuth)
{
STREAM* s;
int length;
@ -517,7 +517,7 @@ void credssp_send(rdpCredssp* credssp, BLOB* negoToken, BLOB* authInfo, BLOB* pu
* @return
*/
int credssp_recv(rdpCredssp* credssp, BLOB* negoToken, BLOB* authInfo, BLOB* pubKeyAuth)
int credssp_recv(rdpCredssp* credssp, rdpBlob* negoToken, rdpBlob* authInfo, rdpBlob* pubKeyAuth)
{
STREAM* s;
int length;

View File

@ -36,12 +36,12 @@ typedef struct rdp_credssp rdpCredssp;
struct rdp_credssp
{
BLOB negoToken;
BLOB pubKeyAuth;
BLOB authInfo;
rdpBlob negoToken;
rdpBlob pubKeyAuth;
rdpBlob authInfo;
int send_seq_num;
BLOB public_key;
BLOB ts_credentials;
rdpBlob public_key;
rdpBlob ts_credentials;
CryptoRc4 rc4_seal_state;
struct _NTLMSSP *ntlmssp;
struct rdp_transport* transport;
@ -49,12 +49,12 @@ struct rdp_credssp
int credssp_authenticate(rdpCredssp* credssp);
void credssp_send(rdpCredssp* credssp, BLOB* negoToken, BLOB* authInfo, BLOB* pubKeyAuth);
int credssp_recv(rdpCredssp* credssp, BLOB* negoToken, BLOB* authInfo, BLOB* pubKeyAuth);
void credssp_send(rdpCredssp* credssp, BLOB* negoToken, rdpBlob* authInfo, rdpBlob* pubKeyAuth);
int credssp_recv(rdpCredssp* credssp, rdpBlob* negoToken, rdpBlob* authInfo, rdpBlob* pubKeyAuth);
void credssp_encrypt_public_key(rdpCredssp* credssp, BLOB* d);
void credssp_encrypt_ts_credentials(rdpCredssp* credssp, BLOB* d);
int credssp_verify_public_key(rdpCredssp* credssp, BLOB* d);
void credssp_encrypt_public_key(rdpCredssp* credssp, rdpBlob* d);
void credssp_encrypt_ts_credentials(rdpCredssp* credssp, rdpBlob* d);
int credssp_verify_public_key(rdpCredssp* credssp, rdpBlob* d);
void credssp_encode_ts_credentials(rdpCredssp* credssp);
void credssp_current_time(uint8* timestamp);

View File

@ -91,7 +91,7 @@ boolean crypto_cert_verify(CryptoCert server_cert, CryptoCert cacert)
return True; /* FIXME: do the actual verification */
}
boolean crypto_cert_get_public_key(CryptoCert cert, BLOB* public_key)
boolean crypto_cert_get_public_key(CryptoCert cert, rdpBlob* public_key)
{
uint8* p;
int length;

View File

@ -81,7 +81,7 @@ typedef struct crypto_cert_struct* CryptoCert;
CryptoCert crypto_cert_read(uint8* data, uint32 length);
void crypto_cert_free(CryptoCert cert);
boolean crypto_cert_verify(CryptoCert server_cert, CryptoCert cacert);
boolean crypto_cert_get_public_key(CryptoCert cert, BLOB* public_key);
boolean crypto_cert_get_public_key(CryptoCert cert, rdpBlob* public_key);
void crypto_rsa_encrypt(uint8* input, int length, uint32 key_length, uint8* modulus, uint8* exponent, uint8* output);
void crypto_reverse(uint8* data, int length);

View File

@ -265,7 +265,7 @@ void license_generate_keys(rdpLicense* license)
freerdp_hexdump(license->master_secret, MASTER_SECRET_LENGTH);
printf("SessionKeyBlob:\n");
freerdp_hexdump(license->session_key_blob, SESSION_KEY_BLOB_LENGTH);
freerdp_hexdump(license->session_key_blob, SESSION_KEY_rdpBlob_LENGTH);
printf("MacSaltKey:\n");
freerdp_hexdump(license->mac_salt_key, MAC_SALT_KEY_LENGTH);

View File

@ -215,7 +215,7 @@ void ntlmssp_generate_timestamp(NTLMSSP* ntlmssp)
* @param signing_key Destination signing key
*/
void ntlmssp_generate_signing_key(uint8* exported_session_key, BLOB* sign_magic, uint8* signing_key)
void ntlmssp_generate_signing_key(uint8* exported_session_key, rdpBlob* sign_magic, uint8* signing_key)
{
int length;
uint8* value;
@ -243,7 +243,7 @@ void ntlmssp_generate_signing_key(uint8* exported_session_key, BLOB* sign_magic,
void ntlmssp_generate_client_signing_key(NTLMSSP* ntlmssp)
{
BLOB sign_magic;
rdpBlob sign_magic;
sign_magic.data = (void*) client_sign_magic;
sign_magic.length = sizeof(client_sign_magic);
ntlmssp_generate_signing_key(ntlmssp->exported_session_key, &sign_magic, ntlmssp->client_signing_key);
@ -257,7 +257,7 @@ void ntlmssp_generate_client_signing_key(NTLMSSP* ntlmssp)
void ntlmssp_generate_server_signing_key(NTLMSSP* ntlmssp)
{
BLOB sign_magic;
rdpBlob sign_magic;
sign_magic.data = (void*) server_sign_magic;
sign_magic.length = sizeof(server_sign_magic);
ntlmssp_generate_signing_key(ntlmssp->exported_session_key, &sign_magic, ntlmssp->server_signing_key);
@ -271,11 +271,11 @@ void ntlmssp_generate_server_signing_key(NTLMSSP* ntlmssp)
* @param sealing_key Destination sealing key
*/
void ntlmssp_generate_sealing_key(uint8* exported_session_key, BLOB* seal_magic, uint8* sealing_key)
void ntlmssp_generate_sealing_key(uint8* exported_session_key, rdpBlob* seal_magic, uint8* sealing_key)
{
uint8* p;
CryptoMd5 md5;
BLOB blob;
rdpBlob blob;
freerdp_blob_alloc(&blob, 16 + seal_magic->length);
p = (uint8*) blob.data;
@ -299,7 +299,7 @@ void ntlmssp_generate_sealing_key(uint8* exported_session_key, BLOB* seal_magic,
void ntlmssp_generate_client_sealing_key(NTLMSSP* ntlmssp)
{
BLOB seal_magic;
rdpBlob seal_magic;
seal_magic.data = (void*) client_seal_magic;
seal_magic.length = sizeof(client_seal_magic);
ntlmssp_generate_signing_key(ntlmssp->exported_session_key, &seal_magic, ntlmssp->client_sealing_key);
@ -313,7 +313,7 @@ void ntlmssp_generate_client_sealing_key(NTLMSSP* ntlmssp)
void ntlmssp_generate_server_sealing_key(NTLMSSP* ntlmssp)
{
BLOB seal_magic;
rdpBlob seal_magic;
seal_magic.data = (void*) server_seal_magic;
seal_magic.length = sizeof(server_seal_magic);
ntlmssp_generate_signing_key(ntlmssp->exported_session_key, &seal_magic, ntlmssp->server_sealing_key);
@ -420,7 +420,7 @@ void ntlmssp_compute_lm_hash(char* password, char* hash)
DES_ecb_encrypt((const_DES_cblock*) lm_magic, (DES_cblock*)&hash[8], &ks, DES_ENCRYPT);
}
void ntlmssp_compute_ntlm_hash(BLOB* password, char* hash)
void ntlmssp_compute_ntlm_hash(rdpBlob* password, char* hash)
{
/* NTLMv1("password") = 8846F7EAEE8FB117AD06BDD830B7586C */
@ -438,7 +438,7 @@ void ntlmssp_compute_ntlm_hash(BLOB* password, char* hash)
void ntlmssp_compute_ntlm_v2_hash(NTLMSSP* ntlmssp, char* hash)
{
char* p;
BLOB blob;
rdpBlob blob;
char ntlm_hash[16];
freerdp_blob_alloc(&blob, ntlmssp->username.length + ntlmssp->domain.length);
@ -522,8 +522,8 @@ void ntlmssp_compute_ntlm_v2_response(NTLMSSP* ntlmssp)
uint8* blob;
uint8 ntlm_v2_hash[16];
uint8 nt_proof_str[16];
BLOB ntlm_v2_temp;
BLOB ntlm_v2_temp_chal;
rdpBlob ntlm_v2_temp;
rdpBlob ntlm_v2_temp_chal;
freerdp_blob_alloc(&ntlm_v2_temp, ntlmssp->target_info.length + 28);
@ -744,7 +744,7 @@ static void ntlmssp_output_restriction_encoding(NTLMSSP* ntlmssp)
void ntlmssp_populate_av_pairs(NTLMSSP* ntlmssp)
{
STREAM* s;
BLOB target_info;
rdpBlob target_info;
AV_PAIRS *av_pairs = ntlmssp->av_pairs;
/* MsvAvFlags */
@ -1035,7 +1035,7 @@ void ntlmssp_compute_message_integrity_check(NTLMSSP* ntlmssp)
* @param[out] signature destination signature
*/
void ntlmssp_encrypt_message(NTLMSSP* ntlmssp, BLOB* msg, BLOB* encrypted_msg, uint8* signature)
void ntlmssp_encrypt_message(NTLMSSP* ntlmssp, rdpBlob* msg, rdpBlob* encrypted_msg, uint8* signature)
{
HMAC_CTX hmac_ctx;
uint8 digest[16];
@ -1079,7 +1079,7 @@ void ntlmssp_encrypt_message(NTLMSSP* ntlmssp, BLOB* msg, BLOB* encrypted_msg, u
* @return
*/
int ntlmssp_decrypt_message(NTLMSSP* ntlmssp, BLOB* encrypted_msg, BLOB* msg, uint8* signature)
int ntlmssp_decrypt_message(NTLMSSP* ntlmssp, rdpBlob* encrypted_msg, rdpBlob* msg, uint8* signature)
{
HMAC_CTX hmac_ctx;
uint8 digest[16];

View File

@ -78,13 +78,13 @@ typedef enum _NTLMSSP_STATE NTLMSSP_STATE;
struct _NTLMSSP
{
NTLMSSP_STATE state;
BLOB password;
BLOB username;
BLOB domain;
BLOB workstation;
BLOB target_info;
BLOB target_name;
BLOB spn;
rdpBlob password;
rdpBlob username;
rdpBlob domain;
rdpBlob workstation;
rdpBlob target_info;
rdpBlob target_name;
rdpBlob spn;
UNICONV *uniconv;
uint32 negotiate_flags;
uint8 timestamp[8];
@ -100,11 +100,11 @@ struct _NTLMSSP
uint8 server_signing_key[16];
uint8 server_sealing_key[16];
uint8 message_integrity_check[16];
BLOB nt_challenge_response;
BLOB lm_challenge_response;
BLOB negotiate_message;
BLOB challenge_message;
BLOB authenticate_message;
rdpBlob nt_challenge_response;
rdpBlob lm_challenge_response;
rdpBlob negotiate_message;
rdpBlob challenge_message;
rdpBlob authenticate_message;
CryptoRc4 send_rc4_seal;
CryptoRc4 recv_rc4_seal;
AV_PAIRS *av_pairs;
@ -132,7 +132,7 @@ void ntlmssp_generate_server_sealing_key(NTLMSSP* ntlmssp);
void ntlmssp_init_rc4_seal_states(NTLMSSP* ntlmssp);
void ntlmssp_compute_lm_hash(char* password, char* hash);
void ntlmssp_compute_ntlm_hash(BLOB* password, char* hash);
void ntlmssp_compute_ntlm_hash(rdpBlob* password, char* hash);
void ntlmssp_compute_ntlm_v2_hash(NTLMSSP* ntlmssp, char* hash);
void ntlmssp_compute_lm_response(char* password, char* challenge, char* response);
@ -146,8 +146,8 @@ void ntlmssp_free_av_pairs(NTLMSSP* ntlmssp);
void ntlmssp_compute_message_integrity_check(NTLMSSP* ntlmssp);
void ntlmssp_encrypt_message(NTLMSSP* ntlmssp, BLOB* msg, BLOB* encrypted_msg, uint8* signature);
int ntlmssp_decrypt_message(NTLMSSP* ntlmssp, BLOB* encrypted_msg, BLOB* msg, uint8* signature);
void ntlmssp_encrypt_message(NTLMSSP* ntlmssp, rdpBlob* msg, rdpBlob* encrypted_msg, uint8* signature);
int ntlmssp_decrypt_message(NTLMSSP* ntlmssp, rdpBlob* encrypted_msg, rdpBlob* msg, uint8* signature);
int ntlmssp_recv(NTLMSSP* ntlmssp, STREAM* s);
int ntlmssp_send(NTLMSSP* ntlmssp, STREAM* s);

View File

@ -27,10 +27,13 @@
#include <time.h>
#include <errno.h>
#include <sys/socket.h>
#include <netdb.h>
#include <fcntl.h>
#ifndef _WIN32
#include <sys/socket.h>
#endif
#include "tpkt.h"
#include "fastpath.h"
#include "credssp.h"

View File

@ -20,7 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <freerdp/rfx/rfx.h>
#include <freerdp/utils/memory.h>

View File

@ -26,6 +26,7 @@
#include "rfx_differential.h"
#include "rfx_quantization.h"
#include "rfx_dwt.h"
#include "rfx_types.h"
#include "rfx_decode.h"

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/settings.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/args.h>

View File

@ -27,7 +27,7 @@
* @param length memory length
*/
void freerdp_blob_alloc(BLOB* blob, int length)
void freerdp_blob_alloc(rdpBlob* blob, int length)
{
blob->data = xmalloc(length);
blob->length = length;
@ -38,7 +38,7 @@ void freerdp_blob_alloc(BLOB* blob, int length)
* @param blob
*/
void freerdp_blob_free(BLOB* blob)
void freerdp_blob_free(rdpBlob* blob)
{
if (blob->data)
xfree(blob->data);

View File

@ -24,6 +24,10 @@
#include <freerdp/utils/memory.h>
#include <freerdp/utils/thread.h>
#ifdef _WIN32
#include <Windows.h>
#endif
freerdp_thread* freerdp_thread_new(void)
{
freerdp_thread* thread;

View File

@ -21,10 +21,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/wait_obj.h>
#ifndef _WIN32
#include <sys/time.h>
#else
#include <windows.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif