Posted: . At: 1:43 PM. This was 2 weeks ago. Post ID: 19585
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored.



How the Windows XP welcome music is played after installation.


The Windows XP welcome music is a file played after installation of Windows XP.

This music was composed by Stan LePard and not Brian Eno as previously believed. but it is a famous track.

The code to play this track in the Windows XP source code is in the /ntsetup/oobe/msobweb/msobweb.cpp file.

This is the code in question.

ntsetup/oobe/msobweb/msobweb.cpp
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
///////////////////////////////////////////////////////////
// PlayBackgroundMusic
STDMETHODIMP
CObWebBrowser::PlayBackgroundMusic()
{
    IWMPSettings* psettings = NULL;
    IWMPControls* pcontrols = NULL;
    HRESULT hr;
    BSTR bstr = NULL;
    WCHAR szFile[MAX_PATH];
 
    if (m_pWMPPlayer == NULL)
    {
        TRACE(L"Couldn't access the media player control.");
        goto LExit;
    }
 
    ExpandEnvironmentStrings(
                    L"%SystemRoot%\\system32\\oobe\\images\\title.wma",
                    szFile,
                    sizeof(szFile)/sizeof(szFile[0]));
 
    bstr = SysAllocString(szFile);
    if (bstr == NULL)
    {
        TRACE(L"Couldn't allocate the background sound file string.");
        goto LExit;
    }
 
    hr = m_pWMPPlayer->put_URL(bstr);
 
    SysFreeString(bstr);
 
    if (FAILED(hr))
    {
        TRACE(L"Couldn't set the movie file.");
        goto LExit;
    }
 
    // Turn off the WMP error dialogs
 
    hr = m_pWMPPlayer->QueryInterface(__uuidof(IWMPSettings), (LPVOID*)&psettings);
    if (FAILED(hr))
    {
        TRACE(L"Couldn't access WMP settings.");
        goto LExit;
    }
 
    hr = psettings->put_enableErrorDialogs(VARIANT_FALSE);
    if (FAILED(hr))
    {
        TRACE(L"Couldn't turn off WMP error dialogs.");
        goto LExit;
    }
 
    // Now, start playing
 
    hr = m_pWMPPlayer->QueryInterface(__uuidof(IWMPControls), (LPVOID*)&pcontrols);
    if (FAILED(hr))
    {
        TRACE(L"Couldn't access WMP controls.");
        goto LExit;
    }
    pcontrols->play();
 
LExit:
    if (pcontrols != NULL)
    {
        pcontrols->Release();
        pcontrols = NULL;
    }
    if (psettings != NULL)
    {
        psettings->Release();
        psettings = NULL;
    }
    return S_OK;
}
 
///////////////////////////////////////////////////////////
// PlayBackgroundMusic
STDMETHODIMP
CObWebBrowser::StopBackgroundMusic()
{
    IWMPControls* pcontrols = NULL;
    HRESULT hr;
 
    if (m_pWMPPlayer == NULL)
    {
        TRACE(L"Couldn't access the media player control.");
        goto LExit;
    }
 
    hr = m_pWMPPlayer->QueryInterface(__uuidof(IWMPControls), (LPVOID*)&pcontrols);
    if (FAILED(hr))
    {
        TRACE(L"Couldn't access WMP controls.");
        goto LExit;
    }
    pcontrols->stop();
 
LExit:
    if (pcontrols != NULL)
    {
        pcontrols->Release();
        pcontrols = NULL;
    }
    return S_OK;
}

This code uses Windows Media Player to play the music track in WMA format.

This is easily done.

651
652
653
654
655
656
657
    hr = m_pWMPPlayer->QueryInterface(__uuidof(IWMPControls), (LPVOID*)&pcontrols);
    if (FAILED(hr))
    {
        TRACE(L"Couldn't access WMP controls.");
        goto LExit;
    }
    pcontrols->play();

This is a very interesting find.

The msobweb.h header file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//*********************************************************************
//*                  Microsoft Windows                               **
//*            Copyright(c) Microsoft Corp., 1999                    **
//*********************************************************************
//
//  MSOBWEB.H - Header for the implementation of CObWebBrowser
//
//  HISTORY:
//  
//  1/27/99 a-jaswed Created.
// 
//  Class which will call up an IOleSite and the WebOC
//  and provide external interfaces.
 
#ifndef _MSOBWEB_H_
#define _MSOBWEB_H_
 
#include <exdisp.h>
#include <oleauto.h>
 
#include "cunknown.h"
#include "obweb.h" 
#include "iosite.h"
#include "wmp.h"
 
class CObWebBrowser :   public CUnknown,
                        public IObWebBrowser,
                        public IDispatch
{
    // Declare the delegating IUnknown.
    DECLARE_IUNKNOWN
 
public:
    static  HRESULT           CreateInstance                  (IUnknown* pOuterUnknown, CUnknown** ppNewComponent);
    // IObWebBrowser Members                                    
    virtual HRESULT __stdcall AttachToWindow                  (HWND hWnd);
    virtual HRESULT __stdcall PreTranslateMessage             (LPMSG lpMsg);
    virtual HRESULT __stdcall Navigate                        (WCHAR* pszUrl, WCHAR* pszTarget);
    virtual HRESULT __stdcall ListenToWebBrowserEvents        (IUnknown* pUnk);
    virtual HRESULT __stdcall StopListeningToWebBrowserEvents (IUnknown* pUnk);
    virtual HRESULT __stdcall get_WebBrowserDoc               (IDispatch** ppDisp);
    virtual HRESULT __stdcall ObWebShowWindow                 ();
    virtual HRESULT __stdcall SetExternalInterface            (IUnknown* pUnk);
    virtual HRESULT __stdcall Stop();
    STDMETHOD (PlayBackgroundMusic)                  ();
    STDMETHOD (StopBackgroundMusic)                  ();
    STDMETHOD (UnhookScriptErrorHandler)             ();
    // IDispatch Members
    STDMETHOD (GetTypeInfoCount)                     (UINT* pcInfo);
    STDMETHOD (GetTypeInfo)                          (UINT, LCID, ITypeInfo** );
    STDMETHOD (GetIDsOfNames)                        (REFIID, OLECHAR**, UINT, 
                                                      LCID, DISPID* );
    STDMETHOD (Invoke)                               (DISPID dispidMember, 
                                                      REFIID riid, 
                                                      LCID lcid, 
                                                      WORD wFlags, 
                                                      DISPPARAMS* pdispparams, 
                                                      VARIANT* pvarResult, 
                                                      EXCEPINFO* pexcepinfo, 
                                                      UINT* puArgErr);
 
private:
    HWND          m_hMainWnd;
    COleSite*     m_pOleSite;
    LPOLEOBJECT   m_lpOleObject;
    IWebBrowser2* m_lpWebBrowser;
    DWORD         m_dwcpCookie;
    DWORD         m_dwDrawAspect;
    BOOL          m_fInPlaceActive;
 
    // Script error reporting stuff
    BOOL          m_fOnErrorWasHooked;
 
    // Need a convenient place to have a WMP control
    COleSite*     m_pOleSiteWMP;
    LPOLEOBJECT   m_lpOleObjectWMP;
    IWMPPlayer*   m_pWMPPlayer;
 
 
    // IUnknown
    virtual HRESULT __stdcall NondelegatingQueryInterface( const IID& iid, void** ppv);
 
                    CObWebBrowser            (IUnknown* pOuterUnknown);
    virtual        ~CObWebBrowser            ();
    virtual void    FinalRelease             (); // Notify derived classes that we are releasing
            void    InitBrowserObject        ();   
            void    InPlaceActivate          ();
            void    UIActivate               ();
            void    CloseOleObject           ();
            void    UnloadOleObject          ();
            HRESULT ConnectToConnectionPoint (IUnknown*          punkThis, 
                                              REFIID             riidEvent, 
                                              BOOL               fConnect, 
                                              IUnknown*          punkTarget, 
                                              DWORD*             pdwCookie, 
                                              IConnectionPoint** ppcpOut);
    STDMETHOD(onerror)  (IN VARIANT* pvarMsg,
                         IN VARIANT* pvarUrl,
                         IN VARIANT* pvarLine,
                         OUT VARIANT_BOOL* pfResult);
};
 
#define SETDefFormatEtc(fe, cf, med) \
{\
(fe).cfFormat=cf;\
(fe).dwAspect=DVASPECT_CONTENT;\
(fe).ptd=NULL;\
(fe).tymed=med;\
(fe).lindex=-1;\
};
 
#endif

This is the Makefile for this source.

1
2
3
4
5
6
#
# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
# file to this component.  This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

And the SOURCES file that lists all source files for compilation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
!IF 0
 
Copyright (C) Microsoft Corporation, 2000 - 2000
 
Module Name:
 
    sources.
 
!ENDIF
 
!include ..\sources.inc
 
TARGETNAME=msobweb
TARGETTYPE=DYNLINK
TARGETPATH=obj
 
DLLDEF=msobweb.def
DLLENTRY=_DllMainCRTStartup
 
LINKLIBS=                           \
    ..\common\$(O)\obcommon.lib     \
 
TARGETLIBS=                         \
    ..\idl\$(O)\obidl.lib  \
    $(SDK_LIB_PATH)\kernel32.lib    \
    $(SDK_LIB_PATH)\user32.lib      \
    $(SDK_LIB_PATH)\advapi32.lib    \
    $(SDK_LIB_PATH)\ole32.lib       \
    $(SDK_LIB_PATH)\oleaut32.lib    \
    $(SDK_LIB_PATH)\shfolder.lib    \
    $(SDK_LIB_PATH)\shlwapi.lib     \
    $(SDK_LIB_PATH)\setupapi.lib    \
    $(SDK_LIB_PATH)\syssetup.lib    \
    $(SDK_LIB_PATH)\uuid.lib
 
INCLUDES=                           \
    $(OOBEINC)
 
SOURCES=                            \
    msobweb.cpp                     \
    iocsite.cpp                     \
    ioipfram.cpp                    \
    ioipsite.cpp                    \
    iosite.cpp                      \
    server.cpp                      \
    msobweb.rc
 
UMTYPE=windows

IOIPFRAM.CPP – Implements IOleInPlaceFrame for the WebOC.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//*********************************************************************
//*                  Microsoft Windows                               **
//*            Copyright(c) Microsoft Corp., 1999                    **
//*********************************************************************
//
//  IOIPFRAM.CPP - Implements IOleInPlaceFrame for the WebOC
//
//  HISTORY:
//  
//  1/27/99 a-jaswed Created.
 
#include <assert.h>
 
#include "ioipfram.h"
#include "iosite.h"
 
//**********************************************************************
// COleInPlaceFrame::COleInPlaceFrame -- Constructor
//**********************************************************************
COleInPlaceFrame::COleInPlaceFrame(COleSite* pSite) 
{
    m_pOleSite = pSite;
    m_nCount   = 0;
 
    AddRef();
}
 
//**********************************************************************
// COleInPlaceFrame::COleInPlaceFrame -- Destructor
//**********************************************************************
COleInPlaceFrame::~COleInPlaceFrame() 
{
    assert(m_nCount == 0);
}
 
//**********************************************************************
// COleInPlaceFrame::QueryInterface
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::QueryInterface(REFIID riid, LPVOID* ppvObj)
{
    // delegate to the document Object
    return m_pOleSite->QueryInterface(riid, ppvObj);
}
 
//**********************************************************************
// COleInPlaceFrame::AddRef
//**********************************************************************
STDMETHODIMP_(ULONG) COleInPlaceFrame::AddRef()
{   
    // increment the interface reference count
    return ++m_nCount;
}
 
//**********************************************************************
// COleInPlaceFrame::Release
//**********************************************************************
STDMETHODIMP_(ULONG) COleInPlaceFrame::Release()
{
    // decrement the interface reference count
    --m_nCount;
    if(m_nCount == 0)
    {
        delete this;
        return 0;
    }
    return m_nCount;
}
 
//**********************************************************************
// COleInPlaceFrame::GetWindow
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::GetWindow (HWND* lphwnd)
{
    *lphwnd = m_pOleSite->m_hWnd;
 
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::ContextSensitiveHelp
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::ContextSensitiveHelp (BOOL fEnterMode)
{
    //Returning S_OK here prevents the default one from showing
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::GetBorder
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::GetBorder (LPRECT lprectBorder)
{
    RECT rect;
 
    // get the rect for the entire frame.
    GetClientRect(m_pOleSite->m_hWnd, &rect);
 
    CopyRect(lprectBorder, &rect);
 
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::RequestBorderSpace -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::RequestBorderSpace (LPCBORDERWIDTHS lpborderwidths)
{
    // always approve the request
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::SetBorderSpace -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::SetBorderSpace (LPCBORDERWIDTHS lpborderwidths)
{   
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::SetActiveObject -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::SetActiveObject(LPOLEINPLACEACTIVEOBJECT lpActiveObject, LPCOLESTR lpszObjName)
{
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::InsertMenus -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::InsertMenus (HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
{
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::SetMenu -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::SetMenu (HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
{
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::RemoveMenus -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::RemoveMenus (HMENU hmenuShared)
{
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::SetStatusText -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::SetStatusText (LPCOLESTR lpszStatusText)
{
    return ResultFromScode(E_FAIL);
}
 
//**********************************************************************
// COleInPlaceFrame::EnableModeless -- Not implemented
//**********************************************************************
 
STDMETHODIMP COleInPlaceFrame::EnableModeless (BOOL fEnable)
{
    return ResultFromScode(S_OK);
}
 
//**********************************************************************
// COleInPlaceFrame::TranslateAccelerator -- Not implemented
//**********************************************************************
STDMETHODIMP COleInPlaceFrame::TranslateAccelerator (LPMSG lpmsg, WORD wID)
{
    return ResultFromScode(S_FALSE);
}

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.