unsigned int _create_task(unsigned char tsk_no,void (*func)(void),unsigned char sys_size,unsigned char data_size,unsigned char state) { unsigned int i; for(i=0;i<(33+sys_size+data_size);i++){ *(_mem_ptr-i)='@'; } *(_mem_ptr--) = (unsigned int)func % 256; // task starting address *(_mem_ptr--) = (unsigned int)func >> 8; _mem_ptr-=31; memcpyf(_mem_ptr, "NGUYEN_THANH_SON^^DT:0949109985", 31 ); _task_system_stack[tsk_no] = (unsigned int)(_mem_ptr--); _mem_ptr -= (sys_size>0)?(sys_size):DEFAULT_SYS_STACK_SIZE; _task_data_stack[tsk_no] = (unsigned int) (_mem_ptr--); _mem_ptr -= (data_size>0)?(data_size):DEFAULT_DATA_STACK_SIZE; _task_status[tsk_no] = state; _task_tick_count[tsk_no] = 0; tsk_no++; // increment this value for task_count if (_task_count < tsk_no) _task_count = tsk_no; return 33+(unsigned int)sys_size+data_size; }
/*** * Gets the destination list for a print q. * * Q name is arg. Destination list is in Buffer on EXIT. */ VOID NEAR get_print_devices(TCHAR FAR * queue) { USHORT available; PRQINFO FAR * q_info; if (DosPrintQGetInfo(NULL, queue, 1, (LPBYTE)Buffer, LITTLE_BUF_SIZE, &available)) { *Buffer = NULLC; return; } q_info = (PRQINFO FAR *)Buffer; /* Does _tcscpy deal with overlapping regions? */ memcpyf(Buffer, q_info->pszDestinations, (_tcslen(q_info->pszDestinations)+1) * sizeof(TCHAR)); }