Example #1
0
void CreateIDBinFile()
{
	MsgWrite(proteinIDFileBin);
	FILE* pFile = fopen(proteinIDFileBin, "wb");
	if (pFile)
	{
		fwrite(TotalProteins, sizeof(Protein), TOTAL_PROTEINS, pFile);
		fflush(pFile);
		fclose(pFile);
	}
	else
	{
		MsgError(proteinIDFileBin);
	}

	MsgWrite(phenotypeIDFileBin);
	pFile = fopen(phenotypeIDFileBin, "wb");
	if (pFile)
	{
		fwrite(TotalPhenotypes, sizeof(Phenotype), TOTAL_PHENOTYPES, pFile);
		fflush(pFile);
		fclose(pFile);
	}
	else
	{
		MsgError(phenotypeIDFileBin);
	}
}
void IndexInitial()
{
	MsgFunction("IndexInitial");
	FILE* pFile = NULL;

	MsgRead(pchProteinIndexFile);
	if (pFile = fopen(pchProteinIndexFile, "r"))
	{
		int step_i = 0;
		for (step_i = 0; step_i <= INDEX_PROTEINS - 1; ++step_i)
		{
			fscanf(pFile, "%s %d", selectProteins[step_i].chName,
				&(selectProteins[step_i].iID));
		}
		fclose(pFile);
	}
	else
	{
		MsgError(pchProteinIndexFile);
	}

	MsgRead(pchPhenotypeIndexFile);
	if (pFile = fopen(pchPhenotypeIndexFile, "r"))
	{
		int step_i = 0;
		for (step_i = 0; step_i <= INDEX_PHENOTYPES - 1; ++step_i)
		{
			fscanf(pFile, "%s %d", selectPhenotypes[step_i].chName,
				&(selectPhenotypes[step_i].iID));
		}
		fclose(pFile);
	}
	else
	{
		MsgError(pchPhenotypeIndexFile);
	}

	MsgRead(pchGeneIndexFile);
	if (pFile = fopen(pchGeneIndexFile, "r"))
	{
		int step_i = 0;
		for (step_i = 0; step_i <= INDEX_GENES - 1; ++step_i)
		{
			fscanf(pFile, "%s %d", selectGenes[step_i].chName,
				&(selectGenes[step_i].iID));
//debug
//if(strcmp(selectGenes[step_i].chName, "613733")==0)
//{
//	cout << "";
//}
		}
		fclose(pFile);
	}
	else
	{
		MsgError(pchGeneIndexFile);
	}
}
Example #3
0
void *router(void *v) {
	wrk_info_t wrk_info = *(wrk_info_t*)v;
	int result, rcvid;
	iov_t *piov, header;
	frame_t frame;
	size_t i;

	SETIOV(&header, &frame, sizeof(frame_t));

	while(true) {
		rcvid = MsgReceivev(wrk_info.chid, &header, 1, NULL);
		printf("rcvid %i\n", rcvid);
		__ERROR_CONT(rcvid, -1, MSG_ERR_MSGREC);
		if(0 == rcvid) {
			switch(frame.header.code) {
			case _PULSE_CODE_DISCONNECT:
				printf("Client has gone\n");
				break;
			default:
				break;
			}
		} else {
			if (frame.header.type == _IO_CONNECT) {
				printf("Send OK\n");
				frame_reply(rcvid, NULL);
				continue;
			}
			if(frame.protocol == STANDART) {
				__ERROR_CHECK(MsgError(rcvid, ENOTSUP),-1,MSG_ERR_MSGERR);
				continue;
			}
			printf("Thread %i, client %i\n", wrk_info.id, frame.cid);
			if(frame.protocol == NOREPLY) {
				for(i=0; i<wrk_info.pslave->amount; ++i) {
					if(FULL != wrk_info.pslave->pslave[i].status) {
						if(0 == sem_trywait(&wrk_info.pslave->pslave[i].sem)) {
							wrk_info.pslave->pslave[i].clientnow ++;
							if(wrk_info.pslave->pslave[i].clientnow ==
									wrk_info.pslave->pslave[i].clientmax) {
								wrk_info.pslave->pslave[i].status = FULL;
							}
							sem_post(&wrk_info.pslave->pslave[i].sem);
							break;
						}
					}
				}
				if(i == wrk_info.pslave->amount) {
					__ERROR_CHECK(MsgError(rcvid, EAGAIN),-1,MSG_ERR_MSGERR);
					continue;
				}
				frame_datareceive(rcvid, &frame);
				frame_reply(rcvid, NULL);
				__ERROR_CHECK(frame_send(wrk_info.pslave->pslave[i].coid, &frame, NULL), -1, "sendv");
			}
		}
	}
}
Example #4
0
bool ProjectGenerator::CopyDirectory(const nglPath& targetPath, const nglPath& srcpath)
{
  // create folder
  if (!targetPath.Create())
  {
    nglString msg;
    msg.Format(_T("creating target folder '%ls'"), targetPath.GetChars());
    return MsgError(msg);
  }
  
  
  std::list<nglPath> children;
  srcpath.GetChildren(&children);
  std::list<nglPath>::iterator it;
  for (it = children.begin(); it != children.end(); ++it)
  {
    const nglPath& srcpath = *it;
    
    if (!srcpath.IsLeaf())
      continue;
    
    nglPath dstpath = targetPath;
    dstpath += srcpath.GetNodeName();
    
    nglString contents;
    
    nglIStream* piFile = srcpath.OpenRead();
    if (!piFile)
    {
      nglString msg;
      msg.Format(_T("opening for reading input file '%ls'"), srcpath.GetChars());
      return MsgError(msg);
    }
    
    nglOStream* poFile = dstpath.OpenWrite(false);
    if (!poFile)
    {
      nglString msg;
      msg.Format(_T("opening for writing output file '%ls'"), dstpath.GetChars());
      return MsgError(msg);
    }
    
    piFile->PipeTo(*poFile);
    delete poFile;
    delete piFile;
    
    NGL_OUT(_T("nui project generator : created file '%ls'\n"), dstpath.GetChars());
  }
  
  return true;
}
Example #5
0
static bool DisableSetUnhandledExceptionFilter()
{

    HMODULE hKernel32 = LoadLibraryA("kernel32.dll");
    if (hKernel32 == NULL)
    {
        MsgError("加载kernel32.dll相关函数地址失败!");
        return false;
    }

    void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter");
    if(pOrgEntry == NULL)
        return false;

    DWORD dwOldProtect = 0;
    SIZE_T jmpSize = 5;

    BOOL bProt = VirtualProtect(pOrgEntry, jmpSize, PAGE_EXECUTE_READWRITE, &dwOldProtect);
    if (!bProt)
    {
        MsgError("调用VirtualProtect失败!");

        return false;
    }

    BYTE newJump[20];
    void *pNewFunc = &SetUnhandledExceptionFilter2;

    SIZE_T dwOrgEntryAddr = (SIZE_T) pOrgEntry;
    dwOrgEntryAddr += jmpSize; // add 5 for 5 op-codes for jmp rel32
    SIZE_T dwNewEntryAddr = (SIZE_T) pNewFunc;
    SIZE_T dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr;
    // JMP rel32: Jump near, relative, displacement relative to next instruction.
    newJump[0] = 0xE9;  // JMP rel32
    memcpy(&newJump[1], &dwRelativeAddr, sizeof(pNewFunc));

    SIZE_T bytesWritten;
    BOOL bRet = WriteProcessMemory(GetCurrentProcess(), pOrgEntry, newJump, jmpSize, &bytesWritten);
    if (!bRet)
    {
        MsgError("调用WriteProcessMemory失败!");
        return false;
    }

    DWORD dwBuf;
    VirtualProtect(pOrgEntry, jmpSize, dwOldProtect, &dwBuf);
    return true;

}
// =========================================================================
// Returns TRUE if the mountpoint specified is a valid mountpoint which may
// be used
BOOL ValidateMountpoint(
    HWND hWnd,
    WCHAR* mountpoint,
    BOOL SkipExistsCheck,
    BOOL silent
)
{
    BOOL retval = FALSE;

    if (wcslen(mountpoint) == 0)
        {
        if (!(silent))
            {
            MsgError(hWnd, _("Please specify a mountpoint"));
            }
        }
    else if (wcscmp(RESERVED_MOUNTPOINT, mountpoint) == 0)
        {
        if (!(silent))
            {
            MsgError(hWnd, _("The mountpoint specified is reserved; please enter a different mountpoint"));
            }
        }
    else if (wcspbrk(mountpoint, RESERVED_MOUNTPOINT_CHARS) != NULL)
        {
        if (!(silent))
            {
            MsgError(hWnd, _("The mountpoint specified includes a invalid character; please enter a different mountpoint"));
            }
        }
    else if (
             (!(SkipExistsCheck)) &&
             (GetFileAttributes(mountpoint) != INVALID_FILE_ATTRIBUTES)
            )
        {
        if (!(silent))
            {
            MsgError(hWnd, _("The mountpoint specified already exists; please enter a different mountpoint"));
            }
        }
    else
        {
        // Everything OK
        retval = TRUE;
        }

    return retval;
}
void CreatePhenotypeProteinRelationFile()
{
	int tCount = 0;
	int i = 0;
	for (i = 0; i <= TOTAL_PHENOTYPES - 1; ++i)
	{
		int rowCount = 0;

		pointerPhenotypeProteins[i].start = tCount;
		int j = 0;
		for (j = 0; j <= CAUSE_PROTEINS - 1 && phenotypeProtein[i][j] != CAUSE_PROTEIN_END; j++)
		{
			TotalPhenotypeProtein[tCount] = phenotypeProtein[i][j];

			rowCount++;
			tCount++;
		}
		pointerPhenotypeProteins[i].offset = rowCount;
	}
	//cout << "total cause protein: " << tCount << endl;
	printf("->TOTAL_PHENOTYPEPROTEINS:%d\n", tCount);

	MsgWrite(pointerPhenotypeProteinFileBin);
	FILE* pFileOut = fopen(pointerPhenotypeProteinFileBin , "wb");
	if (pFileOut)
	{
		fwrite(pointerPhenotypeProteins, sizeof(PhenotypeProteinPointer), TOTAL_PHENOTYPES, pFileOut);
		fflush(pFileOut);
		fclose(pFileOut);
	}
	else
	{
		MsgError(pointerPhenotypeProteinFileBin);
	}

	MsgWrite(phenotypeProteinFileBin);
	if (pFileOut)
	{
		pFileOut = fopen(phenotypeProteinFileBin, "wb");
		fwrite(TotalPhenotypeProtein, sizeof(int), TOTAL_PHENOTYPEPROTEINS, pFileOut);
		fflush(pFileOut);
		fclose(pFileOut);
	}
	else
	{
		MsgError(phenotypeProteinFileBin);
	}
}
Example #8
0
BOOLEAN getToken5(void)
{
    BYTE id5;
    DWORD len5=0;
    //BYTE linea[30];
    int i;
    int cantFacturas;
    int ind = 0;

    id5=get_byte();
    len5=bcd2bin(get_word());

    if( id5 != 0x05)
    {
        MsgError( "ERROR DEL TOKEN 5" );
        return FALSE;
    }

    /*memcpy( &gToken_5.nomEmpresa[0], get_pptr(), len5  );
    inc_pptr(len5);*/
    memcpy( &gToken_5.nomEmpresa[0], get_pptr(), 43 );
    inc_pptr(43);
    /*memcpy( &gToken_5.facturaEmp[0], get_pptr(), len5 - 43 );
    inc_pptr(len5 - 43);*/

    cantFacturas = bcd2bin(gToken_5.cantFacturas);
    if(cantFacturas > 20) {
        MsgError( "CANT. DE FACTURAS EXCEDIDO" );
        return FALSE;
    }

    ptrFacturas = (BYTE*)MallocMW(840);
    memcpy( ptrFacturas, get_pptr(), len5 - 43 );
    inc_pptr(len5 - 43);

    for( i=0; i<cantFacturas; i++ )
    {
        memcpy( gToken_5.facturaEmp[i].fecha, &ptrFacturas[ind], 10 );
        ind+=10;
        memcpy( gToken_5.facturaEmp[i].factura, &ptrFacturas[ind], 20 );
        ind+=20;
        memcpy( gToken_5.facturaEmp[i].valor, &ptrFacturas[ind], 12 );
        ind+=12;
    }
    FreeMW(ptrFacturas);
    return TRUE;
}
Example #9
0
static void reblock_pending_locks(struct _iofunc_lock_blocked **blocked_list, iofunc_lock_list_t **plist_head) {
	struct _iofunc_lock_blocked *bitem, *tbitem;
	iofunc_lock_list_t         *litem;
	int							type, scoid;

	bitem = *blocked_list;

	while (bitem) {
		tbitem = bitem;
		bitem = bitem->next;

		if (!tbitem->pflock) {
			MsgError(tbitem->rcvid, EINVAL);
			_iofunc_blocked_free(tbitem);
			continue;
		}

		type = tbitem->pflock->l_type;
		scoid = tbitem->pflock->l_sysid;

		//TODO: A faster lookup?
		litem = _iofunc_lock_find(*plist_head, scoid, type, tbitem->start, tbitem->end);

		if (litem) {
			if (!(tbitem->next = litem->blocked)) {
				litem->blocked = tbitem;
			}
			else {
				while (tbitem->next->next) { tbitem->next = tbitem->next->next; }
				tbitem->next->next = tbitem;
			}
			tbitem->next = NULL;
		}
		else {
			type = _iofunc_lock_scoid(plist_head, scoid, type, tbitem->start, tbitem->end);
			if (type != EOK) {
				MsgError(tbitem->rcvid, type);
				_iofunc_blocked_free(tbitem);
			}
			else {
				_iofunc_lock_unblock(*plist_head, tbitem);
			}
		}
	}
}
Example #10
0
void *srv_graph(void *v) {
	name_attach_t* pnat;
	char srv_name[BUFFER_SIZE] = SRV_NAME;
	char cmd[BUFFER_SIZE], param[BUFFER_SIZE];
	int rcvid;
	frame_t frame;
	size_t i;
	iov_t *piov, header;

	FILE * pfcfg = fopen(FILE_NAME_CFG, "r");
	if(NULL != pfcfg) {
		while(0 == feof(pfcfg)) {
			fscanf(pfcfg, "%s %s", cmd, param);
			if(0 == strcmp(cmd, "srv_name")) {
				strcpy(srv_name, param);
			}
		}
		fclose(pfcfg);
	}

	//log_start("srv_graph_log", "srv_graph_err");
	pnat = name_attach(NULL, srv_name, NAME_FLAG_ATTACH_GLOBAL);
	SETIOV(&header, &frame, sizeof(frame_t));
	while(true) {
		//log_update();
		rcvid = MsgReceivev(pnat->chid, &header, 1, NULL);
		__ERROR_CONT(rcvid, -1, MSG_ERR_MSGREC);
		if(0 == rcvid) {
			switch(frame.header.code) {
			case _PULSE_CODE_DISCONNECT:
				printf("Client has gone\n");
				break;
			case _PULSE_CODE_UNBLOCK:
				printf("_PULSE_CODE_UNBLOCK\n");
				__ERROR_CHECK(MsgError(frame.header.value.sival_int, ETIME),-1,MSG_ERR_MSGERR);
				break;
			default:
				break;
			}
		} else {
			if (frame.header.type == _IO_CONNECT) {
				printf("Send OK\n");
				frame_reply(rcvid, NULL);
				continue;
			}
			frame_datareceive(rcvid, &frame);
			frame_reply(rcvid, NULL);
			i=0;
			while(i<frame.size) {
				processtask(frame.ptask+i);
				++i;
			}
			frame_destroy(&frame);
		}
		//log_stop();
	}
}
Example #11
0
BOOLEAN ConfigMenu(void)
{
  int select = 0;

  while(TRUE)
  {
    select = MenuSelect(&KConfigMenu, select);
    if (select == -1)
      return FALSE;

    switch (select)
    {
      case 1:
    	  OperadorMenu();
        break;
      case 2:
        if( gUsers_tbl.b_type == KESPECIALISTA )
        {
          MsgError("ACCESO DENEGADO");
          break;
        }
        //TerminalMenu();
        break;
      case 3:
        if( gUsers_tbl.b_type == KESPECIALISTA )
        {
          MsgError("ACCESO DENEGADO");
          break;
        }
        CommMenu();
        break;
      case 4:
        if( gUsers_tbl.b_type == KESPECIALISTA )
        {
          MsgError("ACCESO DENEGADO");
          break;
        }
        //PruebasMenu();
        break;
    }
  }
  return TRUE;
}
Example #12
0
/**
 * This function represents server thread. Thanks to this function we can
 * receive data send by client.
 *
 * @param nth - not used but demanded by pthread_create() convencion
 * @return no value returned
 */
void* receive (void* nth) {
	my_data_t msg;
	int rcvid;
	/* Trying to register and create channel */
	if ((attach = name_attach(NULL, my_channel, 0)) == NULL) {
		std::cerr<< "Can't create Channel\n";
		exit(-1);
	}
	
	/* main loop - receiving messages */
	while(true) {
		rcvid = MsgReceive(attach->chid, &msg, sizeof(msg), NULL);
		
		/* checking if message was received correctly */
		if (rcvid == -1) {
			std::cerr<<"Error in receiving message. \n";
			break;
		}
		
		/* checking if message is a pulse */
		if (rcvid == 0) {
			switch (msg.header.code) {
				case _PULSE_CODE_DISCONNECT:
					/* Canceling client thread */
					pthread_cancel(client);
					/* Waiting for thread to finish executing */
					pthread_join(client, NULL);
					/* Closing connection and destroying channel */
					name_close(coid);
					name_detach(attach, 0);
					/* Finish server thread */
					pthread_exit (0);
			}
		}
		
		/* check if message is connection request */
		if (msg.header.type == _IO_CONNECT) {
			MsgReply(rcvid, EOK, NULL, 0);
			continue;
		}
		
		/* chcek id message is unimplemented system communicate */
		if (msg.header.type > _IO_BASE && msg.header.type <= _IO_MAX) {
			MsgError (rcvid, ENOSYS);
			continue;
		}
		printf("\n");
		printf("[%s]: %s\n", stranger_channel, msg.data);
		printf("[%s]: ", my_channel);
		fflush(stdout);
		//std::cout<<"Server received: " << msg.data<< "\n ";
		MsgReply(rcvid, EOK, NULL, 0);
	}
}
Example #13
0
BOOLEAN getToken96(void) {
    BYTE id96;
    DWORD len96=0;

    id96=get_byte();
    len96=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);
    if(len96 > 16) {
        MsgError( "LONG. TOKEN 96 ERRADA" );
        return FALSE;
    }
    if( id96 != 0x96)
    {
        MsgError( "ERROR DEL TOKEN 96" );
        return FALSE;
    }
    memcpy( &gToken_96, get_pptr(), len96  );
    inc_pptr(len96);
    return TRUE;
}
Example #14
0
BOOLEAN getToken14(void)
{
    BYTE id14;
    DWORD len14=0;

    id14=get_byte();
    len14=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);
    if(len14 > 139) {
        MsgError( "LONG. TOKEN 14 ERRADA" );
        return FALSE;
    }
    if( id14 != 0x14)
    {
        MsgError( "ERROR DEL TOKEN 14" );
        return FALSE;
    }
    memcpy( &gToken_14.nombre[0], get_pptr(), len14  );
    inc_pptr(len14);
    return TRUE;
}
Example #15
0
void _iofunc_lock_free(iofunc_lock_list_t *lockp) {
	if (lockp) {
		while (lockp->blocked) {
			struct _iofunc_lock_blocked *tmp;
			MsgError(lockp->blocked->rcvid, ENOENT);
			tmp = lockp->blocked;
			lockp->blocked = lockp->blocked->next;
			_iofunc_blocked_free(tmp);
		}
		free(lockp);
	}
}
Example #16
0
BOOLEAN getToken6(void)
{
    BYTE id6;
    DWORD len6=0;

    id6=get_byte();
    len6=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);
    if(len6 > 86) {
        MsgError( "LONG. TOKEN 6 ERRADA" );
        return FALSE;
    }
    if( id6 != 0x06)
    {
        MsgError( "ERROR DEL TOKEN 6" );
        return FALSE;
    }
    memcpy( &gToken_6.nomEmpresa[0], get_pptr(), len6  );
    inc_pptr(len6);
    return TRUE;
}
Example #17
0
BOOLEAN getToken39(void)
{
    BYTE id39;
    DWORD len39=0;

    id39=get_byte();
    len39=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);
    if(len39 > 3) {
        MsgError( "LONG. TOKEN 39 ERRADA" );
        return FALSE;
    }
    if( id39 != 0x39)
    {
        MsgError( "ERROR DEL TOKEN 39" );
        return FALSE;
    }
    memcpy( &gToken_39, get_pptr(), len39  );
    inc_pptr(len39);
    return TRUE;
}
Example #18
0
bool ProjectGenerator::GenerateFile(const nglPath& src, const nglPath& dst)
{
  uint32 srcsize = (uint32)src.GetSize();
  
  nglIStream* pFile = src.OpenRead();
  if (!pFile)
  {
    nglString msg;
    msg.Format(_T("reading input file '%ls'"), src.GetChars());
    return MsgError(msg);
  }

  char* str = new char[srcsize + 1];
  pFile->Read(str, srcsize, 1);
  str[srcsize] = 0;
  delete pFile;
  
  nglString contents(str);
  contents.Replace(_T("TemplateApp"), mProjectName);
  contents.Replace(_T("../../../nui3"), mNuiRelativeSource.GetPathName());

  
  nglOStream* poFile = dst.OpenWrite(false);
  if (!poFile)
  {
    nglString msg;
    msg.Format(_T("writing output file '%ls'"), dst.GetChars());
    return MsgError(msg);
  }

  char* ptr = contents.Export();
  
  poFile->Write(ptr, contents.GetLength(), 1);
  delete poFile;
  if (ptr)
    free(ptr);

  NGL_OUT(_T("nui project generator : generated '%ls'\n"), dst.GetChars());
  return true;
}
Example #19
0
BOOLEAN getToken98(void)
{
    BYTE numCuentas[3],entero=0, id98;
    DWORD i=0,len98;

    memset(numCuentas,0x00,sizeof(numCuentas));


    id98=get_byte();
    len98=bcd2bin(get_word());
    //get_mem(len98,2);

    if (id98 !=0x98)
    {
        MsgError( "ERROR DEL TOKEN 98" );
        return FALSE;
    }
    entero=get_byte();
    split(numCuentas,&entero,1);
    memset(gInfo_98[0].cantCuentas,0x00,sizeof(gInfo_98[0].cantCuentas));
    memcpy( gInfo_98[0].cantCuentas, numCuentas, 2 );

    //printf("NumCuentas = %d", atoi(numCuentas));WaitKey(3000, 0);

    if( atoi(numCuentas) > 5) {
        MsgError( "MAX. CUENTAS SUPERADO" );
        return FALSE;
    }

    for( i = 0; i < atoi(numCuentas); i++ )
    {
        //printf("\fi = %d", i);WaitKey(3000, 0);
        memcpy( gInfo_98[i].cuentas, get_pptr(), 18 );  // Longitud de las cuentas
        inc_pptr(18);
    }
    return TRUE;
}
Example #20
0
BOOLEAN getToken3(BYTE pagTarjeta)
{
    BYTE id3;
    DWORD len3=0;

    id3=get_byte();
    len3=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);
    if(len3 > 58) {
        MsgError( "LONG. TOKEN 3 ERRADA" );
        return FALSE;
    }
    if( id3 != 0x03)
    {
        MsgError( "ERROR DEL TOKEN 3" );
        return FALSE;
    }
    if(pagTarjeta)
        memcpy( &gToken_3ptc.tipoTarjeta[0], get_pptr(), len3  );
    else
        memcpy( &gToken_3psp.codEmpresa[0], get_pptr(), len3  );
    inc_pptr(len3);
    return TRUE;
}
Example #21
0
BOOLEAN getToken1(void)
{
    DWORD len1=0;
    BYTE id1=0;
    id1=get_byte();
    //printf("\fToken = %02X", id1);APM_WaitKey(3000, 0);
    len1=bcd2bin(get_word());
    if (id1 != 0x01)
    {
        MsgError( "ERROR DEL TOKEN 1" );
        return FALSE;
    }
    get_mem( gToken_1.version, 5 );
    return TRUE;

}
Example #22
0
BOOLEAN getToken11(void)
{
    BYTE id11;
    DWORD len11=0;

    id11=get_byte();
    len11=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);

    if( id11 != 0x11)
    {
        MsgError( "ERROR DEL TOKEN 11" );
        return FALSE;
    }
    memcpy( &gToken_11.banco_credito[0], get_pptr(), len11  );
    inc_pptr(len11 );
    return TRUE;
}
Example #23
0
BOOLEAN getToken47(void)
{
    BYTE id47;
    DWORD len47=0;

    id47=get_byte();
    len47=bcd2bin(get_word());
    //printf("\fLen47 = %d", len47);WaitKey(3000, 0);

    if(id47 !=0x47)
    {
        MsgError( "ERROR DEL TOKEN 47" );
        return FALSE;
    }
    memcpy( &gToken_47.cedula_ruc[0], get_pptr(), len47  );
    inc_pptr(len47);
    return TRUE;
}
Example #24
0
BOOLEAN getToken15(void)
{
    BYTE id15;
    DWORD len15=0;

    id15=get_byte();
    len15=bcd2bin(get_word());
    //printf("\fLen11 = %d", len11);WaitKey(3000, 0);

    if( id15 != 0x15)
    {
        MsgError( "ERROR DEL TOKEN 15" );
        return FALSE;
    }
    memcpy( &gToken_15.nombre[0], get_pptr(), len15  );
    inc_pptr(len15);
    return TRUE;
}
Example #25
0
BOOLEAN getToken80(void)
{
    DWORD len80=0;
    BYTE id80=0;

    id80=get_byte();
    len80=bcd2bin(get_word());
    //printf("\fLen80 = %d", len80);WaitKey(3000, 0);

    if (id80 != 0x80)
    {
        MsgError( "ERROR DEL TOKEN 80" );
        return FALSE;
    }
    memcpy( &gToken_80.timeMaxConnect[0], get_pptr(), len80 );
    inc_pptr(len80);
    return TRUE;
}
Example #26
0
static int wait_unblock(resmgr_context_t *ctp, io_pulse_t *msg, void *ocb) {
	PROCESS						*prp;
	struct _msg_info			info;
	pid_t						pid;

	pid = ctp->info.pid;
	if(ND_NODE_CMP(ctp->info.nd, ND_LOCAL_NODE) != 0) {
		/* unblock for wait over network */

		pid = pathmgr_netmgr_pid();
		if(pid == 0) {
			/* netmgr is gone */
			return _RESMGR_NOREPLY;
		}
	}

	if((prp = proc_lock_pid(pid))) {
		// msg will be NULL if we're called from wait_close_ocb()
		if(msg && ((MsgInfo(ctp->rcvid, &info) == -1) || !(info.flags & _NTO_MI_UNBLOCK_REQ))) {
			proc_unlock(prp);
			return _RESMGR_NOREPLY;
		}
		if((prp->flags & (_NTO_PF_LOADING | _NTO_PF_TERMING)) == 0) {
			struct wait_entry			*p, **pp;

			for(pp = &prp->wap; (p = *pp); pp = &p->next) {
				if(p->rcvid == ctp->rcvid) {
					*pp = p->next;

					if(prp->wap == NULL) {
						(void)_resmgr_unbind(&ctp->info);
					}
					MsgError(ctp->rcvid, EINTR);
					proc_object_free(&wait_souls, p);
					break;
				}
			}
		}
		proc_unlock(prp);
	}
	return _RESMGR_NOREPLY;
}
Example #27
0
BOOLEAN getToken48(void)
{
    BYTE id48;
    DWORD len48=0;

    id48=get_byte();
    len48=bcd2bin(get_word());
    //printf("\fLen47 = %d", len47);WaitKey(3000, 0);

    if(id48 !=0x48)
    {
        MsgError( "ERROR DEL TOKEN 47" );
        return FALSE;
    }
    memcpy( &gToken_48.numero_kit[0], get_pptr(), 5  );
    inc_pptr(5);
    memcpy( &gToken_48.nombre[0], get_pptr(), 5  );
    inc_pptr(6);
    return TRUE;
}
Example #28
0
BOOLEAN getToken81(void)
{
    DWORD len81=0,tam=0;
    BYTE id81;

    id81=get_byte();
    len81=bcd2bin(get_word());

    //printf("\fID: %02X", id81);WaitKey(3000, 0);
    if( id81 != 0x81)
    {
        MsgError( "ERROR DEL TOKEN 81" );
        return FALSE;
    }
    get_mem(&gToken_81.fecha[0], len81);
    tam=ByteBcd2Int(gToken_81.lenMsg);
    memcpy(gMsgInit, gToken_81.msgInit, tam);

    return TRUE;
}
Example #29
0
BOOLEAN getToken97(void)
{
    DWORD len97=0;
    BYTE id97=0;

    id97=get_byte();
    len97=bcd2bin(get_word());

    if (id97 != 0x97)
    {
        MsgError( "ERROR DEL TOKEN 97" );
        return FALSE;
    }
    get_mem(&gtoken_97.worKeyPin[0],len97);
    //get_mem(gtoken_97.worKeyPin, 16);
    //get_mem(gtoken_97.worTrack2, 16);

    return TRUE;

}
// =========================================================================
// Setup menu
// Returns: Menu HWND, or NULL on failure
HWND SetupMenu_NonSoftkey(HWND hWnd, int menuID)
{
    HWND retval = NULL;
    SHMENUBARINFO mbi;

    // Setup menu...
    memset(&mbi, 0, sizeof(mbi));

    mbi.cbSize     = sizeof(mbi);
    mbi.hwndParent = hWnd;

    if (menuID == IDR_MENU_NULL)
        {
        mbi.dwFlags = SHCMBF_EMPTYBAR;
        mbi.nToolBarId = 0;
        }
    else
        {
        // Needed if mbi.nToolBarId is a menu ID
        mbi.dwFlags = SHCMBF_HMENU;
        mbi.nToolBarId = menuID;
        }
                                       
    mbi.hInstRes   = G_hInstance;
    mbi.nBmpId     = 0;
    mbi.cBmpImages = 0; 

    if (!(SHCreateMenuBar(&mbi)))
        {
        MsgError(hWnd, TEXT("SHCreateMenuBar Failed"));
        }
    else
        {
        retval = mbi.hwndMB;        
        }

    return retval;
}