Index: /trunk/src/VBox/Main/include/ParallelPortImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ParallelPortImpl.h	(revision 59925)
+++ /trunk/src/VBox/Main/include/ParallelPortImpl.h	(revision 59926)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -38,7 +38,7 @@
 
     // public initializer/uninitializer for internal purposes only
-    HRESULT init (Machine *aParent, ULONG aSlot);
-    HRESULT init (Machine *aParent, ParallelPort *aThat);
-    HRESULT initCopy (Machine *parent, ParallelPort *aThat);
+    HRESULT init(Machine *aParent, ULONG aSlot);
+    HRESULT init(Machine *aParent, ParallelPort *aThat);
+    HRESULT initCopy(Machine *parent, ParallelPort *aThat);
     void uninit();
 
@@ -52,4 +52,5 @@
     void i_copyFrom(ParallelPort *aThat);
     void i_applyDefaults();
+    bool i_hasDefaults();
 
 private:
Index: /trunk/src/VBox/Main/include/SerialPortImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SerialPortImpl.h	(revision 59925)
+++ /trunk/src/VBox/Main/include/SerialPortImpl.h	(revision 59926)
@@ -7,5 +7,5 @@
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -41,7 +41,7 @@
 
     // public initializer/uninitializer for internal purposes only
-    HRESULT init (Machine *aParent, ULONG aSlot);
-    HRESULT init (Machine *aParent, SerialPort *aThat);
-    HRESULT initCopy (Machine *parent, SerialPort *aThat);
+    HRESULT init(Machine *aParent, ULONG aSlot);
+    HRESULT init(Machine *aParent, SerialPort *aThat);
+    HRESULT initCopy(Machine *parent, SerialPort *aThat);
     void uninit();
 
@@ -55,5 +55,6 @@
     void i_copyFrom(SerialPort *aThat);
 
-    void i_applyDefaults (GuestOSType *aOsType);
+    void i_applyDefaults(GuestOSType *aOsType);
+    bool i_hasDefaults();
 
     // public methods for internal purposes only
@@ -79,23 +80,5 @@
     HRESULT setPath(const com::Utf8Str &aPath);
 
-    ////////////////////////////////////////////////////////////////////////////////
-    ////
-    //// SerialPort private data definition
-    ////
-    //////////////////////////////////////////////////////////////////////////////////
-    //
-    struct Data
-    {
-      Data()
-           : fModified(false),
-             pMachine(NULL)
-        { }
-
-       bool                                fModified;
-       Machine * const                     pMachine;
-       const ComObjPtr<SerialPort>         pPeer;
-       Backupable<settings::SerialPort>    bd;
-    };
-
+    struct Data;
     Data *m;
 };
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 59925)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 59926)
@@ -10305,4 +10305,7 @@
         for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
         {
+            if (mSerialPorts[slot]->i_hasDefaults())
+                continue;
+
             settings::SerialPort s;
             s.ulSlot = slot;
@@ -10317,4 +10320,7 @@
         for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
         {
+            if (mParallelPorts[slot]->i_hasDefaults())
+                continue;
+
             settings::ParallelPort p;
             p.ulSlot = slot;
Index: /trunk/src/VBox/Main/src-server/ParallelPortImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/ParallelPortImpl.cpp	(revision 59925)
+++ /trunk/src/VBox/Main/src-server/ParallelPortImpl.cpp	(revision 59926)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -124,5 +124,5 @@
     unconst(m->pPeer) = aThat;
 
-    AutoCaller thatCaller (aThat);
+    AutoCaller thatCaller(aThat);
     AssertComRCReturnRC(thatCaller.rc());
 
@@ -442,9 +442,9 @@
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller peerCaller (m->pPeer);
-    AssertComRCReturnVoid (peerCaller.rc());
+    AutoCaller peerCaller(m->pPeer);
+    AssertComRCReturnVoid(peerCaller.rc());
 
     /* lock both for writing since we modify both (m->pPeer is "master" so locked
@@ -469,13 +469,13 @@
 void ParallelPort::i_copyFrom(ParallelPort *aThat)
 {
-    AssertReturnVoid (aThat != NULL);
+    AssertReturnVoid(aThat != NULL);
 
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller thatCaller (aThat);
-    AssertComRCReturnVoid (thatCaller.rc());
+    AutoCaller thatCaller(aThat);
+    AssertComRCReturnVoid(thatCaller.rc());
 
     /* peer is not modified, lock it for reading (aThat is "master" so locked
@@ -495,5 +495,5 @@
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -514,6 +514,43 @@
             break;
         }
-        default: break;
-    }
+        default:
+            AssertMsgFailed(("Parallel port slot %u exceeds limit\n", m->bd->ulSlot));
+            break;
+    }
+}
+
+bool ParallelPort::i_hasDefaults()
+{
+    /* sanity */
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), true);
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (!m->bd->fEnabled)
+    {
+        /* Could be default, check the IO base and IRQ. */
+        switch (m->bd->ulSlot)
+        {
+            case 0:
+                if (m->bd->ulIOBase == 0x378 && m->bd->ulIRQ == 7)
+                    return true;
+                break;
+            case 1:
+                if (m->bd->ulIOBase == 0x278 && m->bd->ulIRQ == 5)
+                    return true;
+                break;
+            default:
+                AssertMsgFailed(("Parallel port slot %u exceeds limit\n", m->bd->ulSlot));
+                break;
+        }
+
+        /* Detect old-style defaults (0x378, irq 4) in any slot, they are still
+         * in place for many VMs created by old VirtualBox versions. */
+        if (m->bd->ulIOBase == 0x378 && m->bd->ulIRQ == 4)
+            return true;
+    }
+
+    return false;
 }
 
Index: /trunk/src/VBox/Main/src-server/SerialPortImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/SerialPortImpl.cpp	(revision 59925)
+++ /trunk/src/VBox/Main/src-server/SerialPortImpl.cpp	(revision 59926)
@@ -6,5 +6,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -22,4 +22,5 @@
 #include "GuestOSTypeImpl.h"
 
+#include <iprt/assert.h>
 #include <iprt/string.h>
 #include <iprt/cpp/utils.h>
@@ -31,8 +32,27 @@
 #include "Logging.h"
 
+//////////////////////////////////////////////////////////////////////////////////
+//
+// SerialPort private data definition
+//
+//////////////////////////////////////////////////////////////////////////////////
+
+struct SerialPort::Data
+{
+    Data()
+        : fModified(false),
+          pMachine(NULL)
+    { }
+
+    bool                                fModified;
+    Machine * const                     pMachine;
+    const ComObjPtr<SerialPort>         pPeer;
+    Backupable<settings::SerialPort>    bd;
+};
+
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
-DEFINE_EMPTY_CTOR_DTOR (SerialPort)
+DEFINE_EMPTY_CTOR_DTOR(SerialPort)
 
 HRESULT SerialPort::FinalConstruct()
@@ -106,9 +126,9 @@
     unconst(m->pPeer) = aThat;
 
-    AutoCaller thatCaller (aThat);
+    AutoCaller thatCaller(aThat);
     AssertComRCReturnRC(thatCaller.rc());
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
-    m->bd.share (aThat->m->bd);
+    m->bd.share(aThat->m->bd);
 
     /* Confirm a successful initialization */
@@ -140,9 +160,9 @@
     /* pPeer is left null */
 
-    AutoCaller thatCaller (aThat);
+    AutoCaller thatCaller(aThat);
     AssertComRCReturnRC(thatCaller.rc());
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
-    m->bd.attachCopy (aThat->m->bd);
+    m->bd.attachCopy(aThat->m->bd);
 
     /* Confirm a successful initialization */
@@ -545,5 +565,5 @@
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
@@ -570,15 +590,15 @@
  *  represented by @a aThat (locked for reading).
  */
-void SerialPort::i_copyFrom (SerialPort *aThat)
-{
-    AssertReturnVoid (aThat != NULL);
+void SerialPort::i_copyFrom(SerialPort *aThat)
+{
+    AssertReturnVoid(aThat != NULL);
 
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller thatCaller (aThat);
-    AssertComRCReturnVoid (thatCaller.rc());
+    AutoCaller thatCaller(aThat);
+    AssertComRCReturnVoid(thatCaller.rc());
 
     /* peer is not modified, lock it for reading (aThat is "master" so locked
@@ -588,14 +608,14 @@
 
     /* this will back up current data */
-    m->bd.assignCopy (aThat->m->bd);
-}
-
-void SerialPort::i_applyDefaults (GuestOSType *aOsType)
-{
-    AssertReturnVoid (aOsType != NULL);
+    m->bd.assignCopy(aThat->m->bd);
+}
+
+void SerialPort::i_applyDefaults(GuestOSType *aOsType)
+{
+    AssertReturnVoid(aOsType != NULL);
 
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -608,5 +628,5 @@
         case 1:
         {
-            m->bd->ulIOBase = 0x2F8;
+            m->bd->ulIOBase = 0x2f8;
             m->bd->ulIRQ = 3;
             break;
@@ -624,5 +644,7 @@
             break;
         }
-        default: break;
+        default:
+            AssertMsgFailed(("Serial port slot %u exceeds limit\n", m->bd->ulSlot));
+            break;
     }
 
@@ -634,4 +656,49 @@
         m->bd->fEnabled = true;
     }
+}
+
+bool SerialPort::i_hasDefaults()
+{
+    /* sanity */
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), true);
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (   !m->bd->fEnabled
+        && m->bd->portMode == PortMode_Disconnected
+        && !m->bd->fServer)
+    {
+        /* Could be default, check the IO base and IRQ. */
+        switch (m->bd->ulSlot)
+        {
+            case 0:
+                if (m->bd->ulIOBase == 0x3f8 && m->bd->ulIRQ == 4)
+                    return true;
+                break;
+            case 1:
+                if (m->bd->ulIOBase == 0x2f8 && m->bd->ulIRQ == 3)
+                    return true;
+                break;
+            case 2:
+                if (m->bd->ulIOBase == 0x3e8 && m->bd->ulIRQ == 4)
+                    return true;
+                break;
+            case 3:
+                if (m->bd->ulIOBase == 0x2e8 && m->bd->ulIRQ == 3)
+                    return true;
+                break;
+            default:
+                AssertMsgFailed(("Serial port slot %u exceeds limit\n", m->bd->ulSlot));
+                break;
+        }
+
+        /* Detect old-style defaults (0x3f8, irq 4) in any slot, they are still
+         * in place for many VMs created by old VirtualBox versions. */
+        if (m->bd->ulIOBase == 0x3f8 && m->bd->ulIRQ == 4)
+            return true;
+    }
+
+    return false;
 }
 
