int main (void) { printf ("Hello World\n"); OpenIniFile ("Test.Ini"); #ifdef INIFILE_TEST_READ_AND_WRITE WriteString ("Test", "Name", "Value"); WriteString ("Test", "Name", "OverWrittenValue"); WriteString ("Test", "Port", "COM1"); WriteString ("Test", "User", "James Brown jr."); WriteString ("Configuration", "eDriver", "MBM2.VXD"); WriteString ("Configuration", "Wrap", "LPT.VXD"); WriteInt ("IO-Port", "Com", 2); WriteBool ("IO-Port", "IsValid", 0); WriteDouble ("TheMoney", "TheMoney", 67892.00241); WriteInt ("Test" , "ToDelete", 1234); WriteIniFile ("Test.Ini"); printf ("Key ToDelete created. Check ini file. Any key to continue"); while (!kbhit()); OpenIniFile ("Test.Ini"); DeleteKey ("Test" , "ToDelete"); WriteIniFile ("Test.Ini"); #endif printf ("[Test] Name = %s\n", ReadString ("Test", "Name", "NotFound")); printf ("[Test] Port = %s\n", ReadString ("Test", "Port", "NotFound")); printf ("[Test] User = %s\n", ReadString ("Test", "User", "NotFound")); printf ("[Configuration] eDriver = %s\n", ReadString ("Configuration", "eDriver", "NotFound")); printf ("[Configuration] Wrap = %s\n", ReadString ("Configuration", "Wrap", "NotFound")); printf ("[IO-Port] Com = %d\n", ReadInt ("IO-Port", "Com", 0)); printf ("[IO-Port] IsValid = %d\n", ReadBool ("IO-Port", "IsValid", 0)); printf ("[TheMoney] TheMoney = %1.10lf\n", ReadDouble ("TheMoney", "TheMoney", 111)); CloseIniFile (); return 0; }
int WritePrivateProfileString(char *appNam, char *keyNam, char *keyVal, char *filNam) { while (s_read_flags) { usleep(10000); } s_read_flags = 1; if (OpenIniFile(filNam)) { char tmpBuf[CONF_MAX_PATH]; memcpy(tmpBuf, ReadString(appNam, keyNam, "NotFound"), CONF_MAX_PATH); if (!strcmp(tmpBuf, "NotFound")) { printf("set appNam=%s,keyNam=%s,NotFound\n", appNam, keyNam); CloseIniFile(); s_read_flags = 0; return 0; } else { WriteString(appNam, keyNam, keyVal); } WriteIniFile(filNam); CloseIniFile(); s_read_flags = 0; return 1; } else { s_read_flags = 0; return 0; } }
void _Cmd_Rules_f (edict_t * self, char *argument) { char section[32], mbuf[1024], *p, buf[30][INI_STR_LEN]; int i, j = 0; ini_t ini; strcpy (mbuf, "\n"); if (*argument) Q_strncpyz(section, argument, sizeof(section)); else strcpy (section, "main"); if (OpenIniFile (GAMEVERSION "/prules.ini", &ini)) { i = ReadIniSection (&ini, section, buf, 30); while (j < i) { p = buf[j++]; if (*p == '.') p++; Q_strncatz(mbuf, p, sizeof(mbuf)); Q_strncatz(mbuf, "\n", sizeof(mbuf)); } CloseIniFile (&ini); } if (!j) gi.cprintf (self, PRINT_MEDIUM, "No rules on %s available\n", section); else gi.cprintf (self, PRINT_MEDIUM, "%s", mbuf); }
static void _usr_default_get_init() { if(_usr_default_get_open_count == 0) { OpenIniFile(_usr_default_get_conf); } _usr_default_get_open_count++; }
/* {{{ CI_SetConfigString */ CK_DEFINE_FUNCTION(CK_RV, CI_SetConfigString)( CK_CHAR_PTR pSectionName, CK_CHAR_PTR pFieldname, CK_CHAR_PTR pValue ) { CK_RV rv = CKR_OK; bool ret; pSectionName=((pSectionName!=NULL_PTR)?pSectionName:(CK_CHAR_PTR)"PKCS11-DLL"); if(CK_I_config_fname == NULL_PTR) { rv = CKR_GENERAL_ERROR; CI_VarLogEntry("CI_GetConfigString", "Reading config field failed: config file not set", rv, 0, pFieldname, pSectionName, CK_I_config_fname, CK_I_init_fail_reasons[rv]); return rv; } do { ret = OpenIniFile(CK_I_config_fname); if (ret != TRUE) break; ret = DeleteKey(pSectionName, pFieldname); if (ret != TRUE) { CloseIniFile(); break; } WriteString(pSectionName, pFieldname, pValue); WriteIniFile(CK_I_config_fname); }while (false); if(ret != TRUE) { CI_VarLogEntry("CI_SetConfigString", "Setting config field '%s' from section [%s] in file '%s' failed: %s", CKR_GENERAL_ERROR, 0, pFieldname, pSectionName, CK_I_config_fname, CK_I_init_fail_reasons[rv]); return CKR_GENERAL_ERROR; } return CKR_OK; }
int OpenTypeFile(char *filNam) { while (s_read_flags) { usleep(10000); } if (!OpenIniFile(filNam)) { return 0; } s_read_flags = 1; return 1; }
int GetPrivateProfileString (char *appNam, char *keyNam, char *keyVal, char *filNam) { while (s_read_flags) usleep (10000); s_read_flags = 1; if (FileIsOpen == 1) { char tmpBuf[CONF_MAX_PATH]; memcpy (tmpBuf, ReadString (appNam, keyNam, "NotFound"), CONF_MAX_PATH); if (!strcmp (tmpBuf, "NotFound")) { // printf("get appNam=%s,keyNam=%s,NotFound\n",appNam,keyNam); keyVal[0] = '\0'; } else { memcpy (keyVal, tmpBuf, strlen (tmpBuf) + 1); } s_read_flags = 0; return strlen (keyVal); } if (OpenIniFile (filNam)) { char tmpBuf[CONF_MAX_PATH]; memcpy (tmpBuf, ReadString (appNam, keyNam, "NotFound"), CONF_MAX_PATH); if (!strcmp (tmpBuf, "NotFound")) { // printf("get appNam=%s,keyNam=%s,NotFound\n",appNam,keyNam); keyVal[0] = '\0'; } else { memcpy (keyVal, tmpBuf, strlen (tmpBuf) + 1); } //CloseIniFile (); s_read_flags = 0; FileIsOpen = 1; return strlen (keyVal); } else { keyVal[0] = '\0'; s_read_flags = 0; return 0; } }
void CIniFileBase::SaveString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpString ) { CGuard Guard(m_CS); if (!m_File.IsOpen()) { if (lpString) { OpenIniFile(); } if (!m_File.IsOpen()) { return; } } std::string strSection; if (lpSectionName == NULL || _tcslen(lpSectionName) == 0) { strSection = "default"; } else { strSection = lpSectionName; } if (!MoveToSectionNameData(strSection.c_str(),true)) { m_CurrentSection = strSection; m_CurrentSectionData.clear(); m_CurrentSectionFilePos = -1; } KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName); if (iter != m_CurrentSectionData.end()) { if (lpString) { if (iter->second != lpString) { iter->second = lpString; m_CurrentSectionDirty = true; } } else { m_CurrentSectionData.erase(iter); m_CurrentSectionDirty = true; } } else { if (lpString) { m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName,lpString)); m_CurrentSectionDirty = true; } } if (m_InstantFlush) { SaveCurrentSection(); } }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: LoadMoxMapTable() ** AUTHOR: Harry Qian ** DATE: 26 - Sep - 2010 ** ** DESCRIPTION: ** load the MOX map table of lift control ** ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** ** RETURNED VALUE: ** ** NOTES: ** */ static void LoadMoxMapTable(void) { const char * pChar = NULL; int nCount = 0; int i = 0; char szSec[20] = {0}; g_mcmt.nUsrCnt = 0; g_mcmt.nLiftCnt = 0; g_mcmt.pMCMT = NULL; OpenIniFile(MCMT_FILE); nCount = ReadInt(MCMT_SECTION, KEY_USER_COUNT, 0); #ifdef MCMT_DEBUG printf("[%s]\n%s=%d\n", MCMT_SECTION, KEY_USER_COUNT, nCount); #endif if (nCount > 0 && nCount < 10001) { g_mcmt.nUsrCnt = nCount; g_mcmt.pMCMT = malloc(sizeof(MCMT) * nCount); memset(g_mcmt.pMCMT, 0, sizeof(MCMT) * nCount); if (g_mcmt.pMCMT == NULL) { printf("Error: the g_mcmt.pMCMT can not be NULL...\n"); CloseIniFile(); return; } for (i = 0; i < nCount; i++) { snprintf(szSec, sizeof (szSec), "user%d", i + 1); pChar = ReadString(szSec, KEY_DEVICECODE, ""); strcpy(g_mcmt.pMCMT[i].szCode, pChar); #ifdef MCMT_DEBUG printf("[%s]\n%s=%s\n", szSec, KEY_DEVICECODE, g_mcmt.pMCMT[i].szCode); #endif g_mcmt.pMCMT[i].ucType = ReadInt(szSec, KEY_TYPE, 0); g_mcmt.pMCMT[i].ucLiftID = ReadInt(szSec, KEY_LIFTID, 0); g_mcmt.pMCMT[i].ucLayer = ReadInt(szSec, KEY_LAYER, 0); } } nCount = ReadInt(MCMT_SECTION, KEY_LIFT_COUNT, 0); #ifdef MCMT_DEBUG printf("[%s]\n%s=%d\n", MCMT_SECTION, KEY_LIFT_COUNT, nCount); #endif if (nCount > 0 && nCount < 9)// assume max lift group is 8. { g_mcmt.nLiftCnt = nCount; g_mcmt.pLFDA = malloc(sizeof(MLDA) * nCount); memset(g_mcmt.pLFDA, 0, sizeof(MLDA) * nCount); if (g_mcmt.pLFDA == NULL) { printf("Error: the g_mcmt.pLFDA can not be NULL...\n"); CloseIniFile(); return; } for (i = 0; i < nCount; i++) { snprintf(szSec, sizeof (szSec), "lift%d", i + 1); g_mcmt.pLFDA[i].da1 = ReadInt(szSec, KEY_DA1, 0); g_mcmt.pLFDA[i].da2 = ReadInt(szSec, KEY_DA2, 0); g_mcmt.pLFDA[i].da3 = ReadInt(szSec, KEY_DA3, 0); } } CloseIniFile(); }
CK_DEFINE_FUNCTION(CK_RV, CI_GetConfigString)( CK_CHAR_PTR pSectionName, CK_CHAR_PTR pFieldname, CK_CHAR_PTR CK_PTR ppValue ) { CK_CHAR_PTR buff; CK_RV rv = CKR_OK; int len; bool ret; pSectionName=((pSectionName!=NULL_PTR)?pSectionName:(CK_CHAR_PTR)"PKCS11-DLL"); if(CK_I_config_fname == NULL_PTR) { if ( CI_FindConfFile() != CKR_OK ) { rv = CKR_GENERAL_ERROR; CI_VarLogEntry("CI_GetConfigString", "Reading config field failed: config file not set", rv, 0, pFieldname, pSectionName, CK_I_config_fname, CK_I_init_fail_reasons[rv]); return rv; } } do { ret = OpenIniFile(CK_I_config_fname); if (ret != TRUE) break; buff = (CK_CHAR_PTR)ReadString(pSectionName, pFieldname, ""); if (strcmp(buff, "") == 0) { CloseIniFile(); ret = FALSE; break; } }while (false); if(ret != TRUE) { CI_VarLogEntry("CI_GetConfigString", "Reading config field '%s' from section [%s] in file '%s' failed: %s", CKR_GENERAL_ERROR, 3, pFieldname, pSectionName, CK_I_config_fname, CK_I_init_fail_reasons[rv]); return CKR_GENERAL_ERROR; } len= strlen(buff)+1; *ppValue = TC_malloc(len); if(*ppValue== NULL_PTR) return CKR_HOST_MEMORY; strcpy(*ppValue, buff); return CKR_OK; }
EFI_STATUS PlatformSpecificElementsBbTest ( IN EFI_BB_TEST_PROTOCOL *This, IN VOID *ClientInterface, IN EFI_TEST_LEVEL TestLevel, IN EFI_HANDLE SupportHandle ) /*++ Routine Description: Check the platform specific elements, which defined in the EFI spec 1.10, section 2.6.2. --*/ { EFI_STATUS Status; EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; EFI_INI_FILE_HANDLE IniFile; // // Locate the standard test library protocol // Status = gtBS->HandleProtocol ( SupportHandle, &gEfiStandardTestLibraryGuid, &StandardLib ); if (EFI_ERROR (Status)) { return Status; } // // Locate the test profile library protocol // Status = gtBS->HandleProtocol ( SupportHandle, &gEfiTestProfileLibraryGuid, &ProfileLib ); if (EFI_ERROR (Status)) { return Status; } // // Open the INI file // Status = OpenIniFile ( ProfileLib, EFI_COMPLIANT_BB_TEST_INI_PATH, EFI_COMPLIANT_BB_TEST_INI_FILE, &IniFile ); if (EFI_ERROR (Status)) { StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_WARNING, gTestGenericFailureGuid, L"EFI Compliant - Cannot open INI file", L"%a:%d", __FILE__, (UINTN)__LINE__ ); return Status; } // // Check the console protocols // CheckConsoleProtocols (StandardLib, IniFile); // // Check the graphical console protocols // CheckGraphicalConsoleProtocols (StandardLib, IniFile); // // Check the pointer protocols // CheckPointerProtocols (StandardLib, IniFile); // // Check the boot from disk protocols // CheckBootFromDiskProtocols (StandardLib, IniFile); // // Check the boot from network protocols // CheckBootFromNetworkProtocols (StandardLib, IniFile); // // Check the UART support protocols // CheckUartProtocols (StandardLib, IniFile); // // Check the PCI support protocols // CheckPciProtocols (StandardLib, IniFile); // // Check the USB support protocols // CheckUsbProtocols (StandardLib, IniFile); // // Check the SCSI support protocols // CheckScsiProtocols (StandardLib, IniFile); // // Check the Debug support protocols // CheckDebugProtocols (StandardLib, IniFile); // // Check the driver override protocols // CheckDriverOverrideProtocols (StandardLib, IniFile); // // Close the INI file // CloseIniFile (ProfileLib, IniFile); // // Done // return EFI_SUCCESS; }
int CGI_user_list(HTTPD_SESSION_t* http_session) { int i = 0; int ret = 0; AVal av_username = AVC(""), av_password = AVC(""); char query_string[2048] = {""}; USRM_I_KNOW_U_t* i_m = NULL; ezxml_t user_xml = NULL; const char* xml_text = NULL; int user_backlog = 0; // get current session username / password cgi_user_parse_query_string(http_session, query_string, &av_username, &av_password, NULL); // xml root node user_xml = ezxml_new_d("user"); ezxml_set_attr_d(user_xml, "ver", CGI_USER_VERSION); // user check in i_m = USRM_login(AVAL_STRDUPA(av_username), AVAL_STRDUPA(av_password)); if(i_m){ lpINI_PARSER user_ini = NULL; // attribute count ezxml_set_attr_d(user_xml, "you", i_m->username); // attribute 'add user' permit ezxml_set_attr_d(user_xml, "add_user", i_m->is_admin ? "yes" : "no"); // open the ini file user_ini = OpenIniFile(USR_MANGER_TMP_FILE); APP_ASSERT(NULL != user_ini, "File not existed? it's impossible"); // put the user list to xml user_list_xml(i_m, user_xml, user_ini); // close the ini file CloseIniFile(user_ini); user_ini = NULL; // add return ezxml_set_attr_d(user_xml, "ret", "success"); ezxml_set_attr_d(user_xml, "mesg", "check in success"); USRM_logout(i_m); i_m = NULL; }else{ // add return ezxml_set_attr_d(user_xml, "ret", "sorry"); ezxml_set_attr_d(user_xml, "mesg", "check in falied"); } // make the xml text xml_text = ezxml_toxml(user_xml); ezxml_free(user_xml); user_xml = NULL; // response cgi_user_http_response(http_session, xml_text); // free the xml text free(xml_text); xml_text = NULL; return 0; }
/*hdr ** Copyright Mox Products, Australia ** ** FUNCTION NAME: LFCOMPortOpen ** AUTHOR: Harry Qian ** DATE: 3 - Nov - 2010 ** ** DESCRIPTION: ** Open serial port ** ** ARGUMENTS: ARGNAME DRIECTION TYPE DESCRIPTION ** nPort [IN] int port number ** RETURNED VALUE: ** port handle if success, otherwise -1 ** NOTES: ** */ static INT LFCOMPortOpen(int nParity) { char tcPort[16]; struct termios oldtio; struct termios newtio; int nFd = -1; int nPort = 0; int nModeType = 0; OpenIniFile(LF_SERIAL_INI_FILE); nPort = ReadInt(SEC_LCA, KEY_COMPORT, 1); if (1 == nPort) { sprintf(tcPort, "/dev/ttymxc%d", 3); } else if (2 == nPort) { sprintf(tcPort, "/dev/ttymxc%d", 1); } else { printf("%s: Error, the EHV only have two com port.\n", __FUNCTION__); CloseIniFile(); return 0; } #ifdef LC_MOX_DEBUG printf("LC mox mode open the com%d.\n", nPort); #endif nFd = open(tcPort, O_RDWR |O_NOCTTY | O_NONBLOCK); if (nFd < 0) { printf("Uart Open Error\n"); CloseIniFile(); return -1; } tcgetattr(nFd,&newtio); nModeType = ReadInt(SEC_LCA, KEY_BAUDRATE, DEFAULT_BAUDRATE); #ifdef LC_MOX_DEBUG printf("LC mox mode nFd=%d.\n", nFd); printf("LC mox mode set the baudrate=%d.\n", nModeType); #endif switch(nModeType) { case 2400: cfsetispeed(&newtio, B2400); cfsetospeed(&newtio, B2400); break; case 4800: cfsetispeed(&newtio, B4800); cfsetospeed(&newtio, B4800); break; case 9600: cfsetispeed(&newtio, B9600); cfsetospeed(&newtio, B9600); break; case 19200: cfsetispeed(&newtio, B19200); cfsetospeed(&newtio, B19200); break; case 38400: cfsetispeed(&newtio, B38400); cfsetospeed(&newtio, B38400); break; case 57600: cfsetispeed(&newtio, B57600); cfsetospeed(&newtio, B57600); break; case 115200: cfsetispeed(&newtio, B115200); cfsetospeed(&newtio, B115200); break; default: printf("the modetype beyond the area. so set baudrate = 9600.\n"); cfsetispeed(&newtio, B9600); cfsetospeed(&newtio, B9600); break; } nModeType = ReadInt(SEC_LCA, KEY_DATABIT, DEFAULT_DATABIT); #ifdef LC_MOX_DEBUG printf("LC mox mode set the databit=%d.\n", nModeType); #endif newtio.c_cflag &= ~CSIZE; /* Mask the character size bits */ switch(nModeType) { case 5: newtio.c_cflag |= CS5; /* Select 5 data bits */ break; case 6: newtio.c_cflag |= CS6; /* Select 6 data bits */ break; case 7: newtio.c_cflag |= CS7; /* Select 7 data bits */ break; case 8: newtio.c_cflag |= CS8; /* Select 8 data bits */ break; default: printf("the data bit set to 8.\n"); newtio.c_cflag |= CS8; /* Select 8 data bits */ break; } nModeType = ReadInt(SEC_LCA, KEY_PARITY, nParity); //nModeType = nParity; #ifdef LC_MOX_DEBUG printf("LC mox mode set the parity=%d.\n", nModeType); #endif switch(nModeType) { case 0: newtio.c_cflag &= ~PARENB; //no parity break; case 1: // odd parity newtio.c_cflag |= PARENB; newtio.c_cflag |= PARODD; break; case 2: // even parity newtio.c_cflag |= PARENB; newtio.c_cflag &= ~PARODD; break; default: printf("the parity set to 0.\n"); newtio.c_cflag &= ~PARENB;//mode:8N1 break; } nModeType = ReadInt(SEC_LCA, KEY_STOPBIT, DEFAULT_STOPBIT); #ifdef LC_MOX_DEBUG printf("LC mox mode set the stop bit=%d.\n", nModeType); #endif switch(nModeType) { case 0: newtio.c_cflag &= ~CSTOPB; break; case 1: break; case 2: newtio.c_cflag |= CSTOPB; break; default: printf("the parity set to 0.\n"); newtio.c_cflag &= ~CSTOPB; break; } CloseIniFile(); newtio.c_cflag |= (CLOCAL | CREAD); newtio.c_cflag &= ~CRTSCTS; /*disable hardware flow control*/ newtio.c_iflag &= ~(IXON | IXOFF | IXANY); /*disable software flow control */ newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /*Input*/ newtio.c_oflag &= ~OPOST; /*Output*/ newtio.c_iflag &=~(INLCR|IGNCR|ICRNL); newtio.c_oflag &=~(ONLCR|OCRNL); newtio.c_cc[VTIME] = 0;//timeout = 2seconds newtio.c_cc[VMIN] = 0; tcflush(nFd, TCIFLUSH); //tcflush(nFd, TCIOFLUSH); tcsetattr(nFd, TCSANOW, &newtio); return nFd; }
static BOOL LoadM2CCMTFile(void) { const char * pChar = NULL; int i = 0; char szSec[20] = {0}; memset(&g_m2ccmt,0,sizeof(g_m2ccmt)); OpenIniFile(M2CCMT_FILE); g_m2ccmt.nLiftCnt = ReadInt(M2CCMT_GLOBAL_SECTION, M2CCMT_KEY_LIFT_CNT, 0); g_m2ccmt.nCardReaderCnt = ReadInt(M2CCMT_GLOBAL_SECTION, M2CCMT_KEY_CARDREADER_CNT, 0); g_m2ccmt.nUserCnt = ReadInt(M2CCMT_GLOBAL_SECTION, M2CCMT_KEY_USER_CNT, 0); g_m2ccmt.nDoorCnt = ReadInt(M2CCMT_GLOBAL_SECTION, M2CCMT_KEY_DOOR_CNT, 0); if(g_m2ccmt.nLiftCnt>MOX2_MAX_LIFT_CNT) { return FALSE; } if(g_m2ccmt.nCardReaderCnt>MOX2_MAX_CARDREADER_CNT) { return FALSE; } if(g_m2ccmt.nUserCnt>MOX2_MAX_USER_CNT) { return FALSE; } if(g_m2ccmt.nDoorCnt>MOX2_MAX_DOOR_CNT) { return FALSE; } g_m2ccmt.pLift= malloc(sizeof(MOXLIFT) * g_m2ccmt.nLiftCnt); if(NULL==g_m2ccmt.pLift) { printf("%s Error %d \n",__FUNCTION__,__LINE__); return FALSE; } memset(g_m2ccmt.pLift, 0, sizeof(MOXLIFT) * g_m2ccmt.nLiftCnt); g_m2ccmt.pCardReader= malloc(sizeof(MOXCARDREADER) * g_m2ccmt.nCardReaderCnt); if(NULL==g_m2ccmt.pCardReader) { printf("%s Error %d \n",__FUNCTION__,__LINE__); return FALSE; } memset(g_m2ccmt.pCardReader, 0, sizeof(MOXCARDREADER) * g_m2ccmt.nCardReaderCnt); g_m2ccmt.pUser= malloc(sizeof(MOXUSER) * g_m2ccmt.nUserCnt); if(NULL==g_m2ccmt.pUser) { printf("%s Error %d \n",__FUNCTION__,__LINE__); return FALSE; } memset(g_m2ccmt.pUser, 0, sizeof(MOXUSER) * g_m2ccmt.nUserCnt); g_m2ccmt.pDoor= malloc(sizeof(MOXDOOR) * g_m2ccmt.nDoorCnt); if(NULL==g_m2ccmt.pDoor) { printf("%s Error %d \n",__FUNCTION__,__LINE__); return FALSE; } memset(g_m2ccmt.pDoor, 0, sizeof(MOXDOOR) * g_m2ccmt.nDoorCnt); for(i=0;i<g_m2ccmt.nLiftCnt;i++) { sprintf(szSec,M2CCMT_LIFT_SECTION, i+1); g_m2ccmt.pLift[i].cDA1= ReadInt(szSec, M2CCMT_KEY_LIFT_DA1, 0); g_m2ccmt.pLift[i].cDA2= ReadInt(szSec, M2CCMT_KEY_LIFT_DA2, 0); g_m2ccmt.pLift[i].cDA3= ReadInt(szSec, M2CCMT_KEY_LIFT_DA3, 0); g_m2ccmt.pLift[i].cGroup= ReadInt(szSec, M2CCMT_KEY_LIFT_GROUP, 0); } for(i=0;i<g_m2ccmt.nCardReaderCnt;i++) { sprintf(szSec,M2CCMT_CARDREADER_SECTION, i+1); g_m2ccmt.pCardReader[i].cLiftID= ReadInt(szSec, M2CCMT_KEY_CARDREADER_LIFTID, 0); g_m2ccmt.pCardReader[i].cStationNum= ReadInt(szSec, M2CCMT_KEY_CARDREADER_STATIONNUM, 0); g_m2ccmt.pCardReader[i].cLiftIndex= ReadInt(szSec, M2CCMT_KEY_CARDREADER_LIFTINDEX, 0); } for(i=0;i<g_m2ccmt.nUserCnt;i++) { sprintf(szSec,M2CCMT_USER_SECTION, i+1); pChar = ReadString(szSec, M2CCMT_KEY_USER_AMTCODE, ""); strcpy(g_m2ccmt.pUser[i].szAMTCode, pChar); pChar = ReadString(szSec, M2CCMT_KEY_USER_DNSCODE, ""); strcpy(g_m2ccmt.pUser[i].szDNSCode, pChar); pChar = ReadString(szSec, M2CCMT_KEY_USER_DOORCODE, ""); strcpy(g_m2ccmt.pUser[i].szDoorCode, pChar); g_m2ccmt.pUser[i].cLiftID= ReadInt(szSec, M2CCMT_KEY_USER_LIFTID, 0); g_m2ccmt.pUser[i].cLevel= ReadInt(szSec, M2CCMT_KEY_USER_LEVEL, 0); g_m2ccmt.pUser[i].cDoorType= ReadInt(szSec, M2CCMT_KEY_USER_TYPE, 0); } for(i=0;i<g_m2ccmt.nDoorCnt;i++) { sprintf(szSec,M2CCMT_DOOR_SECTION, i+1); pChar = ReadString(szSec, M2CCMT_KEY_DOOR_DOORCODE, ""); strcpy(g_m2ccmt.pDoor[i].szDoorCode, pChar); g_m2ccmt.pDoor[i].cLevel= ReadInt(szSec, M2CCMT_KEY_DOOR_LEVEL, 0); g_m2ccmt.pDoor[i].cDoorType= ReadInt(szSec, M2CCMT_KEY_DOOR_TYPE, 0); } CloseIniFile(); return TRUE; }