Пример #1
0
QList<Account*>* ConnectionManager::GetAccountList(bool refresh) throw (const char*, QString)
{
    if (accountList != NULL && refresh)
    {
       accountList = NULL;
       groupList = NULL;
    }
    else if(accountList != NULL && !refresh)
    {
        return accountList;
    }

    QNetworkRequest request(QUrl(getCS(ConnectionManager::AccountList)));
    QNetworkReply *accountListReply = netManager->get(request);

    QEventLoop eventLoop;
    connect(accountListReply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
    eventLoop.exec();

    QString reply = QString::fromUtf8(accountListReply->readAll());

    delete accountListReply;

    QString result = getResult(reply);

    try
    {
        AccountListParser accountListParser(result);

        accountList = accountListParser.parse<Account>();
        groupList = accountListParser.parse<Group>();

        QNetworkRequest request2(QUrl(getCS(ConnectionManager::BalanceList)));
        QNetworkReply *balanceListReply = netManager->get(request2);

        QEventLoop eventLoop2;
        connect(balanceListReply, SIGNAL(finished()), &eventLoop2, SLOT(quit()));
        eventLoop2.exec();

        QString reply2 = QString::fromUtf8(balanceListReply->readAll());

        delete balanceListReply;

        QString result2 = getResult(reply2);

        BalanceListParser balanceListParser(result2);

        balanceListParser.parse(accountList);

        return accountList;
    }
    catch (const char* message)
    {
        throw message;
    }
    catch (QString message)
    {
        throw message;
    }
}
Пример #2
0
	void TransferApi::loadTransfers() noexcept {
		// add the existing connections
		{
			auto cm = ConnectionManager::getInstance();
			RLock l(cm->getCS());
			for (const auto& d : cm->getTransferConnections(true)) {
				auto info = addTransfer(d, "Inactive, waiting for status updates");
				updateQueueInfo(info);
			}

			for (const auto& u : cm->getTransferConnections(false)) {
				addTransfer(u, "Inactive, waiting for status updates");
			}
		}

		{
			auto um = UploadManager::getInstance();
			RLock l(um->getCS());
			for (const auto& u : um->getUploads()) {
				if (u->getUserConnection().getState() == UserConnection::STATE_RUNNING) {
					on(UploadManagerListener::Starting(), u);
				}
			}
		}

		{
			auto dm = DownloadManager::getInstance();
			RLock l(dm->getCS());
			for (const auto& d : dm->getDownloads()) {
				if (d->getUserConnection().getState() == UserConnection::STATE_RUNNING) {
					starting(d, "Downloading", true);
				}
			}
		}
	}
Пример #3
0
static BOOL
win32_alloc_scheme_selectors (unsigned long base,
			      unsigned long size,
			      unsigned short * scheme_cs,
			      unsigned short * scheme_ds,
			      unsigned short * scheme_ss)
{
  BOOL result;
  struct ntw32lib_selalloc_s param;
  LPVOID translation[1];

  param.base = base;
  param.limit = ((size + (I386_PAGE_SIZE - 1)) & (~ (I386_PAGE_SIZE - 1)));
  param.cs32 = (getCS ());
  param.ds32 = (getDS ());
  param.cs = 0;
  param.ds = 0;
  param.ss = 0;
  translation[0] = ((LPVOID) NULL);
  result = ((BOOL)
	    ((* call_16_bit_code) (& param, NTW32LIB_ALLOC_SELECTORS,
				   &translation[0])));
  * scheme_cs = param.cs;
  * scheme_ds = param.ds;
  * scheme_ss = param.ss;
  return (result);
}
Пример #4
0
//creates the signal stack and puts it on the process stack
void signalCreate(struct pcbHeader* pcb, int signal)
{
    struct signalFrame * frame = (long)pcb->esp - sizeof(struct signalFrame);
    frame->oldsp = pcb->esp;
    frame->handler = pcb->handlers[signal];
    frame->context= pcb->handlers[signal]; //TODO: find out what to put in context
    frame->oldIgnoredSignals= pcb->ignoredSignals; //TODO: find out what to put in context
    struct contextFrame *ctx = (long)frame - sizeof(struct contextFrame);
    //Registers
    ctx->edi = 0;
    ctx->esi = 0;
    ctx->ebp = 0;
    ctx->esp = 0;
    ctx->ebx = 0;
    ctx->edx = 0;
    ctx->ecx = 0;
    ctx->eax = 0;
    //Instruction pointer
    ctx->iret_eip = sigtramp;
    // code segment
    ctx->iret_cs = getCS();
    // status flags
    ctx->eflags = 0x00003200;
    //why doesn't this need a spot for EBP?
    ctx->retAdd = &sysstop;
    //Change the pcb's esp to the sigtramp context
    pcb->esp = ctx;
    pcb->ignoredSignals = 0xFFFFFFFF << signal + 1;

}
Пример #5
0
static VOID WINAPI DosSystemBop(LPWORD Stack)
{
    /* Get the Function Number and skip it */
    BYTE FuncNum = *(PBYTE)SEG_OFF_TO_PTR(getCS(), getIP());
    setIP(getIP() + 1);

    switch (FuncNum)
    {
        case 0x11:  // Load the DOS kernel
        {
            BOOLEAN Success = FALSE;
            HANDLE  hDosKernel;
            ULONG   ulDosKernelSize = 0;

            DPRINT1("You are loading Windows NT DOS!\n");

            /* Open the DOS kernel file */
            hDosKernel = FileOpen("ntdos.sys", &ulDosKernelSize);

            /* If we failed, bail out */
            if (hDosKernel == NULL) goto Quit;

            /*
             * Attempt to load the DOS kernel into memory.
             * The segment where to load the DOS kernel is defined
             * by the DOS BIOS and is found in DI:0000 .
             */
            Success = FileLoadByHandle(hDosKernel,
                                       REAL_TO_PHYS(TO_LINEAR(getDI(), 0x0000)),
                                       ulDosKernelSize,
                                       &ulDosKernelSize);

            DPRINT1("Windows NT DOS loading %s at 0x%04X:0x%04X, size 0x%x ; GetLastError() = %u\n",
                    (Success ? "succeeded" : "failed"),
                    getDI(), 0x0000,
                    ulDosKernelSize,
                    GetLastError());

            /* Close the DOS kernel file */
            FileClose(hDosKernel);

Quit:
            if (!Success)
            {
                /* We failed everything, stop the VDM */
                EmulatorTerminate();
            }

            break;
        }

        default:
        {

            DPRINT1("Unknown DOS System BOP Function: 0x%02X\n", FuncNum);
            // setCF(1); // Disable, otherwise we enter an infinite loop
            break;
        }
    }
}
Пример #6
0
QString ConnectionManager::getTransactionSaveCS(
        int accountId,
        int factor,
        bool isTrans,
        float total,
        int curencyId,
        int categoryId,
        QString date,
        QString description,
        int transAccountId,
        float transTotal,
        int transCurencyId,
        bool isPlan,
        QString guid)
{
    QString connString = getCS(ConnectionManager::TransactionSave);
    connString.replace("[accountId]", QString::number(accountId));
    connString.replace("[factor]", QString::number(factor));
    connString.replace("[isTrans]", QVariant(isTrans).toString());
    connString.replace("[total]", QString::number(total));
    connString.replace("[curencyId]", QString::number(curencyId));
    connString.replace("[categoryId]", QString::number(categoryId));
    connString.replace("[date]", date);
    connString.replace("[description]", description);
    connString.replace("[transAccountId]", QString::number(transAccountId));
    connString.replace("[transTotal]", QString::number(transTotal));
    connString.replace("[transCurencyId]", QString::number(transCurencyId));
    connString.replace("[isPlan]", QVariant(isPlan).toString());
    connString.replace("[guid]", guid);

    return connString;
}
Пример #7
0
void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept{
	const string& message = c.getParam(0);
	OnlineUserPtr peer = nullptr;
	OnlineUserPtr me = nullptr;

	auto cm = ClientManager::getInstance();
	{
		RLock l(cm->getCS());
		peer = cm->findOnlineUser(user->getCID(), getHubUrl());
		//try to use the same hub so nicks match to a hub, not the perfect solution for CCPM, nicks keep changing when hubs go offline.
		if(peer && peer->getHubUrl() != hubUrl) 
			setHubUrl(peer->getHubUrl());
		me = cm->findOnlineUser(cm->getMe()->getCID(), getHubUrl());
	}

	if (!me || !peer){ //ChatMessage cant be formatted without the OnlineUser!
		disconnect(true);
		return;
	}

	if (echo) {
		std::swap(peer, me);
	}

	string tmp;

	auto msg = make_shared<ChatMessage>(message, peer, me, peer);
	if (c.getParam("TS", 1, tmp)) {
		msg->setTime(Util::toInt64(tmp));
	}

	msg->setThirdPerson(c.hasFlag("ME", 1));
	fire(UserConnectionListener::PrivateMessage(), this, msg);
}
Пример #8
0
/**
	Takes two parameters, a reference (function pointer) to the start 
	of the process, and an integer denoting the amount of stack to allocate for the 
	process. Returns the new process’ pid on success and −1 on failure
*/
int      create( funcptr fp, int stackSize ) {
/***********************************************/

    context_frame       *contextFrame;
    pcb                 *process = NULL;

    if( stackSize < PROC_STACK ) {
        stackSize = PROC_STACK;
    }

    process = getNextProcess();

    if( !process ) {
        return( -1 );
    }

    contextFrame = kmalloc(stackSize * 2);

    if( !contextFrame ) {
        return( -1 );
    }

    contextFrame = (context_frame *)((int)contextFrame + stackSize - 4);
    contextFrame--;
    
    memset(contextFrame, 0x81, sizeof( context_frame ));
    
    contextFrame->iret_cs = getCS();
    contextFrame->iret_eip = (unsigned int)fp;
    contextFrame->eflags = STARTING_EFLAGS;

    contextFrame->esp = (int)(contextFrame + 1);
    contextFrame->ebp = contextFrame->esp;
    unsigned int* procStackPtr = (unsigned int*) contextFrame->ebp;
    *procStackPtr = getSysStopAddr();
    //procStackPtr++;
    
    process->esp = (int)contextFrame;
    process->state = STATE_READY;
    
    // move this into getNextProcess()?
    if (nextpid > MAX_PROC) {
        process->pid += MAX_PROC;
    }
    
    nextpid++;
    process->senderQueue = 0;
    
   // kprintf("ebp: %d, &ebp: %d, esp: %d, &esp: %d, systop: %d\n", 
   //     contextFrame->ebp, &contextFrame->ebp, contextFrame->esp, &contextFrame->esp, getSysStopAddr());
    
    // TODO: Do I need to subtract the context size or anything? Related to the magic #132?
    process->stackSize = stackSize;

    if (fp != idleproc) {
        ready(process);
    }
    
    return( process->pid );
}
Пример #9
0
static VOID WINAPI VidBiosINT(LPWORD Stack)
{
    /*
     * Set up a false stack to hardwire the BOP function (that can directly
     * manipulate CPU registers) to the 32-bit interrupt function (which uses
     * the stack to be able to modify the original CS:IP and FLAGS).
     *
     * See int32.h stack codes.
     */
    WORD EmuStack[4];
    DWORD Flags = getEFLAGS();

    DPRINT1("Calling BOP VidBiosINT\n");

    EmuStack[STACK_FLAGS]   = LOWORD(Flags);
    EmuStack[STACK_CS]      = getCS();
    EmuStack[STACK_IP]      = getIP();
    EmuStack[STACK_INT_NUM] = BOP_VIDEO_INT;

    VidBiosVideoService(EmuStack);

    setIP(EmuStack[STACK_IP]);
    setCS(EmuStack[STACK_CS]);
    setEFLAGS(MAKELONG(EmuStack[STACK_FLAGS], HIWORD(Flags)));
}
Пример #10
0
void MS_bop_D(void)
{
#ifdef MONITOR
    extern VOID MonitorEndIretHook(VOID);
    half_word iret_index;


    // get iret index
    iret_index = *Sim32GetVDMPointer(SEGOFF(getCS(),getIP()),
                                     1,
                                     (UCHAR)(getPE() ? TRUE : FALSE)
                                     );

    // Tell ica that an iret bop has been called
    ica_iret_hook_called((int) iret_index);

    //
    // Clean up stack, and resume normal code path
    //
    MonitorEndIretHook();
#else
    illegal_bop();
#endif

}
Пример #11
0
void MS_bop_8 (void)
{
    ULONG iFunc;
    UCHAR uchMode = getMSW() & MSW_PE ? TRUE : FALSE;


    // Get the Function Number
    iFunc = (ULONG)(*Sim32GetVDMPointer(SEGOFF(getCS(),getIP()),
                                        1,
                                        uchMode
                                        ));

    switch (iFunc) {
    case 0:    /* RegisterModule */
        ISV_RegisterModule (uchMode);
        break;
    case 1:    /* DeRegisterModule */
        ISV_DeRegisterModule ();
        break;
    case 2:    /* DispatchCall */
        ISV_DispatchCall ();
        break;
    default:
        setCF(1);
    }
    setIP((USHORT)(getIP() + 1));
    return;
}
Пример #12
0
VOID xmsNotifyHookI15 (VOID)
{
    UpdateKbdInt15(getCS(), getAX());

    setCX((USHORT)(xmsMemorySize));
    return;
}
Пример #13
0
void MsBop0(){

    DemDispatch((ULONG)(*Sim32GetVDMPointer(
        ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
    setIP(getIP() + 1);

}
Пример #14
0
void MessageManager::loadUsers() {
    try {
        SimpleXML xml;
        SettingsManager::loadSettingFile(xml, CONFIG_DIR, CONFIG_NAME);
        auto cm = ClientManager::getInstance();
        if (xml.findChild("Ignored")) {
            xml.stepIn();
            xml.resetCurrentChild();
            if (xml.findChild("Users")) {
                xml.stepIn();
                while (xml.findChild("User")) {
                    UserPtr user = cm->getUser(CID(xml.getChildAttrib("CID")));
                    {
                        WLock(cm->getCS());
                        cm->addOfflineUser(user, xml.getChildAttrib("Nick"), xml.getChildAttrib("Hub"), (uint32_t)xml.getIntChildAttrib("LastSeen"));
                    }
                    WLock l(Ignorecs);
                    ignoredUsers.emplace(user);
                    user->setFlag(User::IGNORED);
                }
                xml.stepOut();
            }
            xml.stepOut();
        }
    }
    catch (const Exception& e) {
        LogManager::getInstance()->message(STRING_F(LOAD_FAILED_X, CONFIG_NAME % e.getError()), LogManager::LOG_ERROR);
    }
}
Пример #15
0
int      create( funcptr fp, int stack ) {
/***********************************************/

    context_frame       *cf;
    pcb                 *p = NULL;
    int                 i;

    if( stack < PROC_STACK ) {
        stack = PROC_STACK;
    }

    for( i = 0; i < MAX_PROC; i++ ) {
        if( proctab[i].state == STATE_STOPPED ) {
            p = &proctab[i];
            break;
        }
    }

    if( !p ) {
        return( -1 );
    }


    cf = kmalloc( stack*2);
    p->stack_top = (long) cf;
    if( !cf ) {
        return( -1 );
    }

    cf = (context_frame *)((int)cf + stack - 4);
    cf--;

    memset(cf, 0x81, sizeof( context_frame ));

    cf->iret_cs = getCS();
    cf->iret_eip = (unsigned int)fp;
    cf->eflags = STARTING_EFLAGS;

    cf->esp = (int)(cf + 1);
    cf->ebp = cf->esp;
    //set what ebp points to to the address of systop
    //allows the return key word to run sysstop();
    int *ptr = (int*)cf->esp;
    *ptr = (int)&sysstop;
    
    p->esp = (int)cf;
    p->state = STATE_READY;
	//message queues initialized to null

    
    if(p->pid == 0){
    	p->pid = i+1;
    	}
    else{
    	p->pid *= MAX_PROC;
    	}
    ready( p );
    return( p->pid );
}
Пример #16
0
	BundleList QueueApi::getBundleList() noexcept {
		BundleList bundles;
		auto qm = QueueManager::getInstance();

		RLock l(qm->getCS());
		boost::range::copy(qm->getBundles() | map_values, back_inserter(bundles));
		return bundles;
	}
Пример #17
0
	QueueItemList QueueApi::getFileList() noexcept {
		QueueItemList items;
		auto qm = QueueManager::getInstance();

		RLock l(qm->getCS());
		boost::range::copy(qm->getFileQueue() | map_values, back_inserter(items));
		return items;
	}
Пример #18
0
void MsBop5()
{
#ifdef NTVDM_NET_SUPPORT
    VrDispatch((ULONG)(*Sim32GetVDMPointer(
        ((ULONG)getCS() << 16) + (getIP()), 1, FALSE)));
    setIP(getIP() + 1);
#endif
}
Пример #19
0
// XMS BOP
void MS_bop_2(void) {
    XMSDispatch((ULONG)(*Sim32GetVDMPointer(SEGOFF(getCS(),getIP()),
                                            1,
                                            FALSE
                                            )));

    setIP((USHORT)(getIP() + 1));
}
Пример #20
0
void MS_bop_4(void)
{
    half_word Command;
    IMPORT BOOL CmdDispatch(ULONG);

    sas_load( ((ULONG)getCS()<<4) + getIP(), &Command);
    CmdDispatch((ULONG) Command);
    setIP((USHORT)(getIP() + 1));
}
Пример #21
0
struct pcbHeader* createProcess(void (*func)(), int stack)
{
    void *memPtr = (void *) kmalloc(stack);    
    
    // the memory pointer should not be null

    struct pcbHeader * pcb = popQueue(&stoppedHead);
    if (memPtr == NULL || pcb == NULL)
    {
        return NULL;
    }
    //prevent runnig of the end of the process table

    //kprintf("CREATE: allocating memory at %x,stack size = %d, pcbaddress = %x\n", memPtr, stack, pcb);
    struct contextFrame *ctx = (long)memPtr + stack - SAFETY_MARGIN - sizeof(struct contextFrame);
    //Initialize pcb Header
    //find a pcb spot
    //Assign the pid and increment
    pcb->pid = pidCounter++;
    //limite the pid values
    if(pidCounter > 10000)
    {
        pidCounter = 2;
    }
    pcb->state = READY;
    pcb->memStart = memPtr;
    pcb->esp = ctx;
    pcb->next = NULL;
    pcb->ignoredSignals = 0xFFFFFFFF;
    pcb->handledSignals = 0x00000000;
    pcb->incomingSignals = 0x00000000;
    pcb->fdt[0]= NULL;
    pcb->fdt[1]= NULL;
    pcb->fdt[2]= NULL;
    pcb->fdt[3]= NULL;
    // Initialize context frame
    //Registers
    ctx->edi = 0;
    ctx->esi = 0;
    ctx->ebp = 0;
    ctx->esp = 0;
    ctx->ebx = 0;
    ctx->edx = 0;
    ctx->ecx = 0;
    ctx->eax = 0;
    //Instruction pointer
    ctx->iret_eip = func;
    // code segment
    ctx->iret_cs = getCS();
    // status flags
    ctx->eflags = 0x00003200;
    //why doesn't this need a spot for EBP?
    ctx->retAdd = &sysstop;
    //put on the ready stack
    return pcb;
}   
Пример #22
0
// Creates a new process with code starting at *func amd intializes a stack space of stack
// Returns the process ID of the id if succesful, -1 if failed
extern int create( void (*func)(void), int stack ) {
	
	struct context_frame *contextFrame;	
	struct pcb *processBlock;		
	void *stackStart = kmalloc(stack);
	int pcbTableIndex = findEmptyPCBEntry();
	
	// Return 0 if mem alloc failed
	if(stackStart == 0) {
		return -1;
	}	

	// Return 0 if there is no room in the PCB Table
	if(pcbTableIndex == -1) {
		return -1;
	} else {
		// Else, add the PCB to the process table
		pcbTable[pcbTableIndex] = &processBlock;
	}

	
	// Initializing the context frame
	// Put the context at the top of the stack with a small buffer
	contextFrame = (((int)stackStart + stack) - sizeof(struct context_frame) - 16);	
	contextFrame->edi = 0;
	contextFrame->esi = 0;
	contextFrame->ebp = contextFrame - 16; // Is this right?
	// Set the sp to the end of the frame plus a small buffer
	contextFrame->esp = contextFrame - 16;
	contextFrame->ebx = 0;
	contextFrame->edx = 0;
	contextFrame->ecx = 0;
	contextFrame->eax = 0;
	// Set the next instruction to our process code
	contextFrame->iret_eip = func;
	// Get the code space
	contextFrame->iret_cs = (unsigned int)getCS();
	// Our flags are all zero as shown in class
	contextFrame->eflags = 0;
	
	// Configuring the process block
	//Set the stack pointer
	processBlock->sp = contextFrame - 16;
	// Copy in the context frame
	processBlock->CPU = contextFrame;
	//Set the state to ready
	processBlock->state = 1;
	// Is the PID preset?
	//processBlock->PID = pidCounter++;
	
	//ready(processBlock);
	
	return processBlock;	
	
}
Пример #23
0
BOOL DemDispatch (ULONG iSvc)
{
#if DBG
    if(iSvc < SVC_DEMLASTSVC && (fShowSVCMsg & DEMSVCTRACE) &&
	 apfnSVC[iSvc] != demNotYetImplemented){
	sprintf(demDebugBuffer,"DemDispatch: Entering %s\n\tAX=%.4x BX=%.4x CX=%.4x DX=%.4x DI=%.4x SI=%.4x\n",
	       aSVCNames[iSvc],getAX(),getBX(),getCX(),getDX(),getDI(),getSI());
        OutputDebugStringOem(demDebugBuffer);
	sprintf(demDebugBuffer,"\tCS=%.4x IP=%.4x DS=%.4x ES=%.4x SS=%.4x SP=%.4x BP=%.4x\n",
                getCS(),getIP(), getDS(),getES(),getSS(),getSP(),getBP());
        OutputDebugStringOem(demDebugBuffer);
    }
#endif

    if (iSvc >= SVC_DEMLASTSVC){
#if DBG
	sprintf(demDebugBuffer,"Unimplemented SVC index %x\n",iSvc);
        OutputDebugStringOem(demDebugBuffer);
#endif
	setCF(1);
	return FALSE;
    }

    if (pHardErrPacket) {
	pHardErrPacket->vhe_fbInt24 = 0;
    }
    CurrentISVC = iSvc;
    (apfnSVC [iSvc])();


#if DBG
    if((fShowSVCMsg & DEMSVCTRACE)){
	sprintf(demDebugBuffer,"DemDispatch:On Leaving %s\n\tAX=%.4x BX=%.4x CX=%.4x DX=%.4x DI=%.4x SI=%.4x\n",
               aSVCNames[iSvc],getAX(),getBX(),getCX(),getDX(),getDI(),getSI());
        OutputDebugStringOem(demDebugBuffer);
	sprintf(demDebugBuffer,"\tCS=%.4x IP=%.4x DS=%.4x ES=%.4x SS=%.4x SP=%.4x BP=%.4x CF=%x\n",
                getCS(),getIP(), getDS(),getES(),getSS(),getSP(),getBP(),getCF());
        OutputDebugStringOem(demDebugBuffer);
    }
#endif
    return TRUE;
}
Пример #24
0
BitVector *GprsDecoder::getResult()
{
	switch (getCS()) {
	case ChannelCodingCS4:
		return &mD_CS4;
	case ChannelCodingCS1:
		return &mD;
	default: devassert(0);	// Others not supported yet.
		return NULL;
	}
}
Пример #25
0
void cGenProt(isrVal_t regs)
{
  printf("GP\n");
  printf("\nGeneral Protection Fault\neip\tcs\tds\teflags\tprocesp\tss\n");
  printf("%X\t%X\t%X\t%X\t%X\n", regs.eip, regs.cs, regs.ds, regs.eflags,
                                                        regs.procesp, regs.ss);
  printf("\nCurrent:\n");
  printf("CS\tDS\tSS\tESP\n");
  printf("%X\t%X\t%X\t%X\n", getCS(), getDS(), getSS(), getESP());
  checkFrame(&regs);
//   panic("General Protection fault");
}
Пример #26
0
static VOID CmdStartExternalCommand(VOID)
{
    DWORD Result;

    // TODO: improve: this code has strong similarities
    // with the 'default' case of DosCreateProcess.

    LPSTR Command = (LPSTR)SEG_OFF_TO_PTR(getDS(), getSI());
    CHAR CmdLine[sizeof("cmd.exe /c ") + DOS_CMDLINE_LENGTH + 1] = "";
    LPSTR CmdLinePtr;
    ULONG CmdLineLen;

    /* Spawn a user-defined 32-bit command preprocessor */

    // FIXME: Use COMSPEC env var!!
    CmdLinePtr = CmdLine;
    strcpy(CmdLinePtr, "cmd.exe /c ");
    CmdLinePtr += strlen(CmdLinePtr);

    /* Build a Win32-compatible command-line */
    CmdLineLen = min(strlen(Command), sizeof(CmdLine) - strlen(CmdLinePtr) - 1);
    RtlCopyMemory(CmdLinePtr, Command, CmdLineLen);
    CmdLinePtr[CmdLineLen] = '\0';

    /* Remove any trailing return carriage character and NULL-terminate the command line */
    while (*CmdLinePtr && *CmdLinePtr != '\r' && *CmdLinePtr != '\n') CmdLinePtr++;
    *CmdLinePtr = '\0';

    DPRINT1("CMD Run Command '%s' ('%s')\n", Command, CmdLine);

    /*
     * No need to prepare the stack for DosStartComSpec since we won't start it.
     */
    Result = DosStartProcess32(Command, CmdLine,
                               SEG_OFF_TO_PTR(getES(), 0) /*Environment*/,
                               MAKELONG(getIP(), getCS()) /*ReturnAddress*/,
                               FALSE);
    if (Result != ERROR_SUCCESS)
    {
        DosDisplayMessage("Failed to start command '%s' ('%s'). Error: %u\n", Command, CmdLine, Result);
        setCF(0);
        setAL((UCHAR)Result);
    }
    else
    {
        DosDisplayMessage("Command '%s' ('%s') started successfully.\n", Command, CmdLine);
#ifndef STANDALONE
        setCF(Repeat); // Set CF if we need to start a 16-bit process
#else
        setCF(0);
#endif
    }
}
Пример #27
0
void cBreakp(isrVal_t regs)
{
  printf("BP\n");
  checkFrame(&regs);
  printf("Debug:\n");

  printf("eax\tebx\tecx\tedx\n%X\t%X\t%X\t%X\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
  printf("\nds\n%X\n", regs.ds);
  printf("\nedi\tesi\tebp\tesp\n%X\t%X\t%X\t%X\n", regs.edi, regs.esi, regs.ebp, regs.esp);
  printf("\neip\tcs\teflags\tuseresp\tss\n%X\t%X\t%X\t%X\t%X\n", regs.eip, regs.cs, regs.eflags, regs.procesp, regs.ss);
  printf("\nerr_code\tfunc_ptr\n%X\t%X\n", regs.errCode, regs.funcPtr);
  printf("\n\nCurrent:\n");
  printf("CS\tDS\tSS\tESP\n%X\t%X\t%X\t%X\n", getCS(), getDS(), getSS(), getESP());
}
Пример #28
0
void cDivByZero(isrVal_t regs)
{
  printf("D0\n");
  checkFrame(&regs);
  if (regs.cs != 0x8)
  {
    panic("No process killing code yet");
  }
  printf("\nDiv by 0\neip\tcs\teflags\tprocesp\tss\n");
  printf("%X\t%X\t%X\t%X\t%X\n", regs.eip, regs.cs, regs.eflags, regs.procesp, regs.ss);
  printf("\nCurrent:\n");
  printf("CS\tDS\tSS\tESP\n");
  printf("%X\t%X\t%X\t%X\n", getCS(), getDS(), getSS(), getESP());
  panic ("Devide by zero");
}
Пример #29
0
// DOS EMULATION BOP
void MS_bop_0(void) {
    ULONG DemCmd;

    DemCmd = (ULONG)(*Sim32GetVDMPointer(SEGOFF(getCS(),getIP()),
                                         1,
                                         FALSE
                                         ));
    DemDispatch( DemCmd );
    setIP((USHORT)(getIP() + 1));

    // we need to prevent the idle system from going off on intensive file
    // reads. However, we don't want to disable it for continuous 'Get Time'
    // calls (command 0x15). Nor for Get Date (0x15).
    if (DemCmd != 0x15 && DemCmd != 0x14)
        IDLE_disk();
}
Пример #30
0
static void
win32_release_scheme_selectors (unsigned short scheme_cs,
				unsigned short scheme_ds,
				unsigned short scheme_ss)
{
  struct ntw32lib_selfree_s param;
  LPVOID translation[1];

  param.cs32 = (getCS ());
  param.ds32 = (getDS ());
  param.cs = scheme_cs;
  param.ds = scheme_ds;
  param.ss = scheme_ss;
  translation[0] = ((LPVOID) NULL);
  (* call_16_bit_code) (& param, NTW32LIB_FREE_SELECTORS, &translation[0]);
  return;
}