mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-04-20 22:09:26 +03:00
Include headers properly
This commit is contained in:
@@ -19,6 +19,9 @@ set_target_properties(mayaqua
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
# Required because we include <openssl/opensslv.h> in Encrypt.h.
|
||||
target_include_directories(mayaqua PUBLIC ${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||
|
||||
if(WIN32)
|
||||
|
||||
+7
-11
@@ -5,18 +5,14 @@
|
||||
// Cfg.c
|
||||
// Configuration information manipulation module
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Cfg.h"
|
||||
|
||||
#define CFG_C
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "FileIO.h"
|
||||
#include "Internat.h"
|
||||
#include "Memory.h"
|
||||
#include "Network.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
|
||||
// Create a backup of the configuration file
|
||||
void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef CFG_H
|
||||
#define CFG_H
|
||||
|
||||
#include "Encrypt.h"
|
||||
|
||||
// Macro
|
||||
//#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name
|
||||
|
||||
|
||||
+31
-17
@@ -5,19 +5,17 @@
|
||||
// Encrypt.c
|
||||
// Encryption and digital certification routine
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Encrypt.h"
|
||||
|
||||
#define ENCRYPT_C
|
||||
#include "FileIO.h"
|
||||
#include "Internat.h"
|
||||
#include "Kernel.h"
|
||||
#include "Memory.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
|
||||
#define __WINCRYPT_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
@@ -40,7 +38,6 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h> // For __cpuid()
|
||||
@@ -64,6 +61,23 @@
|
||||
#endif
|
||||
#endif // _MSC_VER
|
||||
|
||||
// OpenSSL <1.1 Shims
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa)
|
||||
# define EVP_PKEY_base_id(pkey) ((pkey)->type)
|
||||
# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore)
|
||||
# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter)
|
||||
# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber)
|
||||
#endif
|
||||
|
||||
#ifndef EVP_CTRL_AEAD_GET_TAG
|
||||
# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
|
||||
#endif
|
||||
|
||||
#ifndef EVP_CTRL_AEAD_SET_TAG
|
||||
# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
|
||||
#endif
|
||||
|
||||
LOCK *openssl_lock = NULL;
|
||||
|
||||
int ssl_clientcert_index = 0;
|
||||
@@ -295,7 +309,7 @@ MD *NewMdEx(char *name, bool hmac)
|
||||
return m;
|
||||
}
|
||||
|
||||
m->Md = (const struct evp_md_st *)EVP_get_digestbyname(name);
|
||||
m->Md = EVP_get_digestbyname(name);
|
||||
if (m->Md == NULL)
|
||||
{
|
||||
Debug("NewMdEx(): Algorithm %s not found by EVP_get_digestbyname().\n", m->Name);
|
||||
@@ -303,7 +317,7 @@ MD *NewMdEx(char *name, bool hmac)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m->Size = EVP_MD_size((const EVP_MD *)m->Md);
|
||||
m->Size = EVP_MD_size(m->Md);
|
||||
m->IsHMac = hmac;
|
||||
|
||||
if (hmac)
|
||||
@@ -341,7 +355,7 @@ bool SetMdKey(MD *md, void *key, UINT key_size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HMAC_Init_ex(md->Ctx, key, key_size, (const EVP_MD *)md->Md, NULL) == false)
|
||||
if (HMAC_Init_ex(md->Ctx, key, key_size, md->Md, NULL) == false)
|
||||
{
|
||||
Debug("SetMdKey(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error());
|
||||
return false;
|
||||
@@ -3858,7 +3872,7 @@ CRYPT *NewCrypt(void *key, UINT size)
|
||||
{
|
||||
CRYPT *c = ZeroMalloc(sizeof(CRYPT));
|
||||
|
||||
c->Rc4Key = Malloc(sizeof(struct rc4_key_st));
|
||||
c->Rc4Key = Malloc(sizeof(RC4_KEY));
|
||||
|
||||
RC4_set_key(c->Rc4Key, size, (UCHAR *)key);
|
||||
|
||||
@@ -4039,8 +4053,8 @@ AES_KEY_VALUE *AesNewKey(void *data, UINT size)
|
||||
|
||||
k = ZeroMalloc(sizeof(AES_KEY_VALUE));
|
||||
|
||||
k->EncryptKey = ZeroMalloc(sizeof(struct aes_key_st));
|
||||
k->DecryptKey = ZeroMalloc(sizeof(struct aes_key_st));
|
||||
k->EncryptKey = ZeroMalloc(sizeof(AES_KEY));
|
||||
k->DecryptKey = ZeroMalloc(sizeof(AES_KEY));
|
||||
|
||||
k->KeySize = size;
|
||||
Copy(k->KeyValue, data, size);
|
||||
|
||||
+28
-33
@@ -8,11 +8,9 @@
|
||||
#ifndef ENCRYPT_H
|
||||
#define ENCRYPT_H
|
||||
|
||||
// Function of OpenSSL
|
||||
void RAND_Init_For_SoftEther();
|
||||
void RAND_Free_For_SoftEther();
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
// Constant
|
||||
#define MIN_SIGN_HASH_SIZE (15 + SHA1_SIZE)
|
||||
@@ -131,27 +129,31 @@ void RAND_Free_For_SoftEther();
|
||||
// Macro
|
||||
#define HASHED_DATA(p) (((UCHAR *)p) + 15)
|
||||
|
||||
// OpenSSL <1.1 Shims
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa)
|
||||
# define EVP_PKEY_base_id(pkey) ((pkey)->type)
|
||||
# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore)
|
||||
# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter)
|
||||
# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber)
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
typedef struct PKCS12_st PKCS12;
|
||||
typedef struct evp_md_st EVP_MD;
|
||||
#else
|
||||
#include <openssl/pkcs12.h>
|
||||
typedef struct env_md_st EVP_MD;
|
||||
#endif
|
||||
|
||||
#ifndef EVP_CTRL_AEAD_GET_TAG
|
||||
# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
|
||||
#endif
|
||||
|
||||
#ifndef EVP_CTRL_AEAD_SET_TAG
|
||||
# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
|
||||
#endif
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
typedef struct bignum_st BIGNUM;
|
||||
typedef struct bio_st BIO;
|
||||
typedef struct DES_ks DES_key_schedule;
|
||||
typedef struct dh_st DH;
|
||||
typedef struct evp_cipher_st EVP_CIPHER;
|
||||
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
|
||||
typedef struct evp_pkey_st EVP_PKEY;
|
||||
typedef struct rc4_key_st RC4_KEY;
|
||||
typedef struct ssl_st SSL;
|
||||
typedef struct x509_st X509;
|
||||
typedef struct X509_crl_st X509_CRL;
|
||||
|
||||
// Crypt context
|
||||
struct CRYPT
|
||||
{
|
||||
struct rc4_key_st *Rc4Key;
|
||||
RC4_KEY *Rc4Key;
|
||||
};
|
||||
|
||||
// Name in the certificate
|
||||
@@ -218,7 +220,7 @@ struct X_CRL
|
||||
// Key element of DES
|
||||
struct DES_KEY_VALUE
|
||||
{
|
||||
struct DES_ks *KeySchedule;
|
||||
DES_key_schedule *KeySchedule;
|
||||
UCHAR KeyValue[DES_KEY_SIZE];
|
||||
};
|
||||
|
||||
@@ -231,8 +233,8 @@ struct DES_KEY
|
||||
// AES key
|
||||
struct AES_KEY_VALUE
|
||||
{
|
||||
struct aes_key_st *EncryptKey;
|
||||
struct aes_key_st *DecryptKey;
|
||||
AES_KEY *EncryptKey;
|
||||
AES_KEY *DecryptKey;
|
||||
UCHAR KeyValue[AES_MAX_KEY_SIZE];
|
||||
UINT KeySize;
|
||||
};
|
||||
@@ -240,7 +242,7 @@ struct AES_KEY_VALUE
|
||||
// DH
|
||||
struct DH_CTX
|
||||
{
|
||||
struct dh_st *dh;
|
||||
DH *dh;
|
||||
BUF *MyPublicKey;
|
||||
BUF *MyPrivateKey;
|
||||
UINT Size;
|
||||
@@ -251,8 +253,8 @@ struct CIPHER
|
||||
{
|
||||
char Name[MAX_PATH];
|
||||
bool IsNullCipher, IsAeadCipher;
|
||||
const struct evp_cipher_st *Cipher;
|
||||
struct evp_cipher_ctx_st *Ctx;
|
||||
const EVP_CIPHER *Cipher;
|
||||
EVP_CIPHER_CTX *Ctx;
|
||||
bool Encrypt;
|
||||
UINT BlockSize, IvSize, KeySize;
|
||||
};
|
||||
@@ -263,7 +265,7 @@ struct MD
|
||||
char Name[MAX_PATH];
|
||||
bool IsNullMd;
|
||||
bool IsHMac;
|
||||
const struct evp_md_st *Md;
|
||||
const EVP_MD *Md;
|
||||
void *Ctx;
|
||||
UINT Size;
|
||||
};
|
||||
@@ -448,11 +450,4 @@ void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec,
|
||||
|
||||
int GetSslClientCertIndex();
|
||||
|
||||
#ifdef ENCRYPT_C
|
||||
// Inner function
|
||||
|
||||
|
||||
#endif // ENCRYPT_C
|
||||
|
||||
#endif // ENCRYPT_H
|
||||
|
||||
|
||||
+11
-9
@@ -5,16 +5,18 @@
|
||||
// FileIO.c
|
||||
// File Input / Output code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "FileIO.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Cfg.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Str.h"
|
||||
#include "Tick64.h"
|
||||
#include "Tracking.h"
|
||||
#include "Unix.h"
|
||||
#include "Win32.h"
|
||||
|
||||
static char exe_file_name[MAX_SIZE] = "/tmp/a.out";
|
||||
static wchar_t exe_file_name_w[MAX_SIZE] = L"/tmp/a.out";
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef FILEIO_H
|
||||
#define FILEIO_H
|
||||
|
||||
#include "Mayaqua.h"
|
||||
|
||||
// Constant
|
||||
#define HAMCORE_DIR_NAME "hamcore"
|
||||
#define HAMCORE_FILE_NAME "hamcore.se2"
|
||||
|
||||
+6
-2
@@ -1,6 +1,10 @@
|
||||
#include <GlobalConst.h>
|
||||
#include "HTTP.h"
|
||||
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Kernel.h"
|
||||
#include "Memory.h"
|
||||
#include "Network.h"
|
||||
#include "Pack.h"
|
||||
#include "Str.h"
|
||||
|
||||
static char http_404_str[] = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<HTML><HEAD>\r\n<TITLE>404 Not Found</TITLE>\r\n</HEAD><BODY>\r\n<H1>Not Found</H1>\r\nThe requested URL $TARGET$ was not found on this server.<P>\r\n<HR>\r\n<ADDRESS>HTTP Server at $HOST$ Port $PORT$</ADDRESS>\r\n</BODY></HTML>\r\n";
|
||||
static char http_403_str[] = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<HTML><HEAD>\r\n<TITLE>403 Forbidden</TITLE>\r\n</HEAD><BODY>\r\n<H1>Forbidden</H1>\r\nYou don't have permission to access $TARGET$\r\non this server.<P>\r\n<HR>\r\n<ADDRESS>HTTP Server at $HOST$ Port $PORT$</ADDRESS>\r\n</BODY></HTML>\r\n";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef HTTP_H
|
||||
#define HTTP_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
#define DEFAULT_USER_AGENT "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"
|
||||
#define DEFAULT_ACCEPT "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*"
|
||||
#define DEFAULT_ENCODING "gzip, deflate"
|
||||
|
||||
+13
-7
@@ -5,16 +5,22 @@
|
||||
// Internat.c
|
||||
// String conversion library for internationalization
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Internat.h"
|
||||
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Network.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
#include "Tracking.h"
|
||||
#include "Win32.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#ifdef OS_UNIX
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
extern LOCK *token_lock;
|
||||
static char charset[MAX_SIZE] = "EUCJP";
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#ifndef INTERNAT_H
|
||||
#define INTERNAT_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
// String token
|
||||
struct UNI_TOKEN_LIST
|
||||
{
|
||||
|
||||
+17
-6
@@ -5,16 +5,27 @@
|
||||
// Kernel.c
|
||||
// System service processing routine
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Kernel.h"
|
||||
|
||||
#include "Encrypt.h"
|
||||
#include "Internat.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
#include "Table.h"
|
||||
#include "Tracking.h"
|
||||
#include "Unix.h"
|
||||
#include "Win32.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#ifdef OS_UNIX
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef TM_YEAR_MAX
|
||||
#define TM_YEAR_MAX 2106
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Memory usage information
|
||||
struct MEMINFO
|
||||
{
|
||||
|
||||
+28
-50
@@ -9,27 +9,27 @@
|
||||
#define MAYATYPE_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Check whether the windows.h header is included
|
||||
#ifndef WINDOWS_H
|
||||
#ifdef _WINDOWS_
|
||||
#define WINDOWS_H
|
||||
#endif // _WINDOWS_
|
||||
#endif // WINDOWS_H
|
||||
#ifdef OS_WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#if !defined(ENCRYPT_C)
|
||||
// Structure which is used by OpenSSL
|
||||
typedef struct x509_st X509;
|
||||
typedef struct evp_pkey_st EVP_PKEY;
|
||||
typedef struct bio_st BIO;
|
||||
typedef struct ssl_st SSL;
|
||||
typedef struct ssl_ctx_st SSL_CTX;
|
||||
typedef struct X509_req_st X509_REQ;
|
||||
typedef struct PKCS12 PKCS12;
|
||||
typedef struct bignum_st BIGNUM;
|
||||
typedef struct x509_crl_st X509_CRL;
|
||||
#endif // ENCRYPT_C
|
||||
#ifndef NTDDI_VERSION
|
||||
#define NTDDI_VERSION NTDDI_VISTA
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT _WIN32_WINNT_VISTA
|
||||
#endif
|
||||
|
||||
#include <WinSock2.h>
|
||||
#include <ws2ipdef.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Constant
|
||||
@@ -44,7 +44,7 @@ typedef struct x509_crl_st X509_CRL;
|
||||
#define SUPPORTED_WINDOWS_LIST "Windows 98 / 98 SE / ME / NT 4.0 SP6a / 2000 SP4 / XP SP2, SP3 / Vista SP1, SP2 / 7 SP1 / 8 / 8.1 / 10 / Server 2003 SP2 / Server 2008 SP1, SP2 / Hyper-V Server 2008 / Server 2008 R2 SP1 / Hyper-V Server 2008 R2 / Server 2012 / Hyper-V Server 2012 / Server 2012 R2 / Hyper-V Server 2012 R2 / Server 2016 / Server 2019"
|
||||
|
||||
// Infinite
|
||||
#ifndef WINDOWS_H
|
||||
#ifndef INFINITE
|
||||
#define INFINITE (0xFFFFFFFF)
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct x509_crl_st X509_CRL;
|
||||
#define SRC_LINE __LINE__ // Line number in the source code
|
||||
|
||||
// Maximum path size
|
||||
#ifndef WINDOWS_H
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif // WINDOWS_H
|
||||
|
||||
@@ -159,51 +159,30 @@ typedef int (COMPARE)(void *p1, void *p2);
|
||||
#define WRITE_UINT(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT)(i))) & 0xFF)
|
||||
#define WRITE_UINT64(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT64)(i)) >> 56) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT64)(i)) >> 48) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT64)(i)) >> 40) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT64)(i)) >> 32) & 0xFF); (((UCHAR *)(buf))[4]) = ((((UINT64)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[5]) = ((((UINT64)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[6]) = ((((UINT64)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[7]) = ((((UINT64)(i))) & 0xFF)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Type declaration
|
||||
//
|
||||
typedef int64_t time_64t;
|
||||
|
||||
// PID type
|
||||
#ifdef OS_UNIX
|
||||
typedef int PID;
|
||||
#endif // OS_UNIX
|
||||
#ifdef OS_WIN32
|
||||
typedef unsigned long PID;
|
||||
#endif // WINDOWS_H
|
||||
|
||||
typedef int64_t time_64t;
|
||||
|
||||
#ifndef _BASETSD_H_
|
||||
typedef uint32_t PID;
|
||||
#else
|
||||
typedef int32_t INT;
|
||||
typedef int64_t INT64;
|
||||
|
||||
typedef uint32_t UINT;
|
||||
typedef uint64_t UINT64;
|
||||
#endif
|
||||
|
||||
#ifndef BASETYPES
|
||||
typedef uint8_t BYTE;
|
||||
typedef uint8_t UCHAR;
|
||||
typedef uint16_t USHORT;
|
||||
#endif
|
||||
|
||||
#ifdef OS_UNIX
|
||||
// Avoiding compile error
|
||||
typedef int SOCKET;
|
||||
typedef pid_t PID;
|
||||
|
||||
#define __cdecl
|
||||
#define __declspec(x)
|
||||
// socket type
|
||||
typedef int SOCKET;
|
||||
#else // OS_UNIX
|
||||
#ifndef _WINSOCK2API_
|
||||
#ifdef CPU_64
|
||||
typedef unsigned __int64 SOCKET;
|
||||
#else
|
||||
typedef unsigned int SOCKET;
|
||||
#endif // CPU_64
|
||||
#endif // _WINSOCK2API_
|
||||
#endif // OS_UNIX
|
||||
#endif
|
||||
|
||||
// OS type
|
||||
#define OSTYPE_WINDOWS_95 1100 // Windows 95
|
||||
@@ -272,7 +251,7 @@ typedef struct OS_INFO
|
||||
} OS_INFO;
|
||||
|
||||
// Time type
|
||||
#ifndef WINDOWS_H
|
||||
#ifndef OS_WIN32
|
||||
typedef struct SYSTEMTIME
|
||||
{
|
||||
USHORT wYear;
|
||||
@@ -286,7 +265,6 @@ typedef struct SYSTEMTIME
|
||||
} SYSTEMTIME;
|
||||
#endif // WINDOWS_H
|
||||
|
||||
|
||||
// Object.h
|
||||
typedef struct LOCK LOCK;
|
||||
typedef struct COUNTER COUNTER;
|
||||
|
||||
+17
-9
@@ -5,17 +5,25 @@
|
||||
// Mayaqua.c
|
||||
// Mayaqua Kernel program
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Mayaqua.h"
|
||||
|
||||
#include "Encrypt.h"
|
||||
#include "FileIO.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Network.h"
|
||||
#include "Object.h"
|
||||
#include "OS.h"
|
||||
#include "Secure.h"
|
||||
#include "Str.h"
|
||||
#include "Table.h"
|
||||
#include "Tick64.h"
|
||||
#include "Tracking.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Global variable
|
||||
bool g_memcheck; // Enable memory check
|
||||
|
||||
+6
-177
@@ -8,8 +8,8 @@
|
||||
#ifndef MAYAQUA_H
|
||||
#define MAYAQUA_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include "Kernel.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define PENCORE_DLL_NAME "|PenCore.dll"
|
||||
@@ -27,10 +27,9 @@
|
||||
|
||||
void InitProcessCallOnce();
|
||||
|
||||
#ifdef VPN_EXE
|
||||
#ifdef VPN_EXE
|
||||
// To build the executable file
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#ifdef OS_WIN32
|
||||
#include "../PenCore/resource.h"
|
||||
int main(int argc, char *argv[]);
|
||||
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
|
||||
@@ -48,13 +47,6 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
|
||||
|
||||
#define STRTABLE_ID "SE_VPN_20121007" // String table identifier
|
||||
|
||||
// Determining the OS
|
||||
#ifdef WIN32
|
||||
#define OS_WIN32 // Microsoft Windows
|
||||
#else
|
||||
#define OS_UNIX // UNIX
|
||||
#endif // WIN32
|
||||
|
||||
// Directory separator
|
||||
#ifdef OS_WIN32
|
||||
#define PATH_BACKSLASH // Backslash (\)
|
||||
@@ -121,172 +113,9 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
|
||||
#define WHEN
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef OS_UNIX
|
||||
#ifndef UNIX_SOLARIS
|
||||
#ifndef CPU_SH4
|
||||
#if !defined(__UCLIBC__) || defined(__UCLIBC_SUPPORT_AI_ADDRCONFIG__)
|
||||
// Getifaddrs system call is supported on UNIX other than Solaris.
|
||||
// However, it is not supported also by the Linux on SH4 CPU
|
||||
#define MAYAQUA_SUPPORTS_GETIFADDRS
|
||||
#endif // !UCLIBC || UCLIBC_SUPPORT_AI_ADDRCONFIG
|
||||
#endif // CPU_SH4
|
||||
#endif // UNIX_SOLARIS
|
||||
#endif // OS_UNIX
|
||||
|
||||
#ifdef OS_UNIX
|
||||
// Header only needed in UNIX OS
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <dirent.h>
|
||||
#ifdef UNIX_LINUX
|
||||
#include <sys/vfs.h>
|
||||
#elif UNIX_BSD
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#ifdef OS_UNIX
|
||||
#define closesocket(s) close(s)
|
||||
#endif
|
||||
#ifdef UNIX_SOLARIS
|
||||
#include <sys/statvfs.h>
|
||||
#define USE_STATVFS
|
||||
#endif // UNIX_SOLARIS
|
||||
#include <sys/stat.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef UNIX_SOLARIS
|
||||
#include <sys/filio.h>
|
||||
#endif // UNIX_SOLARIS
|
||||
#include <sys/resource.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#ifdef UNIX_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif // UNIX_LINUX
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
//#include <netinet/ip.h>
|
||||
#include <netdb.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
//#include <curses.h>
|
||||
#ifdef MAYAQUA_SUPPORTS_GETIFADDRS
|
||||
#include <ifaddrs.h>
|
||||
#endif // MAYAQUA_SUPPORTS_GETIFADDRS
|
||||
|
||||
#ifdef UNIX_LINUX
|
||||
typedef void *iconv_t;
|
||||
iconv_t iconv_open (__const char *__tocode, __const char *__fromcode);
|
||||
size_t iconv (iconv_t __cd, char **__restrict __inbuf,
|
||||
size_t *__restrict __inbytesleft,
|
||||
char **__restrict __outbuf,
|
||||
size_t *__restrict __outbytesleft);
|
||||
int iconv_close (iconv_t __cd);
|
||||
#else // UNIX_LINUX
|
||||
#include <iconv.h>
|
||||
#endif // UNIX_LINUX
|
||||
|
||||
|
||||
|
||||
#ifdef UNIX_LINUX
|
||||
#include <netinet/if_ether.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <netpacket/packet.h>
|
||||
#endif // UNIX_LINUX
|
||||
|
||||
#ifdef UNIX_SOLARIS
|
||||
#include <sys/dlpi.h>
|
||||
#include <sys/stropts.h>
|
||||
#include <sys/stream.h>
|
||||
#endif // UNIX_SOLARIS
|
||||
|
||||
#ifndef NO_VLAN
|
||||
|
||||
#include <Mayaqua/TunTap.h>
|
||||
|
||||
#endif // NO_VLAN
|
||||
|
||||
#define closesocket(s) close(s)
|
||||
|
||||
#else // Win32 only
|
||||
|
||||
#include <conio.h>
|
||||
|
||||
#endif // OS_UNIX
|
||||
|
||||
// IPv6 support flag
|
||||
#ifndef WIN32
|
||||
#ifndef AF_INET6
|
||||
#define NO_IPV6
|
||||
#endif // AF_INET6
|
||||
#endif // WIN32
|
||||
|
||||
// Basic type declaration
|
||||
#include <Mayaqua/MayaType.h>
|
||||
|
||||
// Object management
|
||||
#include <Mayaqua/Object.h>
|
||||
|
||||
// Object tracking
|
||||
#include <Mayaqua/Tracking.h>
|
||||
|
||||
// File I/O
|
||||
#include <Mayaqua/FileIO.h>
|
||||
|
||||
// Memory management
|
||||
#include <Mayaqua/Memory.h>
|
||||
|
||||
// String processing
|
||||
#include <Mayaqua/Str.h>
|
||||
|
||||
// Internationalized string processing
|
||||
#include <Mayaqua/Internat.h>
|
||||
|
||||
// Encryption processing
|
||||
#include <Mayaqua/Encrypt.h>
|
||||
|
||||
// Secure token
|
||||
#include <Mayaqua/Secure.h>
|
||||
|
||||
// Kernel
|
||||
#include <Mayaqua/Kernel.h>
|
||||
|
||||
// Package
|
||||
#include <Mayaqua/Pack.h>
|
||||
|
||||
// Configuration file
|
||||
#include <Mayaqua/Cfg.h>
|
||||
|
||||
// String table
|
||||
#include <Mayaqua/Table.h>
|
||||
|
||||
// Network communication
|
||||
#include <Mayaqua/Network.h>
|
||||
|
||||
// TCP/IP
|
||||
#include <Mayaqua/TcpIp.h>
|
||||
|
||||
// HTTP
|
||||
#include <Mayaqua/HTTP.h>
|
||||
|
||||
// Proxy
|
||||
#include <Mayaqua/Proxy.h>
|
||||
|
||||
// 64 bit real-time clock
|
||||
#include <Mayaqua/Tick64.h>
|
||||
|
||||
// OS-dependent code
|
||||
#include <Mayaqua/OS.h>
|
||||
|
||||
// Code for Microsoft Windows
|
||||
#include <Mayaqua/Microsoft.h>
|
||||
|
||||
|
||||
// Global variables
|
||||
extern bool g_memcheck;
|
||||
|
||||
+12
-7
@@ -5,17 +5,22 @@
|
||||
// Memory.c
|
||||
// Memory management program
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Memory.h"
|
||||
|
||||
#include "Encrypt.h"
|
||||
#include "FileIO.h"
|
||||
#include "Internat.h"
|
||||
#include "Kernel.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Object.h"
|
||||
#include "OS.h"
|
||||
#include "Str.h"
|
||||
#include "Tracking.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <zlib.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#define MEMORY_SLEEP_TIME 150
|
||||
#define MEMORY_MAX_RETRY 30
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef MEMORY_H
|
||||
#define MEMORY_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// MallocFast (not implemented)
|
||||
#define MallocFast Malloc
|
||||
#define ZeroMallocFast ZeroMalloc
|
||||
|
||||
+53
-100
@@ -6,80 +6,68 @@
|
||||
// For Microsoft Windows code
|
||||
// (not compiled on non-Windows environments)
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef OS_WIN32
|
||||
|
||||
#define MICROSOFT_C
|
||||
|
||||
typedef enum _PNP_VETO_TYPE {
|
||||
PNP_VetoTypeUnknown, // Name is unspecified
|
||||
PNP_VetoLegacyDevice, // Name is an Instance Path
|
||||
PNP_VetoPendingClose, // Name is an Instance Path
|
||||
PNP_VetoWindowsApp, // Name is a Module
|
||||
PNP_VetoWindowsService, // Name is a Service
|
||||
PNP_VetoOutstandingOpen, // Name is an Instance Path
|
||||
PNP_VetoDevice, // Name is an Instance Path
|
||||
PNP_VetoDriver, // Name is a Driver Service Name
|
||||
PNP_VetoIllegalDeviceRequest, // Name is an Instance Path
|
||||
PNP_VetoInsufficientPower, // Name is unspecified
|
||||
PNP_VetoNonDisableable, // Name is an Instance Path
|
||||
PNP_VetoLegacyDriver, // Name is a Service
|
||||
PNP_VetoInsufficientRights // Name is unspecified
|
||||
} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
|
||||
#include "Microsoft.h"
|
||||
|
||||
#define _WIN32_IE 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#define SECURITY_WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <Wintrust.h>
|
||||
#include <Softpub.h>
|
||||
#include <ws2ipdef.h>
|
||||
#include <Iphlpapi.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <wincon.h>
|
||||
#include <Nb30.h>
|
||||
#include <shlobj.h>
|
||||
#include <commctrl.h>
|
||||
#include <Dbghelp.h>
|
||||
#include <setupapi.h>
|
||||
#include <regstr.h>
|
||||
#include <process.h>
|
||||
#include <psapi.h>
|
||||
#include <wtsapi32.h>
|
||||
#include <Ntsecapi.h>
|
||||
#include <security.h>
|
||||
#include <Msi.h>
|
||||
#include <Msiquery.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "FileIO.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Memory.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
#include "Table.h"
|
||||
#include "Tick64.h"
|
||||
#include "Win32.h"
|
||||
|
||||
// TODO: Mayaqua should not depend on Cedar.
|
||||
#include <Cedar/Cedar.h>
|
||||
#include <Cedar/Client.h>
|
||||
#include <Cedar/CM.h>
|
||||
#include <Cedar/WinUi.h>
|
||||
|
||||
#define SECURITY_WIN32
|
||||
|
||||
// The struct is defined in Microsoft's <cfg.h>, but Mayaqua's one gets included instead.
|
||||
typedef enum _PNP_VETO_TYPE {
|
||||
PNP_VetoTypeUnknown, // Name is unspecified
|
||||
PNP_VetoLegacyDevice, // Name is an Instance Path
|
||||
PNP_VetoPendingClose, // Name is an Instance Path
|
||||
PNP_VetoWindowsApp, // Name is a Module
|
||||
PNP_VetoWindowsService, // Name is a Service
|
||||
PNP_VetoOutstandingOpen, // Name is an Instance Path
|
||||
PNP_VetoDevice, // Name is an Instance Path
|
||||
PNP_VetoDriver, // Name is a Driver Service Name
|
||||
PNP_VetoIllegalDeviceRequest, // Name is an Instance Path
|
||||
PNP_VetoInsufficientPower, // Name is unspecified
|
||||
PNP_VetoNonDisableable, // Name is an Instance Path
|
||||
PNP_VetoLegacyDriver, // Name is a Service
|
||||
PNP_VetoInsufficientRights, // Name is unspecified
|
||||
PNP_VetoAlreadyRemoved, // Name is unspecified
|
||||
} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
|
||||
|
||||
#include <AclAPI.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <sddl.h>
|
||||
#include <Aclapi.h>
|
||||
#include <DbgHelp.h>
|
||||
#include <dwmapi.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <mmsystem.h>
|
||||
#include <Msi.h>
|
||||
#include <nb30.h>
|
||||
#include <newdev.h>
|
||||
#include <NTSecAPI.h>
|
||||
#include <Psapi.h>
|
||||
#include <sddl.h>
|
||||
#include <security.h>
|
||||
#include <shellapi.h>
|
||||
#include <ShlObj.h>
|
||||
#include <SoftPub.h>
|
||||
#include <WtsApi32.h>
|
||||
|
||||
static MS *ms = NULL;
|
||||
|
||||
// Function prototype
|
||||
UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg);
|
||||
UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...);
|
||||
void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode);
|
||||
void CmTraffic(HWND hWnd);
|
||||
void CnStart();
|
||||
void InitCedar();
|
||||
void FreeCedar();
|
||||
void InitWinUi(wchar_t *software_name, char *font, UINT fontsize);
|
||||
void FreeWinUi();
|
||||
|
||||
// Global variable
|
||||
UINT64 ms_uint64_1 = 0;
|
||||
|
||||
@@ -120,41 +108,6 @@ static UINT (WINAPI *_MsiConfigureProductW)(LPCWSTR, int, INSTALLSTATE) = NULL;
|
||||
static INSTALLUILEVEL (WINAPI *_MsiSetInternalUI)(INSTALLUILEVEL, HWND *) = NULL;
|
||||
static INSTALLSTATE (WINAPI *_MsiLocateComponentW)(LPCWSTR, LPWSTR, LPDWORD) = NULL;
|
||||
|
||||
#define SE_GROUP_INTEGRITY (0x00000020L)
|
||||
|
||||
typedef enum _TOKEN_INFORMATION_CLASS_VISTA
|
||||
{
|
||||
VistaTokenUser = 1,
|
||||
VistaTokenGroups,
|
||||
VistaTokenPrivileges,
|
||||
VistaTokenOwner,
|
||||
VistaTokenPrimaryGroup,
|
||||
VistaTokenDefaultDacl,
|
||||
VistaTokenSource,
|
||||
VistaTokenType,
|
||||
VistaTokenImpersonationLevel,
|
||||
VistaTokenStatistics,
|
||||
VistaTokenRestrictedSids,
|
||||
VistaTokenSessionId,
|
||||
VistaTokenGroupsAndPrivileges,
|
||||
VistaTokenSessionReference,
|
||||
VistaTokenSandBoxInert,
|
||||
VistaTokenAuditPolicy,
|
||||
VistaTokenOrigin,
|
||||
VistaTokenElevationType,
|
||||
VistaTokenLinkedToken,
|
||||
VistaTokenElevation,
|
||||
VistaTokenHasRestrictions,
|
||||
VistaTokenAccessInformation,
|
||||
VistaTokenVirtualizationAllowed,
|
||||
VistaTokenVirtualizationEnabled,
|
||||
VistaTokenIntegrityLevel,
|
||||
VistaTokenUIAccess,
|
||||
VistaTokenMandatoryPolicy,
|
||||
VistaTokenLogonSid,
|
||||
VistaMaxTokenInfoClass
|
||||
} TOKEN_INFORMATION_CLASS_VISTA, *PTOKEN_INFORMATION_CLASS_VISTA;
|
||||
|
||||
typedef struct MS_MSCHAPV2_PARAMS
|
||||
{
|
||||
wchar_t Username[MAX_SIZE];
|
||||
@@ -1585,7 +1538,7 @@ HANDLE MsCreateUserToken()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (SetTokenInformation(hNewToken, VistaTokenIntegrityLevel, &til,
|
||||
if (SetTokenInformation(hNewToken, TokenIntegrityLevel, &til,
|
||||
sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(sid)) == false)
|
||||
{
|
||||
CloseHandle(hNewToken);
|
||||
|
||||
+9
-18
@@ -5,19 +5,13 @@
|
||||
// Microsoft.h
|
||||
// Header of Microsoft.c
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// Make available the types for Windows even if windows.h is not included
|
||||
#ifndef _WINDEF_
|
||||
|
||||
typedef void *HWND;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
#endif // _WINDEF_
|
||||
#ifdef OS_WIN32
|
||||
|
||||
#ifndef MICROSOFT_H
|
||||
#define MICROSOFT_H
|
||||
|
||||
#include "Network.h"
|
||||
|
||||
// Constant for Event log
|
||||
#define MS_EVENTLOG_TYPE_INFORMATION 0
|
||||
#define MS_EVENTLOG_TYPE_WARNING 1
|
||||
@@ -128,7 +122,7 @@ typedef unsigned long DWORD;
|
||||
|
||||
#define DRIVER_DEVICE_ID_TAG "NeoAdapter_%s"
|
||||
|
||||
#ifdef MICROSOFT_C
|
||||
#ifdef MICROSOFT_C
|
||||
// WCM related code on Windows 8
|
||||
typedef enum _MS_WCM_PROPERTY
|
||||
{
|
||||
@@ -767,7 +761,8 @@ void MsProcLeaveSuspend();
|
||||
UINT64 MsGetSuspendModeBeginTick();
|
||||
|
||||
// Inner functions
|
||||
#ifdef MICROSOFT_C
|
||||
#ifdef MICROSOFT_C
|
||||
#include <SetupAPI.h>
|
||||
|
||||
LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
HKEY MsGetRootKeyFromInt(UINT root);
|
||||
@@ -800,12 +795,8 @@ void MsFreeSid(SID *sid);
|
||||
BOOL CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam);
|
||||
LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
void MsSuspendHandlerThreadProc(THREAD *thread, void *param);
|
||||
#endif // MICROSOFT_C
|
||||
|
||||
#endif // MICROSOFT_H
|
||||
|
||||
|
||||
#endif // MICROSOFT_C
|
||||
|
||||
#endif // MICROSOFT_H
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
+44
-37
@@ -5,50 +5,57 @@
|
||||
// Network.c
|
||||
// Network communication module
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Network.h"
|
||||
|
||||
#define ENCRYPT_C
|
||||
#define NETWORK_C
|
||||
#include "Cfg.h"
|
||||
#include "FileIO.h"
|
||||
#include "HTTP.h"
|
||||
#include "Internat.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Object.h"
|
||||
#include "Pack.h"
|
||||
#include "Str.h"
|
||||
#include "TcpIp.h"
|
||||
#include "Tick64.h"
|
||||
#include "Unix.h"
|
||||
|
||||
#define __WINCRYPT_H__
|
||||
|
||||
#ifdef WIN32
|
||||
// Include windows.h for Socket API
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <Ws2tcpip.h>
|
||||
#include <Wspiapi.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <Iphlpapi.h>
|
||||
#include <ws2ipdef.h>
|
||||
#include <netioapi.h>
|
||||
#include <Icmpapi.h>
|
||||
#endif // WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs7.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/rc4.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#ifdef UNIX_MACOS
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#ifdef OS_UNIX
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef UNIX_MACOS
|
||||
#include <sys/event.h>
|
||||
#endif // UNIX_MACOS
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#ifdef UNIX_SOLARIS
|
||||
#define USE_STATVFS
|
||||
#include <sys/statvfs.h>'
|
||||
#else
|
||||
#define MAYAQUA_SUPPORTS_GETIFADDRS
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#include <iphlpapi.h>
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
#include <IcmpAPI.h>
|
||||
|
||||
struct ROUTE_CHANGE_DATA
|
||||
{
|
||||
OVERLAPPED Overlapped;
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#include "Encrypt.h"
|
||||
#include "Mayaqua.h"
|
||||
|
||||
#ifdef OS_UNIX
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
// Dynamic Value
|
||||
struct DYN_VALUE
|
||||
{
|
||||
|
||||
+2
-12
@@ -5,19 +5,9 @@
|
||||
// OS.c
|
||||
// Operating system dependent code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "OS.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#undef Lock
|
||||
#undef Unlock
|
||||
#undef Yield
|
||||
|
||||
// Dispatch table
|
||||
static OS_DISPATCH_TABLE *os = NULL;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef OS_H
|
||||
#define OS_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Function prototype
|
||||
char *OsTypeToStr(UINT type);
|
||||
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
// Object.c
|
||||
// Object management code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Object.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Kernel.h"
|
||||
#include "OS.h"
|
||||
#include "Str.h"
|
||||
#include "Tick64.h"
|
||||
#include "Tracking.h"
|
||||
|
||||
// Thread to try to lock
|
||||
void CheckDeadLockThread(THREAD *t, void *param)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef OBJECT_H
|
||||
#define OBJECT_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Constants
|
||||
#define OBJECT_ALLOC_FAIL_SLEEP_TIME 150
|
||||
|
||||
+7
-9
@@ -5,16 +5,14 @@
|
||||
// Pack.c
|
||||
// Data package code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Pack.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Encrypt.h"
|
||||
#include "Internat.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Network.h"
|
||||
#include "Str.h"
|
||||
|
||||
// Get a list of the element names in the PACK
|
||||
TOKEN_LIST *GetPackElementNames(PACK *p)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef PACK_H
|
||||
#define PACK_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Constant
|
||||
#ifdef CPU_64
|
||||
|
||||
|
||||
+6
-2
@@ -1,6 +1,10 @@
|
||||
#include <GlobalConst.h>
|
||||
#include "Proxy.h"
|
||||
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
// TODO: Mayaqua should not depend on Cedar.
|
||||
#include "Cedar/WinUi.h"
|
||||
|
||||
#include "Memory.h"
|
||||
#include "Str.h"
|
||||
|
||||
SOCK *Internal_ProxyTcpConnect(PROXY_PARAM_IN *param, volatile bool *cancel_flag, IP *resolved_ip)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PROXY_H
|
||||
#define PROXY_H
|
||||
|
||||
#include "HTTP.h"
|
||||
#include "Network.h"
|
||||
|
||||
#define PROXY_CONNECTION_TIMEOUT (4 * 1000)
|
||||
|
||||
#define PROXY_MAX_USERNAME_LEN 255
|
||||
|
||||
+48
-28
@@ -5,45 +5,65 @@
|
||||
// Secure.c
|
||||
// Security token management module
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Secure.h"
|
||||
|
||||
#define SECURE_C
|
||||
#define ENCRYPT_C
|
||||
#include "Encrypt.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Kernel.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs7.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/rc4.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <Mayaqua/cryptoki.h>
|
||||
|
||||
#include <cryptoki.h>
|
||||
|
||||
#define MAX_OBJ 1024 // Maximum number of objects in the hardware (assumed)
|
||||
|
||||
#define A_SIZE(a, i) (a[(i)].ulValueLen)
|
||||
#define A_SET(a, i, value, size) (a[i].pValue = value;a[i].ulValueLen = size;)
|
||||
|
||||
// Internal data structure
|
||||
// The list of supported secure devices
|
||||
static LIST *SecureDeviceList = NULL;
|
||||
|
||||
// Supported hardware list
|
||||
const SECURE_DEVICE SupportedList[] =
|
||||
{
|
||||
{1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"},
|
||||
{2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"},
|
||||
{3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"},
|
||||
{4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"},
|
||||
{5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"},
|
||||
{6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"},
|
||||
{7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"},
|
||||
{8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"},
|
||||
{9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"},
|
||||
{10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"},
|
||||
{11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"},
|
||||
{12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"},
|
||||
{13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"},
|
||||
{14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"},
|
||||
{15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"},
|
||||
{16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"},
|
||||
{17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"},
|
||||
{18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"},
|
||||
{19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"},
|
||||
{20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"},
|
||||
{21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"},
|
||||
{22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"},
|
||||
{23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"},
|
||||
};
|
||||
|
||||
#ifdef OS_WIN32
|
||||
// Code for Win32
|
||||
// Win32 internal data
|
||||
typedef struct SEC_DATA_WIN32
|
||||
{
|
||||
HINSTANCE hInst;
|
||||
} SEC_DATA_WIN32;
|
||||
|
||||
// DLL reading for Win32
|
||||
HINSTANCE Win32SecureLoadLibraryEx(char *dllname, DWORD flags)
|
||||
|
||||
+2
-54
@@ -8,17 +8,11 @@
|
||||
#ifndef SECURE_H
|
||||
#define SECURE_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Constant
|
||||
#define MAX_SEC_DATA_SIZE 4096
|
||||
|
||||
// Type declaration related to PKCS#11
|
||||
#ifndef SECURE_C
|
||||
typedef struct CK_FUNCTION_LIST *CK_FUNCTION_LIST_PTR;
|
||||
typedef struct SEC_DATA_WIN32 SEC_DATA_WIN32;
|
||||
typedef struct CK_TOKEN_INFO CK_TOKEN_INFO;
|
||||
typedef struct CK_DATE CK_DATE;
|
||||
#endif // SECURE_C
|
||||
|
||||
// Secure device
|
||||
struct SECURE_DEVICE
|
||||
{
|
||||
@@ -171,50 +165,4 @@ void Win32FreeSecModule(SECURE *sec);
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
|
||||
#ifdef SECURE_C
|
||||
// Internal data structure
|
||||
// The list of supported secure devices
|
||||
static LIST *SecureDeviceList = NULL;
|
||||
|
||||
// Supported hardware list
|
||||
SECURE_DEVICE SupportedList[] =
|
||||
{
|
||||
{1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"},
|
||||
{2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"},
|
||||
{3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"},
|
||||
{4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"},
|
||||
{5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"},
|
||||
{6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"},
|
||||
{7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"},
|
||||
{8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"},
|
||||
{9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"},
|
||||
{10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"},
|
||||
{11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"},
|
||||
{12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"},
|
||||
{13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"},
|
||||
{14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"},
|
||||
{15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"},
|
||||
{16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"},
|
||||
{17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"},
|
||||
{18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"},
|
||||
{19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"},
|
||||
{20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"},
|
||||
{21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"},
|
||||
{22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"},
|
||||
{23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"},
|
||||
};
|
||||
|
||||
#ifdef OS_WIN32
|
||||
|
||||
// Win32 internal data
|
||||
typedef struct SEC_DATA_WIN32
|
||||
{
|
||||
HINSTANCE hInst;
|
||||
} SEC_DATA_WIN32;
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
#endif // SECURE_C
|
||||
|
||||
#endif // SECURE_H
|
||||
|
||||
+9
-7
@@ -5,17 +5,19 @@
|
||||
// Str.c
|
||||
// String processing routine
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Str.h"
|
||||
|
||||
#include "Cfg.h"
|
||||
#include "Internat.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Object.h"
|
||||
#include "Tracking.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
// Locking for call the token handling function
|
||||
LOCK *token_lock = NULL;
|
||||
|
||||
+4
-1
@@ -8,6 +8,10 @@
|
||||
#ifndef STR_H
|
||||
#define STR_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
// String token
|
||||
struct TOKEN_LIST
|
||||
{
|
||||
@@ -201,7 +205,6 @@ enum JSON_TYPES {
|
||||
JSON_TYPE_ARRAY = 5,
|
||||
JSON_TYPE_BOOL = 6
|
||||
};
|
||||
typedef unsigned int UINT;
|
||||
|
||||
enum JSON_RETS {
|
||||
JSON_RET_OK = 0,
|
||||
|
||||
+11
-8
@@ -5,16 +5,19 @@
|
||||
// Table.c
|
||||
// Read and management routines for string table
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Table.h"
|
||||
|
||||
#include "Cfg.h"
|
||||
#include "FileIO.h"
|
||||
#include "Internat.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Network.h"
|
||||
#include "Str.h"
|
||||
#include "Tick64.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
// List of TABLE
|
||||
static LIST *TableList = NULL;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef TABLE_H
|
||||
#define TABLE_H
|
||||
|
||||
#include "Encrypt.h"
|
||||
|
||||
#define UNICODE_CACHE_FILE L".unicode_cache_%s.dat"
|
||||
|
||||
#define LANGLIST_FILENAME "|languages.txt"
|
||||
|
||||
+5
-10
@@ -5,16 +5,11 @@
|
||||
// TcpIp.c
|
||||
// Utility module for TCP/IP packet processing
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "TcpIp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Cfg.h"
|
||||
#include "Memory.h"
|
||||
#include "Str.h"
|
||||
|
||||
// Release the memory for the ICMP response
|
||||
void IcmpFreeResult(ICMP_RESULT *r)
|
||||
@@ -2027,7 +2022,7 @@ bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_ex
|
||||
b2 = false;
|
||||
}
|
||||
}
|
||||
if (b1 || b2 || (memcmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0))
|
||||
if (b1 || b2 || (Cmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0))
|
||||
{
|
||||
p->InvalidSourcePacket = true;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#ifndef TCPIP_H
|
||||
#define TCPIP_H
|
||||
|
||||
#include "Mayaqua.h"
|
||||
#include "Network.h"
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#pragma pack(push, 1)
|
||||
#endif // OS_WIN32
|
||||
|
||||
+8
-14
@@ -5,21 +5,15 @@
|
||||
// Tick64.c
|
||||
// 64-bit real-time clock program
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Tick64.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Kernel.h"
|
||||
#include "Memory.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
#include "Unix.h"
|
||||
#include "Win32.h"
|
||||
|
||||
static TICK64 *tk64 = NULL;
|
||||
static EVENT *halt_tick_event = NULL;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef TICK64_H
|
||||
#define TICK64_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// Maximum number of correction list entries
|
||||
#define MAX_ADJUST_TIME 1024
|
||||
|
||||
|
||||
@@ -5,16 +5,12 @@
|
||||
// Tracking.c
|
||||
// Object tracking module
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#include "Tracking.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "OS.h"
|
||||
#include "Str.h"
|
||||
|
||||
// Global variables
|
||||
static LOCK *obj_lock;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef TRACKING_H
|
||||
#define TRACKING_H
|
||||
|
||||
#include "MayaType.h"
|
||||
|
||||
// The number of array
|
||||
#define TRACKING_NUM_ARRAY 1048576
|
||||
|
||||
|
||||
+34
-7
@@ -5,19 +5,46 @@
|
||||
// Unix.c
|
||||
// UNIX dependent code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#ifdef OS_UNIX
|
||||
|
||||
#ifdef UNIX
|
||||
#include "Unix.h"
|
||||
|
||||
#include "Cfg.h"
|
||||
#include "FileIO.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Kernel.h"
|
||||
#include "Mayaqua.h"
|
||||
#include "Memory.h"
|
||||
#include "Network.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
#include "Table.h"
|
||||
#include "Tick64.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef UNIX_LINUX
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef UNIX_MACOS
|
||||
#ifdef NO_VLAN
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#ifndef UNIX_H
|
||||
#define UNIX_H
|
||||
|
||||
#include "OS.h"
|
||||
|
||||
// Constants
|
||||
#define UNIX_THREAD_STACK_SIZE (200 * 1000) // Stack size
|
||||
#define UNIX_MAX_CHILD_PROCESSES 2000000 // Maximum number of child processes
|
||||
|
||||
+16
-16
@@ -5,25 +5,25 @@
|
||||
// Win32.c
|
||||
// Microsoft Windows dependent code
|
||||
|
||||
#include <GlobalConst.h>
|
||||
#ifdef OS_WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
#include "Win32.h"
|
||||
|
||||
#include "FileIO.h"
|
||||
#include "GlobalConst.h"
|
||||
#include "Internat.h"
|
||||
#include "Microsoft.h"
|
||||
#include "Memory.h"
|
||||
#include "Object.h"
|
||||
#include "Str.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WINVER 0x0600
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <Dbghelp.h>
|
||||
#include <commctrl.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
|
||||
#include <CommCtrl.h>
|
||||
#include <objbase.h>
|
||||
#include <process.h>
|
||||
#include <timeapi.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
static HANDLE heap_handle = NULL;
|
||||
static HANDLE hstdout = INVALID_HANDLE_VALUE;
|
||||
|
||||
+3
-1
@@ -5,11 +5,13 @@
|
||||
// Win32.h
|
||||
// Header of Win32.c
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#ifdef OS_WIN32
|
||||
|
||||
#ifndef WIN32_H
|
||||
#define WIN32_H
|
||||
|
||||
#include "OS.h"
|
||||
|
||||
// Function prototype
|
||||
OS_DISPATCH_TABLE *Win32GetDispatchTable();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user