VSPE virtual serial port shutdown blue screen (BSOD) solution

Posted by marginalboy on Wed, 01 Apr 2020 00:34:13 +0200

The solution to the problem of VSPE blue screen

This article is just to solve the blue screen problem I encountered. Not everyone will encounter the blue screen caused by this operation, nor VSPE will have the blue screen problem.

  • VSPE(Virtual Serial Ports Emulator Version 0.938 (June 26, 2010))

Blue screen reproduction

Start the VSPE analog serial port, and do not close the software at least after starting. Turn off the computer. The blue screen will appear at the end of the shutdown. And do not generate the blue screen dump file. It is suspected that all the programs generating the dump have been closed before the blue screen appears.

Blue screen reason

It is detected that the VSPE software is not shut down normally during shutdown, which causes VSPE to still simulate the serial port in the background (constantly reading the real serial port data).


  1. Write a logout tool using the API provided by VSPE and put it in the root directory of VSPE program
  2. Write script, which is used to end VSPE program at Windows logoff and call the logoff tool written by yourself
  3. Call script on Windows logoff


Logout tool VSPEmulator.exe source code

// Used to stop all analog serial devices after forcibly ending VPSE software
// Place the compiled exe in the VSPE root directory

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

// include VSPE API header and library
#include "VSPE_API.h"
#pragma comment(lib,"VSPE_API.lib")

int main()
    // ****************************
    // ****************************
    // Add KEY
    // The KEY under 32-bit system is free of charge, in the vspe api.txt file in the package of SetupVSPE.zip
    const char* activationKey = ""; 
    bool result;

    // activate VSPE API
    result = vspe_activate(activationKey);
    if(result == false){
        printf("VSPE API activation error");
        return 1;

    // initialize VSPE python binding subsystem
    result = vspe_initialize();
    if(result == false){
        printf("Initialization error");
        return 1;

    int count = vspe_getDevicesCount();
    printf("Devices count: %d\n", count);

    // remove all existing devices

    // stop current emulation
    result = vspe_stopEmulation();
    if(result == false)
        printf("Error: emulation can not be stopped: maybe one of VSPE devices is still used.");
        return 1;


    printf("Destroy success.\n");
    return 0;

Copy the compiled VSPEmulator.exe to the VPSE root directory.

KillVspe.bat script

taskkill /f /im VSPEmulator.exe

cd /d "C:\Program Files\Eterlogic.com\Virtual Serial Ports Emulator\"
ping -n 3 >nul


Add the KillVspe.bat script to the Windows logout Group Policy (gpedit.msc) to call it when Windows is shut down.

Topics: Windows emulator Python