main.c 2.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 *    MSXML Class Factory
 *
 * Copyright 2002 Lionel Ulmer
 * Copyright 2005 Mike McCormack
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

22 23
#include "config.h"

24 25 26 27
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
28
#include "winreg.h"
29
#include "ole2.h"
30
#include "msxml2.h"
31 32 33

#include "wine/debug.h"

34 35
#include "msxml_private.h"

36 37
WINE_DEFAULT_DEBUG_CHANNEL(msxml);

38
HRESULT WINAPI DllCanUnloadNow(void)
39 40 41 42 43 44 45 46 47 48
{
    FIXME("\n");
    return S_FALSE;
}

BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
    switch(fdwReason)
    {
    case DLL_PROCESS_ATTACH:
49 50 51
#ifdef HAVE_LIBXML2
        xmlInitParser();
#endif
52 53 54
        DisableThreadLibraryCalls(hInstDLL);
        break;
    case DLL_PROCESS_DETACH:
55 56 57
#ifdef HAVE_LIBXML2
        xmlCleanupParser();
#endif
58 59 60 61 62
        break;
    }
    return TRUE;
}

63
static HRESULT add_key_val( LPCSTR key, LPCSTR valname, LPCSTR value )
64
{
65 66 67 68 69
    HKEY hkey;

    if (RegCreateKeyA( HKEY_CLASSES_ROOT, key, &hkey ) != ERROR_SUCCESS) return E_FAIL;
    RegSetValueA( hkey, valname, REG_SZ, value, strlen( value ) + 1 );
    RegCloseKey( hkey );
70 71
    return S_OK;
}
72 73 74 75 76 77 78 79 80 81 82 83 84

HRESULT WINAPI DllRegisterServer(void)
{
    LONG r;

    r = add_key_val( "CLSID\\{2933BF90-7B36-11D2-B20E-00C04F983E60}",
                     NULL,
                     "XML DOM Document" );
    r = add_key_val( "CLSID\\{2933BF90-7B36-11D2-B20E-00C04F983E60}\\InProcServer32",
                     NULL,
                     "msxml3.dll" );
    return r;
}