function_name
stringlengths
1
80
function
stringlengths
14
10.6k
comment
stringlengths
12
8.02k
normalized_comment
stringlengths
6
6.55k
SmEtherIpIdDlgUpdate
void SmEtherIpIdDlgUpdate(HWND hWnd, SM_ETHERIP_ID *t) { bool ok = true; // Validate arguments if (hWnd == NULL || t == NULL) { return; } if (t->InitCompleted == false) { return; } SmEtherIpIdDlgGetSetting(hWnd, t); if (IsEmptyStr(t->Data.Id) || IsEmptyStr(t->Data.HubName) || IsEmptyStr(t->Data.UserName)) { ok = false; } SetEnable(hWnd, IDOK, ok); }
/* EtherIP ID edit dialog: Update the controls*/
EtherIP ID edit dialog: Update the controls
SmEtherIp
void SmEtherIp(HWND hWnd, SM_SERVER *s) { // Validate arguments if (s == NULL) { return; } Dialog(hWnd, D_SM_ETHERIP, SmEtherIpDlg, s); }
/* Open the EtherIP settings dialog*/
Open the EtherIP settings dialog
SmEtherIpDlgInit
void SmEtherIpDlgInit(HWND hWnd, SM_SERVER *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetIcon(hWnd, 0, ICO_MACHINE); DlgFont(hWnd, S_TITLE, 14, true); DlgFont(hWnd, S_BOLD, 0, true); LvInit(hWnd, L_LIST); LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_ETHERIP_COLUMN_0"), 205); LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_ETHERIP_COLUMN_1"), 179); LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_ETHERIP_COLUMN_2"), 154); SmEtherIpDlgRefresh(hWnd, s); }
/* Initialize the EtherIP settings dialog*/
Initialize the EtherIP settings dialog
SmEtherIpDlgUpdate
void SmEtherIpDlgUpdate(HWND hWnd, SM_SERVER *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); }
/* EtherIP Settings dialog controls update*/
EtherIP Settings dialog controls update
SmIPsec
void SmIPsec(HWND hWnd, SM_SERVER *s) { // Validate arguments if (s == NULL) { return; } Dialog(hWnd, D_SM_IPSEC, SmIPsecDlg, s); }
/* Start the IPsec Settings dialog*/
Start the IPsec Settings dialog
SmHubMsgDlgUpdate
void SmHubMsgDlgUpdate(HWND hWnd, SM_EDIT_HUB *s) { bool b = true; // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetEnable(hWnd, E_TEXT, IsChecked(hWnd, C_USEMSG)); if (IsChecked(hWnd, C_USEMSG)) { wchar_t *s = GetText(hWnd, E_TEXT); b = !IsEmptyUniStr(s); Free(s); } SetEnable(hWnd, IDOK, b); }
/* Message dialog update*/
Message dialog update
SmSetupStep
void SmSetupStep(HWND hWnd, SM_SETUP *s) { // Validate arguments if (s == NULL) { return; } Dialog(hWnd, D_SM_SETUP_STEP, SmSetupStepDlg, s); }
/* Setup procedure dialog*/
Setup procedure dialog
SmSetupDeleteAllLocalBridge
bool SmSetupDeleteAllLocalBridge(HWND hWnd, SM_SETUP *s) { RPC_ENUM_LOCALBRIDGE t; UINT i; // Validate arguments if (hWnd == NULL || s == NULL) { return false; } Zero(&t, sizeof(t)); if (ScEnumLocalBridge(s->Rpc, &t) != ERR_NO_ERROR) { return false; } for (i = 0;i < t.NumItem;i++) { RPC_LOCALBRIDGE *e = &t.Items[i]; if (CALL(hWnd, ScDeleteLocalBridge(s->Rpc, e)) == false) { FreeRpcEnumLocalBridge(&t); return false; } } FreeRpcEnumLocalBridge(&t); return true; }
/* Delete all local bridges*/
Delete all local bridges
SmSetupHubDlgUpdate
void SmSetupHubDlgUpdate(HWND hWnd, SM_SETUP *s) { bool ok = true; char tmp[MAX_HUBNAME_LEN + 1]; // Validate arguments if (hWnd == NULL || s == NULL) { return; } GetTxtA(hWnd, E_HUBNAME, tmp, sizeof(tmp)); if (IsEmptyStr(tmp) || IsSafeStr(tmp) == false) { ok = false; } SetEnable(hWnd, IDOK, ok); }
/* Update the control of the Virtual HUB*/
Update the control of the Virtual HUB
SmLicenseAddDlgInit
void SmLicenseAddDlgInit(HWND hWnd, SM_SERVER *s) { HFONT h; // Validate arguments if (hWnd == NULL || s == NULL) { return; } h = GetFont("Arial", 10, true, false, false, false); SetFont(hWnd, B_KEY1, h); SetFont(hWnd, B_KEY2, h); SetFont(hWnd, B_KEY3, h); SetFont(hWnd, B_KEY4, h); SetFont(hWnd, B_KEY5, h); SetFont(hWnd, B_KEY6, h); DlgFont(hWnd, S_INFO, 10, true); SmLicenseAddDlgUpdate(hWnd, s); }
/* License addition dialog initialization*/
License addition dialog initialization
SmLicenseAdd
bool SmLicenseAdd(HWND hWnd, SM_SERVER *s) { // Validate arguments if (s == NULL) { return false; } return Dialog(hWnd, D_SM_LICENSE_ADD, SmLicenseAddDlg, s); }
/* Add a license*/
Add a license
SmLicenseDlgUpdate
void SmLicenseDlgUpdate(HWND hWnd, SM_SERVER *s) { bool b = false; // Validate arguments if (hWnd == NULL || s == NULL) { return; } b = LvIsSingleSelected(hWnd, L_LIST); SetEnable(hWnd, B_DEL, b); SetEnable(hWnd, IDOK, b); }
/* License dialog control update*/
License dialog control update
SmLicense
void SmLicense(HWND hWnd, SM_SERVER *s) { // Validate arguments if (s == NULL) { return; } Dialog(hWnd, D_SM_LICENSE, SmLicenseDlg, s); FreeCapsList(s->CapsList); s->CapsList = ScGetCapsEx(s->Rpc); }
/* Add or Remove license*/
Add or Remove license
SmLogFileStartDownload
void SmLogFileStartDownload(HWND hWnd, SM_SERVER *s, char *server_name, char *filepath, UINT totalsize) { SM_READ_LOG_FILE p; // Validate arguments if (hWnd == NULL || server_name == NULL || filepath == NULL || totalsize == 0) { return; } Zero(&p, sizeof(p)); p.filepath = filepath; p.s = s; p.server_name = server_name; p.totalsize = totalsize; Dialog(hWnd, D_SM_READ_LOG_FILE, SmReadLogFile, &p); }
/* Start the download of the log file*/
Start the download of the log file
SmLogFileDlgInit
void SmLogFileDlgInit(HWND hWnd, SM_SERVER *p) { // Validate arguments if (hWnd == NULL || p == NULL) { return; } SetIcon(hWnd, 0, ICO_LOG2); LvInit(hWnd, L_LIST); LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LOG_FILE_COLUMN_1"), 250); LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LOG_FILE_COLUMN_2"), 100); LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LOG_FILE_COLUMN_3"), 130); LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LOG_FILE_COLUMN_4"), 110); SmLogFileDlgRefresh(hWnd, p); }
/* Initialize the dialog*/
Initialize the dialog
SmLogFileDlgUpdate
void SmLogFileDlgUpdate(HWND hWnd, SM_SERVER *p) { // Validate arguments if (hWnd == NULL || p == NULL) { return; } SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); }
/* Update the dialog control*/
Update the dialog control
SmHubAcDlgUpdate
void SmHubAcDlgUpdate(HWND hWnd, SM_EDIT_AC_LIST *p) { bool b; // Validate arguments if (hWnd == NULL || p == NULL) { return; } b = LvIsSingleSelected(hWnd, L_LIST); SetEnable(hWnd, IDOK, b); SetEnable(hWnd, B_DELETE, b); }
/* Update the dialog control*/
Update the dialog control
SmEditCrlDlgOnLoad
void SmEditCrlDlgOnLoad(HWND hWnd, SM_EDIT_CRL *c) { X *x; // Validate arguments if (hWnd == NULL || c == NULL) { return; } if (CmLoadXFromFileOrSecureCard(hWnd, &x)) { UCHAR md5[MD5_SIZE], sha1[SHA1_SIZE]; SmEditCrlDlgSetName(hWnd, x->subject_name); SmEditCrlDlgSetSerial(hWnd, x->serial); GetXDigest(x, md5, false); GetXDigest(x, sha1, true); SmEditCrlDlgSetHash(hWnd, md5, sha1); FreeX(x); SmEditCrlDlgUpdate(hWnd, c); } }
/* Read the certificate*/
Read the certificate
SmEditCrlDlgSetSerial
void SmEditCrlDlgSetSerial(HWND hWnd, X_SERIAL *serial) { char tmp[MAX_SIZE]; // Validate arguments if (hWnd == NULL || serial == NULL) { return; } BinToStrEx(tmp, sizeof(tmp), serial->data, serial->size); Check(hWnd, R_SERI, true); SetTextA(hWnd, E_SERI, tmp); }
/* Set the serial number to the dialog*/
Set the serial number to the dialog
SmCrlDlgInit
void SmCrlDlgInit(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetIcon(hWnd, 0, ICO_CERT_X); LvInit(hWnd, L_LIST); LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_CRL_COLUMN_1"), 555); SmCrlDlgRefresh(hWnd, s); }
/* Initialize the dialog*/
Initialize the dialog
SmCrlDlgUpdate
void SmCrlDlgUpdate(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); }
/* Update the control*/
Update the control
SmSecureManager
void SmSecureManager(HWND hWnd) { UINT id = SmGetCurrentSecureIdFromReg(); if (id == 0) { id = SmSelectSecureId(hWnd); } if (id == 0) { return; } CmSecureManager(hWnd, id); }
/* Smart Card Manager*/
Smart Card Manager
SmSelectKeyPair
bool SmSelectKeyPair(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size) { return SmSelectKeyPairEx(hWnd, cert_name, cert_name_size, key_name, key_name_size, 0); }
/* Read a key pair from the smart card*/
Read a key pair from the smart card
SmSelectSecureId
UINT SmSelectSecureId(HWND hWnd) { UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); UINT ret; if (id != 0 && CheckSecureDeviceId(id) == false) { id = 0; } ret = CmSelectSecure(hWnd, id); if (ret == 0) { return 0; } SmWriteSelectSecureIdReg(ret); return ret; }
/* Make the user select the smart card number*/
Make the user select the smart card number
SmWriteSelectSecureIdReg
void SmWriteSelectSecureIdReg(UINT id) { MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId", id); }
/* Write the current smart card number to the registry*/
Write the current smart card number to the registry
SmGetCurrentSecureId
UINT SmGetCurrentSecureId(HWND hWnd) { // Load the current settings UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); // Check whether it's valid if (id == 0 || CheckSecureDeviceId(id) == false) { // Select a smart card device number if it's invalid id = SmSelectSecureId(hWnd); } return id; }
/* Get the current smart card number*/
Get the current smart card number
SmGetCurrentSecureIdFromReg
UINT SmGetCurrentSecureIdFromReg() { // Load the current settings UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); // Check whether normal if (id == 0 || CheckSecureDeviceId(id) == false) { id = 0; } return id; }
/* Get the current smart card number from the registry*/
Get the current smart card number from the registry
SmL3IsSwActive
bool SmL3IsSwActive(SM_SERVER *s, char *name) { bool ret = false; UINT i; RPC_ENUM_L3SW t; // Validate arguments if (s == NULL || name == NULL) { return false; } Zero(&t, sizeof(t)); if (ScEnumL3Switch(s->Rpc, &t) == ERR_NO_ERROR) { for (i = 0;i < t.NumItem;i++) { RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; if (StrCmpi(e->Name, name) == 0) { if (e->Active) { ret = true; break; } } } FreeRpcEnumL3Sw(&t); } return ret; }
/* Get whether the specified L3 switch started*/
Get whether the specified L3 switch started
SmL3SwTableDlgInit
void SmL3SwTableDlgInit(HWND hWnd, SM_L3SW *w) { // Validate arguments if (hWnd == NULL || w == NULL) { return; } SmL3SwTableDlgUpdate(hWnd, w); }
/* Initialize the dialog*/
Initialize the dialog
SmL3SwIfDlgUpdate
void SmL3SwIfDlgUpdate(HWND hWnd, SM_L3SW *w) { bool b = true; // Validate arguments if (hWnd == NULL || w == NULL) { return; } if (IsEmpty(hWnd, E_HUBNAME)) { b = false; } if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) { b = false; } if (IpGet(hWnd, E_IP) == 0 || IpGet(hWnd, E_IP) == 0xffffffff) { b = false; } if (IsSubnetMask32(IpGet(hWnd, E_MASK)) == false) { b = false; } SetEnable(hWnd, IDOK, b); }
/* Update the control*/
Update the control
SmL3AddDlgUpdate
void SmL3AddDlgUpdate(HWND hWnd, SM_SERVER *s) { char *tmp; // Validate arguments if (hWnd == NULL || s == NULL) { return; } tmp = GetTextA(hWnd, E_NAME); SetEnable(hWnd, IDOK, IsEmptyStr(tmp) == false && IsSafeStr(tmp)); Free(tmp); }
/* Update the control*/
Update the control
SmL3DlgInit
void SmL3DlgInit(HWND hWnd, SM_SERVER *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetFont(hWnd, S_BOLD, Font(0, true)); SetIcon(hWnd, 0, ICO_SWITCH); LvInit(hWnd, L_LIST); LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_L3_SW_COLUMN1"), 150); LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_L3_SW_COLUMN2"), 120); LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_L3_SW_COLUMN3"), 100); LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_L3_SW_COLUMN4"), 100); SmL3DlgRefresh(hWnd, s); }
/* Initialize the dialog*/
Initialize the dialog
SmHubAdminOptionValueDlgUpdate
void SmHubAdminOptionValueDlgUpdate(HWND hWnd, SM_EDIT_AO *a) { char tmp[MAX_SIZE]; // Validate arguments if (hWnd == NULL || a == NULL) { return; } GetTxtA(hWnd, C_NAME, tmp, sizeof(tmp)); SetEnable(hWnd, IDOK, IsEmpty(hWnd, C_NAME) == false && IsEmpty(hWnd, E_VALUE) == false && IsSafeStr(tmp)); }
/* Update the dialog controls for management option value*/
Update the dialog controls for management option value
SmHubExtOption
void SmHubExtOption(HWND hWnd, SM_EDIT_HUB *e) { SM_EDIT_AO a; // Validate arguments if (hWnd == NULL || e == NULL) { return; } Zero(&a, sizeof(a)); a.e = e; a.ExtOption = true; StrCpy(a.CurrentOptions.HubName, sizeof(a.CurrentOptions.HubName), e->HubName); // Get the current options on the server if (CALL(hWnd, ScGetHubExtOptions(e->p->Rpc, &a.CurrentOptions)) == false) { return; } Dialog(hWnd, D_SM_ADMIN_OPTION, SmHubAdminOptionDlg, &a); FreeRpcAdminOption(&a.CurrentOptions); FreeRpcAdminOption(&a.DefaultOptions); }
/* Virtual HUB extended options*/
Virtual HUB extended options
SmConfig
void SmConfig(HWND hWnd, SM_SERVER *s) { SM_CONFIG c; // Validate arguments if (hWnd == NULL || s == NULL) { return; } Zero(&c, sizeof(c)); c.s = s; // Get current config from the server if (CALL(hWnd, ScGetConfig(s->Rpc, &c.Config)) == false) { return; } // Show the dialog Dialog(hWnd, D_SM_CONFIG, SmConfigDlg, &c); // Release FreeRpcConfig(&c.Config); }
/* Show the config edit dialog*/
Show the config edit dialog
SmIpTableDlgUpdate
void SmIpTableDlgUpdate(HWND hWnd, SM_TABLE *s) { bool ok = true; // Validate arguments if (hWnd == NULL || s == NULL) { return; } if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) { ok = false; } SetEnable(hWnd, B_DELETE, ok); }
/* Update the control*/
Update the control
SmIpTableDlg
void SmIpTableDlg(HWND hWnd, SM_HUB *s, char *session_name) { SM_TABLE t; // Validate arguments if (hWnd == NULL || s == NULL) { return; } Zero(&t, sizeof(t)); t.Hub = s; t.Rpc = s->Rpc; t.SessionName = session_name; Dialog(hWnd, D_SM_IP, SmIpTableDlgProc, &t); }
/* IP address table dialog*/
IP address table dialog
SmMacTableDlgUpdate
void SmMacTableDlgUpdate(HWND hWnd, SM_TABLE *s) { bool ok = true; // Validate arguments if (hWnd == NULL || s == NULL) { return; } if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) { ok = false; } SetEnable(hWnd, B_DELETE, ok); }
/* Update the control*/
Update the control
SmMacTableDlg
void SmMacTableDlg(HWND hWnd, SM_HUB *s, char *session_name) { SM_TABLE t; // Validate arguments if (hWnd == NULL || s == NULL) { return; } Zero(&t, sizeof(t)); t.Hub = s; t.Rpc = s->Rpc; t.SessionName = session_name; Dialog(hWnd, D_SM_MAC, SmMacTableDlgProc, &t); }
/* MAC address table dialog*/
MAC address table dialog
SmSessionDlg
void SmSessionDlg(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } Dialog(hWnd, D_SM_SESSION, SmSessionDlgProc, s); }
/* Session Management dialog*/
Session Management dialog
SmCaDlgUpdate
void SmCaDlgUpdate(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } SetEnable(hWnd, B_DELETE, LvIsSelected(hWnd, L_CERT)); SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_CERT)); }
/* Update the control*/
Update the control
SmCaDlgAdd
bool SmCaDlgAdd(HWND hWnd, SM_HUB *s) { X *x; RPC_HUB_ADD_CA t; // Validate arguments if (hWnd == NULL || s == NULL) { return false; } if (CmLoadXFromFileOrSecureCard(hWnd, &x) == false) { return false; } Zero(&t, sizeof(t)); StrCpy(t.HubName, sizeof(t.HubName), s->HubName); t.Cert = x; if (CALL(hWnd, ScAddCa(s->Rpc, &t)) == false) { return false; } FreeRpcHubAddCa(&t); return true; }
/* CA Adding dialog*/
CA Adding dialog
SmCaDlg
void SmCaDlg(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } Dialog(hWnd, D_SM_CA, SmCaDlgProc, s); }
/* CA List dialog box*/
CA List dialog box
SmLogDlg
UINT SmLogDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { SM_HUB *s = (SM_HUB *)param; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: // Initialize SmLogDlgInit(hWnd, s); break; case WM_COMMAND: switch (LOWORD(wParam)) { case B_SEC: case B_PACKET: SmLogDlgUpdate(hWnd, s); break; } switch (wParam) { case IDOK: // [OK] button SmLogDlgOnOk(hWnd, s); break; case IDCANCEL: // Cancel button Close(hWnd); break; } break; case WM_CLOSE: EndDialog(hWnd, false); break; } return 0; }
/* Log storage settings dialog*/
Log storage settings dialog
SmLinkCreate
bool SmLinkCreate(HWND hWnd, SM_HUB *s) { return SmLinkCreateEx(hWnd, s, false); }
/* Create a new link*/
Create a new link
SmLinkDlg
void SmLinkDlg(HWND hWnd, SM_HUB *s) { SmLinkDlgEx(hWnd, s, false); }
/* Link List dialog*/
Link List dialog
SmRadiusDlg
void SmRadiusDlg(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } Dialog(hWnd, D_SM_RADIUS, SmRadiusDlgProc, s); }
/* Radius Setup dialog*/
Radius Setup dialog
SmRedirect
void SmRedirect(HWND hWnd, SM_EDIT_ACCESS *s) { // Validate arguments if (s == NULL) { return; } Dialog(hWnd, D_SM_REDIRECT, SmRedirectDlg, s); }
/* HTTP Redirection Settings dialog*/
HTTP Redirection Settings dialog
SmSimulationOnOk
void SmSimulationOnOk(HWND hWnd, SM_EDIT_ACCESS *s) { ACCESS *a; // Validate arguments if (hWnd == NULL || s == NULL) { return; } a = s->Access; a->Jitter = a->Loss = a->Delay = 0; if (IsChecked(hWnd, C_DELAY)) { a->Delay = GetInt(hWnd, E_DELAY); } if (IsChecked(hWnd, C_JITTER)) { a->Jitter = GetInt(hWnd, E_JITTER); } if (IsChecked(hWnd, C_LOSS)) { a->Loss = GetInt(hWnd, E_LOSS); } EndDialog(hWnd, 1); }
/* Saving of delay, jitter, packet-loss dialog*/
Saving of delay, jitter, packet-loss dialog
SmCreateGroupDlg
bool SmCreateGroupDlg(HWND hWnd, SM_GROUP *s) { SM_EDIT_GROUP g; RPC_SET_GROUP *group; bool ret; // Validate arguments if (hWnd == NULL || s == NULL) { return false; } Zero(&g, sizeof(g)); g.EditMode = false; g.Hub = s->Hub; g.p = s->p; g.Rpc = s->Rpc; group = &g.SetGroup; StrCpy(group->HubName, sizeof(group->HubName), s->Hub->HubName); ret = Dialog(hWnd, D_SM_EDIT_GROUP, SmEditGroupDlgProc, &g); FreeRpcSetGroup(group); return ret; }
/* Group creation dialog*/
Group creation dialog
SmSelectGroupDlg
char *SmSelectGroupDlg(HWND hWnd, SM_HUB *s, char *default_name) { SM_GROUP g; // Validate arguments if (hWnd == NULL || s == NULL) { return NULL; } Zero(&g, sizeof(g)); g.Hub = s; g.p = s->p; g.Rpc = s->Rpc; g.SelectMode = true; g.SelectedGroupName = default_name; if (Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g) == false) { return NULL; } return g.SelectedGroupName; }
/* Group List dialog (selection mode)*/
Group List dialog (selection mode)
SmGroupListDlg
void SmGroupListDlg(HWND hWnd, SM_HUB *s) { SM_GROUP g; // Validate arguments if (hWnd == NULL || s == NULL) { return; } Zero(&g, sizeof(g)); g.Hub = s; g.p = s->p; g.Rpc = s->Rpc; g.SelectMode = false; Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g); }
/* Group List dialog*/
Group List dialog
SmPolicyDlg
bool SmPolicyDlg(HWND hWnd, POLICY *p, wchar_t *caption) { return SmPolicyDlgEx(hWnd, p, caption, false); }
/* Show Policies dialog box*/
Show Policies dialog box
SmGetAuthTypeStr
wchar_t *SmGetAuthTypeStr(UINT id) { return GetAuthTypeStr(id); }
/* Get a string of user authentication method*/
Get a string of user authentication method
SmSelectUserDlg
char *SmSelectUserDlg(HWND hWnd, SM_HUB *s, char *default_name) { return SmSelectUserDlgEx(hWnd, s, default_name, false); }
/* User List dialog (selection)*/
User List dialog (selection)
SmUserListDlgEx
void SmUserListDlgEx(HWND hWnd, SM_HUB *s, char *groupname, bool create) { SM_USER user; // Validate arguments if (hWnd == NULL || s == NULL) { return; } Zero(&user, sizeof(user)); user.Hub = s; user.p = s->p; user.Rpc = s->Rpc; user.GroupName = groupname; user.CreateNow = create; Dialog(hWnd, D_SM_USER, SmUserListProc, &user); }
/* User List dialog (filtered by group name)*/
User List dialog (filtered by group name)
SmUserListDlg
void SmUserListDlg(HWND hWnd, SM_HUB *s) { SmUserListDlgEx(hWnd, s, NULL, false); }
/* User List dialog*/
User List dialog
SmHubDlgUpdate
void SmHubDlgUpdate(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } }
/* Update the control*/
Update the control
SmHubDlg
void SmHubDlg(HWND hWnd, SM_HUB *s) { // Validate arguments if (hWnd == NULL || s == NULL) { return; } Dialog(hWnd, D_SM_HUB, SmHubDlgProc, s); }
/* Management of HUB*/
Management of HUB
SmFarmMemberCert
void SmFarmMemberCert(HWND hWnd, SM_SERVER *p, UINT id) { RPC_FARM_INFO t; // Validate arguments if (hWnd == NULL || p == NULL || id == 0) { return; } Zero(&t, sizeof(t)); t.Id = id; if (CALL(hWnd, ScGetFarmInfo(p->Rpc, &t)) == false) { return; } CertDlg(hWnd, t.ServerCert, NULL, true); FreeRpcFarmInfo(&t); }
/* Display the farm member certificate*/
Display the farm member certificate
SmStrToPortList
LIST *SmStrToPortList(char *str) { return StrToPortList(str); }
/* Convert the string to port list*/
Convert the string to port list
SmFarmDlg
bool SmFarmDlg(HWND hWnd, SM_SERVER *p) { // Validate arguments if (hWnd == NULL || p == NULL) { return false; } return Dialog(hWnd, D_SM_FARM, SmFarmDlgProc, p); }
/* Server farm configuration*/
Server farm configuration
SmConnectionDlgUpdate
void SmConnectionDlgUpdate(HWND hWnd, SM_SERVER *p) { bool b = false; // Validate arguments if (hWnd == NULL || p == NULL) { return; } if (LvIsSelected(hWnd, L_LIST) && (LvIsMultiMasked(hWnd, L_LIST) == false)) { b = true; } SetEnable(hWnd, IDOK, b); SetEnable(hWnd, B_DISCONNECT, b && p->ServerAdminMode); }
/* Update the control*/
Update the control
SmConnectionDlg
void SmConnectionDlg(HWND hWnd, SM_SERVER *p) { // Validate arguments if (hWnd == NULL || p == NULL) { return; } Dialog(hWnd, D_SM_CONNECTION, SmConnectionDlgProc, p); }
/* Display the connection list*/
Display the connection list
SmGetConnectionTypeStr
wchar_t *SmGetConnectionTypeStr(UINT type) { return GetConnectionTypeStr(type); }
/* Get the connection type string*/
Get the connection type string
SmSaveKeyPairDlg
bool SmSaveKeyPairDlg(HWND hWnd, X *x, K *k) { SM_SAVE_KEY_PAIR s; // Validate arguments if (hWnd == NULL || x == NULL || k == NULL) { return false; } Zero(&s, sizeof(s)); s.Cert = x; s.Key = k; return Dialog(hWnd, D_SM_SAVE_KEY_PAIR, SmSaveKeyPairDlgProc, &s); }
/* Save the certificate and private key*/
Save the certificate and private key
SmGetCertInfoStr
void SmGetCertInfoStr(wchar_t *str, UINT size, X *x) { wchar_t subject[MAX_SIZE]; wchar_t issuer[MAX_SIZE]; wchar_t date[MAX_SIZE]; // Validate arguments if (x == NULL || str == NULL) { if (str != NULL) { str[0] = 0; } return; } GetPrintNameFromName(subject, sizeof(subject), x->subject_name); GetPrintNameFromName(issuer, sizeof(issuer), x->issuer_name); GetDateStrEx64(date, sizeof(date), x->notAfter, NULL); UniFormat(str, size, _UU("CM_CERT_INFO"), subject, issuer, date); }
/* Get the certificate information string*/
Get the certificate information string
SmSslDlg
void SmSslDlg(HWND hWnd, SM_SERVER *p) { SM_SSL s; // Validate arguments if (hWnd == NULL || p == NULL) { return; } Zero(&s, sizeof(s)); s.p = p; Dialog(hWnd, D_SM_SSL, SmSslDlgProc, &s); // Cleanup FreeX(s.Cert); FreeK(s.Key); }
/* Display the SSL related dialog*/
Display the SSL related dialog
SmCreateListenerDlg
bool SmCreateListenerDlg(HWND hWnd, SM_SERVER *p) { // Validate arguments if (hWnd == NULL || p == NULL) { return false; } return Dialog(hWnd, D_SM_CREATE_LISTENER, SmCreateListenerDlgProc, p); }
/* Listener creation dialog*/
Listener creation dialog
SmEditHubDlg
bool SmEditHubDlg(HWND hWnd, SM_SERVER *p, char *hubname) { SM_EDIT_HUB s; // Validate arguments if (hWnd == NULL || p == NULL) { return false; } Zero(&s, sizeof(s)); s.p = p; s.EditMode = true; StrCpy(s.HubName, sizeof(s.HubName), hubname); if (p->Bridge == false) { return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); } else { SmHubExtOption(hWnd, &s); return false; } }
/* HUB edit dialog*/
HUB edit dialog
SmCreateHubDlg
bool SmCreateHubDlg(HWND hWnd, SM_SERVER *p) { SM_EDIT_HUB s; // Validate arguments if (hWnd == NULL || p == NULL) { return false; } Zero(&s, sizeof(s)); s.p = p; s.EditMode = false; return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); }
/* HUB creation dialog*/
HUB creation dialog
SmShowIPSecMessageIfNecessary
void SmShowIPSecMessageIfNecessary(HWND hWnd, SM_SERVER *p) { // Validate arguments if (p == NULL) { return; } if (GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false) { if (GetCapsBool(p->CapsList, "b_support_ipsec") && p->IPsecMessageDisplayed == false) { // Display a message about IPsec RPC_TEST flag; if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_IPSEC_SETUP_QUESTION")) == IDYES) { // Display the IPsec dialog SmIPsec(hWnd, p); } Zero(&flag, sizeof(flag)); flag.IntValue = 9; ToStr(flag.StrValue, 1); ScDebug(p->Rpc, &flag); p->IPsecMessageDisplayed = true; } } }
/* Display messages about IPsec, and prompt for the setting*/
Display messages about IPsec, and prompt for the setting
SmPassword
char *SmPassword(HWND hWnd, char *server_name) { char *ret; UI_PASSWORD_DLG p; // Validate arguments if (server_name == NULL) { return NULL; } Zero(&p, sizeof(p)); p.AdminMode = true; StrCpy(p.ServerName, sizeof(p.ServerName), server_name); if (PasswordDlg(hWnd, &p) == false) { return NULL; } ret = CopyStr(p.Password); return ret; }
/* Password input dialog*/
Password input dialog
SmCheckNewName
bool SmCheckNewName(SETTING *s, wchar_t *new_title) { UINT i; // Validate arguments if (new_title == NULL) { return false; } if (s != NULL) { if (IsInList(sm->SettingList, s) == false) { return false; } } // Check whether there is the same name in other for (i = 0;i < LIST_NUM(sm->SettingList);i++) { SETTING *t = LIST_DATA(sm->SettingList, i); if (s != t) { if (UniStrCmpi(t->Title, new_title) == 0) { return false; } } } return true; }
/* Update the configuration*/
Update the configuration
SmDeleteSetting
void SmDeleteSetting(wchar_t *title) { SETTING *s; // Validate arguments if (title == NULL) { return; } s = SmGetSetting(title); if (s == NULL) { return; } Delete(sm->SettingList, s); Free(s); Sort(sm->SettingList); SmWriteSettingList(); }
/* Delete the configuration*/
Delete the configuration
SmAddSetting
bool SmAddSetting(SETTING *s) { // Validate arguments if (s == NULL) { return false; } if (SmGetSetting(s->Title) != NULL) { return false; } Insert(sm->SettingList, s); SmWriteSettingList(); return true; }
/* Add the settings*/
Add the settings
SmGetSetting
SETTING *SmGetSetting(wchar_t *title) { SETTING s; // Validate arguments if (title == NULL) { return NULL; } Zero(&s, sizeof(SETTING)); UniStrCpy(s.Title, sizeof(s.Title), title); return (SETTING *)Search(sm->SettingList, &s); }
/* Get the configuration*/
Get the configuration
SmCompareSetting
int SmCompareSetting(void *p1, void *p2) { SETTING *s1, *s2; if (p1 == NULL || p2 == NULL) { return 0; } s1 = *(SETTING **)p1; s2 = *(SETTING **)p2; if (s1 == NULL || s2 == NULL) { return 0; } return UniStrCmpi(s1->Title, s2->Title); }
/* Comparison of connection settings*/
Comparison of connection settings
SmInitSettingList
void SmInitSettingList() { sm->SettingList = NewList(SmCompareSetting); SmLoadSettingList(); SmInitDefaultSettingList(); }
/* Initialize the configuration list*/
Initialize the configuration list
SmFreeSettingList
void SmFreeSettingList() { UINT i; // Write SmWriteSettingList(); for (i = 0;i < LIST_NUM(sm->SettingList);i++) { SETTING *s = LIST_DATA(sm->SettingList, i); Free(s); } ReleaseList(sm->SettingList); sm->SettingList = NULL; }
/* Release the configuration list*/
Release the configuration list
SmRefreshSetting
void SmRefreshSetting(HWND hWnd) { SmRefreshSettingEx(hWnd, NULL); }
/* Update the configuration list*/
Update the configuration list
SmMainDlgUpdate
void SmMainDlgUpdate(HWND hWnd) { bool ok = true; // Validate arguments if (hWnd == NULL) { return; } if (LvIsSelected(hWnd, L_SETTING) == false) { ok = false; } if (LvIsMultiMasked(hWnd, L_SETTING)) { ok = false; } SetEnable(hWnd, IDOK, ok); SetEnable(hWnd, B_EDIT_SETTING, ok); SetEnable(hWnd, B_DELETE, ok); }
/* Main dialog update*/
Main dialog update
MainSM
void MainSM() { // MsgBoxEx(NULL, 0, L"MsIsWine: %u\n", MsIsWine()); if (sm->TempSetting == NULL) { // Open the main window SmMainDlg(); } else { SmConnect(sm->hParentWnd, sm->TempSetting); } }
/* Server Manager main process*/
Server Manager main process
SMExec
void SMExec() { InitSM(); MainSM(); FreeSM(); }
/* Running the Server Manager*/
Running the Server Manager
IsThisProcessForeground
bool IsThisProcessForeground() { HWND hWnd = GetForegroundWindow(); DWORD proc_id, thread_id; if (hWnd == NULL) { return false; } proc_id = 0; thread_id = GetWindowThreadProcessId(hWnd, &proc_id); if (proc_id == MsGetCurrentProcessId()) { return true; } return false; }
/* Get whether the current process is foreground*/
Get whether the current process is foreground
ConfigUpdateUi
bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd) { // Validate arguments if (u == NULL) { return false; } return Dialog(hWnd, D_UPDATE_CONFIG, UpdateConfigDlgProc, u); }
/* Show the update notification setting screen*/
Show the update notification setting screen
DisableUpdateUi
void DisableUpdateUi(WINUI_UPDATE *u) { // Validate arguments if (u == NULL) { return; } u->CurrentlyDisabled = true; }
/* Disable the update notification UI*/
Disable the update notification UI
FreeUpdateUi
void FreeUpdateUi(WINUI_UPDATE *u) { // Validate arguments if (u == NULL) { return; } if (u->UpdateClient != NULL) { FreeUpdateClient(u->UpdateClient); } Free(u); }
/* Release the update notification*/
Release the update notification
LoadUpdateUiSetting
void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) { Zero(s, sizeof(UPDATE_CLIENT_SETTING)); // Validate arguments if (u == NULL || s == NULL) { return; } s->DisableCheck = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "DisableCheck"); s->LatestIgnoreBuild = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild"); }
/* Read the current settings from the registry*/
Read the current settings from the registry
SaveUpdateUiSetting
void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) { // Validate arguments if (u == NULL || s == NULL) { return; } MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "DisableCheck", s->DisableCheck); MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild", s->LatestIgnoreBuild); }
/* Write the current settings to the registry*/
Write the current settings to the registry
SetWizardButton
void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish) { SetWizardButtonEx(p, enable_next, enable_back, enable_close, is_finish, false); }
/* Button setting of the wizard*/
Button setting of the wizard
JumpWizard
void JumpWizard(WIZARD_PAGE *p, UINT next_id) { // Validate arguments if (p == NULL || next_id == 0) { return; } PropSheet_SetCurSelByID(p->Wizard->hWndWizard, next_id); }
/* Jump to another wizard page*/
Jump to another wizard page
CloseWizard
void CloseWizard(WIZARD_PAGE *p) { // Validate arguments if (p == NULL) { return; } p->Wizard->CloseConfirmMsg = NULL; SetWizardButton(p, false, false, true, false); if (p->Wizard->IsAreoStyle) { PropSheet_PressButton(p->hWndPage, PSBTN_CANCEL); } else { Close(p->Wizard->hWndWizard); } }
/* Close the wizard*/
Close the wizard
NewWizard
WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param) { WIZARD *w = ZeroMalloc(sizeof(WIZARD)); w->Icon = icon; w->Pages = NewList(NULL); w->Param = param; w->Bitmap = bitmap; w->Caption = CopyUniStr(caption); return w; }
/* Create a new wizard*/
Create a new wizard
FreeWizard
void FreeWizard(WIZARD *w) { UINT i; // Validate arguments if (w == NULL) { return; } for (i = 0;i < LIST_NUM(w->Pages);i++) { WIZARD_PAGE *p = LIST_DATA(w->Pages, i); FreeWizardPage(p); } ReleaseList(w->Pages); Free(w->Caption); Free(w); }
/* Release the wizard*/
Release the wizard
GetWizardPage
WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id) { UINT i; // Validate arguments if (w == NULL || id == 0) { return NULL; } for (i = 0;i < LIST_NUM(w->Pages);i++) { WIZARD_PAGE *p = LIST_DATA(w->Pages, i); if (p->Id == id) { return p; } } return NULL; }
/* Get the wizard page*/
Get the wizard page
AddWizardPage
void AddWizardPage(WIZARD *w, WIZARD_PAGE *p) { // Validate arguments if (w == NULL || p == NULL) { return; } Add(w->Pages, p); p->Wizard = w; }
/* Add a wizard page*/
Add a wizard page
NewWizardPage
WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title) { WIZARD_PAGE *p; // Validate arguments if (id == 0 || proc == NULL) { return NULL; } p = ZeroMalloc(sizeof(WIZARD_PAGE)); p->Id = id; p->Proc = proc; p->Title = CopyUniStr(title); return p; }
/* Create a new wizard page*/
Create a new wizard page
FreeWizardPage
void FreeWizardPage(WIZARD_PAGE *p) { // Validate arguments if (p == NULL) { return; } if (p->DialogParam != NULL) { FreeBitmapList(p->DialogParam->BitmapList); Free(p->DialogParam); } Free(p->Title); Free(p); }
/* Release the wizard page*/
Release the wizard page
NicInfo
void NicInfo(UI_NICINFO *info) { // Validate arguments if (info == NULL) { return; } info->RouteChange = NewRouteChange(); DialogEx2(NULL, D_NICINFO, NicInfoProc, info, true, true); FreeRouteChange(info->RouteChange); info->RouteChange = NULL; }
/* Show the NIC information dialog*/
Show the NIC information dialog