Index: src/VBox/Devices/Audio/dsoundaudio.c
===================================================================
--- src/VBox/Devices/Audio/dsoundaudio.c	(revision 39122)
+++ src/VBox/Devices/Audio/dsoundaudio.c	(working copy)
@@ -53,6 +53,8 @@
     int bufsize_out;
     audsettings_t settings;
     int latency_millis;
+    const char *device_guid_out;
+    const char *device_guid_in;
 } conf = {
     1,
     1,
@@ -65,7 +67,9 @@
         2,
         AUD_FMT_S16
     },
-    10
+    10,
+    NULL,
+    NULL
 };
 
 typedef struct {
@@ -1016,6 +1020,8 @@
     int err;
     HRESULT hr;
     dsound *s = &glob_dsound;
+    RTUUID devguid;
+    LPCGUID devguidp;
 
     hr = CoInitializeEx (NULL, COINIT_MULTITHREADED);
     if (FAILED (hr)) {
@@ -1046,7 +1052,16 @@
         return NULL;
     }
 
-    hr = IDirectSound_Initialize (s->dsound, NULL);
+    if (conf.device_guid_out) {
+        hr = RTUuidFromStr(&devguid, conf.device_guid_out);
+        if (FAILED (hr)) {
+            LogRel(("DSound: Could not parse DirectSound output device GUID\n"));
+        }
+        devguidp = (LPCGUID)&devguid;
+    } else {
+        devguidp = NULL
+    }
+    hr = IDirectSound_Initialize (s->dsound, devguidp);
     if (FAILED (hr)) {
 #ifndef VBOX
         dsound_logerr (hr, "Could not initialize DirectSound\n");
@@ -1080,7 +1095,16 @@
 #endif
     }
     else {
-        hr = IDirectSoundCapture_Initialize (s->dsound_capture, NULL);
+        if (conf.device_guid_in) {
+            hr = RTUuidFromStr(&devguid, conf.device_guid_in);
+            if (FAILED (hr)) {
+                LogRel(("DSound: Could not parse DirectSound input device GUID\n"));
+            }
+            devguidp = (LPCGUID)&devguid;
+        } else {
+            devguidp = NULL
+        }
+        hr = IDirectSoundCapture_Initialize (s->dsound_capture, devguidp);
         if (FAILED (hr)) {
 #ifndef VBOX
             dsound_logerr (hr, "Could not initialize DirectSoundCapture\n");
@@ -1128,6 +1152,10 @@
      "(undocumented)", NULL, 0},
     {"BUFSIZE_IN", AUD_OPT_INT, &conf.bufsize_in,
      "(undocumented)", NULL, 0},
+    {"DEVICE_GUID_OUT", AUD_OPT_STR, &conf.device_guid_out,
+     "DirectSound output device GUID", NULL, 0},
+    {"DEVICE_GUID_IN", AUD_OPT_STR, &conf.device_guid_in,
+     "DirectSound input device GUID", NULL, 0},
     {NULL, 0, NULL, NULL, NULL, 0}
 };
 
