summaryrefslogtreecommitdiffstats
path: root/private/ole2ui32/dllfuncs.cpp
blob: 830d2079c895255bc7d004f64340806cffd002bc (plain) (blame)
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
/*
 * DLLFUNCS.CPP
 *
 * Contains entry and exit points for the DLL implementation
 * of the OLE 2.0 User Interface Support Library.
 *
 * This file is not needed if we are linking the static library
 * version of this library.
 *
 * Copyright (c)1992 Microsoft Corporation, All Right Reserved
 */

#include "precomp.h"
#include "common.h"
#include "uiclass.h"

OLEDBGDATA_MAIN(TEXT("OLEDLG"))

/*
 * DllMain
 *
 * Purpose:
 *  DLL-specific entry point called from LibEntry.
 */

STDAPI_(BOOL) OleUIInitialize(HINSTANCE, HINSTANCE);
STDAPI_(BOOL) OleUIUnInitialize();

#pragma code_seg(".text$initseg")

BOOL WINAPI DllMain(HINSTANCE hInst, DWORD Reason, LPVOID lpv)
{
        if (Reason == DLL_PROCESS_DETACH)
        {
                OleDbgOut2(TEXT("DllMain: OLEDLG.DLL unloaded\r\n"));

                OleUIUnInitialize();
        }
        else if (Reason == DLL_PROCESS_ATTACH)
        {
                OSVERSIONINFO sVersion;

                sVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

                if (GetVersionEx(&sVersion))
                {
                    if (VER_PLATFORM_WIN32s == sVersion.dwPlatformId)
                    {
                        if ((1 == sVersion.dwMajorVersion) && (30 > sVersion.dwMinorVersion))
                        {
                            return(FALSE); // fail to load on older versions of Win32s
                        }
                    }
                }

                OleDbgOut2(TEXT("DllMain: OLEDLG.DLL loaded\r\n"));

                DisableThreadLibraryCalls(hInst);

                OleUIInitialize(hInst, (HINSTANCE)0);
        }
        return TRUE;
}

#pragma code_seg()