windows: fix compilation and linking of all libraries
This commit is contained in:
parent
b56962d254
commit
e49a690d46
@ -63,12 +63,12 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd /MT")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2 /Ob2")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_X86_")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include files
|
# Include files
|
||||||
|
@ -45,11 +45,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define FREERDP_CC __stdcall
|
#define FREERDP_CC __cdecl
|
||||||
#else
|
#else
|
||||||
#define FREERDP_CC
|
#define FREERDP_CC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define INLINE __inline
|
||||||
|
#else
|
||||||
|
#define INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IFCALL(_cb, ...) do { if (_cb != NULL) { _cb( __VA_ARGS__ ); } } while (0)
|
#define IFCALL(_cb, ...) do { if (_cb != NULL) { _cb( __VA_ARGS__ ); } } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,14 +50,14 @@ struct rdp_rail
|
|||||||
rdpIconCache* cache;
|
rdpIconCache* cache;
|
||||||
rdpWindowList* list;
|
rdpWindowList* list;
|
||||||
rdpSettings* settings;
|
rdpSettings* settings;
|
||||||
railCreateWindow CreateWindow;
|
railCreateWindow rail_CreateWindow;
|
||||||
railDestroyWindow DestroyWindow;
|
railDestroyWindow rail_DestroyWindow;
|
||||||
railMoveWindow MoveWindow;
|
railMoveWindow rail_MoveWindow;
|
||||||
railShowWindow ShowWindow;
|
railShowWindow rail_ShowWindow;
|
||||||
railSetWindowText SetWindowText;
|
railSetWindowText rail_SetWindowText;
|
||||||
railSetWindowIcon SetWindowIcon;
|
railSetWindowIcon rail_SetWindowIcon;
|
||||||
railSetWindowRects SetWindowRects;
|
railSetWindowRects rail_SetWindowRects;
|
||||||
railSetWindowVisibilityRects SetWindowVisibilityRects;
|
railSetWindowVisibilityRects rail_SetWindowVisibilityRects;
|
||||||
};
|
};
|
||||||
|
|
||||||
FREERDP_API void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update);
|
FREERDP_API void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update);
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
#include <freerdp/utils/pcap.h>
|
#include <freerdp/utils/pcap.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Common */
|
/* Common */
|
||||||
|
|
||||||
struct _BOUNDS
|
struct _BOUNDS
|
||||||
|
@ -27,16 +27,17 @@ struct rdp_certstore
|
|||||||
struct rdp_certdata* certdata;
|
struct rdp_certdata* certdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
void certstore_create(rdpCertstore* certstore);
|
FREERDP_API void certstore_create(rdpCertstore* certstore);
|
||||||
void certstore_open(rdpCertstore* certstore);
|
FREERDP_API void certstore_open(rdpCertstore* certstore);
|
||||||
void certstore_load(rdpCertstore* certstore);
|
FREERDP_API void certstore_load(rdpCertstore* certstore);
|
||||||
void certstore_close(rdpCertstore* certstore);
|
FREERDP_API void certstore_close(rdpCertstore* certstore);
|
||||||
char* get_local_certloc();
|
FREERDP_API char* get_local_certloc();
|
||||||
rdpCertdata* certdata_new(char* host_name,char* fingerprint);
|
FREERDP_API rdpCertdata* certdata_new(char* host_name, char* fingerprint);
|
||||||
void certdata_free(rdpCertdata* certdata);
|
FREERDP_API void certdata_free(rdpCertdata* certdata);
|
||||||
void certstore_init(rdpCertstore* certstore);
|
FREERDP_API void certstore_init(rdpCertstore* certstore);
|
||||||
rdpCertstore* certstore_new(rdpCertdata* certdata);
|
FREERDP_API rdpCertstore* certstore_new(rdpCertdata* certdata);
|
||||||
void certstore_free(rdpCertstore* certstore);
|
FREERDP_API void certstore_free(rdpCertstore* certstore);
|
||||||
int match_certdata(rdpCertstore* certstore);
|
FREERDP_API int match_certdata(rdpCertstore* certstore);
|
||||||
void print_certdata(rdpCertstore* certstore);
|
FREERDP_API void print_certdata(rdpCertstore* certstore);
|
||||||
|
|
||||||
#endif /* __CERTSTORE_UTILS_H */
|
#endif /* __CERTSTORE_UTILS_H */
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
|
|
||||||
#include "orders.h"
|
#include "orders.h"
|
||||||
@ -73,7 +74,7 @@ uint16 fastpath_read_header(rdpFastPath* fastpath, STREAM* s)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fastpath_read_update_header(STREAM* s, uint8* updateCode, uint8* fragmentation, uint8* compression)
|
INLINE void fastpath_read_update_header(STREAM* s, uint8* updateCode, uint8* fragmentation, uint8* compression)
|
||||||
{
|
{
|
||||||
uint8 updateHeader;
|
uint8 updateHeader;
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ inline void fastpath_read_update_header(STREAM* s, uint8* updateCode, uint8* fra
|
|||||||
*compression = (updateHeader >> 6) & 0x03;
|
*compression = (updateHeader >> 6) & 0x03;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fastpath_write_update_header(STREAM* s, uint8 updateCode, uint8 fragmentation, uint8 compression)
|
INLINE void fastpath_write_update_header(STREAM* s, uint8 updateCode, uint8 fragmentation, uint8 compression)
|
||||||
{
|
{
|
||||||
uint8 updateHeader = 0;
|
uint8 updateHeader = 0;
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <freerdp/utils/print.h>
|
||||||
|
|
||||||
#include "gcc.h"
|
#include "gcc.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <freerdp/utils/print.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -47,6 +48,9 @@ static boolean freerdp_listener_open(freerdp_listener* instance, const char* bin
|
|||||||
int option_value;
|
int option_value;
|
||||||
void* sin_addr;
|
void* sin_addr;
|
||||||
char buf[50];
|
char buf[50];
|
||||||
|
#ifdef _WIN32
|
||||||
|
u_long arg;
|
||||||
|
#endif
|
||||||
|
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
@ -78,7 +82,13 @@ static boolean freerdp_listener_open(freerdp_listener* instance, const char* bin
|
|||||||
{
|
{
|
||||||
perror("setsockopt");
|
perror("setsockopt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
fcntl(sockfd, F_SETFL, O_NONBLOCK);
|
fcntl(sockfd, F_SETFL, O_NONBLOCK);
|
||||||
|
#else
|
||||||
|
arg = 1;
|
||||||
|
ioctlsocket(sockfd, FIONBIO, &arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
status = bind(sockfd, ai->ai_addr, ai->ai_addrlen);
|
status = bind(sockfd, ai->ai_addr, ai->ai_addrlen);
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
|
@ -251,13 +251,14 @@ rdpTls* tls_new()
|
|||||||
int tls_verify_certificate(CryptoCert cert, char* hostname)
|
int tls_verify_certificate(CryptoCert cert, char* hostname)
|
||||||
{
|
{
|
||||||
boolean ret;
|
boolean ret;
|
||||||
|
rdpCertstore* certstore;
|
||||||
ret = x509_verify_cert(cert);
|
ret = x509_verify_cert(cert);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
rdpCertdata* certdata;
|
rdpCertdata* certdata;
|
||||||
certdata = crypto_get_certdata(cert->px509, hostname);
|
certdata = crypto_get_certdata(cert->px509, hostname);
|
||||||
rdpCertstore* certstore = certstore_new(certdata);
|
certstore = certstore_new(certdata);
|
||||||
|
|
||||||
if (match_certdata(certstore) == 0)
|
if (match_certdata(certstore) == 0)
|
||||||
goto end;
|
goto end;
|
||||||
@ -267,17 +268,17 @@ int tls_verify_certificate(CryptoCert cert, char* hostname)
|
|||||||
char answer;
|
char answer;
|
||||||
crypto_cert_printinfo(cert->px509);
|
crypto_cert_printinfo(cert->px509);
|
||||||
|
|
||||||
while(1)
|
while (1)
|
||||||
{
|
{
|
||||||
printf("Do you trust the above certificate? (Y/N) ");
|
printf("Do you trust the above certificate? (Y/N) ");
|
||||||
answer=fgetc(stdin);
|
answer = fgetc(stdin);
|
||||||
|
|
||||||
if(answer=='y' || answer =='Y')
|
if (answer == 'y' || answer == 'Y')
|
||||||
{
|
{
|
||||||
print_certdata(certstore);
|
print_certdata(certstore);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(answer=='n' || answer=='N')
|
else if (answer == 'n' || answer == 'N')
|
||||||
{
|
{
|
||||||
certstore_free(certstore);
|
certstore_free(certstore);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
#include <freerdp/gdi/color.h>
|
#include <freerdp/gdi/color.h>
|
||||||
@ -799,96 +800,96 @@ int PatBlt_16bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_BLACK_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_BLACK_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = 0 */
|
/* D = 0 */
|
||||||
*pixel = 0;
|
*pixel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMERGEPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOTMERGEPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D | P) */
|
/* D = ~(D | P) */
|
||||||
*pixel = ~(*pixel | *pen);
|
*pixel = ~(*pixel | *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKNOTPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MASKNOTPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = D & ~P */
|
/* D = D & ~P */
|
||||||
*pixel &= ~(*pen);
|
*pixel &= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTCOPYPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOTCOPYPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~P */
|
/* D = ~P */
|
||||||
*pixel = ~(*pen);
|
*pixel = ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPENNOT_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MASKPENNOT_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = P & ~D */
|
/* D = P & ~D */
|
||||||
*pixel = *pen & ~*pixel;
|
*pixel = *pen & ~*pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOT_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOT_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~D */
|
/* D = ~D */
|
||||||
*pixel = ~(*pixel);
|
*pixel = ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_XORPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_XORPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = D ^ P */
|
/* D = D ^ P */
|
||||||
*pixel = *pixel ^ *pen;
|
*pixel = *pixel ^ *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMASKPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOTMASKPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D & P) */
|
/* D = ~(D & P) */
|
||||||
*pixel = ~(*pixel & *pen);
|
*pixel = ~(*pixel & *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MASKPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = D & P */
|
/* D = D & P */
|
||||||
*pixel &= *pen;
|
*pixel &= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTXORPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOTXORPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D ^ P) */
|
/* D = ~(D ^ P) */
|
||||||
*pixel = ~(*pixel ^ *pen);
|
*pixel = ~(*pixel ^ *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOP_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_NOP_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = D */
|
/* D = D */
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGENOTPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MERGENOTPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = D | ~P */
|
/* D = D | ~P */
|
||||||
*pixel |= ~(*pen);
|
*pixel |= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_COPYPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_COPYPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = P */
|
/* D = P */
|
||||||
*pixel = *pen;
|
*pixel = *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPENNOT_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MERGEPENNOT_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = P | ~D */
|
/* D = P | ~D */
|
||||||
*pixel = *pen | ~(*pixel);
|
*pixel = *pen | ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPEN_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_MERGEPEN_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = P | D */
|
/* D = P | D */
|
||||||
*pixel |= *pen;
|
*pixel |= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_WHITE_16bpp(uint16 *pixel, uint16 *pen)
|
INLINE void SetPixel_WHITE_16bpp(uint16 *pixel, uint16 *pen)
|
||||||
{
|
{
|
||||||
/* D = 1 */
|
/* D = 1 */
|
||||||
*pixel = 0xFFFF;
|
*pixel = 0xFFFF;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
#include <freerdp/gdi/color.h>
|
#include <freerdp/gdi/color.h>
|
||||||
@ -827,96 +828,96 @@ int PatBlt_32bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, i
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_BLACK_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_BLACK_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = 0 */
|
/* D = 0 */
|
||||||
*pixel = 0;
|
*pixel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMERGEPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOTMERGEPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D | P) */
|
/* D = ~(D | P) */
|
||||||
*pixel = ~(*pixel | *pen);
|
*pixel = ~(*pixel | *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKNOTPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MASKNOTPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = D & ~P */
|
/* D = D & ~P */
|
||||||
*pixel &= ~(*pen);
|
*pixel &= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTCOPYPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOTCOPYPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~P */
|
/* D = ~P */
|
||||||
*pixel = ~(*pen);
|
*pixel = ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPENNOT_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MASKPENNOT_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = P & ~D */
|
/* D = P & ~D */
|
||||||
*pixel = *pen & ~*pixel;
|
*pixel = *pen & ~*pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOT_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOT_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~D */
|
/* D = ~D */
|
||||||
*pixel = ~(*pixel);
|
*pixel = ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_XORPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_XORPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = D ^ P */
|
/* D = D ^ P */
|
||||||
*pixel = *pixel ^ *pen;
|
*pixel = *pixel ^ *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMASKPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOTMASKPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D & P) */
|
/* D = ~(D & P) */
|
||||||
*pixel = ~(*pixel & *pen);
|
*pixel = ~(*pixel & *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MASKPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = D & P */
|
/* D = D & P */
|
||||||
*pixel &= *pen;
|
*pixel &= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTXORPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOTXORPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D ^ P) */
|
/* D = ~(D ^ P) */
|
||||||
*pixel = ~(*pixel ^ *pen);
|
*pixel = ~(*pixel ^ *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOP_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_NOP_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = D */
|
/* D = D */
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGENOTPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MERGENOTPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = D | ~P */
|
/* D = D | ~P */
|
||||||
*pixel |= ~(*pen);
|
*pixel |= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_COPYPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_COPYPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = P */
|
/* D = P */
|
||||||
*pixel = *pen;
|
*pixel = *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPENNOT_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MERGEPENNOT_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = P | ~D */
|
/* D = P | ~D */
|
||||||
*pixel = *pen | ~(*pixel);
|
*pixel = *pen | ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPEN_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_MERGEPEN_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = P | D */
|
/* D = P | D */
|
||||||
*pixel |= *pen;
|
*pixel |= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_WHITE_32bpp(uint32 *pixel, uint32 *pen)
|
INLINE void SetPixel_WHITE_32bpp(uint32 *pixel, uint32 *pen)
|
||||||
{
|
{
|
||||||
/* D = 1 */
|
/* D = 1 */
|
||||||
*pixel = 0xFFFFFF;
|
*pixel = 0xFFFFFF;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
#include <freerdp/gdi/color.h>
|
#include <freerdp/gdi/color.h>
|
||||||
@ -707,96 +708,96 @@ int PatBlt_8bpp(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, in
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_BLACK_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_BLACK_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = 0 */
|
/* D = 0 */
|
||||||
*pixel = 0;
|
*pixel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMERGEPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOTMERGEPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D | P) */
|
/* D = ~(D | P) */
|
||||||
*pixel = ~(*pixel | *pen);
|
*pixel = ~(*pixel | *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKNOTPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MASKNOTPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = D & ~P */
|
/* D = D & ~P */
|
||||||
*pixel &= ~(*pen);
|
*pixel &= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTCOPYPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOTCOPYPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = ~P */
|
/* D = ~P */
|
||||||
*pixel = ~(*pen);
|
*pixel = ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPENNOT_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MASKPENNOT_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = P & ~D */
|
/* D = P & ~D */
|
||||||
*pixel = *pen & ~*pixel;
|
*pixel = *pen & ~*pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOT_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOT_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = ~D */
|
/* D = ~D */
|
||||||
*pixel = ~(*pixel);
|
*pixel = ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_XORPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_XORPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = D ^ P */
|
/* D = D ^ P */
|
||||||
*pixel = *pixel ^ *pen;
|
*pixel = *pixel ^ *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTMASKPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOTMASKPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D & P) */
|
/* D = ~(D & P) */
|
||||||
*pixel = ~(*pixel & *pen);
|
*pixel = ~(*pixel & *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MASKPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MASKPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = D & P */
|
/* D = D & P */
|
||||||
*pixel &= *pen;
|
*pixel &= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOTXORPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOTXORPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = ~(D ^ P) */
|
/* D = ~(D ^ P) */
|
||||||
*pixel = ~(*pixel ^ *pen);
|
*pixel = ~(*pixel ^ *pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_NOP_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_NOP_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = D */
|
/* D = D */
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGENOTPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MERGENOTPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = D | ~P */
|
/* D = D | ~P */
|
||||||
*pixel |= ~(*pen);
|
*pixel |= ~(*pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_COPYPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_COPYPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = P */
|
/* D = P */
|
||||||
*pixel = *pen;
|
*pixel = *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPENNOT_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MERGEPENNOT_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = P | ~D */
|
/* D = P | ~D */
|
||||||
*pixel = *pen | ~(*pixel);
|
*pixel = *pen | ~(*pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_MERGEPEN_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_MERGEPEN_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = P | D */
|
/* D = P | D */
|
||||||
*pixel |= *pen;
|
*pixel |= *pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetPixel_WHITE_8bpp(uint8* pixel, uint8* pen)
|
INLINE void SetPixel_WHITE_8bpp(uint8* pixel, uint8* pen)
|
||||||
{
|
{
|
||||||
/* D = 1 */
|
/* D = 1 */
|
||||||
*pixel = 0xFF;
|
*pixel = 0xFF;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
#include <freerdp/gdi/color.h>
|
#include <freerdp/gdi/color.h>
|
||||||
@ -48,39 +49,39 @@ pBitBlt BitBlt_[5] =
|
|||||||
* @return pixel color
|
* @return pixel color
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline GDI_COLOR gdi_GetPixel(HGDI_DC hdc, int nXPos, int nYPos)
|
INLINE GDI_COLOR gdi_GetPixel(HGDI_DC hdc, int nXPos, int nYPos)
|
||||||
{
|
{
|
||||||
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||||
GDI_COLOR* colorp = (GDI_COLOR*)&(hBmp->data[(nYPos * hBmp->width * hdc->bytesPerPixel) + nXPos * hdc->bytesPerPixel]);
|
GDI_COLOR* colorp = (GDI_COLOR*)&(hBmp->data[(nYPos * hBmp->width * hdc->bytesPerPixel) + nXPos * hdc->bytesPerPixel]);
|
||||||
return (GDI_COLOR) *colorp;
|
return (GDI_COLOR) *colorp;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8 gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint8 gdi_GetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return *((uint8*)&(hBmp->data[(Y * hBmp->width) + X]));
|
return *((uint8*)&(hBmp->data[(Y * hBmp->width) + X]));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint16 gdi_GetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return *((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2]));
|
return *((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint32 gdi_GetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return *((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4]));
|
return *((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint8* gdi_GetPointer_8bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return ((uint8*)&(hBmp->data[(Y * hBmp->width) + X]));
|
return ((uint8*)&(hBmp->data[(Y * hBmp->width) + X]));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint16* gdi_GetPointer_16bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return ((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2]));
|
return ((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y)
|
INLINE uint32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y)
|
||||||
{
|
{
|
||||||
return ((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4]));
|
return ((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4]));
|
||||||
}
|
}
|
||||||
@ -95,24 +96,24 @@ inline uint32* gdi_GetPointer_32bpp(HGDI_BITMAP hBmp, int X, int Y)
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline GDI_COLOR gdi_SetPixel(HGDI_DC hdc, int X, int Y, GDI_COLOR crColor)
|
INLINE GDI_COLOR gdi_SetPixel(HGDI_DC hdc, int X, int Y, GDI_COLOR crColor)
|
||||||
{
|
{
|
||||||
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||||
*((GDI_COLOR*)&(hBmp->data[(Y * hBmp->width * hdc->bytesPerPixel) + X * hdc->bytesPerPixel])) = crColor;
|
*((GDI_COLOR*)&(hBmp->data[(Y * hBmp->width * hdc->bytesPerPixel) + X * hdc->bytesPerPixel])) = crColor;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, uint8 pixel)
|
INLINE void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, uint8 pixel)
|
||||||
{
|
{
|
||||||
*((uint8*)&(hBmp->data[(Y * hBmp->width) + X])) = pixel;
|
*((uint8*)&(hBmp->data[(Y * hBmp->width) + X])) = pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, uint16 pixel)
|
INLINE void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, uint16 pixel)
|
||||||
{
|
{
|
||||||
*((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])) = pixel;
|
*((uint16*)&(hBmp->data[(Y * hBmp->width * 2) + X * 2])) = pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel)
|
INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel)
|
||||||
{
|
{
|
||||||
*((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])) = pixel;
|
*((uint32*)&(hBmp->data[(Y * hBmp->width * 4) + X * 4])) = pixel;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
#include <freerdp/gdi/color.h>
|
#include <freerdp/gdi/color.h>
|
||||||
@ -301,17 +302,17 @@ const uint32 rop3_code_table[] =
|
|||||||
|
|
||||||
/* GDI Helper Functions */
|
/* GDI Helper Functions */
|
||||||
|
|
||||||
inline uint32 gdi_rop3_code(uint8 code)
|
INLINE uint32 gdi_rop3_code(uint8 code)
|
||||||
{
|
{
|
||||||
return rop3_code_table[code];
|
return rop3_code_table[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void gdi_copy_mem(uint8 * d, uint8 * s, int n)
|
INLINE void gdi_copy_mem(uint8 * d, uint8 * s, int n)
|
||||||
{
|
{
|
||||||
memmove(d, s, n);
|
memmove(d, s, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
|
INLINE void gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
|
||||||
{
|
{
|
||||||
d = (d + n) - 1;
|
d = (d + n) - 1;
|
||||||
s = (s + n) - 1;
|
s = (s + n) - 1;
|
||||||
@ -336,7 +337,7 @@ inline void gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
|
INLINE uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
|
||||||
{
|
{
|
||||||
uint8 * p;
|
uint8 * p;
|
||||||
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdcBmp->selectedObject;
|
HGDI_BITMAP hBmp = (HGDI_BITMAP) hdcBmp->selectedObject;
|
||||||
@ -353,7 +354,7 @@ inline uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
|
INLINE uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
|
||||||
{
|
{
|
||||||
uint8 * p;
|
uint8 * p;
|
||||||
|
|
||||||
@ -377,7 +378,7 @@ inline uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width)
|
INLINE int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width)
|
||||||
{
|
{
|
||||||
int byte;
|
int byte;
|
||||||
int shift;
|
int shift;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
|
|
||||||
@ -47,13 +48,13 @@ HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor)
|
|||||||
return hPen;
|
return hPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8 gdi_GetPenColor_8bpp(HGDI_PEN pen)
|
INLINE uint8 gdi_GetPenColor_8bpp(HGDI_PEN pen)
|
||||||
{
|
{
|
||||||
/* TODO: implement conversion using palette */
|
/* TODO: implement conversion using palette */
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen)
|
INLINE uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen)
|
||||||
{
|
{
|
||||||
uint16 p;
|
uint16 p;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
@ -63,7 +64,7 @@ inline uint16 gdi_GetPenColor_16bpp(HGDI_PEN pen)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 gdi_GetPenColor_32bpp(HGDI_PEN pen)
|
INLINE uint32 gdi_GetPenColor_32bpp(HGDI_PEN pen)
|
||||||
{
|
{
|
||||||
return pen->color;
|
return pen->color;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/gdi/gdi.h>
|
#include <freerdp/gdi/gdi.h>
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ HGDI_RECT gdi_CreateRect(int xLeft, int yTop, int xRight, int yBottom)
|
|||||||
* @param rgn destination region
|
* @param rgn destination region
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_RectToRgn(HGDI_RECT rect, HGDI_RGN rgn)
|
INLINE void gdi_RectToRgn(HGDI_RECT rect, HGDI_RGN rgn)
|
||||||
{
|
{
|
||||||
rgn->x = rect->left;
|
rgn->x = rect->left;
|
||||||
rgn->y = rect->top;
|
rgn->y = rect->top;
|
||||||
@ -91,7 +92,7 @@ inline void gdi_RectToRgn(HGDI_RECT rect, HGDI_RGN rgn)
|
|||||||
* @param rgn destination region
|
* @param rgn destination region
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_CRectToRgn(int left, int top, int right, int bottom, HGDI_RGN rgn)
|
INLINE void gdi_CRectToRgn(int left, int top, int right, int bottom, HGDI_RGN rgn)
|
||||||
{
|
{
|
||||||
rgn->x = left;
|
rgn->x = left;
|
||||||
rgn->y = top;
|
rgn->y = top;
|
||||||
@ -108,7 +109,7 @@ inline void gdi_CRectToRgn(int left, int top, int right, int bottom, HGDI_RGN rg
|
|||||||
* @param h height
|
* @param h height
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_RectToCRgn(HGDI_RECT rect, int *x, int *y, int *w, int *h)
|
INLINE void gdi_RectToCRgn(HGDI_RECT rect, int *x, int *y, int *w, int *h)
|
||||||
{
|
{
|
||||||
*x = rect->left;
|
*x = rect->left;
|
||||||
*y = rect->top;
|
*y = rect->top;
|
||||||
@ -128,7 +129,7 @@ inline void gdi_RectToCRgn(HGDI_RECT rect, int *x, int *y, int *w, int *h)
|
|||||||
* @param h height
|
* @param h height
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_CRectToCRgn(int left, int top, int right, int bottom, int *x, int *y, int *w, int *h)
|
INLINE void gdi_CRectToCRgn(int left, int top, int right, int bottom, int *x, int *y, int *w, int *h)
|
||||||
{
|
{
|
||||||
*x = left;
|
*x = left;
|
||||||
*y = top;
|
*y = top;
|
||||||
@ -142,7 +143,7 @@ inline void gdi_CRectToCRgn(int left, int top, int right, int bottom, int *x, in
|
|||||||
* @param rect destination rectangle
|
* @param rect destination rectangle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_RgnToRect(HGDI_RGN rgn, HGDI_RECT rect)
|
INLINE void gdi_RgnToRect(HGDI_RGN rgn, HGDI_RECT rect)
|
||||||
{
|
{
|
||||||
rect->left = rgn->x;
|
rect->left = rgn->x;
|
||||||
rect->top = rgn->y;
|
rect->top = rgn->y;
|
||||||
@ -159,7 +160,7 @@ inline void gdi_RgnToRect(HGDI_RGN rgn, HGDI_RECT rect)
|
|||||||
* @param rect destination rectangle
|
* @param rect destination rectangle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_CRgnToRect(int x, int y, int w, int h, HGDI_RECT rect)
|
INLINE void gdi_CRgnToRect(int x, int y, int w, int h, HGDI_RECT rect)
|
||||||
{
|
{
|
||||||
rect->left = x;
|
rect->left = x;
|
||||||
rect->top = y;
|
rect->top = y;
|
||||||
@ -176,7 +177,7 @@ inline void gdi_CRgnToRect(int x, int y, int w, int h, HGDI_RECT rect)
|
|||||||
* @param bottom y2
|
* @param bottom y2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_RgnToCRect(HGDI_RGN rgn, int *left, int *top, int *right, int *bottom)
|
INLINE void gdi_RgnToCRect(HGDI_RGN rgn, int *left, int *top, int *right, int *bottom)
|
||||||
{
|
{
|
||||||
*left = rgn->x;
|
*left = rgn->x;
|
||||||
*top = rgn->y;
|
*top = rgn->y;
|
||||||
@ -196,7 +197,7 @@ inline void gdi_RgnToCRect(HGDI_RGN rgn, int *left, int *top, int *right, int *b
|
|||||||
* @param bottom y2
|
* @param bottom y2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline void gdi_CRgnToCRect(int x, int y, int w, int h, int *left, int *top, int *right, int *bottom)
|
INLINE void gdi_CRgnToCRect(int x, int y, int w, int h, int *left, int *top, int *right, int *bottom)
|
||||||
{
|
{
|
||||||
*left = x;
|
*left = x;
|
||||||
*top = y;
|
*top = y;
|
||||||
@ -215,7 +216,7 @@ inline void gdi_CRgnToCRect(int x, int y, int w, int h, int *left, int *top, int
|
|||||||
* @return 1 if there is an overlap, 0 otherwise
|
* @return 1 if there is an overlap, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy)
|
INLINE int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int srcy)
|
||||||
{
|
{
|
||||||
GDI_RECT dst;
|
GDI_RECT dst;
|
||||||
GDI_RECT src;
|
GDI_RECT src;
|
||||||
@ -238,7 +239,7 @@ inline int gdi_CopyOverlap(int x, int y, int width, int height, int srcx, int sr
|
|||||||
* @return 1 if successful, 0 otherwise
|
* @return 1 if successful, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom)
|
INLINE int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBottom)
|
||||||
{
|
{
|
||||||
rc->left = xLeft;
|
rc->left = xLeft;
|
||||||
rc->top = yTop;
|
rc->top = yTop;
|
||||||
@ -257,7 +258,7 @@ inline int gdi_SetRect(HGDI_RECT rc, int xLeft, int yTop, int xRight, int yBotto
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight)
|
INLINE int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHeight)
|
||||||
{
|
{
|
||||||
hRgn->x = nXLeft;
|
hRgn->x = nXLeft;
|
||||||
hRgn->y = nYLeft;
|
hRgn->y = nYLeft;
|
||||||
@ -277,7 +278,7 @@ inline int gdi_SetRgn(HGDI_RGN hRgn, int nXLeft, int nYLeft, int nWidth, int nHe
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
INLINE int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||||
{
|
{
|
||||||
gdi_CRectToRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn);
|
gdi_CRectToRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn);
|
||||||
hRgn->null = 0;
|
hRgn->null = 0;
|
||||||
@ -302,7 +303,7 @@ inline int gdi_SetRectRgn(HGDI_RGN hRgn, int nLeftRect, int nTopRect, int nRight
|
|||||||
* @return 1 if both regions are equal, 0 otherwise
|
* @return 1 if both regions are equal, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2)
|
INLINE int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2)
|
||||||
{
|
{
|
||||||
if ((hSrcRgn1->x == hSrcRgn2->x) &&
|
if ((hSrcRgn1->x == hSrcRgn2->x) &&
|
||||||
(hSrcRgn1->y == hSrcRgn2->y) &&
|
(hSrcRgn1->y == hSrcRgn2->y) &&
|
||||||
@ -322,7 +323,7 @@ inline int gdi_EqualRgn(HGDI_RGN hSrcRgn1, HGDI_RGN hSrcRgn2)
|
|||||||
* @return 1 if successful, 0 otherwise
|
* @return 1 if successful, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src)
|
INLINE int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src)
|
||||||
{
|
{
|
||||||
dst->left = src->left;
|
dst->left = src->left;
|
||||||
dst->top = src->top;
|
dst->top = src->top;
|
||||||
@ -340,7 +341,7 @@ inline int gdi_CopyRect(HGDI_RECT dst, HGDI_RECT src)
|
|||||||
* @return 1 if the point is inside, 0 otherwise
|
* @return 1 if the point is inside, 0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_PtInRect(HGDI_RECT rc, int x, int y)
|
INLINE int gdi_PtInRect(HGDI_RECT rc, int x, int y)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* points on the left and top sides are considered in,
|
* points on the left and top sides are considered in,
|
||||||
@ -369,7 +370,7 @@ inline int gdi_PtInRect(HGDI_RECT rc, int x, int y)
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
|
INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
GDI_RECT inv;
|
GDI_RECT inv;
|
||||||
GDI_RECT rgn;
|
GDI_RECT rgn;
|
||||||
|
@ -71,7 +71,7 @@ static void rail_WindowIcon(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WIN
|
|||||||
else
|
else
|
||||||
window->smallIcon = icon;
|
window->smallIcon = icon;
|
||||||
|
|
||||||
IFCALL(rail->SetWindowIcon, rail, window, icon);
|
IFCALL(rail->rail_SetWindowIcon, rail, window, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rail_WindowCachedIcon(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
static void rail_WindowCachedIcon(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
||||||
|
@ -278,15 +278,15 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
memcpy(window->title, "RAIL", sizeof("RAIL"));
|
memcpy(window->title, "RAIL", sizeof("RAIL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
IFCALL(rail->CreateWindow, rail, window);
|
IFCALL(rail->rail_CreateWindow, rail, window);
|
||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
||||||
{
|
{
|
||||||
IFCALL(rail->SetWindowRects, rail, window);
|
IFCALL(rail->rail_SetWindowRects, rail, window);
|
||||||
}
|
}
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
||||||
{
|
{
|
||||||
IFCALL(rail->SetWindowVisibilityRects, rail, window);
|
IFCALL(rail->rail_SetWindowVisibilityRects, rail, window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
||||||
{
|
{
|
||||||
IFCALL(rail->ShowWindow, rail, window, window->showState);
|
IFCALL(rail->rail_ShowWindow, rail, window, window->showState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
||||||
@ -314,7 +314,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
|
|
||||||
window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length);
|
window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length);
|
||||||
|
|
||||||
IFCALL(rail->SetWindowText, rail, window);
|
IFCALL(rail->rail_SetWindowText, rail, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
||||||
@ -340,7 +340,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
if ((window->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
|
if ((window->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
|
||||||
(window->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
|
(window->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
|
||||||
{
|
{
|
||||||
IFCALL(rail->MoveWindow, rail, window);
|
IFCALL(rail->rail_MoveWindow, rail, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
||||||
@ -350,7 +350,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
||||||
{
|
{
|
||||||
IFCALL(rail->SetWindowRects, rail, window);
|
IFCALL(rail->rail_SetWindowRects, rail, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
||||||
@ -360,13 +360,13 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
|
|
||||||
if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
||||||
{
|
{
|
||||||
IFCALL(rail->SetWindowVisibilityRects, rail, window);
|
IFCALL(rail->rail_SetWindowVisibilityRects, rail, window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
|
void rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
|
||||||
{
|
{
|
||||||
IFCALL(rail->DestroyWindow, rail, window);
|
IFCALL(rail->rail_DestroyWindow, rail, window);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
{
|
{
|
||||||
|
@ -36,19 +36,20 @@ void certstore_create(rdpCertstore* certstore)
|
|||||||
printf("certstore_create: error opening [%s] for writing\n", certstore->file);
|
printf("certstore_create: error opening [%s] for writing\n", certstore->file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(certstore->fp);
|
fflush(certstore->fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void certstore_load(rdpCertstore* certstore)
|
void certstore_load(rdpCertstore* certstore)
|
||||||
{
|
{
|
||||||
certstore->fp = fopen((char*)certstore->file, "r+");
|
certstore->fp = fopen((char*) certstore->file, "r+");
|
||||||
}
|
}
|
||||||
|
|
||||||
void certstore_open(rdpCertstore* certstore)
|
void certstore_open(rdpCertstore* certstore)
|
||||||
{
|
{
|
||||||
struct stat stat_info;
|
struct stat stat_info;
|
||||||
|
|
||||||
if (stat((char*)certstore->file, &stat_info) != 0)
|
if (stat((char*) certstore->file, &stat_info) != 0)
|
||||||
certstore_create(certstore);
|
certstore_create(certstore);
|
||||||
else
|
else
|
||||||
certstore_load(certstore);
|
certstore_load(certstore);
|
||||||
@ -62,14 +63,23 @@ void certstore_close(rdpCertstore* certstore)
|
|||||||
|
|
||||||
char* get_local_certloc()
|
char* get_local_certloc()
|
||||||
{
|
{
|
||||||
char *home_path;
|
char* home_path;
|
||||||
char *certloc;
|
char* certloc;
|
||||||
struct stat stat_info;
|
struct stat stat_info;
|
||||||
home_path=getenv("HOME");
|
home_path = getenv("HOME");
|
||||||
certloc=(char*)xmalloc(strlen(home_path)+strlen("/.")+strlen(cert_dir)+strlen("/")+strlen(cert_loc)+1);
|
|
||||||
|
certloc = (char*) xmalloc(strlen(home_path) + strlen("/.") + strlen(cert_dir) + strlen("/") + strlen(cert_loc) + 1);
|
||||||
sprintf(certloc,"%s/.%s/%s",home_path,cert_dir,cert_loc);
|
sprintf(certloc,"%s/.%s/%s",home_path,cert_dir,cert_loc);
|
||||||
if(stat((char*)certloc, &stat_info) != 0)
|
|
||||||
|
if(stat((char*) certloc, &stat_info) != 0)
|
||||||
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
mkdir(certloc, S_IRUSR | S_IWUSR | S_IXUSR);
|
mkdir(certloc, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||||
|
#else
|
||||||
|
CreateDirectory(certloc, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return certloc;
|
return certloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,14 +125,18 @@ void certstore_init(rdpCertstore* certstore)
|
|||||||
|
|
||||||
rdpCertdata* certdata_new(char* host_name,char* fingerprint)
|
rdpCertdata* certdata_new(char* host_name,char* fingerprint)
|
||||||
{
|
{
|
||||||
rdpCertdata* certdata=(rdpCertdata*)xzalloc(sizeof(rdpCertdata));
|
rdpCertdata* certdata;
|
||||||
if(certdata !=NULL)
|
|
||||||
|
certdata = (rdpCertdata*) xzalloc(sizeof(rdpCertdata));
|
||||||
|
|
||||||
|
if (certdata !=NULL)
|
||||||
{
|
{
|
||||||
certdata->hostname=xzalloc(strlen(host_name)+1);
|
certdata->hostname = xzalloc(strlen(host_name) + 1);
|
||||||
certdata->thumbprint=xzalloc(strlen(fingerprint)+1);
|
certdata->thumbprint = xzalloc(strlen(fingerprint) + 1);
|
||||||
sprintf(certdata->hostname,"%s",host_name);
|
sprintf(certdata->hostname, "%s", host_name);
|
||||||
sprintf(certdata->thumbprint,"%s",fingerprint);
|
sprintf(certdata->thumbprint, "%s", fingerprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return certdata;
|
return certdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +152,9 @@ void certdata_free(rdpCertdata* certdata)
|
|||||||
|
|
||||||
rdpCertstore* certstore_new(rdpCertdata* certdata)
|
rdpCertstore* certstore_new(rdpCertdata* certdata)
|
||||||
{
|
{
|
||||||
rdpCertstore* certstore = (rdpCertstore*) xzalloc(sizeof(rdpCertstore));
|
rdpCertstore* certstore;
|
||||||
|
|
||||||
|
certstore = (rdpCertstore*) xzalloc(sizeof(rdpCertstore));
|
||||||
|
|
||||||
if (certstore != NULL)
|
if (certstore != NULL)
|
||||||
{
|
{
|
||||||
@ -164,32 +180,39 @@ void certstore_free(rdpCertstore* certstore)
|
|||||||
|
|
||||||
int match_certdata(rdpCertstore* certstore)
|
int match_certdata(rdpCertstore* certstore)
|
||||||
{
|
{
|
||||||
char *host;
|
char* host;
|
||||||
char *p;
|
char* p;
|
||||||
char *thumb_print;
|
char* thumb_print;
|
||||||
int length;
|
int length;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
rdpCertdata* cert_data;
|
||||||
FILE* cfp;
|
FILE* cfp;
|
||||||
cfp=certstore->fp;
|
cfp = certstore->fp;
|
||||||
rdpCertdata* cert_data=certstore->certdata;
|
cert_data = certstore->certdata;
|
||||||
length=strlen(cert_data->thumbprint);
|
length = strlen(cert_data->thumbprint);
|
||||||
host=xzalloc(strlen(cert_data->hostname)+1);
|
host = xzalloc(strlen(cert_data->hostname) + 1);
|
||||||
for(;;)
|
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
if((int)fread(host,sizeof(char),strlen(cert_data->hostname),cfp) < strlen(cert_data->hostname))
|
if ((int) fread(host, sizeof(char), strlen(cert_data->hostname), cfp) < strlen(cert_data->hostname))
|
||||||
break;
|
break;
|
||||||
if((!strcmp(host,cert_data->hostname)) && ((c=fgetc(cfp))==' ' || c=='\t') )
|
|
||||||
|
if ((!strcmp(host, cert_data->hostname)) && ((c = fgetc(cfp)) ==' ' || c == '\t') )
|
||||||
{
|
{
|
||||||
ungetc(c,cfp);
|
ungetc(c, cfp);
|
||||||
while((c=fgetc(cfp))==' ' || c=='\t');
|
while((c = fgetc(cfp)) == ' ' || c == '\t');
|
||||||
if(c==EOF)
|
|
||||||
|
if (c == EOF)
|
||||||
break;
|
break;
|
||||||
ungetc(c,cfp);
|
|
||||||
thumb_print=xzalloc(length+1);
|
ungetc(c, cfp);
|
||||||
p=thumb_print;
|
thumb_print = xzalloc(length + 1);
|
||||||
while((p-thumb_print) < length && (*p=fgetc(cfp))!=EOF && *p!='\n' && *p==*(cert_data->thumbprint+(p-thumb_print)))
|
p = thumb_print;
|
||||||
|
|
||||||
|
while((p - thumb_print) < length && (*p = fgetc(cfp)) != EOF && *p != '\n' && *p == *(cert_data->thumbprint + (p - thumb_print)))
|
||||||
p++;
|
p++;
|
||||||
if(p-thumb_print==length)
|
|
||||||
|
if(p - thumb_print == length)
|
||||||
certstore->match=0;
|
certstore->match=0;
|
||||||
else
|
else
|
||||||
certstore->match=-1;
|
certstore->match=-1;
|
||||||
@ -197,13 +220,15 @@ int match_certdata(rdpCertstore* certstore)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while(c!='\n' && c!=EOF)
|
while (c != '\n' && c != EOF)
|
||||||
c=fgetc(cfp);
|
c = fgetc(cfp);
|
||||||
if(c==EOF)
|
|
||||||
|
if(c == EOF)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xfree(host);
|
xfree(host);
|
||||||
|
|
||||||
return certstore->match;
|
return certstore->match;
|
||||||
}
|
}
|
||||||
void print_certdata(rdpCertstore* certstore)
|
void print_certdata(rdpCertstore* certstore)
|
||||||
|
@ -65,6 +65,6 @@ void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, uint32* sec, u
|
|||||||
|
|
||||||
*sec = ((uint32) stopwatch->elapsed) / CLOCKS_PER_SEC;
|
*sec = ((uint32) stopwatch->elapsed) / CLOCKS_PER_SEC;
|
||||||
uelapsed = stopwatch->elapsed - ((double)(*sec) * CLOCKS_PER_SEC);
|
uelapsed = stopwatch->elapsed - ((double)(*sec) * CLOCKS_PER_SEC);
|
||||||
*usec = (uelapsed / (CLOCKS_PER_SEC / 1000000));
|
*usec = (uint32)(uelapsed / (CLOCKS_PER_SEC / 1000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user