NetTunnelWindows/NetTunnelSDK/misc.h

33 lines
960 B
C

#pragma once
#include <windows.h>
#ifdef __cplusplus // If used by C++ code,
extern "C" {
// we need to export the C interface
#endif
void RemoveTailLineBreak(TCHAR *pInputStr, int strSize);
int RunCommand(TCHAR *pszCmd, TCHAR *pszResultBuffer, int dwResultBufferSize, unsigned long *pRetCode);
/**
* @brief IPv4 子网掩码转 CIDR 掩码
* @param[in] pNetMask IPv4 子网掩码字符串
* @return IPv4 CIDR 掩码
*/
int __cdecl NetmaskToCIDR(const TCHAR *pNetMask);
/**
* @brief CIDR 掩码转 IPv4 子网掩码
* @param[in] cidr CIDR 掩码
* @return CIDR 对应的子网掩码
*/
const TCHAR *CIDRToNetmask(const UINT8 cidr);
void ShowWindowsErrorMessage(const TCHAR *pMsgHead);
void StringReplaceAll(TCHAR *pOrigin, const TCHAR *pOldStr, const TCHAR *pNewStr);
void StringRemoveAll(TCHAR *pOrigin, const TCHAR *pString);
TCHAR *binToHexString(TCHAR *p, const unsigned char *cp, unsigned int count);
#ifdef __cplusplus
}
#endif