~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to nvdaHelper/nvdajpimeRPC/dllmain.cpp

  • Committer: Masataka Shinke
  • Date: 2011-10-25 12:35:26 UTC
  • mfrom: (4185 jpmain)
  • mto: This revision was merged to the branch mainline in revision 4211.
  • Revision ID: mshinke@users.sourceforge.jp-20111025123526-ze527a2rl3z0g2ky
lp:~nishimotz/nvdajp/main : 4185 をマージ

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
#A part of NonVisual Desktop Access (NVDA)
 
3
#Copyright (C) 2006-2010 NVDA Contributors <http://www.nvda-project.org/>
 
4
#This file is covered by the GNU General Public License.
 
5
#See the file COPYING for more details.
 
6
#
 
7
# nvdajpime
 
8
# by Masataka Shinke
 
9
*/
 
10
 
 
11
// dllmain.cpp : DLL アプリケーションのエントリ ポイントを定義します。
 
12
#include "nvdajpime.h"  //@@
 
13
#include "tls.h"                //@@
 
14
#include "tsf.h"                //@@
 
15
 
 
16
//@@
 
17
BOOL Process_Attach(HMODULE hModule)
 
18
{
 
19
        g_hModule               = hModule;
 
20
 
 
21
    g_SharedMemory.BaseInit();
 
22
    if (!g_SharedMemory.Start())
 
23
        return FALSE;
 
24
 
 
25
    if (!TLS::Initialize())
 
26
        return FALSE;
 
27
 
 
28
 
 
29
    return TRUE;
 
30
}
 
31
 
 
32
//@@
 
33
void Process_Dettach(HMODULE hModule)
 
34
{
 
35
    TLS::DestroyTLS();
 
36
    TLS::Uninitialize();
 
37
        g_hModule = NULL;
 
38
}
 
39
 
 
40
BOOL APIENTRY DllMain( HMODULE hModule,
 
41
                       DWORD  ul_reason_for_call,
 
42
                       LPVOID lpReserved
 
43
                                         )
 
44
{
 
45
        switch (ul_reason_for_call)
 
46
        {
 
47
        case DLL_PROCESS_ATTACH:
 
48
                if(!Process_Attach(hModule))
 
49
                {
 
50
                        Process_Dettach(hModule);
 
51
                        return FALSE;
 
52
                }
 
53
                break;
 
54
        case DLL_THREAD_ATTACH:
 
55
                break;
 
56
        case DLL_THREAD_DETACH:
 
57
                break;
 
58
        case DLL_PROCESS_DETACH:
 
59
                Process_Dettach(hModule);
 
60
                break;
 
61
        }
 
62
        return TRUE;
 
63
}
 
64