1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge PR #1195: Define our types to the standard ones from <stdint.h>, remove unnecessary duplicate ones

This commit is contained in:
Davide Beatrici 2020-08-16 00:03:34 +02:00 committed by GitHub
commit 6a7883b5fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 133 additions and 150 deletions

View File

@ -2693,7 +2693,7 @@ BLOCK *NewBlock(void *data, UINT size, int compress)
if (compress == 0) if (compress == 0)
{ {
// Uncompressed // Uncompressed
b->Compressed = FALSE; b->Compressed = false;
b->Buf = data; b->Buf = data;
b->Size = size; b->Size = size;
b->SizeofData = size; b->SizeofData = size;
@ -2703,7 +2703,7 @@ BLOCK *NewBlock(void *data, UINT size, int compress)
UINT max_size; UINT max_size;
// Compressed // Compressed
b->Compressed = TRUE; b->Compressed = true;
max_size = CalcCompress(size); max_size = CalcCompress(size);
b->Buf = MallocFast(max_size); b->Buf = MallocFast(max_size);
b->Size = Compress(b->Buf, max_size, data, size); b->Size = Compress(b->Buf, max_size, data, size);
@ -2717,7 +2717,7 @@ BLOCK *NewBlock(void *data, UINT size, int compress)
// Expand // Expand
UINT max_size; UINT max_size;
b->Compressed = FALSE; b->Compressed = false;
max_size = MAX_PACKET_SIZE; max_size = MAX_PACKET_SIZE;
b->Buf = MallocFast(max_size); b->Buf = MallocFast(max_size);
b->Size = Uncompress(b->Buf, max_size, data, size); b->Size = Uncompress(b->Buf, max_size, data, size);

View File

@ -2520,7 +2520,7 @@ void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
} }
else else
{ {
CHAR tmp[MAX_SIZE]; char tmp[MAX_SIZE];
IPToStr6(tmp, MAX_SIZE, &srcIp); IPToStr6(tmp, MAX_SIZE, &srcIp);
Debug("We couldn't find a router for the source address of %s! Trying as local.\n", tmp); Debug("We couldn't find a router for the source address of %s! Trying as local.\n", tmp);
isLocal = true; isLocal = true;
@ -2569,7 +2569,7 @@ void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
UCHAR destMacAddress[6]; UCHAR destMacAddress[6];
IPV6_ADDR solicitAddress; IPV6_ADDR solicitAddress;
CHAR tmp[MAX_SIZE]; char tmp[MAX_SIZE];
UCHAR *copy; UCHAR *copy;
BLOCK *blk; BLOCK *blk;
@ -2605,7 +2605,7 @@ void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
} }
else else
{ {
CHAR tmp[MAX_SIZE]; char tmp[MAX_SIZE];
IPToStr6(tmp, MAX_SIZE, next_ip); IPToStr6(tmp, MAX_SIZE, next_ip);
Debug("We couldn't deduce the MAC address for unicast address %s, packet dropped.\n", tmp); Debug("We couldn't deduce the MAC address for unicast address %s, packet dropped.\n", tmp);
/// TODO: think about sending to the all routers broadcast MAC as a last resort /// TODO: think about sending to the all routers broadcast MAC as a last resort

View File

@ -1780,7 +1780,7 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
Insert(t->RecvQueue, q); Insert(t->RecvQueue, q);
// Read to the end of completed part from the head of the queue // Read to the end of completed part from the head of the queue
while (TRUE) while (true)
{ {
L2TP_QUEUE *q; L2TP_QUEUE *q;
if (LIST_NUM(t->RecvQueue) == 0) if (LIST_NUM(t->RecvQueue) == 0)

View File

@ -3491,7 +3491,7 @@ PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UC
UINT tls_datasize = datasize + sizeof(UCHAR); UINT tls_datasize = datasize + sizeof(UCHAR);
if (flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) if (flags & PPP_EAP_TLS_FLAG_TLS_LENGTH)
{ {
tls_datasize += sizeof(UINT32); tls_datasize += sizeof(UINT);
} }
lcp_packet = BuildEAPPacketEx(code, id, type, tls_datasize); lcp_packet = BuildEAPPacketEx(code, id, type, tls_datasize);
eap_packet = lcp_packet->Data; eap_packet = lcp_packet->Data;

View File

@ -202,7 +202,7 @@ struct PPP_EAP
UCHAR TlsDataWithoutLength[0]; UCHAR TlsDataWithoutLength[0];
struct struct
{ {
UINT32 TlsLength; UINT TlsLength;
UCHAR Data[0]; UCHAR Data[0];
} TlsDataWithLength; } TlsDataWithLength;
}; };

View File

@ -1972,10 +1972,10 @@ RECV_RETRY:
if (recv_size == 0) if (recv_size == 0)
{ {
Debug("Radius recv_size 0\n"); Debug("Radius recv_size 0\n");
finish[pos] = TRUE; finish[pos] = true;
for(i = 0; i < LIST_NUM(ip_list); i++) for (i = 0; i < LIST_NUM(ip_list); ++i)
{ {
if(finish[i] == FALSE) if (finish[i] == false)
{ {
// Switch the host to refer // Switch the host to refer
pos++; pos++;

View File

@ -19,15 +19,19 @@
// Make available the types for Windows even if windows.h is not included // Make available the types for Windows even if windows.h is not included
#ifndef _WINDEF_ #ifndef _WINDEF_
typedef void *HWND; typedef void *HWND;
typedef void *HFONT; typedef void *HFONT;
typedef void *HICON; typedef void *HICON;
typedef void *HMENU; typedef void *HMENU;
typedef UINT_PTR WPARAM;
typedef LONG_PTR LPARAM;
typedef void *HINSTANCE; typedef void *HINSTANCE;
#ifdef CPU_64
typedef unsigned __int64 *WPARAM;
typedef __int64 *LPARAM;
#else
typedef unsigned int *WPARAM;
typedef long *LPARAM;
#endif // CPU_64
#endif // _WINDEF_ #endif // _WINDEF_

View File

@ -220,7 +220,7 @@ UINT64 TickGetRealtimeTickValue64()
} }
else else
{ {
ret = (UINT64)((UINT64)((UINT32)tv.tv_sec)) * 1000ULL + (UINT64)tv.tv_usec / 1000ULL; ret = (UINT64)((UINT64)((UINT)tv.tv_sec)) * 1000ULL + (UINT64)tv.tv_usec / 1000ULL;
} }
return ret; return ret;
@ -1903,7 +1903,7 @@ void UINT64ToSystem(SYSTEMTIME *st, UINT64 sec64)
sec = (UINT)tmp64; sec = (UINT)tmp64;
time = (time_64t)sec; time = (time_64t)sec;
TimeToSystem(st, time); TimeToSystem(st, time);
st->wMilliseconds = (WORD)millisec; st->wMilliseconds = (USHORT)millisec;
} }
// Convert the SYSTEMTIME to UINT64 // Convert the SYSTEMTIME to UINT64

View File

@ -8,6 +8,8 @@
#ifndef MAYATYPE_H #ifndef MAYATYPE_H
#define MAYATYPE_H #define MAYATYPE_H
#include <stdint.h>
// Check whether the windows.h header is included // Check whether the windows.h header is included
#ifndef WINDOWS_H #ifndef WINDOWS_H
#ifdef _WINDOWS_ #ifdef _WINDOWS_
@ -15,7 +17,6 @@
#endif // _WINDOWS_ #endif // _WINDOWS_
#endif // WINDOWS_H #endif // WINDOWS_H
#if !defined(ENCRYPT_C) #if !defined(ENCRYPT_C)
// Structure which is used by OpenSSL // Structure which is used by OpenSSL
typedef struct x509_st X509; typedef struct x509_st X509;
@ -171,52 +172,28 @@ typedef int PID;
typedef unsigned long PID; typedef unsigned long PID;
#endif // WINDOWS_H #endif // WINDOWS_H
// bool type // TODO: include <stdbool.h> instead of manually defining type
#ifndef WINDOWS_H
typedef unsigned int BOOL;
#define TRUE 1
#define FALSE 0
#endif // WINDOWS_H
// bool type
#ifndef WIN32COM_CPP #ifndef WIN32COM_CPP
typedef unsigned int bool; typedef unsigned int bool;
#define true 1 #define true 1
#define false 0 #define false 0
#endif // WIN32COM_CPP #endif // WIN32COM_CPP
// 32bit integer type typedef int64_t time_64t;
#ifndef WINDOWS_H
typedef unsigned int UINT;
typedef unsigned int UINT32;
typedef unsigned int DWORD;
typedef signed int INT;
typedef signed int INT32;
typedef int UINT_PTR; #ifndef _BASETSD_H_
typedef long LONG_PTR; typedef int32_t INT;
typedef int64_t INT64;
typedef uint32_t UINT;
typedef uint64_t UINT64;
#endif #endif
// 16bit integer type #ifndef BASETYPES
typedef unsigned short WORD; typedef uint8_t BYTE;
typedef unsigned short USHORT; typedef uint8_t UCHAR;
typedef signed short SHORT; typedef uint16_t USHORT;
#endif
// 8bit integer type
typedef unsigned char BYTE;
typedef unsigned char UCHAR;
#ifndef WIN32COM_CPP
typedef signed char CHAR;
#endif // WIN32COM_CPP
// 64-bit integer type
typedef unsigned long long UINT64;
typedef signed long long INT64;
typedef signed long long time_64t;
#ifdef OS_UNIX #ifdef OS_UNIX
// Avoiding compile error // Avoiding compile error
@ -226,7 +203,11 @@ typedef signed long long time_64t;
typedef int SOCKET; typedef int SOCKET;
#else // OS_UNIX #else // OS_UNIX
#ifndef _WINSOCK2API_ #ifndef _WINSOCK2API_
typedef UINT_PTR SOCKET; #ifdef CPU_64
typedef unsigned __int64 SOCKET;
#else
typedef unsigned int SOCKET;
#endif // CPU_64
#endif // _WINSOCK2API_ #endif // _WINSOCK2API_
#endif // OS_UNIX #endif // OS_UNIX
@ -302,14 +283,14 @@ typedef struct OS_INFO
#ifndef WINDOWS_H #ifndef WINDOWS_H
typedef struct SYSTEMTIME typedef struct SYSTEMTIME
{ {
WORD wYear; USHORT wYear;
WORD wMonth; USHORT wMonth;
WORD wDayOfWeek; USHORT wDayOfWeek;
WORD wDay; USHORT wDay;
WORD wHour; USHORT wHour;
WORD wMinute; USHORT wMinute;
WORD wSecond; USHORT wSecond;
WORD wMilliseconds; USHORT wMilliseconds;
} SYSTEMTIME; } SYSTEMTIME;
#endif // WINDOWS_H #endif // WINDOWS_H

View File

@ -23,7 +23,7 @@ bool g_debug; // Debug mode
UINT64 kernel_status[NUM_KERNEL_STATUS]; // Kernel state UINT64 kernel_status[NUM_KERNEL_STATUS]; // Kernel state
UINT64 kernel_status_max[NUM_KERNEL_STATUS]; // Kernel state (maximum value) UINT64 kernel_status_max[NUM_KERNEL_STATUS]; // Kernel state (maximum value)
LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; // Kernel state lock LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; // Kernel state lock
BOOL kernel_status_inited = false; // Kernel state initialization flag bool kernel_status_inited = false; // Kernel state initialization flag
bool g_little_endian = true; bool g_little_endian = true;
char *cmdline = NULL; // Command line char *cmdline = NULL; // Command line
wchar_t *uni_cmdline = NULL; // Unicode command line wchar_t *uni_cmdline = NULL; // Unicode command line

View File

@ -302,7 +302,7 @@ extern bool g_foreground;
extern UINT64 kernel_status[NUM_KERNEL_STATUS]; extern UINT64 kernel_status[NUM_KERNEL_STATUS];
extern UINT64 kernel_status_max[NUM_KERNEL_STATUS]; extern UINT64 kernel_status_max[NUM_KERNEL_STATUS];
extern LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; extern LOCK *kernel_status_lock[NUM_KERNEL_STATUS];
extern BOOL kernel_status_inited; extern bool kernel_status_inited;
// Kernel state operation macro // Kernel state operation macro
#define KS_LOCK(id) LockKernelStatus(id) #define KS_LOCK(id) LockKernelStatus(id)

View File

@ -3438,7 +3438,7 @@ int B64_Encode(char *set, char *source, int len)
{ {
return 0; return 0;
} }
while (TRUE) while (true)
{ {
if (i >= len) if (i >= len)
{ {
@ -3491,7 +3491,7 @@ int B64_Decode(char *set, char *source, int len)
src = source; src = source;
i = 0; i = 0;
j = 0; j = 0;
while (TRUE) while (true)
{ {
f1 = f2 = f3 = f4 = 0; f1 = f2 = f3 = f4 = 0;
if (i >= len) if (i >= len)

View File

@ -4427,7 +4427,7 @@ bool MsServiceStopProc()
} }
// Service handler // Service handler
void CALLBACK MsServiceHandler(DWORD opcode) void CALLBACK MsServiceHandler(UINT opcode)
{ {
switch (opcode) switch (opcode)
{ {
@ -4451,7 +4451,7 @@ void CALLBACK MsServiceHandler(DWORD opcode)
} }
// Dispatch function of the service // Dispatch function of the service
void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv) void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv)
{ {
// Creating a stopping event // Creating a stopping event
service_stop_event = CreateEventA(NULL, true, false, NULL); service_stop_event = CreateEventA(NULL, true, false, NULL);
@ -10513,7 +10513,7 @@ bool MsIsAeroEnabled()
} }
// Generate an access mask to force accessing to the 32 bit registry key for 64 bit application // Generate an access mask to force accessing to the 32 bit registry key for 64 bit application
DWORD MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit) UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit)
{ {
if (MsIs64BitWindows() == false) if (MsIs64BitWindows() == false)
{ {

View File

@ -158,29 +158,29 @@ typedef struct NETWORK_WIN32_FUNCTIONS
{ {
HINSTANCE hIpHlpApi32; HINSTANCE hIpHlpApi32;
HINSTANCE hIcmp; HINSTANCE hIcmp;
DWORD (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW); UINT (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW);
DWORD (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW); UINT (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW);
DWORD (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL); UINT (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL);
DWORD (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG); UINT (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG);
ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG); ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
DWORD (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL); UINT (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL);
DWORD (WINAPI *GetIfTable2)(void **); UINT (WINAPI *GetIfTable2)(void **);
void (WINAPI *FreeMibTable)(PVOID); void (WINAPI *FreeMibTable)(PVOID);
DWORD (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP); UINT (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP);
DWORD (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP); UINT (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP);
DWORD (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG); UINT (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG);
DWORD (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG); UINT (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG);
DWORD (WINAPI *GetExtendedTcpTable)(PVOID, PDWORD, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG); UINT (WINAPI *GetExtendedTcpTable)(PVOID, PUINT, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG);
DWORD (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, DWORD, DWORD); UINT (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, UINT, UINT);
DWORD (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PDWORD, BOOL); UINT (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PUINT, BOOL);
DWORD (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED); UINT (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED);
BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED); BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED);
DWORD (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **, UINT (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **,
PDWORD, BOOL, HANDLE, DWORD); PUINT, BOOL, HANDLE, UINT);
HANDLE (WINAPI *IcmpCreateFile)(); HANDLE (WINAPI *IcmpCreateFile)();
BOOL (WINAPI *IcmpCloseHandle)(HANDLE); BOOL (WINAPI *IcmpCloseHandle)(HANDLE);
DWORD (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, UINT (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION,
LPVOID, DWORD, DWORD); LPVOID, UINT, UINT);
} NETWORK_WIN32_FUNCTIONS; } NETWORK_WIN32_FUNCTIONS;
#endif #endif
@ -222,7 +222,7 @@ typedef struct _MS_WCM_PROFILE_INFO {
} MS_WCM_PROFILE_INFO, *MS_PWCM_PROFILE_INFO; } MS_WCM_PROFILE_INFO, *MS_PWCM_PROFILE_INFO;
typedef struct _MS_WCM_PROFILE_INFO_LIST { typedef struct _MS_WCM_PROFILE_INFO_LIST {
DWORD dwNumberOfItems; UINT dwNumberOfItems;
MS_WCM_PROFILE_INFO ProfileInfo[1]; MS_WCM_PROFILE_INFO ProfileInfo[1];
@ -310,68 +310,68 @@ typedef struct NT_API
HINSTANCE hDbgHelp; HINSTANCE hDbgHelp;
HINSTANCE hWcmapi; HINSTANCE hWcmapi;
HINSTANCE hDwmapi; HINSTANCE hDwmapi;
BOOL (WINAPI *OpenProcessToken)(HANDLE, DWORD, PHANDLE); BOOL (WINAPI *OpenProcessToken)(HANDLE, UINT, PHANDLE);
BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID); BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID);
BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD); BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, UINT, PTOKEN_PRIVILEGES, PUINT);
BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, DWORD, BOOL, BOOL); BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, UINT, BOOL, BOOL);
BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, DWORD, DWORD, HANDLE *); BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, UINT, UINT, HANDLE *);
BOOL (WINAPI *LogonUserA)(char *, char *, char *, DWORD, DWORD, HANDLE *); BOOL (WINAPI *LogonUserA)(char *, char *, char *, UINT, UINT, HANDLE *);
BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, wchar_t *hardware_id, wchar_t *inf_path, UINT flag, BOOL *need_reboot); BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, wchar_t *hardware_id, wchar_t *inf_path, UINT flag, BOOL *need_reboot);
UINT (WINAPI *CM_Get_DevNode_Status_Ex)(UINT *, UINT *, DWORD, UINT, HANDLE); UINT (WINAPI *CM_Get_DevNode_Status_Ex)(UINT *, UINT *, UINT, UINT, HANDLE);
UINT (WINAPI *CM_Get_Device_ID_ExA)(DWORD, char *, UINT, UINT, HANDLE); UINT (WINAPI *CM_Get_Device_ID_ExA)(UINT, char *, UINT, UINT, HANDLE);
UINT (WINAPI *WTSQuerySessionInformation)(HANDLE, DWORD, WTS_INFO_CLASS, wchar_t *, DWORD *); UINT (WINAPI *WTSQuerySessionInformation)(HANDLE, UINT, WTS_INFO_CLASS, wchar_t *, UINT *);
void (WINAPI *WTSFreeMemory)(void *); void (WINAPI *WTSFreeMemory)(void *);
BOOL (WINAPI *WTSDisconnectSession)(HANDLE, DWORD, BOOL); BOOL (WINAPI *WTSDisconnectSession)(HANDLE, UINT, BOOL);
BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, DWORD, DWORD, PWTS_SESSION_INFO *, DWORD *); BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, UINT, UINT, PWTS_SESSION_INFO *, UINT *);
BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, DWORD); BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, UINT);
BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND); BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND);
SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, DWORD); SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, UINT);
SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD, DWORD, LPCTSTR, LPCTSTR, LPDWORD, LPCTSTR, LPCTSTR, LPCTSTR); SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, UINT, UINT, UINT, UINT, LPCTSTR, LPCTSTR, LPUINT, LPCTSTR, LPCTSTR, LPCTSTR);
SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, DWORD, DWORD, DWORD, DWORD, LPCWSTR, LPCWSTR, LPDWORD, LPCWSTR, LPCWSTR, LPCWSTR); SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, UINT, UINT, UINT, UINT, LPCWSTR, LPCWSTR, LPUINT, LPCWSTR, LPCWSTR, LPCWSTR);
BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, DWORD, LPVOID); BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, UINT, LPVOID);
BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE); BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE);
SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, DWORD); SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, UINT);
BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS); BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS);
BOOL (WINAPI *StartService)(SC_HANDLE, DWORD, LPCTSTR); BOOL (WINAPI *StartService)(SC_HANDLE, UINT, LPCTSTR);
BOOL (WINAPI *ControlService)(SC_HANDLE, DWORD, LPSERVICE_STATUS); BOOL (WINAPI *ControlService)(SC_HANDLE, UINT, LPSERVICE_STATUS);
BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS); BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS);
SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION); SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION);
BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY); BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY);
BOOL (WINAPI *DeleteService)(SC_HANDLE); BOOL (WINAPI *DeleteService)(SC_HANDLE);
BOOL (WINAPI *EnumProcesses)(DWORD *, DWORD, DWORD *); BOOL (WINAPI *EnumProcesses)(UINT *, UINT, UINT *);
BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, DWORD, DWORD *); BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, UINT, UINT *);
DWORD (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD); UINT (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, UINT);
DWORD (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, DWORD); UINT (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, UINT);
DWORD (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, DWORD); UINT (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, UINT);
DWORD (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, DWORD); UINT (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, UINT);
BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, DWORD, LPSTR, PDWORD); BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, UINT, LPSTR, PUINT);
BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, DWORD, LPWSTR, PDWORD); BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, UINT, LPWSTR, PUINT);
LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, DWORD); LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, UINT);
BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *); BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *);
void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *); void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *);
BOOL (WINAPI *DuplicateTokenEx)(HANDLE, DWORD, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *); BOOL (WINAPI *DuplicateTokenEx)(HANDLE, UINT, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *);
BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *); BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *);
BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD); BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT);
BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, DWORD, PDWORD); BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT, PUINT);
BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION); BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION);
BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION);
BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE); BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPUINT,LPSTR,LPUINT,PSID_NAME_USE);
BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE); BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPUINT,LPSTR,LPUINT,PSID_NAME_USE);
BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG); BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
BOOL (WINAPI *SwitchDesktop)(HDESK); BOOL (WINAPI *SwitchDesktop)(HDESK);
HDESK (WINAPI *OpenDesktopA)(LPTSTR, DWORD, BOOL, ACCESS_MASK); HDESK (WINAPI *OpenDesktopA)(LPTSTR, UINT, BOOL, ACCESS_MASK);
BOOL (WINAPI *CloseDesktop)(HDESK); BOOL (WINAPI *CloseDesktop)(HDESK);
BOOL (WINAPI *SetProcessShutdownParameters)(DWORD, DWORD); BOOL (WINAPI *SetProcessShutdownParameters)(UINT, UINT);
HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR); HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR);
BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, DWORD, PSID, WORD, DWORD, LPCWSTR *, LPVOID); BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, UINT, PSID, WORD, UINT, LPCWSTR *, LPVOID);
BOOL (WINAPI *DeregisterEventSource)(HANDLE); BOOL (WINAPI *DeregisterEventSource)(HANDLE);
BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **); BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **);
BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN); BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN);
BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *); BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *);
BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION); BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION);
HANDLE (WINAPI *GetProcessHeap)(); HANDLE (WINAPI *GetProcessHeap)();
BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, UINT, HANDLE, MINIDUMP_TYPE,
PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION,
PMINIDUMP_CALLBACK_INFORMATION); PMINIDUMP_CALLBACK_INFORMATION);
BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID); BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID);
@ -382,14 +382,14 @@ typedef struct NT_API
PQUOTA_LIMITS, PNTSTATUS); PQUOTA_LIMITS, PNTSTATUS);
NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE); NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE);
NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID); NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID);
DWORD (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PDWORD, PBYTE *); UINT (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PUINT, PBYTE *);
DWORD (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, DWORD, const BYTE *); UINT (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, UINT, const BYTE *);
void (WINAPI *WcmFreeMemory)(PVOID); void (WINAPI *WcmFreeMemory)(PVOID);
DWORD (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList); UINT (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList);
DWORD (WINAPI *SetNamedSecurityInfoW)(LPWSTR, UINT, SECURITY_INFORMATION, PSID, PSID, PACL, PACL); UINT (WINAPI *SetNamedSecurityInfoW)(LPWSTR, UINT, SECURITY_INFORMATION, PSID, PSID, PACL, PACL);
BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, DWORD, DWORD, DWORD, PSID); BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, UINT, UINT, UINT, PSID);
HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *); HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *);
BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPDWORD); BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPUINT);
LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR); LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR);
LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR); LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR);
} NT_API; } NT_API;
@ -413,7 +413,7 @@ typedef struct MS_USERMODE_SVC_PULSE_THREAD_PARAM
// Structure to suppress the warning message // Structure to suppress the warning message
typedef struct NO_WARNING typedef struct NO_WARNING
{ {
DWORD ThreadId; UINT ThreadId;
THREAD *NoWarningThread; THREAD *NoWarningThread;
EVENT *HaltEvent; EVENT *HaltEvent;
volatile bool Halt; volatile bool Halt;
@ -541,7 +541,7 @@ void MsFree();
char *MsCutExeNameFromCommandLine(char *str); char *MsCutExeNameFromCommandLine(char *str);
wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str); wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str);
DWORD MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit); UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit);
bool MsRegIsKey(UINT root, char *name); bool MsRegIsKey(UINT root, char *name);
bool MsRegIsKeyEx(UINT root, char *name, bool force32bit); bool MsRegIsKeyEx(UINT root, char *name, bool force32bit);
@ -946,8 +946,8 @@ bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data);
bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data);
bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data);
bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data);
void CALLBACK MsServiceDispatcher(DWORD argc, LPTSTR *argv); void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv);
void CALLBACK MsServiceHandler(DWORD opcode); void CALLBACK MsServiceHandler(UINT opcode);
bool MsServiceStopProc(); bool MsServiceStopProc();
void MsServiceStoperMainThread(THREAD *t, void *p); void MsServiceStoperMainThread(THREAD *t, void *p);
void MsServiceStarterMainThread(THREAD *t, void *p); void MsServiceStarterMainThread(THREAD *t, void *p);

View File

@ -14948,7 +14948,7 @@ void QuerySocketInformation(SOCK *sock)
struct sockaddr_in6 sockaddr6; struct sockaddr_in6 sockaddr6;
struct in6_addr *addr6; struct in6_addr *addr6;
int size; int size;
DWORD dw; UINT dw;
UINT opt_value = 0; UINT opt_value = 0;
if (sock->Type == SOCK_TCP) if (sock->Type == SOCK_TCP)
@ -15038,7 +15038,7 @@ void QuerySocketInformation(SOCK *sock)
} }
// Support of the TTL value // Support of the TTL value
size = sizeof(DWORD); size = sizeof(UINT);
if (opt_value == 0 || if (opt_value == 0 ||
getsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, &size) != 0) getsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, &size) != 0)
{ {
@ -15056,7 +15056,7 @@ void QuerySocketInformation(SOCK *sock)
// Setting the TTL value // Setting the TTL value
bool SetTtl(SOCK *sock, UINT ttl) bool SetTtl(SOCK *sock, UINT ttl)
{ {
DWORD dw; UINT dw;
int size; int size;
UINT opt_value = 0; UINT opt_value = 0;
// Validate arguments // Validate arguments
@ -15076,7 +15076,7 @@ bool SetTtl(SOCK *sock, UINT ttl)
} }
dw = ttl; dw = ttl;
size = sizeof(DWORD); size = sizeof(UINT);
if (sock->IPv6) if (sock->IPv6)
{ {

View File

@ -17,7 +17,7 @@
struct LOCK struct LOCK
{ {
void *pData; void *pData;
BOOL Ready; bool Ready;
#ifdef OS_UNIX #ifdef OS_UNIX
UINT thread_id; UINT thread_id;
UINT locked_count; UINT locked_count;

View File

@ -2478,7 +2478,6 @@ void TrimRight(char *str)
{ {
char *buf, *tmp; char *buf, *tmp;
UINT len, i, wp, wp2; UINT len, i, wp, wp2;
BOOL flag;
// Validate arguments // Validate arguments
if (str == NULL) if (str == NULL)
{ {
@ -2496,10 +2495,9 @@ void TrimRight(char *str)
buf = Malloc(len + 1); buf = Malloc(len + 1);
tmp = Malloc(len + 1); tmp = Malloc(len + 1);
flag = FALSE;
wp = 0; wp = 0;
wp2 = 0; wp2 = 0;
for (i = 0;i < len;i++) for (i = 0; i < len; ++i)
{ {
if (str[i] != ' ' && str[i] != '\t') if (str[i] != ' ' && str[i] != '\t')
{ {
@ -2524,7 +2522,7 @@ void TrimLeft(char *str)
{ {
char *buf; char *buf;
UINT len, i, wp; UINT len, i, wp;
BOOL flag; bool flag;
// Validate arguments // Validate arguments
if (str == NULL) if (str == NULL)
{ {
@ -2541,13 +2539,13 @@ void TrimLeft(char *str)
} }
buf = Malloc(len + 1); buf = Malloc(len + 1);
flag = FALSE; flag = false;
wp = 0; wp = 0;
for (i = 0;i < len;i++) for (i = 0;i < len;i++)
{ {
if (str[i] != ' ' && str[i] != '\t') if (str[i] != ' ' && str[i] != '\t')
{ {
flag = TRUE; flag = true;
} }
if (flag) if (flag)
{ {

View File

@ -1938,7 +1938,7 @@ void UnixGetSystemTime(SYSTEMTIME *system_time)
if (sizeof(time_t) == 4) if (sizeof(time_t) == 4)
{ {
now2 = (time_64t)((UINT64)((UINT32)now)); now2 = (time_64t)((UINT64)((UINT)now));
} }
else else
{ {
@ -1976,7 +1976,7 @@ UINT64 UnixGetTick64()
clock_gettime(CLOCK_REALTIME, &t); clock_gettime(CLOCK_REALTIME, &t);
#endif #endif
ret = ((UINT64)((UINT32)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL; ret = ((UINT64)((UINT)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL;
if (ret == 0) if (ret == 0)
{ {