Skip to content

Commit 45f803c

Browse files
committed
added:hardware bind login support for client module
1 parent 073fa74 commit 45f803c

File tree

7 files changed

+48
-31
lines changed

7 files changed

+48
-31
lines changed

XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ int nDYCode = 0;
4747
XSOCKET m_Socket = 0;
4848
LPCXSTR lpszUser = _X("123123aa");
4949
LPCXSTR lpszPass = _X("123123");
50+
LPCXSTR lpszHWCode = _X("2FDWAD02JD2091");
5051
LPCXSTR lpszSerial = _X("XAUTH-XYRYS-EWW60-UZO37-MHJAW-48386-Z806P");
5152
LPCXSTR lpszEmail = _X("[email protected]");
5253
__int64x nPhoneNumber = 1366666666;
@@ -145,7 +146,7 @@ int AuthClient_Register()
145146
st_JsonUserInfo["nIDNumber"] = (Json::Value::Int64)nIDNumber;
146147
st_JsonUserInfo["nUserLevel"] = ENUM_XENGINE_PROTOCOLHDR_LEVEL_TYPE_USER;
147148

148-
st_JsonUserTable["tszHardCode"] = "2FDWAD02JD2091";
149+
st_JsonUserTable["tszHardCode"] = lpszHWCode;
149150
st_JsonUserTable["st_UserInfo"] = st_JsonUserInfo;
150151

151152
st_JsonRoot["st_UserTable"] = st_JsonUserTable;
@@ -257,21 +258,22 @@ int AuthClient_Login()
257258
{
258259
XCHAR tszMsgBuffer[2048];
259260
XENGINE_PROTOCOLHDR st_ProtocolHdr; //协议头
260-
XENGINE_PROTOCOL_USERAUTH st_AuthUser;
261+
AUTHORIZE_PROTOCOL_USERAUTHEX st_AuthUser;
261262

262263
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
263264
memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
264-
memset(&st_AuthUser, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
265+
memset(&st_AuthUser, '\0', sizeof(AUTHORIZE_PROTOCOL_USERAUTHEX));
265266

266267
st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
267268
st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
268269
st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN;
269-
st_ProtocolHdr.unPacketSize = sizeof(XENGINE_PROTOCOL_USERAUTH);
270+
st_ProtocolHdr.unPacketSize = sizeof(AUTHORIZE_PROTOCOL_USERAUTHEX);
270271
st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
271272

272273
st_AuthUser.enDeviceType = ENUM_PROTOCOL_FOR_DEVICE_TYPE_PC_WINDOWS;
273274
strcpy(st_AuthUser.tszUserName, lpszUser);
274275
strcpy(st_AuthUser.tszUserPass, lpszPass);
276+
strcpy(st_AuthUser.tszHWCode, lpszHWCode);
275277

276278
#ifdef _PASS_ENCRYPT
277279
int nPLen = _tcsxlen(st_AuthUser.tszUserPass);
@@ -306,7 +308,7 @@ int AuthClient_Login()
306308
memcpy(tszMsgBuffer, &st_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR));
307309
memcpy(tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), &st_AuthUser, st_ProtocolHdr.unPacketSize);
308310

309-
nMsgLen = sizeof(XENGINE_PROTOCOLHDR) + sizeof(XENGINE_PROTOCOL_USERAUTH);
311+
nMsgLen = sizeof(XENGINE_PROTOCOLHDR) + sizeof(AUTHORIZE_PROTOCOL_USERAUTHEX);
310312
}
311313

312314
if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nMsgLen))
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
2-
"bSwitchDelete":true,
3-
"bSwitchRegister":true,
4-
"bSwitchLogin":true,
5-
"bSwitchPay":true,
6-
"bSwitchPass":true,
7-
"bSwitchTime":true,
8-
"bSwitchCDKey":true,
9-
"bSwitchNotice":true,
10-
"bSwitchDCode":false,
11-
"bSwitchMulti":true,
12-
"bSwitchTry":true,
13-
"bSwitchBanned":true,
14-
"bSwitchTokenLogin":true,
15-
"bSwitchHCLogin":true
2+
"bSwitchDelete": true,
3+
"bSwitchRegister": true,
4+
"bSwitchLogin": true,
5+
"bSwitchPay": true,
6+
"bSwitchPass": true,
7+
"bSwitchTime": true,
8+
"bSwitchCDKey": true,
9+
"bSwitchNotice": true,
10+
"bSwitchDCode": false,
11+
"bSwitchMulti": true,
12+
"bSwitchTry": true,
13+
"bSwitchBanned": true,
14+
"bSwitchTokenLogin": true,
15+
"bSwitchHCLogin": true,
16+
"bSwitchHWBind": false
1617
}

XEngine_Release/XEngine_XLog/Storage/keepfile

Whitespace-only changes.

XEngine_Source/AuthorizeModule_Client/AuthClient_Connector/AuthClient_Connector.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,22 @@ bool CAuthClient_Connector::AuthClient_Connector_GetAuth(bool* pbAuth /* = NULL
130130
类型:常量字符指针
131131
可空:N
132132
意思:输入密码
133-
参数.三:nDYCode
133+
参数.三:lpszHWCode
134+
In/Out:In
135+
类型:常量字符指针
136+
可空:Y
137+
意思:输入硬件码,如果服务器开启了硬件绑定
138+
参数.四:nDYCode
134139
In/Out:In
135140
类型:整数型
136141
可空:Y
137142
意思:输入动态码
138-
参数.:xhToken
143+
参数.:xhToken
139144
In/Out:In
140145
类型:句柄型
141146
可空:Y
142147
意思:输入动态码绑定的句柄
143-
参数.:dwCryption
148+
参数.:dwCryption
144149
In/Out:In
145150
类型:整数型
146151
可空:Y
@@ -150,7 +155,7 @@ bool CAuthClient_Connector::AuthClient_Connector_GetAuth(bool* pbAuth /* = NULL
150155
意思:是否成功
151156
备注:
152157
*********************************************************************/
153-
bool CAuthClient_Connector::AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, XSHOT nDYCode /* = 0 */, XNETHANDLE xhToken /* = 0 */, XLONG dwCryption /* = 0 */)
158+
bool CAuthClient_Connector::AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszHWCode /* = NULL */, XSHOT nDYCode /* = 0 */, XNETHANDLE xhToken /* = 0 */, XLONG dwCryption /* = 0 */)
154159
{
155160
AuthClient_IsErrorOccur = false;
156161

@@ -179,7 +184,11 @@ bool CAuthClient_Connector::AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR
179184
st_AuthUser.enDeviceType = ENUM_PROTOCOL_FOR_DEVICE_TYPE_PC_MACOS;
180185
#endif
181186
_tcsxcpy(st_AuthUser.tszUserName, lpszUser);
182-
187+
if (NULL != lpszHWCode)
188+
{
189+
_tcsxcpy(st_AuthUser.tszHWCode, lpszHWCode);
190+
}
191+
183192
if (dwCryption > 0)
184193
{
185194
int nPLen = _tcsxlen(lpszPass);

XEngine_Source/AuthorizeModule_Client/AuthClient_Connector/AuthClient_Connector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CAuthClient_Connector
2626
bool AuthClient_Connector_Connect(LPCXSTR lpszClientAddr, int nPort, LPCXSTR lpszPass = NULL);
2727
bool AuthClient_Connector_Close();
2828
bool AuthClient_Connector_GetAuth(bool* pbAuth = NULL);
29-
bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, XSHOT nDYCode = 0, XNETHANDLE xhToken = 0, XLONG dwCryption = 0);
29+
bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszHWCode = NULL, XSHOT nDYCode = 0, XNETHANDLE xhToken = 0, XLONG dwCryption = 0);
3030
bool AuthClient_Connector_Heart(bool bEnable = true);
3131
protected:
3232
static XHTHREAD XCALLBACK AuthClient_Connector_Thread(XPVOID lParam);

XEngine_Source/AuthorizeModule_Client/AuthClient_Define.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,22 @@ extern "C" bool AuthClient_Connector_GetAuth(bool* pbAuth = NULL);
7777
类型:常量字符指针
7878
可空:N
7979
意思:输入密码
80-
参数.三:nDYCode
80+
参数.三:lpszHWCode
81+
In/Out:In
82+
类型:常量字符指针
83+
可空:Y
84+
意思:输入硬件码,如果服务器开启了硬件绑定
85+
参数.四:nDYCode
8186
In/Out:In
8287
类型:整数型
8388
可空:Y
8489
意思:输入动态码
85-
参数.:xhToken
90+
参数.:xhToken
8691
In/Out:In
8792
类型:句柄型
8893
可空:Y
8994
意思:输入动态码绑定的句柄
90-
参数.:dwCryption
95+
参数.:dwCryption
9196
In/Out:In
9297
类型:整数型
9398
可空:Y
@@ -97,7 +102,7 @@ extern "C" bool AuthClient_Connector_GetAuth(bool* pbAuth = NULL);
97102
意思:是否成功
98103
备注:
99104
*********************************************************************/
100-
extern "C" bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, XSHOT nDYCode = 0, XNETHANDLE xhToken = 0, XLONG dwCryption = 0);
105+
extern "C" bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszHWCode = NULL, XSHOT nDYCode = 0, XNETHANDLE xhToken = 0, XLONG dwCryption = 0);
101106
/********************************************************************
102107
函数名称:AuthClient_Connector_Heart
103108
函数功能:启用禁用客户端心跳

XEngine_Source/AuthorizeModule_Client/pch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ extern "C" bool AuthClient_Connector_GetAuth(bool* pbAuth)
4343
{
4444
return m_Connector.AuthClient_Connector_GetAuth(pbAuth);
4545
}
46-
extern "C" bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, XSHOT nDYCode, XNETHANDLE xhToken, XLONG dwCryption)
46+
extern "C" bool AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR lpszPass, LPCXSTR lpszHWCode, XSHOT nDYCode, XNETHANDLE xhToken, XLONG dwCryption)
4747
{
48-
return m_Connector.AuthClient_Connector_Login(lpszUser, lpszPass, nDYCode, xhToken, dwCryption);
48+
return m_Connector.AuthClient_Connector_Login(lpszUser, lpszPass, lpszHWCode, nDYCode, xhToken, dwCryption);
4949
}
5050
extern "C" bool AuthClient_Connector_Heart(bool bEnable)
5151
{

0 commit comments

Comments
 (0)