void clsCMM::MakeTelegraph(ADDRESSEDPACKAGE *pPackage, TELEGRAPH *pTele) { int size = pPackage->package.size; pTele->size = size+6; unsigned short sum = CheckSum(pPackage->package.content, pPackage->package.size); char *content = pTele->content; content[0] = 0x80 | pPackage->from; //ground station content[1] = 0x80 | pPackage->to; PUTWORD(content, size); // (short &)content[2] = size; //size ::memcpy(content+4, pPackage->package.content, size); //package PUTWORD(content+4+size, sum); // (unsigned short &)content[4+size] = sum; //check }
void IT_GLOBALENTRYHANDLE (ENV *envp,LONGPROC f) { DWORD retcode,dwSize; UINT uSel,uIndex; LPBYTE lpData; GLOBALENTRY ge; LPMODULEINFO lpModInfo; extern MODULEINFO *lpModuleTable[]; lpData = (LPBYTE)GetAddress(GETWORD(SP+8), GETWORD(SP+6)); dwSize = GETDWORD(lpData); if (dwSize != (3*DWORD_86 + HANDLE_86 + 3*WORD_86 + INT_86 + HANDLE_86 + 2*WORD_86 + 2*DWORD_86)) retcode = 0; else { ge.dwSize = sizeof(GLOBALENTRY); uSel = (UINT)GETWORD(SP+4); if ((retcode = (DWORD)GlobalEntryHandle(&ge,GetSelectorHandle(uSel)))) { PUTDWORD(lpData+4,ge.dwAddress); PUTDWORD(lpData+8,ge.dwBlockSize); PUTWORD(lpData+12,ge.hBlock); PUTWORD(lpData+14,ge.wcLock); PUTWORD(lpData+16,ge.wcPageLock); PUTWORD(lpData+18,ge.wFlags); PUTWORD(lpData+20,ge.wHeapPresent); #ifdef LATER PUTWORD(lpData+22,ge.hOwner); #else /* this is a kludge to run DELPHI */ if (!(uIndex = (UINT)GetModuleIndex(uSel))) /* this is an index for KERNEL (maybe!) */ uIndex = 1; lpModInfo = lpModuleTable[uIndex]; PUTWORD(lpData+22,lpModInfo->ObjHead.hObj); #endif PUTWORD(lpData+24,ge.wType); PUTWORD(lpData+26,ge.wData); PUTDWORD(lpData+28,ge.dwNext); PUTDWORD(lpData+32,ge.dwNextAlt); } } envp->reg.sp += LP_86 + HANDLE_86 + RET_86; envp->reg.ax = LOWORD(retcode); envp->reg.dx = HIWORD(retcode); }
void clsCMM::MakeTelegraph(TELEGRAPH *pTele, short code, double time, const void *pData, int nDataSize) { char *pBuffer = pTele->content; pBuffer[0] = 0x80 | _HELICOPTER; pBuffer[1] = 0x80 | ID_STATION; //ground station // (short &)pBuffer[2] = nDataSize+10; // (short &)pBuffer[4] = code; // (double &)pBuffer[6] = time; PUTWORD(pBuffer+2, nDataSize+10); PUTWORD(pBuffer+4, code); PUTDOUBLE(pBuffer+6, time); ::memcpy(pBuffer+14, pData, nDataSize); unsigned short sum = CheckSum(pBuffer+4, 10+nDataSize); PUTWORD(pBuffer+14+nDataSize, sum); pTele->size = nDataSize + 16; }
void IT_UNBLOCKSERVER (ENV *envp,LONGPROC f) /* OleUnblockServer */ { DWORD retcode; LPBYTE lpData; BOOL flag; lpData = (LPBYTE)GetAddress(GETWORD(SP+6),GETWORD(SP+4)); flag = (BOOL)GETWORD(lpData); retcode = (f)((LHSERVER)GETDWORD(SP+8),&flag); PUTWORD(lpData,(WORD)flag); envp->reg.sp += LONG_86 + LP_86 + RET_86; envp->reg.ax = LOWORD(retcode); envp->reg.dx = HIWORD(retcode); }
/* ** SendFileNo -- send the name of a bootable file to the requester. ** ** Parameters: ** req - RMP BOOT packet containing the request. ** rconn - the reply packet to be formatted. ** filelist - list of files available to the requester. ** ** Returns: ** 1 on success, 0 on failure. ** ** Side Effects: ** none. */ int SendFileNo(struct rmp_packet *req, RMPCONN *rconn, char *filelist[]) { struct rmp_packet *rpl; char *src, *dst; u_int8_t *size; int i; GETWORD(req->r_brpl.rmp_seqno, i); /* SeqNo is really FileNo */ rpl = &rconn->rmp; /* cache ptr to RMP packet */ /* * Set up assorted fields in reply packet. */ rpl->r_brpl.rmp_type = RMP_BOOT_REPL; PUTWORD(i, rpl->r_brpl.rmp_seqno); i--; rpl->r_brpl.rmp_session = 0; rpl->r_brpl.rmp_version = htons(RMP_VERSION); size = &rpl->r_brpl.rmp_flnmsize; /* ptr to length of filename */ *size = 0; /* init length to zero */ /* * Copy the file name into the reply packet incrementing the * length as we go. Stop at end of string or when RMPBOOTDATA * characters have been copied. Also, set return code to * indicate success or "no more files". */ if (i < C_MAXFILE && filelist[i] != NULL) { src = filelist[i]; dst = (char *)&rpl->r_brpl.rmp_flnm; for (; *src && *size < RMPBOOTDATA; (*size)++) { if (*src == '\0') break; *dst++ = *src++; } rpl->r_brpl.rmp_retcode = RMP_E_OKAY; } else rpl->r_brpl.rmp_retcode = RMP_E_NODFLT; rconn->rmplen = RMPBOOTSIZE(*size); /* set packet length */ return(SendPacket(rconn)); /* send packet */ }